<!--
  @description: 联系人信息-竞价类/非竞价类-报名详情-待审核
  @Modifier: sxm/wxy
  @routerPath:procurement/procurementDrive/supplierResponse/contactInfoAudit
  @date: 2020-6-3 10:53:31
-->
<template>
  <div class="p0-16">
    <p class="page-title">
      1、采购项目情况
    </p>
    <table class="tableData">
      <tr>
        <td>采购项目名称</td>
        <td>
          {{ immediatelyQuotedPriceVo.tenderName }}
        </td>
        <td>采购项目编号</td>
        <td>
          {{ immediatelyQuotedPriceVo.tenderNo }}
        </td>
      </tr>
      <tr>
        <td>公告标题</td>
        <td colspan="3">
          {{ immediatelyQuotedPriceVo.title }}
        </td>
      </tr>
      <tr>
        <td>采购单位</td>
        <td colspan="3">
          {{ immediatelyQuotedPriceVo.projectBuyersName }}
        </td>
      </tr>
      <tr>
        <td>公告发布时间</td>
        <td>{{ immediatelyQuotedPriceVo.publishTime }}</td>
        <td>报价截止时间</td>
        <td>{{ immediatelyQuotedPriceVo.quoteEndTime }}</td>
      </tr>
    </table>
    <p class="page-title">
      2、联系人信息
    </p>
    <table class="tableData">
      <tr>
        <td>单位名称</td>
        <td>{{ immediatelyQuotedPriceVo.supplierName }}</td>
        <td>联系人</td>
        <td>{{ immediatelyQuotedPriceVo.linker }}</td>
      </tr>
      <tr>
        <td>联系电话</td>
        <td>{{ immediatelyQuotedPriceVo.linkerTel }}</td>
        <td>邮箱</td>
        <td>{{ immediatelyQuotedPriceVo.linkerEmail }}</td>
      </tr>
      <tr>
        <td>附件</td>
        <td colspan="3">
          <downloadFile :data="upLoadData" />
        </td>
      </tr>
    </table>
    <p v-if="immediatelyQuotedPriceVo.tenderMethod === '14'||immediatelyQuotedPriceVo.tenderMethod==='15'" class="page-title">
      3、响应条件
    </p>
    <section v-if="immediatelyQuotedPriceVo.tenderMethod === '14'||immediatelyQuotedPriceVo.tenderMethod==='15'">
      <el-table
        ref="smallTable"
        :data="signUpList"
      >
        <el-table-column
          type="index"
          label="序号"
          width="60"
          align="center"
        />
        <el-table-column
          prop="conditionName"
          label="响应条件名称"
          header-align="center"
        />
        <el-table-column
          prop="conditionContent"
          align="left"
          label="响应条件内容"
          header-align="center"
        />
        <el-table-column
          prop="conditionState"
          align="center"
          label="响应情况"
          header-align="center"
        />
        <el-table-column
          prop="remark"
          align="left"
          label="备注"
          header-align="center"
        />
      </el-table>
    </section>
    <p v-if="immediatelyQuotedPriceVo.signupAudit!='00'" class="page-title">
      审核意见
    </p>
    <table v-if="immediatelyQuotedPriceVo.signupAudit!='00'" 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="immediatelyQuotedPriceVo.signupAudit!='00'" class="page-title">
      审核消息
    </p>
    <section v-if="immediatelyQuotedPriceVo.signupAudit!='00'">
      <el-table
        ref="smallTable"
        :data="procurementSignUpAuditList"
      >
        <el-table-column
          prop="auditTime"
          label="审核时间"
          align="center"
        />
        <el-table-column
          prop="auditUserRealName"
          label="审核人"
          header-align="center"
        />
        <el-table-column
          prop="auditStatus"
          align="center"
          label="审核状态"
          header-align="center"
        >
          <template slot-scope="scope">
            <!-- 判断审核状态 00未审核  01审核通过  02审核未通过 -->
            <span v-if="scope.row.auditStatus === '00'">未审核</span>
            <span v-else-if="scope.row.auditStatus === '01'">审核通过</span>
            <span v-else>审核不通过</span>
          </template>
        </el-table-column>
        <el-table-column
          prop="auditNotPassReason"
          align="left"
          label="审核意见"
          header-align="center"
        />
      </el-table>
    </section>
    <!--操作按钮-->
    <div class="but_footer">
      <div class="but_footer-h">
        <div class="but_footer-but">
          <el-button v-if="immediatelyQuotedPriceVo.signupAudit!='00'" type="primary" @click="auditResult('01')">
            审核通过
          </el-button>
          <el-button v-if="immediatelyQuotedPriceVo.signupAudit!='00'" @click="auditResult('02')">
            审核不通过
          </el-button>
          <el-button @click="close">
            关闭
          </el-button>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
/* 接口*/
import { immediatelyQuotedPrice, auditSignUp } from '@/api/procurement/procurementSignup'
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: '' // 审核意见
      },
      immediatelyQuotedPriceVo: {}, // 采购项目详情
      procurementSignUpAuditList: [], // 审核信息
      signUpList: [], // 响应条件
      dialogData: {
        dialog: false
      },
      auditStatus: '',
      upLoadData: { // 附件
        bizId: this.$route.query.data.id,
        fileType: 'prot_procurement_procfile_attment_base'
      },
      savaData: {
        downloadStatus: '', // 下载状态 00失败 01成功
        downloadTerminal: '00', // 下载终端00:平台端 01:投标管家端 02:招标管家端 03:开标工具端 04:评标工具端 05:安卓端 06:苹果端
        procfileId: this.$route.query.data.procfileId // 文件id
      },
      tenderBase: this.getTenderBase() // 获取项目信息
    }
  },
  created() {
    this.initData()
  },
  methods: {
    // 查询邀请函信息
    initData() {
      const data = {
        packId: this.tenderBase.packId, // 供应商id
        supplierId: this.$route.query.data.supplierId
      }
      immediatelyQuotedPrice(data).then(res => {
        if (res.header.ret === '0') {
          this.immediatelyQuotedPriceVo = { ...res.data.immediatelyQuotedPriceVo }
          this.procurementSignUpAuditList = res.data.procurementSignUpAuditList
          this.signUpList = res.data.signUpConditionVoList
        }
      })
    },
    // 关闭
    close() {
      this.$router.history.go('-1')
    },
    // 审核
    auditResult(status) {
      if (status === '02' && this.formData.projectContent === '') {
        this.$message({
          type: 'warning',
          message: '请填写审核意见'
        })
      } else {
        const text = status === '01' ? '确定审核通过？' : '确定不通过审核？'
        this.$confirm(text, '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          confirmButtonClass: 'confirmBtn',
          cancelButtonClass: 'cancelBtn'
        }).then(() => {
          auditSignUp(this.immediatelyQuotedPriceVo.signUpId, status, this.formData.projectContent).then(res => {
            this.$router.push({
              path: '/procurement/procurementDrive/supplierResponse/contactInfoAdd',
              query: { ... this.$route.query }

            })
          })
        }).catch(() => {
        })
      }
    }
  }
}
</script>

<style lang="less" scoped>

</style>
