<template>
  <view class="view-container">
    <view class="box">
      <view
        class="wd-flex"
        style="justify-content: space-between; align-items: center"
      >
        <view style="font-weight: bold">
          <text style="color: #f8285a; margin-right: 4px">*</text>
          处理意见
        </view>
      </view>
      <view style="color: #071437">{{ detail.feedBack }}</view>
      <view
        class="wd-flex"
        style="justify-content: space-between; align-items: center"
      >
        <view style="font-weight: bold">
          <text style="color: #f8285a; margin-right: 4px">*</text>
          上传证明
        </view>
      </view>
      <view class="imageList">
        <image
          :src="photo.url"
          v-for="photo in detail.fileList"
          :key="photo.id"
          mode="aspectFill"
          class="image"
        ></image>
      </view>
    </view>

    <view class="box" v-if="detail.status == 3">
      <view
        class="wd-flex"
        style="justify-content: space-between; align-items: center"
      >
        <view style="font-weight: bold">
          <text style="color: #f8285a; margin-right: 4px">*</text>
          截止日期
        </view>
        <view class="wd-flex" style="gap: 4px; align-items: center">
          <text style="color: #f8285a">
            {{ $util.formatDate(detail.correctionTime, 'YYYY年M月D日') }}
          </text>
        </view>
      </view>
    </view>
  </view>
</template>

<script>
import { getDictBatchByType } from '@/api/system/dict.js'
import { InspectionsApi } from '@/api/inspections/index.js'
export default {
  data() {
    return { detail: {}, dictMap: {} }
  },
  async onLoad(res) {
    this.detail.id = res.id
    await this.getDict()
  },
  onShow() {
    this.getDetail()
  },
  methods: {
    getDetail() {
      InspectionsApi.feedBackDetail(this.detail.id).then(res => {
        this.detail = res.data
      })
    },
    /**
     * 获取字典
     */
    async getDict() {
      const dict = await getDictBatchByType({
        type: ['inspections_mark'].join(',')
      })
      this.dictMap = {
        ...dict.data
      }
    }
  }
}
</script>

<style lang="scss" scoped>
.view-container {
  padding: 12px;
  display: flex;
  gap: 12px;
  flex-direction: column;
  .box {
    padding: 12px;
    border-radius: 8px;
    background-color: #fff;
    display: flex;
    flex-flow: column nowrap;
    gap: 12px;

    .imageList {
      display: flex;
      gap: 12px;
      .image {
        width: 192rpx;
        height: 192rpx;
        border-radius: 8px;
      }
    }
  }
}
</style>