import Taro, { Component } from '@tarojs/taro';
import './index.scss'
import { connect } from '@tarojs/redux'
import { dispatchProjectDetail } from '@actions/project'
import dayjs from 'dayjs'
import 'dayjs/locale/zh-cn' // 按需加载
import ready from '@utils/ready'
@connect(
  ({ user, card, project }) => ({ ...user, ...card, ...project }),
  { dispatchProjectDetail }
)
export default class Index extends Component {
  config = {
    navigationBarTitleText: '楼盘信息'
  }

  state = {
    statusOpts: ['待定', '在建', '在售'],
  }



  render() {
    const { projectDetail } = this.props
    const { uvList = {} } = projectDetail
    const { total = 0, records = [] } = uvList
    const openDate = projectDetail.openingDate ? dayjs(projectDetail.openingDate).locale('zh-cn').format('YYYY年M月D日') : '暂无'

    return (
      <View className='page'>
        <View className='more-info'>
          <View className='item'>
            <Text className='txt left-txt'>项目名称</Text>
            <Text className='txt right-txt'>{projectDetail.buildingName}</Text>
          </View>
          <View className='item'>
            <Text className='txt left-txt'>均价</Text>
            <Text className='txt right-txt'>{projectDetail.price ? projectDetail.price :'待定'}</Text>
          </View>
          <View className='item'>
            <Text className='txt left-txt'>销售状态</Text>
            <Text className='txt right-txt'>{projectDetail.marketStatus ? projectDetail.marketStatus :'待定'}</Text>
          </View>
          <View className='item'>
            <Text className='txt left-txt'>开盘日期</Text>
            <Text className='txt right-txt'>{projectDetail.openingDate ? dayjs(projectDetail.openingDate).format('YYYY-MM-DD HH:mm:ss') : '待定'}</Text>
          </View>
          <View className='item'>
            <Text className='txt left-txt'>楼盘地址</Text>
            <Text className='txt right-txt'>{projectDetail.address || '暂无'}</Text>
          </View>
        </View>
        <View className='more-info'>
          <View className='item'>
            <Text className='txt left-txt'>装修标准</Text>
            <Text className='txt right-txt'>{projectDetail.decoration || '暂无'}</Text>
          </View>
          <View className='item'>
            <Text className='txt left-txt'>物业类型</Text>
            <Text className='txt right-txt'>{projectDetail.serviceCompany || '暂无'}</Text>
          </View>
          <View className='item'>
            <Text className='txt left-txt'>物业费</Text>
            <Text className='txt right-txt'>{projectDetail.serviceFee || '暂无'}</Text>
          </View>
        </View>
        <View className='more-info'>
          <View className='item'>
            <Text className='txt left-txt'>容积率</Text>
            <Text className='txt right-txt'>{projectDetail.volumeRate || '暂无'}</Text>
          </View>
          <View className='item'>
            <Text className='txt left-txt'>车位比率</Text>
            <Text className='txt right-txt'>{projectDetail.parkingRate || '暂无'}</Text>
          </View>
          <View className='item'>
            <Text className='txt left-txt'>规划户数</Text>
            <Text className='txt right-txt'>{projectDetail.familyNum || '暂无'}</Text>
          </View>
          <View className='item'>
            <Text className='txt left-txt'>绿化率</Text>
            <Text className='txt right-txt'>{projectDetail.greeningRate || '暂无'}</Text>
          </View>
          <View className='item'>
            <Text className='txt left-txt'>项目说明</Text>
            <Text className='txt right-txt'>{'暂无'}</Text>
          </View>
        </View>
      </View >
    );
  }
}
