<!--
  @description: 文件领购记录-待审核
  @Modifier: sxm/王秀阳
  @routerPath:/procurement/procurementDrive/supplierResponse/docRecordAudit
  @date: 2020-6-3 10:00:31
-->
<template>
  <div class="p0-16">
    <p class="page-title">
      1、开票信息
    </p>
    <table class="tableData">
      <tr>
        <td>发票抬头</td>
        <td>{{ invoiceVo.invoiceTitle }}</td>
        <td>发票类型</td>
        <td>  {{ invoiceVo.invoiceType === '00'?'电子发票（普通发票）':'增值税专用发票' }}</td>
      </tr>
      <tr>
        <td>纳税人识别号（统一社会信用识别码）</td>
        <td>{{ invoiceVo.taxpayerIdentificationNumber }}</td>
        <td>地址、电话</td>
        <td>{{ invoiceVo.taxpayeraddr }} </td>
      </tr>
      <tr>
        <td>开户行及账号</td>
        <td>{{ invoiceVo.bankname }}</td>
        <td>邮箱</td>
        <td>{{ invoiceVo.email }}</td>
      </tr>
    </table>
    <p class="page-title">
      2、订单支付
    </p>
    <table class="tableData">
      <tr>
        <td class="singleRow">
          标书费（元）
        </td>
        <td colspan="3">
          {{ invoiceInfo.payAmount }}
        </td>
      </tr>
      <tr>
        <td class="singleRow">
          支付方式
        </td>
        <td colspan="3">
          {{ invoiceInfo.payType==='01'?'微信支付':invoiceInfo.payType==='00'?'支付宝支付':'其他支付' }}
        </td>
      </tr>
      <tr class="singleRow">
        <td>附件</td>
        <td colspan="3">
          <downloadFile :data="upLoadData" />
        </td>
      </tr>
      <tr>
        <td class="singleRow">
          提交时间
        </td>
        <td colspan="3">
          {{ invoiceInfo.createTime }}
        </td>
      </tr>
    </table>
    <p class="page-title">
      审核意见
    </p>
    <table class="tableData">
      <tr class="singleRow">
        <td>审核意见</td>
        <td>
          <el-input
            v-model="formData.projectContent"
            :autosize="{ minRows: 4, maxRows: 4 }"
            type="textarea"
            maxlength="1000"
            show-word-limit
            style="width: 100%"
          />
        </td>
      </tr>
    </table>
    <p v-if="tableData.length>0" class="page-title">
      审核信息
    </p>
    <section v-if="tableData.length>0">
      <el-table
        ref="smallTable"
        :data="tableData"
      >
        <el-table-column
          prop="auditDate"
          label="审核时间"
          align="center"
        />
        <el-table-column
          prop="auditName"
          label="审核人"
          header-align="center"
        />
        <el-table-column
          prop="auditStatus"
          align="center"
          label="审核状态"
          header-align="center"
        >
          <template slot-scope="scope">
            <span v-if="scope.row.auditStatus === '01'">审核通过</span>
            <span v-if="scope.row.auditStatus === '02'">审核不通过</span>
            <span v-else>待审核</span>
          </template>
        </el-table-column>
        <el-table-column
          prop="auditOpinion"
          align="left"
          label="审核意见"
          header-align="center"
        />
      </el-table>
    </section>
    <!--操作按钮-->
    <div class="but_footer">
      <div class="but_footer-h">
        <div class="but_footer-but">
          <gx-button :code="'001_011_005'" @click="auditResult('01')">
            审核通过
          </gx-button>
          <gx-button :code="'001_011_006'" @click="auditResult('02')">
            审核不通过
          </gx-button>
          <gx-button :code="'001_011_006'" @click="back">
            关 闭
          </gx-button>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
/* 接口*/
import { queryFeeInfo, updateAuditFeeInfo } from '@/api/procurement/procurementFee'// 获取信息
// import { saveDownloadProcfileRecord } from '@/api/procurement/procurementProtdoc'
import downloadFile from '@comp/common/updownload/downloadFile.vue'
export default {
  name: 'ContactInfoAdd',
  inject: ['getTenderBase'],
  components: {
    downloadFile
  },
  mixins: [],
  props: {
    // 弹框展示状态bu
    tenderId: {
      type: String,
      default: ''
    }
  },
  data() {
    return {
      tableData: [], // 审核信息
      formData: {
        projectContent: '' // 审核意见
      },
      dialogData: { // 审核弹框
        dialog: false
      },
      invoiceVo: {}, // 开票信息
      invoiceInfo: {}, // 订单支付
      ids: '', // 费用主键id
      upLoadData: { // 附件
        bizId: this.$route.query.data.id,
        fileType: 'pay_extinfo_invoice_attachment_base'
      },
      tenderBase: this.getTenderBase() // 获取项目信息
    }
  },
  created() {
    this.initData()
  },
  methods: {
    // 查询邀请函信息
    initData() {
      queryFeeInfo(this.$route.query.data.id).then(response => {
        this.invoiceVo = response.data.data.invoiceVo
        this.invoiceInfo.payType = response.data.data.payType
        this.invoiceInfo.payAmount = response.data.data.payAmount
        this.invoiceInfo.createTime = response.data.data.createTime
        this.ids = response.data.data.id
        this.tableData = response.data.auditList
      }).catch(() => {
      })
    },
    back() {
      this.$router.history.go(-1)
    },
    auditResult(auditStatus) {
      if (auditStatus === '02' && this.formData.projectContent === '') {
        this.$message({
          type: 'warning',
          message: '请填写审核意见'
        })
      } else {
        const text = auditStatus === '01' ? '确定审核通过？' : '确定不通过审核？'
        this.$confirm(text, '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          confirmButtonClass: 'confirmBtn',
          cancelButtonClass: 'cancelBtn'
        }).then(() => {
          const data = {
            auditReason: this.formData.projectContent,
            audiStatus: auditStatus,
            ids: this.ids
          }
          updateAuditFeeInfo(data).then(res => {
            this.$router.push({ path: '/procurement/procurementDrive/supplierResponse/docRecord'
            })
          })
        }).catch(() => {
        })
      }
    }
  }
}

</script>

<style lang="less" scoped>

</style>
