<!--
  @description: 风险控制部异议复核
  @Modifier: haoFx
  @routerPath: /objection/objectionTabs/objectionAcceptanceRecheck
  @date: 2020/3/3-16:01
-->
<template>
  <div class="mb10">
    <!--受理详情-->
    <objectionAcceptanceDetail v-if="receiptStatus==='01'" />
    <!--异议不予受理详情-->
    <objectionNotAcceptanceDetail v-if="receiptStatus==='02'" />
    <!--复核操作按鈕-->
    <div class="but_footer">
      <div class="p0-16">
        <div class="page-title">
          复核意见
        </div>
        <el-form ref="auditInfoParam" :model="auditInfoParam">
          <el-form-item ref="confirmReason" prop="confirmReason">
            <el-input
              v-model="auditInfoParam.confirmReason"
              :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 { confirmobjectionReceipt } from '@api/bidding/tenderObjection'
/* 组件*/
import objectionAcceptanceDetail from './objectionAcceptance-detail' // 受理详情
import objectionNotAcceptanceDetail from './objectionNotAcceptance-detail' // 不予受理详情
export default {
  name: 'ObjectionAcceptanceRecheck',
  components: {
    objectionAcceptanceDetail,
    objectionNotAcceptanceDetail
  },
  data() {
    return {
      receiptStatus: this.$route.params.receiptStatus, // 接受状态 01:受理 02:不受理
      // 审核信息参数
      auditInfoParam: {
        confirmStatus: '', // 01-审核通过 ||00-审核不通过
        confirmReason: '', // 审核意见
        objectionId: this.$route.params.objectionId // 异议id
      }
    }
  },
  methods: {
    // 返回
    back() {
      this.$router.push({
        path: '/objection/objectionList'
      })
    },
    // 操作审核通过不通过调用接口
    handleAuditObjection(auditStatus) {
      this.auditInfoParam.confirmStatus = auditStatus
      confirmobjectionReceipt(this.auditInfoParam).then(() => {
        this.$message({
          type: 'success',
          message: '审核成功'
        })
        this.back()
      }).catch(() => {
      })
    },
    // 审核通过
    verified() {
      this.$confirm('确认提交?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        confirmButtonClass: 'confirmBtn',
        cancelButtonClass: 'cancelBtn',
        type: 'warning'
      }).then(() => {
        this.handleAuditObjection('01')
      }).catch(() => {
      })
    },
    // 审核不通过
    auditFail() {
      if (this.auditInfoParam.confirmReason) {
        this.$confirm('确认提交?', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          confirmButtonClass: 'confirmBtn',
          cancelButtonClass: 'cancelBtn',
          type: 'warning'
        }).then(() => {
          this.handleAuditObjection('00')
        }).catch(() => {
        })
      } else {
        this.$message({
          type: 'warning',
          message: '请输入审核意见'
        })
      }
    }
  }
}
</script>
<style lang="less" scoped>

</style>
