<template>
  <view>
    <cc-scroll-loading :meta="useModel?.metaData?.value" @load="method?.loadMore">
      <view v-for="(i, index) in useModel?.listData?.value" :key="`item_${index}`" class="items">
        <view class="cell_items">
          <view class="label"> 状态 </view>
          <view :class="`value status status_${i.status}`">
            {{ GoodsReleasesStatusEnum[i.status as keyof typeof GoodsReleasesStatusEnum]?.text }}
          </view>
        </view>
        <view class="cell_items">
          <view class="label"> 房屋信息 </view>
          <view class="value"> {{ i?.asset_house?.full_name || '-' }} </view>
        </view>
        <view class="cell_items">
          <view class="label"> 预计到访时间 </view>
          <view class="value"> {{ i?.visit_start_time || '-' }} </view>
        </view>
        <view class="cell_items">
          <view class="label"> 预计离开时间 </view>
          <view class="value"> {{ i?.visit_end_time || '-' }} </view>
        </view>
        <view class="cell_items">
          <view class="label"> 来访事由 </view>
          <view class="value">
            {{ VisitReasonEnum[i?.visit_reason as keyof typeof VisitReasonEnum]?.text || '-' }}
          </view>
        </view>
      </view>
    </cc-scroll-loading>
  </view>
</template>
<script setup lang="ts">
import { onLoad, onUnload } from '@dcloudio/uni-app'
import method from './method'
import useModel from './model'
import { GoodsReleasesStatusEnum, VisitReasonEnum } from '@/gen/Enums'
onLoad(() => {
  method?.getList()
})
onUnload(() => {
  useModel.listData.value = []
  useModel.metaData.value = { page: 1 }
})
</script>
<style lang="scss">
@import './style.scss';
</style>
