<template>
  <view class="qr_code_page">
    <view class="qr_code">
      <image :src="useModel?.qrCode?.value" />
    </view>
    <view class="project_name">
      {{ useModel?.showData?.value?.asset_house?.full_name || '-' }}
    </view>
    <view class="passed_time">
      <view class="date">
        {{ useModel?.showData?.value?.passed_time || '-' }}
      </view>
      <view class="passed_type">
        通行缘由：{{
          GoodsReleasesPassedTypeEnum[
            useModel?.showData?.value?.passed_type as keyof typeof GoodsReleasesPassedTypeEnum
          ]?.text || '-'
        }}
      </view>
    </view>
    <view class="goods_contents">
      <view class="goods_title"> 物品信息 </view>
      <view class="">
        <view
          v-for="(i, index) in useModel?.showData?.value?.goods"
          :key="`goods_${index}`"
          class="goods_items"
        >
          <view class="goods_items_header">
            {{ i?.name || '-' }}
            <text class="goods_items_count"> x{{ i?.number || '-' }} </text>
          </view>
          <view class="goods_items_remark">
            {{ i?.remark || '-' }}
          </view>
        </view>
      </view>
    </view>
    <view class="goods_remark" v-if="useModel?.showData?.value?.remark">
      其他备注：{{ useModel?.showData?.value?.remark || '-' }}
    </view>
  </view>
</template>
<script setup lang="ts">
import { onLoad, onShow, onUnload } from '@dcloudio/uni-app'
import method from './method'
import useModel from './model'
import { GoodsReleasesPassedTypeEnum } from '@/gen/Enums'

onLoad((e: any) => {
  method?.getShow(e)
})
onUnload(() => {
  useModel.showData.value = {}
})
</script>

<style lang="scss">
@import './style.scss';
</style>
