<!--
  @description: 查看退款明细
  @Modifier: sunxinman
  @routerPath:
  @date: 2020/04/05-16:30
-->
<template>
  <el-dialog
    v-dialogDrag
    :visible.sync="dialogDataRefund.dialog"
    :close-on-click-modal="false"
    append-to-body
    title="查看详情"
    width="840px"
    custom-class="el-dialog__body-p0"
  >
    <section class="p8">
      <!-- 表格部分 -->
      <table class="tableData">
        <tr>
          <td>投标单位</td>
          <td>{{ formData.supplierName }}</td>
          <td>退款账户名称</td>
          <td>{{ formData.desName }}</td>
        </tr>
        <tr>
          <td>退款开户行</td>
          <td>{{ formData.desBankName }}</td>
          <td>退款账号</td>
          <td>{{ formData.desNo }}</td>
        </tr>
        <tr>
          <td>退款联行号</td>
          <td>{{ formData.desBankNo }}</td>
          <td>子账号</td>
          <td>{{ formData.accountNo }}</td>
        </tr>
        <tr>
          <td style="white-space: nowrap">
            退款金额小写（元）
          </td>
          <td>{{ moneyFormat(formData.refundAmount) }}</td>
          <td>退款金额大写</td>
          <td>{{ formData.ArefundAmount }}</td>
        </tr>
        <tr>
          <td>是否中标</td>
          <td>
            <span
              v-for="(item,index) in winStatusttList"
              v-if="formData.winStatus === item.typecode"
              :key="index"
            >{{ item.typename }}</span>
          </td>
          <td>提交时间</td>
          <td>{{ formData.createTime }}</td>
        </tr>
        <tr>
          <td>备注</td>
          <td colspan="3">
            {{ formData.remark }}
          </td>
        </tr>
        <tr>
          <td>附件</td>
          <td colspan="3">
            <downloadFile :data="annexFileData" />
          </td>
        </tr>
        <tr>
          <!-- <td>说明</td>
          <td colspan="3">{{ formData.supplierName }}</td> -->
        </tr>
      </table>
    </section>
  </el-dialog>
</template>
<script>
/* 接口*/
import { detailDepositRefundDetailInfo } from '@api/fee/bailfee'
/* 混合开发方法-参数字段*/
import { cashDepositGroupMixin } from '../mixins/cashDepositGroupMixin'
/* 公用方法*/
import { numberChinese, moneyFormat, restoreInitialValue } from '@/assets/js/utils'// 过滤空的key
/* 组件 */
import downloadFile from '@comp/common/updownload/downloadFile'// 附件下载

export default {
  name: 'RedundDetail',
  components: {
    downloadFile // 附件下载
  },
  mixins: [cashDepositGroupMixin],
  props: {
    // 弹框展示状态
    dialogDataRefund: {
      type: Object,
      default: function() {
        return {
          dialog: false,
          refundDetailId: ''// 退款明细ID

        }
      }
    }
  },
  data() {
    return {
      moneyFormat: moneyFormat, // 千分位
      annexFileData: {
        bizId: '',
        fileType: 'refund_audit_file'
      },
      formData: {
        createTime: '', // 提交时间
        desBankName: '', // 退款开户行
        desBankNo: '', // 退款联行号
        desName: '', // 退款账户名称
        desNo: '', // 退款账号
        accountNo: '', // 子账号
        refundAmount: 0, // 退款金额
        ArefundAmount: '', // 退款金额(大写)
        refundStt: '', // 是否中标00未中01中标
        remark: '', // 备注说明
        supplierName: '' // 投标人名称
      }
    }
  },
  watch: {
    'dialogDataRefund.dialog'(val) {
      if (val) {
      // 查看保证金退款详细信息
        this.getDetailInfo()
      } else {
        restoreInitialValue(this.formData)
      }
    }
  },
  methods: {
    // 查看保证金退款详细信息
    getDetailInfo() {
      detailDepositRefundDetailInfo(this.dialogDataRefund && this.dialogDataRefund.refundDetailId).then(res => {
        this.formData = res.data
        this.formData.refundAmount = Number(this.formData.refundAmount) ? Number(this.formData.refundAmount).toFixed(2) : this.formData.refundAmount// 保留两位小数
        this.formData.ArefundAmount = numberChinese(this.formData.refundAmount)// 退款金额转大写
		this.annexFileData.bizId = this.dialogDataRefund.refundDetailId
      }).catch(() => {
      })
    }
  }
}
</script>
<style lang="less" scoped>

</style>
