<template>
  <div
    style="width: 100%; background: #fff; min-height: 700px"
    class="userCenterAuthenticationPersonal"
  >

    <div
      style="
        height: 80px;
        line-height: 80px;
        margin-top: 20px;
        margin: 0 20px;
        color: #666;
        font-size: 15px;
        border-bottom: 1px solid #bcbcbc;
      "
    >
      {{ $t("common.realAuthentication") }}({{
        this.realnameStatus[this.realnameAuthenticationUnit]
      }})
      <!-- <span style="float: right;margin-top: 27px;"> <i class="el-icon-edit"></i> 修改</span> -->
    </div>
    <div
      style="margin: 0 20px; margin-top: 0px"
      v-if="realnameAuthenticationUnit == '0'"
    >
      <el-collapse v-model="activeNames" accordion>
        <!-- 申请单位基本信息 -->
        <el-collapse-item name="1" v-if="active == 1">
          <template slot="title">
            <span style="color: red; margin-right: 3px">* </span
            >{{ $t("common.Unit Basic Information") }}
          </template>
          <el-form
            ref="form1"
            :model="form1"
            :rules="form1Rules"
            label-width="260px"
            class="demo-ruleForm"
            style="margin-top: 20px; width: 1000px"
          >
            <el-form-item
              :label="$t('common.NameOfEnterprise')"
              prop="unitName"
            >
              <el-input
                :placeholder="$t('common.NameOfEnterprisePlaceholder')"
                v-model="form1.unitName"
                style="width: 70%"
                maxlength="20"
                show-word-limit
              ></el-input>
            </el-form-item>
            <el-form-item :label="$t('common.Continent')">
              <el-select
                :placeholder="$t('common.ContinentPlaceholder')"
                v-model="form1.areDict"
                style="width: 70%"
              >
                <el-option
                  v-for="item in areDicts"
                  :label="item.label"
                  :value="item.value"
                ></el-option>
              </el-select>
            </el-form-item>
            <el-form-item :label="$t('common.UCountry')">
              <el-select
                :placeholder="$t('common.UCountryPlaceholder')"
                v-model="form1.unitCountryDict"
                style="width: 70%"
              >
                <el-option
                  v-for="item in unitCountryDicts"
                  :label="item.label"
                  :value="item.value"
                ></el-option>
              </el-select>
            </el-form-item>
            <el-form-item :label="$t('common.UnitRegion')">
              <el-input
                :placeholder="$t('common.UnitRegionPlaceholder')"
                v-model="form1.unitRegion"
                style="width: 70%"
                maxlength="10"
                show-word-limit
              ></el-input>
            </el-form-item>
            <!-- <el-select placeholder="请选择城市" v-model="form.unitRegion"  style="width: 70%;">
                                     <el-option v-for="item in userIdCardTypes" :label="item.label" :value="item.value"></el-option>
                                 </el-select>-->
            <el-form-item :label="$t('common.UnitAddress')">
              <el-input
                :placeholder="$t('common.UnitAddressPlaceholder')"
                v-model="form1.unitAddress"
                style="width: 70%"
                maxlength="30"
                show-word-limit
              ></el-input>
            </el-form-item>
            <el-form-item :label="$t('common.UIndustry')">
              <el-select
                :placeholder="$t('common.UIndustryPlaceholder')"
                v-model="form1.industryDict"
                style="width: 70%"
              >
                <el-option
                  v-for="item in industryDicts"
                  :label="item.label"
                  :value="item.value"
                ></el-option>
              </el-select>
            </el-form-item>
            <el-form-item :label="$t('common.Nature')">
              <el-select
                :placeholder="$t('common.NaturePlaceholder')"
                v-model="form1.enterprisePropertyDict"
                style="width: 70%"
              >
                <el-option
                  v-for="item in propDicts"
                  :label="item.label"
                  :value="item.value"
                ></el-option>
              </el-select>
            </el-form-item>
            <el-form-item :label="$t('common.EstablishmentTime')">
              <el-date-picker
                v-model="form1.setUpDate"
                type="date"
                style="width: 70%"
                :placeholder="$t('common.SelectDate')"
              >
              </el-date-picker>
            </el-form-item>
            <el-form-item :label="$t('common.UcorporateName')">
              <el-input
                :placeholder="$t('common.UcorporateNamePlaceholder')"
                v-model="form1.corporateName"
                style="width: 70%"
                maxlength="10"
                show-word-limit
              ></el-input>
            </el-form-item>
            <el-form-item
              :label="$t('common.UcorporateIdCard')"
              prop="corporateIdCard"
            >
              <el-input
                :placeholder="$t('common.UcorporateIdCardPlaceholder')"
                v-model="form1.corporateIdCard"
                style="width: 70%"
                maxlength="18"
                show-word-limit
              ></el-input>
            </el-form-item>
            <el-form-item :label="$t('common.UcorporateDuty')">
              <el-input
                :placeholder="$t('common.UcorporateDutyPlaceholder')"
                v-model="form1.corporateDuty"
                style="width: 70%"
                maxlength="10"
                show-word-limit
              ></el-input>
            </el-form-item>
            <el-form-item :label="$t('common.RegisteredCapital')">
              <el-input
                :placeholder="$t('common.RegisteredCapitalPlaceholder')"
                v-model="form1.registerMoney"
                style="width: 70%"
                maxlength="10"
                show-word-limit
              ></el-input>
            </el-form-item>
            <el-form-item :label="$t('common.UnitIntrodution')">
              <el-input
                :placeholder="$t('common.UnitIntrodutionPlaceholder')"
                v-model="form1.unitIntrodution"
                style="width: 70%"
                maxlength="30"
                show-word-limit
              ></el-input>
            </el-form-item>
            <el-form-item :label="$t('common.Website')">
              <el-input
                :placeholder="$t('common.WebsitePlaceholder')"
                v-model="form1.officialWebsitePath"
                style="width: 70%"
                maxlength="50"
                show-word-limit
              ></el-input>
            </el-form-item>
            <el-form-item :label="$t('common.UnitLabel')">
              <el-input
                :placeholder="$t('common.UnitLabelPlaceholder')"
                v-model="form1.unitLabel"
                style="width: 70%"
                maxlength="50"
                show-word-limit
              ></el-input>
            </el-form-item>
            <!--<el-form-item label="项目标签:" prop='name'>
                            <el-button type="success" plain @click="dialogVisibles()">选择标签</el-button>
                        </el-form-item>-->
            <el-form-item :label="$t('common.Logo')" style="position: relative">
              <el-upload
                class="avatar-uploader"
                action="/api/file/upload/img?module=authenticationUnit"
                :show-file-list="false"
                :on-success="photoSuccess"
                :headers="myHeaders"
                :before-upload="beforeAvatarUpload1"
              >
                <img
                  v-if="form1.photo"
                  :src="'/api/file/pub/' + form1.photo"
                  class="avatar"
                />
                <i v-else class="el-icon-plus avatar-uploader-icon"></i>
              </el-upload>
            </el-form-item>
          </el-form>
        </el-collapse-item>
        <!-- 认证信息 -->
        <el-collapse-item name="2" v-if="active == 1">
          <template slot="title">
            <span style="color: red; margin-right: 3px">* </span
            >{{ $t("common.Authentication Information") }}
          </template>
          <el-form
            ref="form2"
            :model="form2"
            :rules="form2Rules"
            label-width="150px"
            class="demo-ruleForm form2Sty"
          >
            <el-form-item :label="$t('common.UScope')">
              <el-input
                :placeholder="$t('common.BusinessTermPlaceholder')"
                v-model="form2.unitScope"
                style="width: 70%"
                maxlength="10"
                show-word-limit
              >
              </el-input>
            </el-form-item>
            <el-form-item
              prop="businessLicenseRegistrationNumber"
              :label="$t('common.businessLicenseRegistrationNumber')"
            >
              <el-input
                :placeholder="$t('common.businessNumberPlaceholder')"
                v-model="form2.businessLicenseRegistrationNumber"
                style="width: 70%"
                maxlength="20"
                show-word-limit
              ></el-input>
            </el-form-item>
            <el-form-item :label="$t('common.BusinessTerm')">
              <el-date-picker
                v-model="form2.businessTermStartTime"
                type="date"
                style="width: 30%"
                :placeholder="$t('common.startTimePlaceholder')"
              ></el-date-picker>
              -
              <el-date-picker
                v-model="form2.businessTermEndTime"
                type="date"
                style="width: 30%"
                :placeholder="$t('common.endTimePlaceholder')"
              ></el-date-picker>
            </el-form-item>
            <el-form-item :label="$t('common.OrganizationCodeNum')">
              <el-input
                :placeholder="$t('common.OrganizationCodeNumPlaceholder')"
                v-model="form2.organizationCodeCertificateNo"
                style="width: 70%"
                maxlength="20"
                show-word-limit
              ></el-input>
            </el-form-item>
            <el-form-item
              :label="$t('common.businessLicensePhoto')"
              style="position: relative"
              prop="businessLicensePhoto"
            >
              <el-upload
                class="avatar-uploader"
                action="/api/file/upload/img?module=authenticationUnit"
                :show-file-list="false"
                :on-success="businessLicenseSuccess"
                :headers="myHeaders"
                :before-upload="beforeAvatarUpload2"
              >
                <img
                  v-if="form2.businessLicensePhoto"
                  :src="'/api/file/pub/' + form2.businessLicensePhoto"
                  class="avatar"
                />
                <i v-else class="el-icon-plus avatar-uploader-icon"></i>
              </el-upload>
              <div
                style="
                  position: absolute;
                  left: 230px;
                  top: 0;
                  font-size: 12px;
                  color: #666;
                  line-height: 22px;
                "
              >
                <span style="color: #ff8400">{{ $t("common.remark1") }}</span>
                {{ $t("common.remark2") }}
              </div>
            </el-form-item>
            <el-form-item
              :label="$t('common.organizationCodePhoto')"
              style="position: relative"
              prop="organizationCodePhoto"
            >
              <el-upload
                class="avatar-uploader"
                action="/api/file/upload/img?module=authenticationUnit"
                :show-file-list="false"
                :on-success="organizationCodeSuccess"
                :headers="myHeaders"
                :before-upload="beforeAvatarUpload3"
              >
                <img
                  v-if="form2.organizationCodePhoto"
                  :src="'/api/file/pub/' + form2.organizationCodePhoto"
                  class="avatar"
                />
                <i v-else class="el-icon-plus avatar-uploader-icon"></i>
              </el-upload>
              <!--<div style="position: absolute;left: 230px;top: 0;font-size: 12px;color: #666;line-height: 22px;">
                                <span style="color: #ff8400;">证件要求：</span>
                                必须为清晰、完整的彩色原件扫描件或数码照
                                仅支持.jpg .bmp .png .gif的图片格式，图片大小不超过4M
                                必须在有效期内且年检章齐全（当年成立的公司可无年检章）
                                必须为中国大陆工商局颁发
                            </div>-->
            </el-form-item>
          </el-form>
        </el-collapse-item>
        <!-- 联系人基本信息 -->
        <el-collapse-item name="3" v-if="active == 1">
          <template slot="title">
            <span style="color: red; margin-right: 3px">* </span
            >{{ $t("common.Contact Information") }}
          </template>
          <el-form
            ref="form3"
            :model="form3"
            :rules="form3Rules"
            label-width="260px"
            class="demo-ruleForm"
            style="margin-top: 20px; width: 1000px"
          >
            <el-form-item :label="$t('common.ContactsName')">
              <el-input
                :placeholder="$t('common.ContactsNamePlaceholder')"
                v-model="form3.linkName"
                style="width: 70%"
                maxlength="10"
                show-word-limit
              ></el-input>
            </el-form-item>
            <el-form-item
              :label="$t('common.ContactsPhone')"
              prop="linkPhoneNumber"
            >
              <el-input
                :placeholder="$t('common.ContactsPhonePlaceholder')"
                v-model="form3.linkPhoneNumber"
                style="width: 70%"
                maxlength="11"
                show-word-limit
              ></el-input>
            </el-form-item>
          </el-form>
        </el-collapse-item>
      </el-collapse>
    </div>
    <div
      v-if="realnameAuthenticationUnit == '1'"
      style="margin-top: 122px; margin-left: 273px; height: 200px"
    >
      <img
        src="@/assets/img/userCenter/u55899.png"
        alt=""
        style="vertical-align: top; float: left"
      />
      <span
        style="float: left; margin-top: 40px; line-height: 30px; color: #666"
      >
        <div style="font-size: 18px; font-weight: 700">
          {{ $t("common.authenticationYes") }}
        </div>
        <div>{{ $t("common.NameOfEnterprise") }}：{{ name }}</div>
        <div>
          {{ $t("common.businessLicenseRegistrationNumber") }}：{{ number }}
        </div>
      </span>
    </div>
    <div
      v-if="realnameAuthenticationUnit == '2'"
      style="margin-top: 122px; margin-left: 273px; height: 200px"
    >
      <img
        src="@/assets/img/userCenter/u55899.png"
        alt=""
        style="vertical-align: top; float: left"
      />
      <span
        style="float: left; margin-top: 40px; line-height: 30px; color: #666"
      >
        <div style="font-size: 18px; font-weight: 700">
          {{ $t("common.underReview") }}
        </div>
      </span>
    </div>
    <div
      v-if="realnameAuthenticationUnit == '3'"
      style="margin-top: 122px; margin-left: 273px; height: 200px"
    >
      <img
        src="@/assets/img/userCenter/u55899.png"
        alt=""
        style="vertical-align: top; float: left"
      />
      <span
        style="float: left; margin-top: 40px; line-height: 30px; color: #666"
      >
        <div style="font-size: 18px; font-weight: 700">
          {{ $t("common.auditFailed") }}：{{
            this.unitAuthenticationInfo.realnameValidatedProposal
          }}
        </div>
      </span>
    </div>
    <div style="height: 200px">
      <div style="margin-top: 100px">
        <el-button
          type="warning"
          style="margin-left: 300px"
          @click="goAithentication"
          v-if="realnameAuthenticationUnit == '0'"
          >{{ $t("common.back") }}</el-button
        >
        <el-button
          type="warning"
          style="margin-left: 400px"
          @click="goAithentication2"
          v-if="realnameAuthenticationUnit == '3'"
          >{{ $t("common.modifyAuthentication") }}</el-button
        >
        <el-button
          type="primary"
          style="margin-left: 30px"
          @click="submitAithentication"
          v-if="realnameAuthenticationUnit == '0'"
          >{{ $t("common.submitAuthentication") }}</el-button
        >
      </div>
    </div>
    <div v-if="dialogVisible2">
      <userCenterAddTag
        v-bind:systemLabel="systemLabel"
        :mergeSelectedLabels="mergeSelectedLabels"
        @closeMain="closeMain"
      ></userCenterAddTag>
    </div>
  </div>
