<!--
  @description:竞价大厅外部页-开始/未开始 竞价
  @Modifier:hdk
  @date:2020/9/25-13:23
-->
<template>
  <div class="offer-purchase-content">
    <div class="offer-beging offerTop">
      <!-- {{ biddingText }} -->
      {{ projectRulesData.statusName }}
    </div>
    <div class="offer-tabel">
      <el-form
        ref="projectRulesData"
        :model="projectRulesData"
        style="height:216px;overflow:auto"
      >
        <table class="tableData">
          <tr>
            <td>
              <p>竞价开始时间</p>
            </td>
            <td colspan="3" style="background-color: #FFFFFF">
              <p class="money">
                {{ $Moment(projectRulesData.quoteStartTime).format(momentSaveFormat) }}
              </p>
            </td>
          </tr>
          <tr>
            <td>
              <p>竞价时长</p>
            </td>
            <td colspan="3" style="background-color: #FFFFFF">
              <p class="money">
                <span>{{ projectRulesData.quoteTime }}</span>
                <span>{{ filterDictText(protproject_quoteTimeUnitList, projectRulesData.quoteTimeUnit) }}</span>
              </p>
            </td>
          </tr>
          <tr>
            <td>
              <p>竞价方式</p>
            </td>
            <td colspan="3" style="background-color: #FFFFFF">
              <p class="money">
                {{ filterDictText(protproject_comparePriceMethodList, projectRulesData.comparePriceMethod) }}
              </p>
            </td>
          </tr>
          <tr>
            <td>
              <p>竞价类型</p>
            </td>
            <td colspan="3" style="background-color: #FFFFFF">
              <p class="money">
                {{ filterDictText(protproject_comparePriceTypeList, projectRulesData.quoteCountType) }}
              </p>
            </td>
          </tr>
          <tr>
            <td>
              <p>起拍价格</p>
            </td>
            <td colspan="3" style="background-color: #FFFFFF">
              <p class="money">
                <span>{{ projectRulesData.comparePrice }}</span><span>{{ projectRulesData.comparePriceType==='00'? '元' : '%' }}</span>
              </p>
            </td>
          </tr>
          <tr>
            <td>
              <p>报价次数</p>
            </td>
            <td colspan="3" style="background-color: #FFFFFF">
              <p class="money">
                {{ filterDictText(protproject_quoteCountTypeList, projectRulesData.quoteCountType) }}
              </p>
            </td>
          </tr>
          <tr>
            <td>
              <p>超时竞价</p>
            </td>
            <td colspan="3" style="background-color: #FFFFFF">
              <p class="money">
                {{ projectRulesData.quoteOutTime }}
                {{ filterDictText(protproject_quoteOutTimeUnitList, projectRulesData.quoteOutTimeUnit) }}
              </p>
            </td>
          </tr>
          <tr>
            <td>
              <p>报价幅度</p>
            </td>
            <td colspan="3" style="background-color: #FFFFFF">
              {{ projectRulesData.quoteRangePrice }}
              {{ filterDictText(protproject_quoteRangeTypeList, projectRulesData.quoteRangeType) }}
            </td>
          </tr>
        </table>
      </el-form>
    </div>
  </div>
</template>

<script>
/* 混入*/
import { procurementBiddingMixins } from '../mixins/procurementBiddingMixins'
import { procurementBiddingGroupMixin } from '../mixins/procurementBiddingGrounpMixins'
/* 公共方法*/
import { filterDictText } from '@/assets/js/utils'// 常用方法
export default {
  name: 'ProcurementBiddingExternalIsStart',
  mixins: [procurementBiddingMixins, procurementBiddingGroupMixin],
  props: {
    // 竞价状态 00竞价未开始 01竞价开始 02竞价结束
    biddingStatus: {
      type: String,
      default: '00'
    },
    // 竞价规则
    projectRulesData: {
      type: Object,
      default: () => {}
    }
  },
  inject: ['getTenderBase'],
  data() {
    return {
      dictionaryType: ['protproject_quoteTimeUnit', 'protproject_comparePriceMethod', 'protproject_quoteCountType', 'protproject_comparePriceType', 'protproject_quoteOutTimeUnit', 'protproject_quoteRangeType'], // 字典类型
      protproject_quoteTimeUnitList: [], // 竞价时长
      protproject_comparePriceMethodList: [], // 竞价方式
      protproject_comparePriceTypeList: [], // 竞价类型
      protproject_quoteCountTypeList: [], // 竞价次数
      protproject_quoteOutTimeUnitList: [], // 超时竞价单位
      protproject_quoteRangeTypeList: [], // 报价幅度
      tenderBase: this.getTenderBase(), // 获取项目信息
      biddingText: '竞价暂未开始....'
    }
  },
  watch: {
    biddingStatus: {
      handler(val) {
        if (val === '00') {
          this.biddingText = '竞价进行中....'
        }
      },
      immediate: true
    }
  },
  created() {
    // 页面初始
    this.pageInit()
  },
  methods: {
    // 字典检索
    filterDictText,
    // 页面初始
    pageInit() {
      // 获取竞价规则
      // this.getOfferRulesData(this.tenderBase.packId)
      // 获取字典信息
      this.$store.dispatch('getGroupType', this.dictionaryType).then((data) => {
        // 遍历key存储相应的数据
        for (const key in data.bidTypeData) {
          /* 是否有数据*/
          if (data.bidTypeData[key]) {
            this[key] = data.bidTypeData[key]
          }
        }
      })
    }
  }
}
</script>

<style lang="less" scoped>
.offer-purchase-content{
  width:496px;
  .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>
