<!--
  @description:招标项目/采购项目-合同付款条款
  @Modifier:郝定康
  @routerPath:
  @date:2021-10-18 14:30:49
-->
<template>
  <div>
    <table v-for="(item, index) in formData.stageDetailDtoList" :key="index" class="tableData mt10">
      <tr>
        <td>
          付款阶段
        </td>
        <td>
          {{ item.paymentStage }}
        </td>
        <td>
          付款阶段名称
        </td>
        <td>
          {{ item.paymentName }}
        </td>
      </tr>
      <tr>
        <td>
          合同款付款比例
        </td>
        <td>
          {{ item.paymentProportion }}
        </td>
        <td>
          付款金额
        </td>
        <td>
          {{ item.paymentMoney }}
          <span style="color: red;">（大写：{{ numberChinese(item.paymentMoney) }}）</span>
        </td>
      </tr>
      <tr>
        <td>
          币种
        </td>
        <td>
          {{ filterDictText(protproject_currencyList, item.paymentCurrencyCode) }}
        </td>
        <td>
          计划付款日期
        </td>
        <td>
          {{ item.paymentTime }}
        </td>
      </tr>
      <tr>
        <td>
          付款备注说明
        </td>
        <td colspan="3">
          {{ item.paymentRemarks }}
        </td>
      </tr>
    </table>
  </div>
</template>

<script>
/* api */
import { listContractPayStage } from '@/api/contractManagement/index'
/* 公共混入*/
import { contractSigningMixins } from '../mixins/contractSigningMixins'
/* 公用方法*/
import { numberChinese, filterDictText } from '@assets/js/utils'
export default {
  name: 'ContractPaymentProvisionDetail',
  mixins: [contractSigningMixins],
  data() {
    return {
      protproject_currencyList: [],
      formData: {
        contractId: '',
        stageDetailDtoList: [
          {
            paymentCurrency: '', // 付款币种
            paymentCurrencyCode: '', // 付款币种编码
            paymentMoney: 0, // 付款金额
            paymentName: '', // 付款阶段名称
            paymentProportion: 0, // 付款比例
            paymentRemarks: '', // 付款备注
            paymentStage: '1', // 付款阶段编号
            paymentTime: '' // 付款时间
          }
        ]
      },
      dictionaryType: ['protproject_currency']
    }
  },
  created() {
    this.formData.contractId = this.$route.params.id ? this.$route.params.id : this.$route.query.id
    this.getGroupType()
    // 获取详情
    this.loadData()
  },
  methods: {
    numberChinese,
    filterDictText,
    getGroupType() {
      // 获取字典信息
      this.$store.dispatch('getGroupType', this.dictionaryType).then((data) => {
      // 遍历key存储相应的数据
        for (const key in data.bidTypeData) {
        /* 是否有数据*/
          if (data.bidTypeData[key]) {
            this[key] = data.bidTypeData[key]
          }
        }
      })
    },
    // 获取详情
    loadData() {
      const params = {
        contractId: this.$route.params.id ? this.$route.params.id : this.$route.query.id
      }
      listContractPayStage(params).then(res => {
        this.formData = res.data
      })
    }
  }
}
</script>

<style>
</style>