</template>
<script>
import { getDicts } from "@/api/dict";
import Base from "@/views/base/Base";
import ue from "@/components/ue";
import userCenterAddTag from "./userCenterAddTag";
import { formatDate } from "@/utils/formatUtils";
import {
  saveOrUpdate,
  getUnitAuthenticationStatus,
} from "@/api/userCenter/authenticationUnit";
import { getToken } from "@/utils/auth";
import { addIntegral } from "@/utils/toCompleteTask";
export default {
  name: "userCenterAuthenticationEnterprise",
  extends: Base,
  components: {
    ue,
    userCenterAddTag,
  },
  data() {
    return {
      active: 1,
      activeNames: ["1"],
      dialogVisible: false,
      dialogVisible2: false,
      realnameAuthenticationUnit: "",
      title: "",
      selectedOptions: [],
      unitCountryDicts: [],
      unitCityDicts: [],
      industryDicts: [],
      areDicts: [],
      statusDicts: [],
      propDicts: [],
      unitAuthenticationInfo: [],
      myHeaders: { Authorization: "Bearer " + getToken() },
      name: "",
      number: "",
      systemLabel: [
        {
          label: "标签一",
          type: "",
        },
        {
          label: "标签二",
          type: "",
        },
      ],
      mergeSelectedLabels: [],
      form1: {
        unitName: "",
        unitCode: "",
        registerMoney: "",
        unitCountry: "",
        unitCountryDict: "",
        unitProvince: "",
        unitProvinceDict: "",
        unitCity: "",
        unitCityDict: "",
        unitRegion: "",
        setUpDate: "",
        corporateName: "",
        corporateIdCard: "",
        corporateDuty: "",
        officialWebsitePath: "",
        unitAddress: "",
        dynamic: "",
        dynamicDict: "",
        unitsSystem: "",
        unitsSystemDict: "",
        councilMembers: "",
        councilMembersDict: "",
        are: "",
        industry: "",
        industryDict: "",
        areDict: "",
        unitLabel: "",
        unitIntrodution: "",
        status: "",
        statusDict: "",
        language: "",
        enterpriseProperty: "",
        photo: "",
        enterprisePropertyDict: "",
      },
      form2: {
        unitScope: "",
        businessLicenseRegistrationNumber: "",
        // businessTerm: '',
        businessTermStartTime: "",
        businessTermEndTime: "",
        organizationCodeCertificateNo: "",
        businessLicensePhoto: "",
        organizationCodePhoto: "",
      },
      form3: {
        linkName: "",
        linkPhoneNumber: "",
      },
      realnameStatus: {
        0: this.$t("common.NotCertified"),
        1: this.$t("common.Certified"),
        2: this.$t("common.UnderReview"),
        3: this.$t("common.Failed"),
      },
      user: {
        umsUser: {},
      },
    };
  },
  watch: {
    "$i18n.locale"() {
      this.initData();
      // this.$refs.form.clearValidate();
      this.realnameStatus = {
        0: this.$t("common.NotCertified"),
        1: this.$t("common.Certified"),
        2: this.$t("common.UnderReview"),
        3: this.$t("common.Failed"),
      };
    },
  },
  mounted() {
    this.initData();
  },
  computed: {
    unitCountryDictMap: function () {
      return this.unitCountryDicts.array2Obj("value", "label");
    },
    industryDictMap: function () {
      return this.industryDicts.array2Obj("value", "label");
    },
    areDictMap: function () {
      return this.areDicts.array2Obj("value", "label");
    },
    propDictMap: function () {
      return this.propDicts.array2Obj("value", "label");
    },
    form1Rules() {
      return {
        unitName: [
          {
            required: true,
            message:
              this.$t("common.PleaseEnter") + "  " + this.$t("common.fullName"),
            trigger: "blur",
          },
        ],
        corporateIdCard: [
          {
            pattern:
              /(^[1-9]\d{5}(18|19|([23]\d))\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$)|(^[1-9]\d{5}\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}$)/,
            message: this.$t("common.PleaseEnterYourLegalIDNumber"),
            trigger: "blur",
          },
        ],
      };
    },
    form2Rules() {
      return {
        businessLicenseRegistrationNumber: [
          {
            required: true,
            message:
              this.$t("common.PleaseEnter") +
              "  " +
              this.$t("common.businessLicenseRegistrationNumber"),
            trigger: "blur",
          },
        ],
        businessLicensePhoto: [
          {
            required: true,
            message:
              this.$t("common.PleaseUpload") +
              "  " +
              this.$t("common.businessLicensePhoto"),
            trigger: "blur",
          },
        ],
        organizationCodePhoto: [
          {
            required: true,
            message:
              this.$t("common.PleaseUpload") +
              "  " +
              this.$t("common.organizationCodePhoto"),
            trigger: "blur",
          },
        ],
      };
    },
    form3Rules() {
      return {
        linkPhoneNumber: [
          {
            pattern:
              /^1(3[0-9]|4[01456879]|5[0-35-9]|6[2567]|7[0-8]|8[0-9]|9[0-35-9])\d{8}$/,
            message: this.$t("common.Pleaseenteravalidmobilephonenumber"),
            trigger: "blur",
          },
        ],
      };
    },
  },
  methods: {
    initData() {
        this.user = JSON.parse(window.localStorage.getItem("user"));
      getUnitAuthenticationStatus()
        .then((result) => {
          var data = result.data;
          if (data == "" || data == undefined) {
            this.realnameAuthenticationUnit = "0";
            return;
          }
          if (data.statusDict == "04") {
            //认证通过
            this.realnameAuthenticationUnit = "1";
            this.number =
              data.businessLicenseRegistrationNumber.substr(0, 2) +
              "****" +
              data.businessLicenseRegistrationNumber.substr(14);
            this.name =
              data.unitName.substr(0, 1) + "***" + data.unitName.substr(3);
          } else if (data.statusDict == "02") {
            this.realnameAuthenticationUnit = "2";
          } else if (data.statusDict == "03") {
            //认证不通过
            this.realnameAuthenticationUnit = "3";
            this.unitAuthenticationInfo = data;
          } else {
            this.realnameAuthenticationUnit = "0";
          }
          window.localStorage.setItem("companyVerifyPassed", data.statusDict);
        })
        .catch((error) => {
          this.$message({
            message: error.msg,
            type: "error",
          });
          this.realnameAuthenticationUnit = "0";
        });
      getDicts(
        this.$i18n.locale.toUpperCase() == "ZH"
          ? "CONTINENT_CODE_DICT,INDUSTRY_DICTS,BUSINESS_APPROVAL_STATUS,UNIT_COUNTRY_DICT,ENT_PROP_DICT"
          : "CONTINENT_CODE_DICT_EN,INDUSTRY_DICTS_EN,BUSINESS_APPROVAL_STATUS_EN,UNIT_COUNTRY_DICT_EN,ENT_PROP_DICT_EN"
      ).then((result) => {
        let data = result.data;
        console.log(data)
        if (data) {
          this.areDicts = result.data[0];
          this.industryDicts = result.data[1];
          this.statusDicts = result.data[2];
          this.unitCountryDicts = result.data[3];
          this.propDicts = result.data[4];
        }
      });
    },
    goAithentication(num) {
      this.$emit("aithentication", 1);
    },
    goAithentication2(num) {
      this.realnameAuthenticationUnit = "0";
      this.form1 = this.unitAuthenticationInfo;
      this.form2.businessLicensePhoto =
        this.unitAuthenticationInfo.businessLicensePhoto;
      this.form2.businessLicenseRegistrationNumber =
        this.unitAuthenticationInfo.businessLicenseRegistrationNumber;
      this.form2.businessTerm = this.unitAuthenticationInfo.businessTerm;
      this.form2.organizationCodeCertificateNo =
        this.unitAuthenticationInfo.organizationCodeCertificateNo;
      this.form2.unitScope = this.unitAuthenticationInfo.unitScope;
      this.form2.organizationCodePhoto =
        this.unitAuthenticationInfo.organizationCodePhoto;
      this.form2.businessTermStartTime =
        this.unitAuthenticationInfo.businessTermStartTime;
      this.form2.businessTermEndTime =
        this.unitAuthenticationInfo.businessTermEndTime;
      this.form3.linkName = this.unitAuthenticationInfo.linkName;
      this.form3.linkName = this.unitAuthenticationInfo.linkName;
      this.form3.linkPhoneNumber = this.unitAuthenticationInfo.linkPhoneNumber;
    },
    handleChange(value) {
      debugger;
      console.log(value);
    },
    photoSuccess(res, file) {
      this.form1.photo = res.data;
    },
    businessLicenseSuccess(res, file) {
      this.form2.businessLicensePhoto = res.data;
    },
    organizationCodeSuccess(res, file) {
      this.form2.organizationCodePhoto = res.data;
    },
    beforeAvatarUpload1(file) {
      const isJPG = file.type === "image/jpeg";
      const isLt2M = file.size / 1024 / 1024 < 2;

      /* if (!isJPG) {
                      this.$message.error('上传头像图片只能是 JPG 格式!');
                      return;
                      }*/
      if (!isLt2M) {
        this.$message.error(this.$t("common.uploadInfo"));
        return;
      }
      // return isJPG && isLt2M;
    },
    beforeAvatarUpload2(file) {
      const isJPG = file.type === "image/jpeg";
      const isLt2M = file.size / 1024 / 1024 < 2;

      /* if (!isJPG) {
                      this.$message.error('上传头像图片只能是 JPG 格式!');
                     return;
                      }*/
      if (!isLt2M) {
        this.$message.error(this.$t("common.uploadInfo"));
        return;
      }
    },
    beforeAvatarUpload3(file) {
      const isJPG = file.type === "image/jpeg";
      const isLt2M = file.size / 1024 / 1024 < 2;
      /* if (!isJPG) {
                      this.$message.error('上传头像图片只能是 JPG 格式!');
                      return;
                      }*/
      if (!isLt2M) {
        this.$message.error(this.$t("common.uploadInfo"));
        return;
      }
      // return isJPG && isLt2M;
    },
    dialogVisibles() {
      this.dialogVisible2 = true;
    },
    closeMain(val) {
      this.mergeSelectedLabels = val;
      console.log(this.mergeSelectedLabels);
      this.dialogVisible2 = false;
    },
    submitAithentication() {
      console.log(this.mergeSelectedLabels);
      this.$refs["form1"].validate((valid1) => {
        if (valid1) {
          if (this.user.umsUser.userUsertypeDict !== "2") {
            addIntegral("point_task_verified_name", "50");
          }
          this.$refs["form2"].validate((valid2) => {
            if (valid2) {
              this.$refs["form3"].validate((valid3) => {
                if (valid3) {
                  this.print();
                } else {
                  this.$notify.error({
                    title: this.$t("common.errorInfo"),
                    message: this.$t("common.Supplementary1"),
                  });
                  this.activeNames = ["3"];
                  return false;
                }
              });
            } else {
              this.$notify.error({
                title: this.$t("common.errorInfo"),
                message: this.$t("common.Supplementary2"),
              });
              this.activeNames = ["2"];
              return false;
            }
          });
        } else {
          this.$notify.error({
            title: this.$t("common.errorInfo"),
            message: this.$t("common.Supplementary3"),
          });
          this.activeNames = ["1"];
          return false;
        }
      });
    },
    print() {
      this.submitHandler((token) => {
        var unitAuthenticationInfo = this.form1;
        unitAuthenticationInfo.setUpDate = this.form1.setUpDate
          ? formatDate(this.form1.setUpDate, "YYYY-MM-DD HH:mm:ss")
          : "";
        unitAuthenticationInfo.businessTermEndTime = this.form2
          .businessTermEndTime
          ? formatDate(this.form2.businessTermEndTime, "YYYY-MM-DD HH:mm:ss")
          : "";
        unitAuthenticationInfo.businessTermStartTime = this.form2
          .businessTermStartTime
          ? formatDate(this.form2.businessTermStartTime, "YYYY-MM-DD HH:mm:ss")
          : "";
        unitAuthenticationInfo.are = this.areDictMap[this.form1.areDict];
        unitAuthenticationInfo.industry =
          this.industryDictMap[this.form1.industryDict];
        unitAuthenticationInfo.unitCountry =
          this.unitCountryDictMap[this.form1.unitCountryDict];
        unitAuthenticationInfo.enterpriseProperty =
          this.propDictMap[this.form1.enterprisePropertyDict];
        unitAuthenticationInfo.statusDict = "02";
        unitAuthenticationInfo.status = "待审核";
        unitAuthenticationInfo.unitScope = this.form2.unitScope;
        unitAuthenticationInfo.businessLicenseRegistrationNumber =
          this.form2.businessLicenseRegistrationNumber;
        unitAuthenticationInfo.organizationCodeCertificateNo =
          this.form2.organizationCodeCertificateNo;
        unitAuthenticationInfo.organizationCodeCertificateNo =
          this.form2.organizationCodeCertificateNo;
        unitAuthenticationInfo.businessLicensePhoto =
          this.form2.businessLicensePhoto;
        unitAuthenticationInfo.organizationCodePhoto =
          this.form2.organizationCodePhoto;
        unitAuthenticationInfo.linkName = this.form3.linkName;
        unitAuthenticationInfo.linkPhoneNumber = this.form3.linkPhoneNumber;
        unitAuthenticationInfo.language = this.$i18n.locale;
        saveOrUpdate(JSON.stringify(unitAuthenticationInfo), token)
          .then((res) => {
            if (res.data != "") {
              this.$message({
                message: this.$t("common.successInfo"),
                type: "success",
              });
              this.realnameAuthenticationUnit = "2";
            }
          })
          .catch((error) => {
            this.$message({
              message: error.msg,
              type: "error",
            });
          });
      });
    },
  },
};
</script>
<style scoped>
.el-button {
  width: 200px;
  height: 45px;
}
.authenticationBox1 {
  margin-left: 35px;
  margin-right: 150px;
  height: 100px;
  border: 1px solid rgba(153, 153, 153, 1);
  border-radius: 10px;
  margin-top: 50px;
  position: relative;
}
.authenticationBox2 {
  margin: 50px 150px 0 35px;
  height: 100px;
  border: 1px solid rgba(153, 153, 153, 1);
  border-radius: 10px;
  position: relative;
}
.authenticationBox1:hover,
.authenticationBox2:hover {
  border: 1px solid #ff8400;
}
.avatar-uploader .el-upload {
  border: 1px dashed #d9d9d9;
  border-radius: 6px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}
.avatar-uploader .el-upload:hover {
  border-color: #409eff;
}
.userCenterAuthenticationPersonal >>> .el-upload {
  border: 1px solid rgba(204, 204, 204, 1);
}
.avatar-uploader-icon {
  font-size: 28px;
  color: #8c939d;
  width: 178px;
  height: 178px;
  line-height: 178px;
  text-align: center;
}
.avatar {
  width: 178px;
  height: 178px;
  display: block;
}
</style>
