<template>
  <view>
    <cu-custom bgColor="bg-gradual-blueness" :isBack="true">
      <block slot="backText">返回</block>
      <block slot="content">处罚管理</block>
    </cu-custom>
    <view class="form">
      <view class="wui-form-list">
        <view class="cu-form-group">
          <view class="title">被处罚单位</view>
          <view>{{ data.UNITS_NAME }}</view>
        </view>
        <view class="cu-form-group">
          <view class="title">被处罚人</view>
          <view>{{ data.PERSON_NAME }}</view>
        </view>
        <view class="cu-form-group">
          <view class="title">处罚原因</view>
          <view>{{ data.REASON }}</view>
        </view>
        <view class="cu-form-group">
          <view class="title">处罚金额</view>
          <view>{{ data.AMOUT }}元</view>
        </view>
        <view class="cu-form-group">
          <view class="title">下发人</view>
          <view>{{ data.CREATOR_NAME }}</view>
        </view>
        <view class="cu-form-group">
          <view class="title">下发处罚时间</view>
          <view>{{ data.DATE }}</view>
        </view>
        <template v-if="TabCur === '2'">
          <view class="cu-form-group">
            <view class="title">
              罚款缴纳单
            </view>
            <view @click="previewImage(data.HANDLE_IMG)">
              <image :src="data.HANDLE_IMG" mode="aspectFill" style="width: 80px;height: 80px;"></image>
            </view>
          </view>
          <view class="cu-form-group">
            <view class="title">处罚处理人</view>
            <view>{{ data.PERSON_NAME }}</view>
          </view>
          <view class="cu-form-group">
            <view class="title">处罚处理时间</view>
            <view>{{ data.HANLDE_TIME }}</view>
          </view>
        </template>
      </view>
    </view>
  </view>
</template>

<script>
import {
  basePath, corpinfoId, deptId, loginUser, formatDate, loginSession, baseImgPath, loginUserId
} from '@/common/tool.js';

export default {
  data() {
    return {
      baseImgPath,
      KEYPROJECTPUNISH_ID: '',
      OUTSOURCED_ID: '',
      TabCur: '',
      data:{}
    }
  },
  onLoad(e) {
    this.KEYPROJECTPUNISH_ID = e.KEYPROJECTPUNISH_ID
    this.OUTSOURCED_ID = e.OUTSOURCED_ID
    this.TabCur = e.TabCur
    this.getData()
  },
  methods: {
    getData() {
      uni.showLoading({
        title: "加载中..."
      });//加载中动画
      uni.request({
        url: basePath + '/app/keyprojectpunish/goEdit',
        method: 'POST',
        dataType: 'json',
        header: {
          'Content-type': 'application/x-www-form-urlencoded'
        },
        data: {
          KEYPROJECTPUNISH_ID: this.KEYPROJECTPUNISH_ID,
          OUTSOURCED_ID: this.OUTSOURCED_ID,
        },
        success: (res) => {
          uni.hideLoading();//结束加载中动画
          if (res.data != null) {
            this.data = res.data.pd
            this.data.HANDLE_IMG = baseImgPath + res.data.pd.HANDLE_IMG;
          }
        }
      })
    },
    previewImage(current) {
      uni.previewImage({
        urls: [current],
        current
      });
    },
  }
}
</script>

<style scoped>

</style>
