
<!--
  @description:评标-下达评标命令
  @Modifier:yf/wxy
  @routerPath: /procurement/evaluationLobbyDrive/evaluationOrders
  @date:2020/08/04-15:48
-->
<template>
  <div class="main">
    <gx-button :code="'001_005_009'" :loading="loading" type="primary" class="ordersBtn" @click="startEvaluation">
      <span class="iconfont icon-tuixuan" />
      <span style="font-size: 17px;line-height: 20px;">开始评审</span>
    </gx-button>
  </div>
</template>

<script>
/* api接口*/
import {
  unsealProtProjectProcurementEval,
  qryProtProjectProcurementEvalHallStatus
} from '@/api/procurement/procurementEvaluation'
export default {
  name: 'ExpertOrders',
  inject: ['getTenderBase'],
  components: {},
  mixins: [],
  beforeRouteEnter(to, from, next) {
    if (from.meta.shrink) {
      next(vm => {
        vm.shrink = true
      })
      return
    }
    next(vm => {
      vm.shrink = false
    })
  },
  data() {
    return {
      loading: false,
      tenderBase: this.getTenderBase() // getTenderBase参数
    }
  },
  watch: {
  },
  mounted() {
  },
  methods: {
    // 下达开始评标命令
    startEvaluation() {
      this.loading = true
      qryProtProjectProcurementEvalHallStatus(this.tenderBase.packId).then(res => {
        if (res.data) {
          this.$confirm('开始评审后，评委名单，评审步骤和指标将不允许修改。', '提示', {
            confirmButtonText: '确认开始评审',
            cancelButtonText: '取消',
            confirmButtonClass: 'confirmBtn',
            cancelButtonClass: 'cancelBtn',
            type: 'warning'
          }).then(() => {
            unsealProtProjectProcurementEval(this.tenderBase.packId).then(res => {
              this.loading = false
              this.$message.success('开启评审成功！')
            }).catch(() => {
              this.loading = false
            })
          }).catch(() => {
            this.loading = false
          })
          return
        }
        this.$message.warning('已下达评审指令')
        this.loading = false
      })
    }
  }
}
</script>

<style lang="less" scoped>
.main{
  position: relative;
  height:235px;
  background:url('~@assets/img/procurement/procurementEvaluation/evabg.png') no-repeat;
  background-size: auto;
  margin-top: -3px !important;
}
.ordersBtn{
  position: absolute;;
  top: 50%;
  left: 50%;
  margin-left: -70px;
  margin-top: -25px;
  width:115px;
  height:40px;
  color:white;
  line-height: 20px;
  font-size: 14px;
  border-radius:8px;
  text-align:center;
}
</style>
