
<template>
  <div class="user-operation">
    <el-dialog
      :visible="visible"
      :title="`人工审核详情`"
      :close-on-click-modal="false"
      :close-on-press-escape="false"
      class="audit-dialog"
      width="1300px"
      @close="$emit('update:visible', false)"
    >
      <RnrDetail :page-data="data" v-if="visible" @submit-click="handleSubmit" />
    </el-dialog>
  </div>
</template>
<script>
import RnrDetail from './rnr-detail'
export default {
  components: {
    RnrDetail
  },
  props: {
    visible: {
      type: Boolean,
      default: false
    },
    data: {
      type: Object,
      default: () => {}
    }
  },

  data() {
    return {
      isLoading: false
    }
  },
  mounted() {
  },
  methods: {

    /**
     * 点击关闭方法
     */
    handleClose() {
      this.$emit('update:visible', false)
    },

    /**
     * 点击审核方法
     */
    handleSubmit(formData) {
      if (formData.auditResult === 3) {
        this.handleConfirm()
      } else {
        this.handleCancel(formData)
      }
    },
    /**
    * 通过事件3
    * @time 2022-04-26 18:10:55
    */
    handleConfirm() {
      this.$confirm('审核通过操作成功', '提示', {
        confirmButtonText: '确定',
        showCancelButton: false,
        showClose: false,
        closeOnClickModal: false,
        type: 'success'
      }).then(() => {
        this.$emit('update:visible', false)
        this.$emit('refresh')
        console.log('ok')
      })
    },

    /**
    * 拒绝事件4
    * @time 2022-04-26 18:11:11
    */
    handleCancel() {
      this.$confirm('审核拒绝操作成功', '提示', {
        confirmButtonText: '确定',
        showCancelButton: false,
        showClose: false,
        closeOnClickModal: false,
        type: 'success'
      }).then(() => {
        this.$emit('update:visible', false)
        this.$emit('refresh')
        console.log('ok')
      })
    }
  }
}
</script>
<style lang="scss" scoped>
.audit-dialog{
  margin-bottom: 10px;
}
</style>
