<template>
  <view class="content">
    <view class="card">
      <u-cell-group :border="false">
        <u-cell>
          <view slot="title" class="title">处罚原因：</view>
          <view slot="value">{{data.REASON}}</view>
        </u-cell>
        <u-cell>
          <view slot="title" class="title">处罚金额：</view>
          <view slot="value">{{data.AMOUT}}元</view>
        </u-cell>
        <u-cell>
          <view slot="title" class="title">被处罚单位：</view>
          <view slot="value">{{data.UNITS_NAME}}</view>
        </u-cell>
        <u-cell>
          <view slot="title" class="title">被处罚人：</view>
          <view slot="value">{{data.PERSON_NAME}}</view>
        </u-cell>
        <u-cell>
          <view slot="title" class="title">下发人：</view>
          <view slot="value">{{data.CREATOR_NAME}}</view>
        </u-cell>
        <u-cell>
          <view slot="title" class="title">下发处罚时间：</view>
          <view slot="value">{{data.DATE}}</view>
        </u-cell>
        <template v-if="type === '2'">
          <u-cell>
            <view slot="title" class="title">罚款缴纳单：</view>
            <view slot="label" class="mt-10">
              <u--image :showLoading="true" :src="data.HANDLE_IMG"
                        width="80px" height="80px" @click="previewImage(data.HANDLE_IMG)"></u--image>
            </view>
          </u-cell>
          <u-cell>
            <view slot="title" class="title">处罚处理人：</view>
            <view slot="value">{{data.PERSON_NAME}}</view>
          </u-cell>
          <u-cell>
            <view slot="title" class="title">处罚处理时间：</view>
            <view slot="value">{{data.HANLDE_TIME}}</view>
          </u-cell>
        </template>
      </u-cell-group>
    </view>
  </view>
</template>

<script>
import {setKeyProjectsPunishView} from "../../../api";

export default {
  data() {
    return {
      KEYPROJECTPUNISH_ID:'',
      type:'',
      data: {}
    }
  },
  onLoad(e){
    this.KEYPROJECTPUNISH_ID = e.KEYPROJECTPUNISH_ID
    this.type = e.type
    this.getData()
  },
  methods: {
    async getData() {
      let resData = await setKeyProjectsPunishView({
        KEYPROJECTPUNISH_ID:this.KEYPROJECTPUNISH_ID
      })
      this.data = resData.pd
      this.data.HANDLE_IMG = this.$store.state.filePath + resData.pd.HANDLE_IMG;
    },
    previewImage(current) {
      uni.previewImage({
        urls:[current],
        current
      });
    },
  },
}
</script>

<style scoped>

</style>
