<!--
  @description:查看供货记录详情-弹框
  @Modifier:肖文龙
  @routerPath:supplierDeclaration/supplier/supplYrecord
  @date:2020/2/17-17:27
-->
<template>
  <el-dialog
    v-dialogDrag
    :visible.sync="data.dialog"
    :close-on-click-modal="false"
    title="查看供货记录"
    width="700px"
    custom-class="el-dialog__body-p0"
    top="calc((100vh - 551px) / 2)"
    style="padding:0 50px;"
  >
    <div class="main" style="margin-bottom:10px">
      <table class="tableData">
        <tr>
          <td>合同合作方</td>
          <td>
            <span v-for="(groupItem,index) in supplierPartnersList" v-if="supplyRecordData.partners===groupItem.typecode" :key="index">
              {{ groupItem.typename }}
            </span>
          </td>
        </tr>
        <tr>
          <td>产品名称</td>
          <td>{{ supplyRecordData.productName }}</td>
        </tr>
        <tr>
          <td>采购单位</td>
          <td>{{ supplyRecordData.purchasingUnit }}</td>
        </tr>
        <tr>
          <td>合同签订日期</td>
          <td>{{ supplyRecordData.contractDate }}</td>
        </tr>
        <tr>
          <td>合同金额（万元）</td>
          <td>
            <span>{{ supplyRecordData.contractAmount?Number(supplyRecordData.contractAmount).toFixed(6):supplyRecordData.contractAmount }}</span>
          </td>
        </tr>
        <tr>
          <td>币种</td>
          <td>
            <span v-for="(groupItem,index) in currencies" v-if="supplyRecordData.currencies===groupItem.typecode" :key="index">
              {{ groupItem.typename }}
            </span>
          </td>
        </tr>
        <tr>
          <td>供货项目</td>
          <td>{{ supplyRecordData.supplyProject }}</td>
        </tr>
        <tr>
          <td>项目所在地</td>
          <td>{{ supplyRecordData.projectLocation }}</td>
        </tr>

        <tr>
          <td>买方业务代表</td>
          <td>{{ supplyRecordData.buyerRepresentative }}</td>
        </tr>

        <tr>
          <td>是否国内电话</td>
          <td>
            <span v-for="(groupItem,index) in isDomesticPhoneList" v-if="supplyRecordData.isDomesticPhone===groupItem.typecode" :key="index">
              {{ groupItem.typename }}
            </span>
          </td>
        </tr>

        <tr>
          <td>买方业务代表联系电话</td>
          <td>{{ supplyRecordData.buyerLinker }}</td>
        </tr>
        <tr>
          <td>合同扫描件</td>
          <td><downloadFile v-if="supplyRecordFile.bizId" :data="supplyRecordFile" /></td>
        </tr>
      </table>
    </div>
  </el-dialog>
</template>

<script>
/* 接口*/
import { querySupplyRecordInfo } from '@/api/supplier/supplierSupplyRecord'
/* 混合开发*/
import { declareHegSupperGroupMixin } from '@/views/supplier/editorDeclaration/mixins/declareHegSupperGroupMixin'// 供应商-字典
import { declareHegSupperMixins } from '@/views/supplier/editorDeclaration/mixins/declareHegSupperMixins'// 应商-公用方法参数
/* 组件*/
// import money from '@comp/common/money/money'// 金额
import downloadFile from '@comp/common/updownload/downloadFile'// 附件
import { mapGetters } from 'vuex'
export default {
  name: 'SupplYrecordnDialog',
  components: {
    // money,
    downloadFile
  },
  mixins: [declareHegSupperGroupMixin, declareHegSupperMixins],
  props: {
    // 弹框展示状态
    data: {
      type: Object,
      default: function() {
        return {
          dialog: false, // 弹窗状态
          id: '', // 编辑时才会有供货记录id
          oldId: '' // 修改时用的Id
        }
      }
    }
  },
  data() {
    return {
    }
  },
  computed: {
    ...mapGetters(['language'])
  },
  created() {
    this.initData()// 初始化数据
    this.getSupplyRecordDictionaries()// 字典信息获取
  },
  methods: {
    // 初始化数据
    initData() {
      const data = {
        id: this.data.id,
        oldId: this.data.oldId
      }
      querySupplyRecordInfo(data).then(res => {
        this.supplyRecordData = res.data
        this.supplyRecordData.contractDate = this.$Moment(this.supplyRecordData.contractDate).format(this.momentDate)// 签订日期
        this.supplyRecordFile.bizId = this.supplyRecordData.id// 合同扫描件
      })
    }
  }
}
</script>

<style scoped lang="less">

</style>
