<!--
  @description:竞价大厅外部页-供应商-竞价结束
  @Modifier:hdk
  @date:2020/9/25-13:23
-->
<template>
  <el-col :span="24" class="offer-purchase-content">
    <div class="offer-beging offerTop">
      竞价信息
    </div>
    <div class="offer-tabel">
      <el-table
        :data="tableData"
        border
        style="width: 100%"
      >
        <el-table-column
          type="index"
          header-align="center"
          align="center"
          label="序号"
          width="180"
        />
        <el-table-column
          header-align="center"
          align="center"
          prop="supplierName"
          label="供应商名称"
          width="180"
        />
        <el-table-column
          header-align="center"
          align="center"
          prop="negRecordTime"
          label="报价时间"
        />
        <el-table-column
          header-align="center"
          align="center"
          prop="sort"
          label="排名"
        />
        <el-table-column
          header-align="center"
          align="center"
        >
          <template slot="header">
            最终报价<span>（{{ Unit }}）</span>
          </template>
          <template slot-scope="scope">
            {{ scope.row.newBidPrice }}
          </template>
        </el-table-column>
        <el-table-column
          header-align="center"
          align="center"
          prop="address"
          label="报价次数"
        />
      </el-table>
    </div>
  </el-col>
</template>

<script>
/* api 接口 */
import { quotationRankingForSupplier } from '@/api/procurement/procurementOffer'
export default {
  name: 'ProcurementBiddingExternalEnd',
  props: {
    // 竞价规则
    projectRulesData: {
      type: Object,
      default: () => {
        return {}
      }
    }
  },
  inject: ['getTenderBase'],
  data() {
    return {
      // 表格数据
      tableData: [],
      // 获取项目信息
      tenderBase: this.getTenderBase()
    }
  },
  watch: {
    // 监听竞价类型 comparePriceType 00竞价格 01 竞折扣率
    'projectRulesData.comparePriceType': {
      handler(val) {
        if (val === '00') {
          this.Unit = '元'
        } else {
          this.Unit = '%'
        }
      },
      deep: true,
      immediate: true
    }
  },
  created() {
    // 全部报价
    this.quotationOfferData()
  },
  methods: {
    // 全部报价
    quotationOfferData() {
      const params = {
        packId: this.tenderBase.packId
      }
      quotationRankingForSupplier(params).then(res => {
        this.tableData = res.data
      }).catch(() => {
      })
    }
  }
}
</script>

<style lang="less" scoped>
.offer-purchase-content{
  width:80%;
  .offer-single {
    width:100%;
    text-align: center;
  }
  .offer-beging{
    color:#47A20A;
    font-size: 20px;
    font-weight: bold;
    text-align: center;
  }
  .offerTop{
    margin-top:calc(50% - 55%);
  }
  .offer-tabel{
    width:100%;
    margin-top:calc(50% - 45%);
  }
}
</style>
