<!--
  @description:服务费单管理-生成收款单详情
  @Modifier: haofengxian
  @routerPath:
  @date: 2021-3-12-17:39
-->
<template>
  <div>
    <table class="tableData mb10">
      <tr>
        <td>收款单号</td>
        <td>{{ formData.orderCode }}</td>
        <td>供应商名称</td>
        <td>{{ formData.supplierName }}</td>
      </tr>
      <tr>
        <td>订单含税总额（元）</td>
        <td>
          {{ numFilter(formData.taxOrderTotalMoney) }}
        </td>
        <td>收取服务费金额（元）</td>
        <td>
          {{ numFilter(formData.voucherMoney) }}
        </td>
      </tr>
      <tr>
        <td>说明文件</td>
        <td colspan="3">
          <downloadFile v-if="skdFileTypeData.bizId" :data="skdFileTypeData" />
        </td>
      </tr>
    </table>
    <el-table ref="singleTable" :data="tableData">
      <el-table-column
        type="index"
        label="序号"
        align="center"
        width="50"
      />
      <el-table-column
        prop="orderCode"
        label="订单编号"
        align="center"
        width="160"
      />
      <el-table-column
        prop="taxOrderTotalMoney"
        label="订单含税金额（元）"
        align="right"
        width="130"
        header-align="center"
      />
      <el-table-column
        prop="shouldChargeMoney"
        label="服务费金额（元）"
        align="right"
        width="120"
        header-align="center"
      />
      <el-table-column
        prop="supplierName"
        label="供应商名称"
        header-align="center"
        min-width="180"
      />
      <el-table-column
        prop="tenderNo"
        label="采购单结果"
        header-align="center"
      />
      <el-table-column
        :formatter="formatterIfRelief"
        prop="ifRelief"
        label="有无减免"
        align="center"
        header-align="center"
      />
      <el-table-column
        prop="remark"
        label="减免原因"
        header-align="center"
      />
    </el-table>
  </div>
</template>

<script>
/* api*/
import { payeeSingleDetails } from '@/api/procurement/procurementOrder'
/* 公用方法*/
import downloadFile from '@comp/common/updownload/downloadFile' // 获取附件信息 下载组件
import { orderServeFeeMixins } from '../../mixins/orderServeFeeMixins'
export default {
  name: 'ProcurementServeOrderReceiptSureDialog',
  components: {
    downloadFile // 文件下载
  },
  mixins: [orderServeFeeMixins],
  props: {
    orderReceiptInfo: {
      type: Object,
      default: () => {}
    }
  },
  data() {
    return {
      flowStatus: this.$route.query.flowStatus, // 工作流进入
      tableData: [],
      formData: {
        ifRelief: '0', // 是否减免 0 否 1是
        purchaseDepartName: '', // 采购单位名称
        processInitDto: {}, // 工作流信息
        // 服务费明细
        reductionServiceFeeDtos: [
          /*      {
            actualServiceFeeMoney: '', // 实际服务费金额
            amountServiceFeeMoney: '', // 应收服务费金额
            id: '', // 服务单ID
            reductionServiceFeeMoney: '' // 减免服务费金额
          }*/
        ],
        reliefMoney: '', // 减免 金额
        remark: '', // 备注
        serviceFeeIds: '', // 服务费详情Id 用逗号分隔
        supplierId: '', // 供应商id
        supplierName: '', // 供应商名称
        voucherMoney: '' // 服务费金额
      }
    }
  },
  mounted() {
    // 工作流进入
    let id = ''
    if (this.flowStatus) {
      id = this.$route.query.packId
    } else {
      id = this.orderReceiptInfo.id
    }
    this.getPayeeSingleDetails(id)
  },
  methods: {
    // 审批详情--收款单、减免收款单
    getPayeeSingleDetails(id) {
      payeeSingleDetails(id).then(res => {
        this.formData = res.data
        this.skdFileTypeData.bizId = this.formData.bizId
        this.tableData = res.data.reductionServiceFeeDtos
        this.tableData.map(item => {
          item.shouldChargeMoney = item.amountServiceFeeMoney // 应收服务费金额
          item.reliefMoney = item.reductionServiceFeeMoney // 减免服务费金额
          item.supplierName = this.formData.supplierName
          item.ifRelief = this.formData.ifRelief
          item.remark = this.formData.remark
        })
      }).catch(() => {
      })
    }
  }
}
</script>

<style scoped lang="less">
</style>
