<template>
  <div style="padding: 20px">
    <header
      style="display: flex; justify-content: space-between; align-items: center"
    >
      <h1 style="font-weight: 600; font-size: 20px">{{ $t("会员详情") }}</h1>
      <div>
        <el-button
          type="primary"
          v-has-permi="['member:certificate']"
          @click="guarantee(details)"
          >{{ $t("保函证书") }}</el-button
        >
        <el-button
          type="primary"
          v-has-permi="['member:log']"
          @click="operationLogFn(details)"
          >{{ $t("操作日志") }}</el-button
        >
        <el-button
          type="primary"
          v-has-permi="['member:id-card']"
          @click="identityFn(details, '1')"
          >{{ $t("身份证") }}</el-button
        >
        <el-button
          type="primary"
          v-has-permi="['member:business-license']"
          @click="identityFn(details, '2')"
          >{{ $t("营业执照") }}</el-button
        >
        <el-button
          type="danger"
          v-has-permi="['member:delete']"
          @click="deleteFn(details)"
          >{{ $t("删除") }}</el-button
        >
      </div>
    </header>
    <!--lanbm 2024-05-15 修改信息显示BUG-->
    <el-descriptions :title="$t('基础信息')" :column="4" border>
      <el-descriptions-item :label="$t('会员编号')">{{
        details.id
      }}</el-descriptions-item>
      <el-descriptions-item :label="$t('会员昵称')">{{
        details.nickname
      }}</el-descriptions-item>
      <el-descriptions-item :label="$t('英文名称')">{{
        details.englishName
      }}</el-descriptions-item>
      <el-descriptions-item :label="$t('真实姓名')">{{
        details.identityName || "-"
      }}</el-descriptions-item>
      <el-descriptions-item :label="$t('联系方式')"
        ><span style="margin-right: 10px">+{{ details.areaCode }}</span
        ><span>{{ details.mobile }}</span>
      </el-descriptions-item>
      <el-descriptions-item :label="$t('绑定邮箱')">{{
        details.email
      }}</el-descriptions-item>
      <el-descriptions-item :label="$t('生日')">{{
        details.birthday
      }}</el-descriptions-item>
      <el-descriptions-item :label="$t('性别')"
        >{{
          details.gender === 0 ? "女" : details.gender === 1 ? "男" : "保密"
        }}
      </el-descriptions-item>
      <el-descriptions-item :label="$t('地址')">{{
        details.address
      }}</el-descriptions-item>
      <el-descriptions-item :label="$t('部门')">{{
        details.department
      }}</el-descriptions-item>
      <el-descriptions-item :label="$t('职位')">{{
        details.jobPosition
      }}</el-descriptions-item>
      <el-descriptions-item :label="$t('创建时间')">{{
        details.createTime
      }}</el-descriptions-item>
      <el-descriptions-item :label="$t('上次登录')">{{
        details.loginDate
      }}</el-descriptions-item>
    </el-descriptions>
    <!--lanbm 2024-05-15 修改信息显示BUG-->
    <el-descriptions
      style="margin-top: 20px"
      :title="$t('公司信息')"
      :column="4"
      border
    >
      <el-descriptions-item :label="$t('公司名称')">{{
        details.enterpriseName
      }}</el-descriptions-item>
      <el-descriptions-item :label="$t('公司英文名称')">{{
        details.enterpriseNameEn
      }}</el-descriptions-item>
      <el-descriptions-item :label="$t('档口')">{{
        details.enterpriseStall
      }}</el-descriptions-item>
      <el-descriptions-item :label="$t('品牌')">{{
        details.enterpriseBrand
      }}</el-descriptions-item>
      <el-descriptions-item :label="$t('公司地址')">{{
        details.enterpriseAddress
      }}</el-descriptions-item>
      <el-descriptions-item :label="$t('公司简介')">{{
        details.enterpriseDesc
      }}</el-descriptions-item>
    </el-descriptions>
    <el-descriptions
      style="margin-top: 20px"
      :title="$t('认证信息')"
      :column="4"
      border
    >
      <el-descriptions-item :label="$t('成交')">{{
        details.customerStatus === 3 ? "成交" : "未成交"
      }}</el-descriptions-item>
      <el-descriptions-item :label="$t('认证')">
        <span
          v-if="
            details.identityAuditStatus === 2 &&
            details.enterpriseAuditStatus === 2
          "
          >{{ $t("双认证") }}</span
        >
        <span
          v-else-if="
            details.identityAuditStatus === 2 &&
            details.enterpriseAuditStatus !== 2
          "
          >{{ $t("身份证") }}</span
        >
        <span
          v-else-if="
            details.identityAuditStatus !== 2 &&
            details.enterpriseAuditStatus === 2
          "
          >{{ $t("企业") }}</span
        >
        <span
          v-else-if="
            details.identityAuditStatus !== 2 &&
            details.enterpriseAuditStatus !== 2
          "
          >{{ $t("否") }}</span
        >
      </el-descriptions-item>
      <el-descriptions-item :label="$t('身份证认证状态')">{{
        details.identityAuditStatus !== null
          ? $l(
              getDictDatas(this.DICT_TYPE.AUDIT_STATUS).find(
                (i) => i.value == details.identityAuditStatus
              ),
              "label"
            )
          : ""
      }}</el-descriptions-item>
      <el-descriptions-item :label="$t('营业执照认证状态')">{{
        details.enterpriseAuditStatus !== null
          ? $l(
              getDictDatas(this.DICT_TYPE.AUDIT_STATUS).find(
                (i) => i.value == details.enterpriseAuditStatus
              ),
              "label"
            )
          : ""
      }}</el-descriptions-item>
    </el-descriptions>
    <el-dialog
      title="保函/证书"
      :visible.sync="guaranteeShow"
      :before-close="
        () => {
          guaranteeUrl = '';
          guaranteeShow = false;
        }
      "
      width="50%"
    >
      <el-form>
        <el-form-item :label="$t('保函/证书')">
          <el-row :gutter="20" type="flex" justify="center">
            <el-col :span="12">
              <el-input v-model="guaranteeUrl"></el-input>
            </el-col>
            <el-col :span="4">
              <div style="height: 45px; overflow: hidden">
                <file-upload
                  v-model="guaranteeUrl"
                  :fileType="['png', 'jpg', 'jpeg', 'pdf']"
                  :limit="1"
                  :isShowTip="false"
                ></file-upload>
              </div>
            </el-col>
            <el-col :span="6">
              <div>{{ $t("可上传图片,pdf文档") }}</div>
            </el-col>
          </el-row>
        </el-form-item>
      </el-form>
      <div style="text-align: center">
        <el-button @click="setGuarantee">{{ $t("保 存") }}</el-button>
      </div>
    </el-dialog>
    <el-dialog
      :title="$t('操作日志')"
      :visible.sync="operationLogShow"
      width="50%"
    >
      <el-table :data="operationLogList">
        <el-table-column :label="$t('标题')" prop="title"></el-table-column>
        <el-table-column
          :label="$t('操作内容')"
          prop="content"
        ></el-table-column>
        <el-table-column :label="$t('操作人')" prop="userId">
          <template v-slot="{ row }">
            {{ details.identityName }}
          </template>
        </el-table-column>
        <el-table-column :label="$t('操作时间')">
          <template v-slot:default="scope">
            {{ parseTime(scope.row.createTime) }}
          </template>
        </el-table-column>
        <el-table-column :label="$t('操作ip')" prop="ip"></el-table-column>
      </el-table>
      <pagination
        v-show="totalLog > 0"
        :total="totalLog"
        :page.sync="operationLogFrom.page"
        :limit.sync="operationLogFrom.row"
        @pagination="getOperationLogList"
      />
    </el-dialog>
    <el-dialog :title="$t('认证')" :visible.sync="attestationShow" width="80%">
      <div class="details">
        <el-tabs v-model="activeName" @tab-click="handleClick">
          <el-tab-pane :label="$t('身份证')" name="1">
            <div style="padding: 0 40px; box-sizing: border-box">
              <el-form
                :disabled="[2, 3].includes(IdDetails.status) && modifyIdCard"
                ref="formId"
                label-position="left"
                label-width="100px"
                :rules="rulesId"
                :model="IdDetails"
              >
                <el-form-item :label="$t('姓名')" prop="name">
                  <el-input v-model="IdDetails.name"></el-input>
                </el-form-item>
                <el-form-item :label="$t('证件类型')" prop="cardType">
                  <dict-selector
                    v-model="IdDetails.cardType"
                    :type="DICT_TYPE.CERTIFICATE_TYPE"
                  ></dict-selector>
                </el-form-item>
                <el-form-item :label="$t('证件号码')" prop="cardNumber">
                  <el-input v-model="IdDetails.cardNumber"></el-input>
                </el-form-item>
                <el-form-item :label="$t('证件正面照')" prop="img1">
                  <div>
                    <el-input
                      readonly
                      style="margin-bottom: 20px"
                      v-model="IdDetails.img1"
                    ></el-input>
                    <ImageUpload
                      :isShowTip="false"
                      v-model="IdDetails.img1"
                      :limit="1"
                    ></ImageUpload>
                  </div>
                </el-form-item>
                <el-form-item :label="$t('证件背面照')" prop="img2">
                  <div>
                    <el-input
                      readonly
                      style="margin-bottom: 20px"
                      v-model="IdDetails.img2"
                    ></el-input>
                    <ImageUpload
                      :isShowTip="false"
                      :limit="1"
                      v-model="IdDetails.img2"
                    ></ImageUpload>
                  </div>
                </el-form-item>
                <el-form-item
                  :label="$t('审核状态')"
                  v-if="modifyIdCard && IdDetails.status !== 0"
                >
                  {{
                    getDictDatas(DICT_TYPE.AUDIT_STATUS)[IdDetails.status]
                      ? getDictDatas(DICT_TYPE.AUDIT_STATUS)[IdDetails.status]
                          .label
                      : ""
                  }}
                </el-form-item>
                <el-form-item
                  :label="$t('审核时间')"
                  v-if="[2, 3].includes(IdDetails.status) && modifyIdCard"
                >
                  {{ parseTime(IdDetails.auditTime) }}
                </el-form-item>
                <el-form-item
                  v-if="modifyIdCard && IdDetails.status !== 0"
                  :label="$t('审核备注')"
                >
                  <el-input
                    v-model="IdDetails.auditRemark"
                    :disabled="IdDetails.status === 3"
                    type="textarea"
                  ></el-input>
                </el-form-item>
              </el-form>
              <div
                v-if="IdDetails.status === 1"
                style="text-align: center; margin-top: 20px"
              >
                <el-button type="primary" @click="idCardAuditFn(2)">{{
                  $t("审核通过")
                }}</el-button>
                <el-button type="primary" @click="idCardAuditFn(3)">{{
                  $t("审核不通过")
                }}</el-button>
                <el-button @click="attestationShow = false">{{
                  $t("取 消")
                }}</el-button>
              </div>
              <div
                v-if="IdDetails.status === 2 || IdDetails.status === 3"
                style="text-align: center; margin-top: 20px"
              >
                <el-button
                  type="primary"
                  v-if="modifyIdCard"
                  @click="modifyIdCard = false"
                  >{{ $t("修 改") }}
                </el-button>
                <el-button
                  type="primary"
                  v-else
                  @click="setMemberUserUpdateIdCard"
                  >{{ $t("提交审核") }}</el-button
                >
                <el-button @click="attestationShow = false">{{
                  $t("取 消")
                }}</el-button>
              </div>
              <div
                v-if="IdDetails.status === 0"
                style="text-align: center; margin-top: 20px"
              >
                <el-button type="primary" @click="submitId">{{
                  $t("上 传")
                }}</el-button>
                <el-button @click="attestationShow = false">{{
                  $t("取 消")
                }}</el-button>
              </div>
            </div>
          </el-tab-pane>
          <el-tab-pane :label="$t('营业执照')" name="2">
            <div style="width: 500px; padding: 0 40px; box-sizing: border-box">
              <el-form
                :disabled="
                  modifyLicense && [2, 3].includes(enterpriseFrom.status)
                "
                :rules="rulesEnterprise"
                :model="enterpriseFrom"
                label-position="left"
                ref="formEnter"
                label-width="100px"
              >
                <el-form-item :label="$t('企业名称')" prop="name">
                  <el-input v-model="enterpriseFrom.name"></el-input>
                </el-form-item>
                <el-form-item :label="$t('企业法人')" prop="legalName">
                  <el-input v-model="enterpriseFrom.legalName"></el-input>
                </el-form-item>
                <el-form-item :label="$t('证件号码')" prop="cardNumber">
                  <el-input v-model="enterpriseFrom.cardNumber"></el-input>
                </el-form-item>
                <el-form-item :label="$t('证件照')" prop="img1">
                  <div>
                    <el-input
                      readonly
                      style="margin-bottom: 20px"
                      v-model="enterpriseFrom.img1"
                    ></el-input>
                    <ImageUpload
                      :isShowTip="false"
                      :limit="1"
                      v-model="enterpriseFrom.img1"
                    ></ImageUpload>
                  </div>
                </el-form-item>
                <el-form-item :label="$t('附件')">
                  <el-input readonly v-model="enterpriseFrom.img2"></el-input>
                  <ImageUpload
                    :isShowTip="false"
                    :limit="1"
                    v-model="enterpriseFrom.img2"
                  ></ImageUpload>
                </el-form-item>
                <el-form-item
                  v-if="modifyLicense && enterpriseFrom.status !== 0"
                  :label="$t('审核状态')"
                >
                  {{
                    getDictDatas(DICT_TYPE.AUDIT_STATUS)[enterpriseFrom.status]
                      .label
                  }}
                </el-form-item>
                <el-form-item
                  v-if="[2, 3].includes(enterpriseFrom.status) && modifyLicense"
                  :label="$t('审核时间')"
                >
                  {{ parseTime(enterpriseFrom.auditTime) }}
                </el-form-item>
                <el-form-item
                  v-if="modifyLicense && enterpriseFrom.status !== 0"
                  :label="$t('审核备注')"
                >
                  <el-input
                    v-model="enterpriseFrom.auditRemark"
                    :disabled="enterpriseFrom.status === 3"
                    type="textarea"
                  ></el-input>
                </el-form-item>
              </el-form>
              <div
                v-if="enterpriseFrom.status === 1"
                style="text-align: center; margin-top: 20px"
              >
                <el-button
                  type="primary"
                  @click="certificateVerificationFn(2)"
                  >{{ $t("审核通过") }}</el-button
                >
                <el-button
                  type="primary"
                  @click="certificateVerificationFn(3)"
                  >{{ $t("审核不通过") }}</el-button
                >
                <el-button @click="attestationShow = false">{{
                  $t("取 消")
                }}</el-button>
              </div>
              <div
                v-if="
                  enterpriseFrom.status === 2 || enterpriseFrom.status === 3
                "
                style="text-align: center; margin-top: 20px"
              >
                <el-button
                  type="primary"
                  v-if="modifyLicense"
                  @click="modifyLicense = false"
                  >{{ $t("修 改") }}
                </el-button>
                <el-button
                  type="primary"
                  v-else
                  @click="setMemberUserUpdateEnterprise"
                  >{{ $t("提交审核") }}</el-button
                >
                <el-button @click="attestationShow = false">{{
                  $t("取 消")
                }}</el-button>
              </div>
              <div
                v-if="enterpriseFrom.status === 0"
                style="text-align: center; margin-top: 20px"
              >
                <el-button type="primary" @click="submit">{{
                  $t("上 传")
                }}</el-button>
                <el-button @click="attestationShow = false">{{
                  $t("取 消")
                }}</el-button>
              </div>
            </div>
          </el-tab-pane>
        </el-tabs>
      </div>
    </el-dialog>
  </div>
