<!--
  @description: 运维-报名审核页面
  @Modifier: 张慢慢
  @routerPath:
  @date: 2021/07/08-16:00
-->
<template>
  <div>
    <section class="main title clearfix" style="margin-top:0">
      <!-- 返回 -->
      <div class="title-back pointer" @click="back()">
        <i class="iconfont icon-fanhui mr10" />报名审核
      </div>
    </section>
    <!--报名详情组件-->
    <tenderApplyDetail :signup-id="$route.params.signupId" />
    <!--操作按鈕 auditStatus 00待审核-->
    <div v-if="$route.params.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 :loading="confirmLoading" type="primary" @click="verified()">
            审核通过
          </el-button>
          <el-button :loading="confirmLoading" @click="auditFail()">
            审核不通过
          </el-button>
          <el-button @click="back()">
            返 回
          </el-button>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import { auditSignupInfo } from '@/api/bidding/biddocfee' // 审核
/* 组件*/
import tenderApplyDetail from './../tenderApply/tenderApply-detail'// 报名详情查看
export default {
  name: 'TenderApplyAuditDetail',
  components: {
    tenderApplyDetail
  },

  data() {
    return {
      confirmLoading: false, // 控制按钮重复点击Loding
      // 审核信息参数
      auditInfoParam: {
        auditStatus: '', // 01-审核通过 ||02-审核不通过
        auditNotPassReason: '', // 审核意见
        signupIds: this.$route.params.signupId// 报名Id
      }
    }
  },
  methods: {
    // 返回
    back() {
      this.$router.push({
        path: '/projectManagement/tenderApplyAudit-list'
      })
    },
    // 操作审核通过不通过调用接口
    handleAuditBulletin(auditStatus) {
      this.auditInfoParam.auditStatus = auditStatus
      this.confirmLoading = true// btnLoding
      auditSignupInfo(this.auditInfoParam).then(reponse => {
        this.$message({
          type: 'success',
          message: '审核成功'
        })
        this.back()
        this.confirmLoading = false// btnLoding
      }).catch(() => {
        this.confirmLoading = false// btnLoding
      })
    },
    // 审核通过
    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('02')
        }).catch(() => {
        })
      } else {
        this.$message({
          type: 'warning',
          message: '请输入审核意见'
        })
      }
    }
  }
}
</script>

<style lang="less" scoped>

</style>
