<template>
  <view class="release_items_page">
    <view class="release_content">
      <view class="release_content_title"> 物品放行 </view>
      <view class="cell_content">
        <view class="cell_items">
          <view class="label"> 关联房屋 </view>
          <view>
            {{ useModel?.showData?.value?.asset_house?.full_name || '-' }}
          </view>
        </view>
        <view class="cell_items">
          <view class="label"> 通行缘由 </view>
          <view class="value">
            {{
              GoodsReleasesPassedTypeEnum[
                useModel?.showData?.value?.passed_type as keyof typeof GoodsReleasesPassedTypeEnum
              ]?.text
            }}
          </view>
        </view>
        <view class="cell_items">
          <view class="label"> 放行时间 </view>
          <view class="value">{{ useModel?.showData?.value?.passed_time }} </view>
        </view>
        <view class="cell_items">
          <view class="label"> 申请人 </view>
          <view class="value">{{ useModel?.showData?.value?.apply_name }} </view>
        </view>
        <view class="cell_items">
          <view class="label"> 放行状态 </view>
          <view v-if="useModel?.isExpired?.value" class="value status_expired"> 放行码已过期 </view>
          <view v-else :class="`value status_${useModel?.showData?.value?.status}`">
            {{
              GoodsReleasesStatusEnum[
                useModel?.showData?.value?.status as keyof typeof GoodsReleasesStatusEnum
              ]?.text
            }}
          </view>
        </view>
      </view>
      <view class="goods_info">
        <view class="title"> 物品信息 </view>
        <view>
          <view
            v-for="(i, index) in useModel?.showData?.value?.goods"
            :key="`goods_${index}`"
            class="items_list"
          >
            <view class="label">
              {{ i?.name }} <view>x{{ i?.number }}</view>
            </view>
            <view class="des"> {{ i?.remark }} </view>
          </view>
        </view>
      </view>
      <view class="remark" v-if="useModel?.showData?.value?.remark">
        备注：{{ useModel?.showData?.value?.remark }}
      </view>
    </view>
    <hs-footer
      btnParimaryName="确认放行"
      v-if="useModel?.showData?.value?.status === 'Approved' && !useModel?.isExpired?.value"
      @handleParmaryClick="method?.handleSubmit"
    />
  </view>
</template>
<script setup lang="ts">
import { onLoad } from '@dcloudio/uni-app'
import { GoodsReleasesPassedTypeEnum, GoodsReleasesStatusEnum } from '@/gen/Enums'
import method from './method'
import useModel from './model'

onLoad((e: any) => {
  method?.getShow(e)
  console.log(e)
})
</script>
<style lang="scss">
@import './style.scss';
</style>
