<template>
  <el-dialog
    custom-class="party-dialog"
    title="审核详情"
    :visible.sync="dialogVisible"
    width="468px"
    :before-close="handleClose"
  >
    <div class="dialog-content">
      <p class="isNoData" v-if="isNoData">暂无数据</p>
      <el-form
        v-else
        ref="form"
        :model="form"
        label-width="80px"
        label-position="top"
        class="party-form"
      >
        <el-form-item label="审核层级">
          {{ form.level | levelFilter }}
        </el-form-item>
        <el-form-item label="审核时间">
          {{ form.level === "TBCA" ? form.secondTime : form.firstTime }}
        </el-form-item>
        <el-form-item label="审核结果">
          {{ form.status | statusFilter }}
        </el-form-item>
        <el-form-item label="驳回原因" v-if="form.status === 'REFUSED'">
          {{ form.level === "TBCA" ? form.secondRemarks : form.firstRemarks }}
        </el-form-item>
      </el-form>
    </div>
  </el-dialog>
</template>
<script>
export default {
  data() {
    return {
      dialogVisible: false,
      id: "",
      form: {},
      isNoData: false,
    };
  },
  filters: {
    levelFilter(level) {
      switch (level) {
        case "TBCA":
          return "复审";
          break;
        case "TBC":
          return "初审";
          break;
        default:
          return "暂无数据";
          break;
      }
    },
    statusFilter(status) {
      switch (status) {
        case "TBC":
          return "待初审";
          break;
        case "TBCA":
          return "待复审";
          break;
        case "REFUSED":
          return "驳回";
          break;
        case "APPROVED_FINAL":
          return "通过";
          break;
        default:
          return "暂无数据";
          break;
      }
    },
  },
  methods: {
    // 根据id获取获取详情内容
    getDetailById() {
      let _this = this;
      this.$https(
        {
          method: "get",
          url: "audit/getById",
          type: "ACCOUNT",
          authType: this.backToken,
        },
        { id: _this.id }
      )
        .then((res) => {
          if (res.status == 200) {
            if (res.data.resultCode == 200) {
              if (res.data.data) {
                this.isNoData = false;
                this.form = res.data.data;
              } else {
                this.isNoData = true;
                this.form = {};
              }
            } else {
              _this.$message.error(res.data.message);
            }
          } else {
            _this.$message.error(res.data);
          }
        })
        .catch((err) => {
          console.log(err);
        });
    },
    // 弹窗关闭
    handleClose() {
      this.handleReset();
    },
    handleReset() {
      this.dialogVisible = false;
      this.form = {};
    },
  },
};
</script>
<style lang="less" scoped>
</style>    