<template>
  <view class="release_items_page">
    <cc-scroll-loading :meta="useModel?.metaData?.value" @load="method?.loadMore">
      <view v-for="(i, index) in useModel?.listData?.value" :key="`items_${index}`" class="items">
        <view class="cell_items">
          <view class="label"> 状态 </view>
          <view :class="`value status status_${i.payment_status}`">
            {{ HouseOrdersOrderStatusEnum[i.payment_status as keyof typeof HouseOrdersOrderStatusEnum]?.text }}
          </view>
        </view>
        <view class="cell_items">
          <view class="label"> 支付金额 </view>
          <view class="value"> ¥{{ i?.amount || '-' }} </view>
        </view>
        <view class="cell_items">
          <view class="label"> 订单号 </view>
          <view class="value">
            {{ i?.payment_no || '-' }}
          </view>
        </view>
        <!-- <view class="cell_items">
          <view class="label"> 支付方式 </view>
          <view class="value"> {{ HouseOrdersPaymentMethodEnum[i.payment_method as keyof typeof HouseOrdersPaymentMethodEnum]?.text }} </view>
        </view> -->
        
        <view class="cell_items">
          <view class="label"> 支付时间 </view> 
          <view class="value"> {{ i?.paid_time || '-' }} </view>
        </view>

        <view class="cell_items">
          <view class="label"> 创建日期 </view>
          <view class="value"> {{ i?.created_at || '-' }} </view>
        </view>

        <view class="cell_items">
          <view class="label"> 其他备注 </view>
          <view class="value"> {{ i?.remark || '-' }} </view>
        </view>
        
      </view>
    </cc-scroll-loading>
  </view>
</template>
<script setup lang="ts">
import { onLoad, onShow, onUnload } from '@dcloudio/uni-app'
import method from './method'
import useModel from './model'
import { HouseOrdersOrderStatusEnum, HouseOrdersPaymentMethodEnum } from '@/gen/Enums'
onLoad(() => {
  method?.getList()
})
onShow(() => {
  if (useModel?.loadingStatus?.value) {
    useModel.listData.value = []
    useModel.formData.value = { page: 1 }
    method?.getList()
  }
})

onUnload(() => {
  useModel.loadingStatus.value = false
  useModel.listData.value = []
  useModel.formData.value = { page: 1 }
})
</script>
<style lang="scss">
@import './style.scss';
</style>
