import React, { useState } from 'react'
import { useModel } from '@/store'
import WuYeFuWuItem from '@/components/WuYeFuWuItem/index'
import ScrollPageRefresh from '@/components/ScrollPageRefresh/index'
import '@/assets/css/reset.less'
import '@/assets/css/iconfont.less'
import './index.less'

export default function WuYeFuWu () {

  const { user } = useModel('user')
  const [PageList, setPageList] = useState([])

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

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

  return (
    <view className='WuYeFuWu'>
      <ScrollPageRefresh ApiName={`getMessageList`} ListName={`list`} RequestUrlData={{ orgId: user.orgId }} Refresh={Refresh} Push={Push}>
        {/* 大图 */}
        <view className='BigImg'>
          <image mode='aspectFill' src={null} className='centerLabel'></image>
        </view>

        {/* 物业办事指南 */}
        <view className='BanShiZhiNan'>
          <text>物业办事指南</text>
          <view className='flex-h'>
            <view className='Line'><view></view></view>
            <view className='flex-item'>
              <text>1、业主收楼手续办理</text>
              <text>2、物业转名手续办理</text>
              <text>3、业主卡、住户卡办理</text>
            </view>
          </view>
        </view>

        {/* 服务列表 */}
        <view className='List'>
          {
            PageList.map((item, index) => (
              <view key={`WuYeFuWuItem-${index}`}>
                <WuYeFuWuItem Data={item}></WuYeFuWuItem>
              </view>
            ))
          }
        </view>
      </ScrollPageRefresh>
    </view>
  )
}
