<!--
  @description: 代理机构-投标-标书投递-查看标书投递列表
  @Modifier: haoFx
  @routerPath: /bidding/projectDrive/tenderBid/tenderDeliveryList
  @date: 2020/2/12-17:04
-->

<template>
  <div class="main">
    <el-button v-if="!isShowDetail" type="text" class="mb10" size="mini">
      温馨提醒：到了开标时间后才能显示投标人名称
    </el-button>
    <div>
      <el-table
        v-loading="loading"
        :data="tableData"
        width="100%"
      >
        <el-table-column
          type="index"
          label="序号"
          width="60px"
          align="center"
        />
        <el-table-column
          header-align="center"
          prop="supplierName"
          min-width="300"
          label="投标人名称"
        />
        <el-table-column
          align="center"
          prop="linkerTel"
          width="140"
          label="投标人联系电话"
        />
        <el-table-column
          align="center"
          label="投标状态"
          prop="bidStatus"
          min-width="110"
        />
        <el-table-column
          header-align="center"
          label="投标文件成功递交日期"
          prop="bidTime"
          width="150"
          align="center"
        >
          <template slot-scope="scope">
            <span>
              {{ scope.row.bidTime && $Moment(scope.row.bidTime).format(momentSaveFormat) }}
            </span>
          </template>
        </el-table-column>
        <el-table-column
          header-align="center"
          label="投标文件撤回日期"
          prop="receiptBidTime"
          width="150"
          align="center"
        >
          <template slot-scope="scope">
            <span>
              {{ scope.row.receiptBidTime && $Moment(scope.row.receiptBidTime).format(momentSaveFormat) }}
            </span>
          </template>
        </el-table-column>
        <el-table-column
          header-align="center"
          label="是否缴纳保证金"
          prop="isPayTenderBailPrice"
          width="130"
          align="center"
        >
          <template slot-scope="scope">
            <span
              v-for="(groupItem,index) in isPayTenderBailPriceList"
              v-if="scope.row.isPayTenderBailPrice===groupItem.typecode"
              :key="index"
            >{{ groupItem.typename }}
            </span>
          </template>
        </el-table-column>
        <el-table-column
          header-align="center"
          label="ip地址"
          prop="ip"
          min-width="100"
          align="center"
        />
        <!-- isOperation是报价大厅查看唱标结果新增保证金查看功能  -->
        <el-table-column
          v-if="isShowDetail&&isOperation"
          label="操作"
          align="center"
          width="80"
        >
          <template slot-scope="scope">
            <el-link
              type="primary"
              @click="examine(scope.row)"
            >
              [查看]
            </el-link>
          </template>
        </el-table-column>
      </el-table>
    </div>
  </div>
</template>

<script>
/* api*/
import { listTenderBidBaseInfo } from '@api/bidding/bid'
/* 混合开发方法-参数字段*/
import { tenderBidGroupMixin } from './../mixins/tenderBidGroupMixin'// 投标-字典信息
export default {
  name: 'TenderDeliveryList',
  mixins: [tenderBidGroupMixin],
  props: {
    isOperation: {
      type: Boolean,
      default: function() {
        return true
      }
    }
  },
  data() {
    return {
      loading: true,
      groupId: this.$store.getters.groupId, // 包Id 项目Id 阶段id
      // 投标基本信息列表
      tableDataAll: [], // 所有的数据
      isShowDetail: null, // 是否显示详情列
      // 分页数据
      tableData: [
        /*        {
          bidStatus: '', // 投递状态 00申请投标 01确认投标 02撤标
          bidTime: '', // 投递时间
          ip: '', // ip地址
          isPayTenderBailPrice: '', // 是否支付投标保证金 00否 01是
          linker: '', // 联系人
          linkerEmail: '', // 联系人邮箱
          linkerTel: '', // 联系人电话
          supplierId: '', // 供应商id
          supplierName: '' // 供应商名称
        }*/
      ]
    }
  },
  mounted() {
    // 获取投标供应商投标基本信息列表（开标前开标后）
    this.getTenderBidBaseListInfo()
  },
  methods: {
    getTenderBidBaseListInfo() {
      const params = {
        stageId: this.groupId.stageId,
        tenderId: this.groupId.tenderId
      }
      listTenderBidBaseInfo(params).then(res => {
        this.tableData = res.data
        // 根据列表返回isShowDetail状态判断是否显示操作列 isShowDetail 是否显示详情 00否 01是
        if (this.tableData.length > 0) {
          this.tableData[0].isShowDetail === '01' ? this.isShowDetail = true : this.isShowDetail = false
        }
        this.loading = false
      }).catch(() => {
        this.loading = false
      })
    },
    // 查看
    examine(row) {
      const supplierInfo = {
        linker: row.linker, // 联系人
        linkerEmail: row.linkerEmail, // 联系人邮箱
        linkerTel: row.linkerTel, // 联系人电话
        supplierName: row.supplierName // 供应商名称
      }
      sessionStorage.setItem('supplierInfo', JSON.stringify(supplierInfo))
      this.$router.push({
        path: '/bidding/projectDrive/tenderBid/tenderDeliveryDetail',
        query: {
          ...this.$route.query,
          supplierId: row.supplierId // 供应商id
        }
      })
    }
  }
}
</script>

<style lang="less" scoped>

</style>