</template>
<script>
import {
  createAuditIdCard,
  deleteUser,
  memberGetAuthEnterpriseInfo,
  memberGetAuthIdcardInfo,
  memberUserAuditEnterprise,
  memberUserAuditIdCard,
  memberUserGet,
  memberUserUpdateEnterprise,
  memberUserUpdateIdCard,
  operationLogApi,
  seTupdateBackletter,
  userCreateAuditEnterprise,
} from "@/api/member/user";
import FileUpload from "@/components/FileUpload/index.vue";
import ImageUpload from "@/components/ImageUpload/index.vue";
import { DICT_TYPE, getDictDatas } from "@/utils/dict";

export default {
  name: "memberDetails",
  components: { ImageUpload, FileUpload },
  data() {
    return {
      // 表单校验
      rulesId: {
        name: [
          {
            required: true,
            message: this.$t("用户昵称不能为空"),
            trigger: "blur",
          },
        ],
        cardType: [
          {
            required: true,
            message: this.$t("证件类型不能为空"),
            trigger: "blur",
          },
        ],
        cardNumber: [
          {
            required: true,
            message: this.$t("证件号码不能为空"),
            trigger: "blur",
          },
        ],
        img1: [
          {
            required: true,
            message: this.$t("身份正面照不能为空"),
            trigger: ["blur", "change"],
          },
        ],
        img2: [
          {
            required: true,
            message: this.$t("身份正面照不能为空"),
            trigger: ["blur", "change"],
          },
        ],
      },
      rulesEnterprise: {
        name: [
          {
            required: true,
            message: this.$t("企业名称不能为空"),
            trigger: "blur",
          },
        ],
        legalName: [
          {
            required: true,
            message: this.$t("企业法人不能为空"),
            trigger: "blur",
          },
        ],
        cardNumber: [
          {
            required: true,
            message: this.$t("证件号码不能为空"),
            trigger: "blur",
          },
        ],
        img1: [
          {
            required: true,
            message: this.$t("证件照不能为空"),
            trigger: ["blur", "change"],
          },
        ],
      },
      getDictDatas,
      DICT_TYPE,
      details: {
        address: "",
        areaCode: "",
        avatar: "",
        backLetterImg: "",
        birthday: "",
        createTime: "",
        customerStatus: "",
        department: "",
        email: "",
        englishName: "",
        enterpriseAddress: "",
        enterpriseAuditCreateTime: "",
        enterpriseAuditRemark: "",
        enterpriseAuditStatus: "",
        enterpriseAuditTime: "",
        enterpriseBrand: "",
        enterpriseDesc: "",
        enterpriseName: "",
        enterpriseNameEn: "",
        enterpriseStall: "",
        enterpriseWebsite: "",
        gender: "",
        groupCount: "",
        id: "",
        identityAuditCreateTime: "",
        identityAuditRemark: "",
        identityAuditStatus: "",
        identityAuditTime: "",
        identityName: "",
        isDeal: "",
        isSimplePassword: "",
        jobPosition: "",
        loginDate: "",
        loginIp: "",
        mobile: "",
        nickname: "",
        password: "",
        registDate: "",
        registerIp: "",
        status: "",
      },
      publicObj: {},
      guaranteeShow: false,
      guaranteeUrl: "",
      operationLogFrom: {
        page: 1,
        row: 10,
        userId: undefined,
      },
      attestationShow: false,
      modifyLicense: false,
      modifyIdCard: true, //修改身份证
      IdDetails: {},
      enterpriseFrom: {},
      operationLogShow: false,
      activeName: "1",
      operationLogList: [],
      totalLog: 0,
    };
  },
  created() {
    this.getDetails();
  },
  methods: {
    deleteFn(row) {
      const nickname = row.nickname;
      this.$modal
        .confirm(
          `${this.$t("是否确认删除昵称为{nickname}的会员?", { nickname })}`
        )
        .then(function () {
          return deleteUser(row.id);
        })
        .then((res) => {
          this.$message.success(this.$t("删除成功"));
          this.$router.back();
        })
        .catch(() => {
          // this.$message.success(this.$t('删除失败'))
        });
    },
    getDetails() {
      memberUserGet({ id: this.$route.params.id }).then((r) => {
        console.log(r, "rrrr");
        this.details = r.data;
      });
    },
    // 保函证书
    guarantee(row) {
      this.publicObj = row;
      this.guaranteeShow = true;
      this.guaranteeUrl = row.backLetterImg;
    },
    // 操作日志
    operationLogFn(row) {
      this.publicObj = row;
      this.operationLogFrom.page = 1;
      this.operationLogFrom.userId = row.id;
      this.operationLogShow = true;
      this.operationLogList = [];
      this.getOperationLogList();
    },
    getOperationLogList() {
      operationLogApi(this.operationLogFrom).then((r) => {
        if (r.code === 0) {
          this.operationLogList = r.data.list;
          this.totalLog = r.data.total;
        }
      });
    },
    identityFn(row, val) {
      this.attestationShow = true;
      this.activeName = val;
      this.publicObj = row;
      if (val == 1) {
        this.getIdentityDetails();
      } else {
        this.getEnterpriseFn();
      }
    },
    handleClick(val) {
      if (val.name == 1) {
        this.getIdentityDetails();
      } else {
        this.getEnterpriseFn();
      }
    },
    getIdentityDetails() {
      this.resetId();
      memberGetAuthIdcardInfo({ userId: this.publicObj.id }).then((r) => {
        if (r.code === 0 && !!r.data) {
          this.IdDetails = r.data;
        }
      });
    },
    getEnterpriseFn() {
      this.resetEnterprise();
      memberGetAuthEnterpriseInfo({ userId: this.publicObj.id }).then((r) => {
        if (r.code === 0 && !!r.data) {
          this.enterpriseFrom = r.data;
        }
      });
    },
    //身份证审核
    idCardAuditFn(val) {
      let p = {
        auditStatus: val,
        userCardAuthId: this.IdDetails.id,
        auditRemark: this.IdDetails.auditRemark,
      };
      memberUserAuditIdCard(p).then((r) => {
        if (r.code === 0) {
          this.$message.success(this.$t("修改成功"));
          this.getList();
          this.getIdentityDetails();
        }
      });
    },
    //  企业证书审核
    certificateVerificationFn(val) {
      let p = {
        auditStatus: val,
        userEnterpriseAuthId: this.enterpriseFrom.id,
        auditRemark: this.enterpriseFrom.auditRemark,
      };
      memberUserAuditEnterprise(p).then((r) => {
        if (r.code === 0) {
          this.getList();
          this.getEnterpriseFn();
        }
      });
    },
    setMemberUserUpdateIdCard() {
      this.$refs.formId.validate(async (valid) => {
        if (valid) {
          let p = {
            cardNumber: this.IdDetails.cardNumber,
            cardType: this.IdDetails.cardType,
            img1: this.IdDetails.img1,
            img2: this.IdDetails.img2,
            name: this.IdDetails.name,
            userCardAuthId: this.IdDetails.id,
            auditPass: true,
          };
          memberUserUpdateIdCard(p).then((r) => {
            if (r.code === 0) {
              this.$message.success(this.$t("修改成功"));
              if (p.auditPass === true) {
                this.getIdentityDetails();
              }
              this.getList();
              this.modifyIdCard = true;
            }
          });
        }
      });
    },
    setMemberUserUpdateEnterprise() {
      this.$refs.formEnter.validate(async (valid) => {
        if (valid) {
          let p = {
            cardNumber: this.enterpriseFrom.cardNumber,
            img1: this.enterpriseFrom.img1,
            img2: this.enterpriseFrom.img2,
            legalName: this.enterpriseFrom.legalName,
            name: this.enterpriseFrom.name,
            userEnterpriseAuthId: this.enterpriseFrom.id,
            auditPass: true,
          };
          memberUserUpdateEnterprise(p).then((r) => {
            if (r.code === 0) {
              if (p.auditPass === true) {
                this.getEnterpriseFn();
              }
              this.getList();
              this.modifyLicense = true;
              this.$message.success(this.$t("修改成功"));
            }
          });
        }
      });
    },
    submit() {
      let p = {
        cardNumber: this.enterpriseFrom.cardNumber,
        img1: this.enterpriseFrom.img1,
        img2: this.enterpriseFrom.img2,
        legalName: this.enterpriseFrom.legalName,
        name: this.enterpriseFrom.name,
        userEnterpriseAuthId: this.enterpriseFrom.id,
        userId: this.publicObj.id,
      };
      userCreateAuditEnterprise(p).then((r) => {
        if (r.code === 0) {
          this.$message.success(this.$t("添加成功!"));
          this.enterpriseFrom.status = 2;
          this.enterpriseFrom.auditTime = new Date().getTime();
          this.getEnterpriseFn();
          this.getList();
        }
      });
    },
    submitId() {
      this.$refs.formId.validate(async (valid) => {
        if (valid) {
          let p = {
            cardNumber: this.IdDetails.cardNumber,
            cardType: this.IdDetails.cardType,
            img1: this.IdDetails.img1,
            img2: this.IdDetails.img2,
            name: this.IdDetails.name,
            status: 2,
            userId: this.publicObj.id,
          };
          createAuditIdCard(p).then((r) => {
            if (r.code === 0) {
              this.$message.success(this.$t("添加成功!"));
              this.IdDetails.status = 2;
              this.IdDetails.auditTime = new Date().getTime();
              this.getIdentityDetails();
              this.getList();
            }
          });
        }
      });
    },
    /** 表单重置 */
    resetId() {
      this.IdDetails = {
        auditRemark: undefined,
        auditTime: undefined,
        cardNumber: undefined,
        cardType: undefined,
        createTime: undefined,
        id: 0,
        img1: undefined,
        img2: undefined,
        name: "",
        status: 0,
        userId: 0,
      };
    }, //清空身份证
    resetEnterprise() {
      this.enterpriseFrom = {
        auditRemark: undefined,
        auditTime: undefined,
        cardNumber: undefined,
        createTime: undefined,
        id: undefined,
        img1: undefined,
        img2: undefined,
        legalName: undefined,
        name: undefined,
        status: 0,
        userId: undefined,
      };
    }, //清空企业
    setGuarantee() {
      seTupdateBackletter({
        userId: this.publicObj.id,
        backLetter: this.guaranteeUrl,
      }).then((r) => {
        if (r.code === 0) {
          this.publicObj.backLetterImg = this.guaranteeUrl;
          this.guaranteeShow = false;
          this.$message.success(this.$t("保存成功"));
        }
      });
    },
  },
};
</script>
<style scoped lang="scss">
</style>
