import React, { useState } from 'react'
import ScrollPageRefresh from '@/components/ScrollPageRefresh'
import toolclass from '@/utils/toolclass.js'
import Taro from '@tarojs/taro'
import '@/assets/css/reset.less'
import '@/assets/css/iconfont.less'
import './index.less'

export default function WoDeRenZheng () {

  const [PageList, setPageList] = useState([])

  const Refresh = (e) => { // 下拉刷新
    setPageList(e)
  }

  const Push = (e) => { // 上拉加载
    setPageList(PageList.concat(e))
  }


  return (
    <view className='WoDeRenZheng'>
      <ScrollPageRefresh ApiName={`getOwnerVerifyList`} ListName={null} Refresh={Refresh} Push={Push}>
        <view className='Content Activity'>
          {
            PageList.map((item, index) => (
              <view className='ListItem' key={`RenZhengItem-${index}`} onClick={() => { Taro.navigateTo({ url: `/pages/WoDe/YeZhuShenHe/index?id=${item.id}` }) }}>
                <text>{item.phaseName}{item.buildingName}{item.unitName}{item.levelName}{item.roomNoName}</text>
                <view className='flex-h'>
                  <view className='flex-item'>
                    <text>业主：{item.ownerName} {item.phone}</text>
                    <text>{toolclass.FormatDate(item.createDate)}</text>
                  </view>
                  <view>
                    <text className={item.verifyStatus - 0 === 0 ? '' : item.verifyStatus - 0 === 1 ? 'Green' : 'Red'}>{item.verifyStatus - 0 === 0 ? '审核中' : item.verifyStatus - 0 === 1 ? '审核通过' : '审核未通过'}</text>
                  </view>
                </view>
              </view>
            ))
          }
          <view className='AddBtn'>
            <text onClick={() => { Taro.navigateTo({ url: `/pages/WoDe/YeZhuRenZheng/index` }) }}>添加认证</text>
          </view>
        </view>
      </ScrollPageRefresh>
    </view>
  )
}
