<!--
  @description: 审核重新招标
  @Modifier: haoFx
  @routerPath:/projectManagement/auditChangeBulletinContent
  @date: 2020/3/12-15:41
-->
<template>
  <div>
    <div class="title p0-16 clearfix">
      <!-- 返回 -->
      <div class="title-back pointer" @click="back">
        <i class="iconfont icon-fanhui mr10" />
        重新招标审核
      </div>
    </div>
    <!--重新招标详情组件-->
    <rebiddingRecord-detail />
    <!--操作按鈕 auditStatus 00待审核-->
    <div v-if="$route.query.auditStatus === '00'" class="but_footer">
      <div class="p0-16">
        <div class="page-title">
          审核意见
        </div>
        <el-form ref="auditInfoParam" :model="auditInfoParam">
          <el-form-item ref="auditNotPassReason" prop="auditNotPassReason">
            <el-input
              v-model="auditInfoParam.auditNotPassReason"
              :rows="4"
              type="textarea"
              placeholder="请填写审核意见"
              maxlength="200"
              show-word-limit
            />
          </el-form-item>
        </el-form>
      </div>
      <div class="but_footer-h">
        <div class="but_footer-but">
          <el-button type="primary" @click="verified()">
            审核通过
          </el-button>
          <el-button @click="auditFail()">
            审核不通过
          </el-button>
          <el-button @click="back()">
            返 回
          </el-button>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import { auditRebiddingRecord } from '@api/bidding/rebiddingRecord'
/* 组件*/
import rebiddingRecordDetail from '../tenderRebidding/rebiddingRecord-detail'

export default {
  name: 'AuditBulletinOpinion',
  components: {
    'rebiddingRecord-detail': rebiddingRecordDetail
  },
  data() {
    return {
      // 审核信息参数
      auditInfoParam: {
        isPass: '', // 是否审核通过 00否 01是
        auditNotPassReason: '', // 审核意见
        rebiddingRecordId: ''
      }
    }
  },
  created() {
    this.auditInfoParam.rebiddingRecordId = sessionStorage.getItem('bizId')
  },
  methods: {
    // 返回
    back() {
      this.$router.push({
        path: '/projectManagement/auditRebiddingRecord'
      })
    },
    // 操作审核通过不通过调用接口
    handleAuditBulletin(isPass) {
      this.auditInfoParam.isPass = isPass
      auditRebiddingRecord(this.auditInfoParam).then(reponse => {
        this.$message({
          type: 'success',
          message: '审核成功'
        })
        this.back()
      }).catch(() => {

      })
    },
    // 审核通过
    verified() {
      this.$confirm('确认提交?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        confirmButtonClass: 'confirmBtn',
        cancelButtonClass: 'cancelBtn',
        type: 'warning'
      }).then(() => {
        this.handleAuditBulletin('01')
      }).catch(() => {
      })
    },
    // 审核不通过
    auditFail() {
      if (this.auditInfoParam.auditNotPassReason) {
        this.$confirm('确认提交?', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          confirmButtonClass: 'confirmBtn',
          cancelButtonClass: 'cancelBtn',
          type: 'warning'
        }).then(() => {
          this.handleAuditBulletin('00')
        }).catch(() => {
        })
      } else {
        this.$message({
          type: 'warning',
          message: '请输入审核意见'
        })
      }
    }
  }
}
</script>

<style lang="less" scoped>

</style>
