<template>
  <div class="rnr-aduit-module">
    <div class="aduit-title-box">
      <div class="aduit-title">
        <span>审核信息</span>
      </div>
      <div v-if="formData.verifyMsg" class="create-box">
        <span style="margin-right: 20px;">审核人员: {{ formData.verifyMsg.currentUserName }}</span>
        <span>审核日期: {{ formData.verifyMsg.currentDate }}</span>
      </div>
    </div>
    <el-form ref="aduitForm" :model="aduitForm" size="small" label-width="70px" label-position="right">
      <el-row :gutter="14">
        <el-col :span="24">
          <el-form-item label="审核意见">
            <el-checkbox-group v-model="aduitForm.reason">
              <el-checkbox label="证件信息不全" name="reason" />
              <el-checkbox label="证件信息不一致" name="reason" />
              <el-checkbox label="查不到证件信息" name="reason" />
              <el-checkbox label="照片格式不正确" name="reason" />
              <el-checkbox label="照片不清晰" name="reason" />
            </el-checkbox-group>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row :gutter="14">
        <el-col :span="24">
          <el-form-item label="其他">
            <el-input
              v-model.trim="aduitForm.remark"
              type="textarea"
              placeholder="其他补充意见"
              :rows="3"
              autocomplete="off"
              maxlength="250"
              show-word-limit
            />
          </el-form-item>
        </el-col>
      </el-row>
      <el-row :gutter="14">
        <el-col :span="24">
          <el-form-item style="text-align: center;">
            <el-button round type="primary" @click="handleConfirm(3)">审核通过</el-button>
            <el-button class="reject-btn" round @click="handleConfirm(4)">审核拒绝</el-button>
          </el-form-item>
        </el-col>
      </el-row>
    </el-form>
  </div>
</template>

<script>
export default {
  name: 'RnrAuditForm',
  props: {
    formData: {
      type: Object,
      default: () => {}
    },
    pageData: {
      type: Object,
      default: () => {}
    }
  },
  data() {
    return {
      auditor: '',
      auditDate: '',
      aduitForm: {
        reason: [],
        remark: ''
      }
    }
  },
  computed: {

  },
  mounted() {
  },
  methods: {
    /**
    *  提交审核
     * COMMIT(0, "已提交 ，待确认"),
     * ASSIGNMENT(1, "待分派/认领"),
     * TO_EXAMINE(2, "待审核"),
     * PASS(3, "审核通过"),
     * NOT_PASS(4, "未通过"),
     * CANCEL(9, "作废");
    * @time 2022-06-13 21:08:28
    */
    handleConfirm(val) {
      if (val === 4) {
        if (this.aduitForm.reason.length <= 0 && this.aduitForm.remark === '') {
          this.$message.error('审核拒绝需填写意见')
          return false
        }
      }
      const content = this.aduitForm.reason.join(', ')
      let otherComments = ''
      if (this.aduitForm.remark !== '') {
        otherComments = this.aduitForm.remark
      }
      const formData = {
        userId: '',
        userName: '',
        rnrOrderInfoId: this.pageData.rnrOrderInfoId,
        otherComments: otherComments,
        auditResult: val,
        auditNote: content
      }
      console.log('ok', formData)
      this.$emit('submit-audit-click', formData)
    }
  }
}
</script>

<style lang="scss" scoped>
.rnr-aduit-module{
  border-top: 12px solid #F7F8FA;
  padding: 10px 24px;
  .aduit-title-box{
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    font-weight: 400;
    color: #A5ACB9;
    line-height: 28px;
    margin-bottom: 10px;
  }
  .aduit-title{
    font-size: 16px;
    font-weight: 600;
    color: #3F3F59;
    line-height: 28px;
  }
  .reject-btn{
    color: #2A68FF;
    border-color: #2A68FF;
  }
  }
</style>
