<template>
  <h-view class="public-style companyRegister" title="企业用户注册">
    <h-content v-if="status != '成功'">
      <list-item class="reg-content">
        <!-- <div class="repre-type" v-if="faceAuthStatus != 'SUCCESS'">

          <input type="radio" name="agent" v-model="agentType" @change="isAgent" value="Y" />
          代理店


          <input
          style="margin-left:32px"
            type="radio"
            name="agent"
            v-model="agentType"
            @change="isAgent"
            value="N"
          />非代理店
        </div>-->
        <!-- <div class="repre-type" v-if="faceAuthStatus == 'SUCCESS'">
          代理店
          <input type="radio" name="agent" v-model="agentType" @change="isAgent" value="Y" disabled/>
          非代理店
          <input
            type="radio"
            name="agent"
            v-model="agentType"
            @change="isAgent"
            value="N"
            disabled
          />
        </div>-->
        <div class="repre-type" v-if="faceAuthStatus != 'SUCCESS'">
          <span>经办人类型：</span>
          <input
            type="radio"
            name="peopleType"
            v-model="staffType"
            @change="getRadioVal"
            value="组织其他员工"
          />组织其他员工
          <input
            type="radio"
            name="peopleType"
            v-model="staffType"
            @change="getRadioVal"
            value="法定代表人"
          />法定代表人
        </div>
        <div class="repre-type" v-if="faceAuthStatus == 'SUCCESS'">
          <span>经办人类型：</span>
          <input
            type="radio"
            name="peopleType"
            v-model="staffType"
            @change="getRadioVal"
            value="组织其他员工"
            disabled
          />组织其他员工
          <input
            type="radio"
            name="peopleType"
            v-model="staffType"
            @change="getRadioVal"
            value="法定代表人"
            disabled
          />法定代表人
        </div>
        <!-- 法定代表人 -->
        <div v-if="staffType == '法定代表人'">
          <div class="info_list" v-if="orgAuthStatus =='SUCCESS'">
            <div class="list_left" style="width:39%;">
              <img
                src="../../../assets/userRegister/company.png"
                alt
                style="width:16px;height:16px;margin-right:5px;"
              />
              组织机构名称：
            </div>
            <div class="list_right" style="width:61%;">
              <input type="text" class="edit" v-model="organizationName" @blur="goTop()"/>
            </div>
          </div>
          <div class="info_list" v-if="orgAuthStatus !='SUCCESS'">
            <div class="list_left" style="width:39%;">
              <img
                src="../../../assets/userRegister/company.png"
                alt
                style="width:16px;height:16px;margin-right:5px;"
              />
              组织机构名称：
            </div>
            <div class="list_right" style="width:61%;">
              <input type="text" class="edit" v-model="organizationName" readonly/>
            </div>
          </div>
          <div class="info_list" v-if="orgAuthStatus =='SUCCESS'">
            <div class="list_left" style="width:48%;">
              <img
                src="../../../assets/userRegister/idCard.png"
                alt
                style="width:16px;height:16px;margin-right:5px;"
              />
              统一社会信用代码：
            </div>
            <div class="list_right" style="width:52%;">
              <input type="text" class="edit" v-model="socialCode" @blur="goTop()"/>
            </div>
          </div>
          <div class="info_list" v-if="orgAuthStatus !='SUCCESS'">
            <div class="list_left" style="width:48%;">
              <img
                src="../../../assets/userRegister/idCard.png"
                alt
                style="width:16px;height:16px;margin-right:5px;"
              />
              统一社会信用代码：
            </div>
            <div class="list_right" style="width:52%;">
              <input type="text" class="edit" v-model="socialCode" readonly/>
            </div>
          </div>
          <div class="info_list" style="border-bottom:none;">
            <div class="list_left2">请上传营业执照照片</div>
          </div>
          <div class="bus-license">
            <img :src="busLic" alt class="pic" @click="uploadBusLic()"/>
          </div>
          <div class="info_list" v-if="faceAuthStatus =='SUCCESS'">
            <div class="list_left" style="width:43%;">
              <img
                src="../../../assets/userRegister/people.png"
                alt
                style="width:16px;height:16px;margin-right:5px;"
              />
              法定代表人姓名：
            </div>
            <div class="list_right" style="width:57%;">
              <input type="text" class="edit" v-model="legalRepresentativeName" @blur="goTop()"/>
            </div>
          </div>
          <div class="info_list" v-if="faceAuthStatus !='SUCCESS'">
            <div class="list_left" style="width:43%;">
              <img
                src="../../../assets/userRegister/people.png"
                alt
                style="width:16px;height:16px;margin-right:5px;"
              />
              法定代表人姓名：
            </div>
            <div class="list_right" style="width:57%;">
              <input type="text" class="edit" v-model="legalRepresentativeName" readonly/>
            </div>
          </div>
          <div class="info_list" v-if="faceAuthStatus =='SUCCESS'">
            <div class="list_left" style="width:54%;">
              <img
                src="../../../assets/userRegister/idCard.png"
                alt
                style="width:16px;height:16px;margin-right:5px;"
              />
              法定代表人身份证号码：
            </div>
            <div class="list_right" style="width:46%;">
              <input
                type="text"
                class="edit"
                v-model="legalRepresentativeCardNumber"
                @blur="goTop()"
              />
            </div>
          </div>
          <div class="info_list" v-if="faceAuthStatus !='SUCCESS'">
            <div class="list_left" style="width:54%;">
              <img
                src="../../../assets/userRegister/idCard.png"
                alt
                style="width:16px;height:16px;margin-right:5px;"
              />
              法定代表人身份证号码：
            </div>
            <div class="list_right" style="width:46%;">
              <input type="text" class="edit" v-model="legalRepresentativeCardNumber" readonly/>
            </div>
          </div>
          <div class="info_list">
            <div class="list_left" style="width:30%;">
              <img
                src="../../../assets/userRegister/phone.png"
                alt
                style="width:16px;height:16px;margin-right:5px;"
              />
              手机号码：
            </div>
            <div class="list_right" style="width:70%;">
              <input
                type="text"
                class="edit"
                v-model="legalPhoneNumber"
                placeholder="请输入手机号码"
                @blur="goTop()"
              />
            </div>
          </div>

          <div style="margin: 10px 0 0 14px;color:#636363">
            <p>请上传身份证照片</p>
          </div>
          <div style="height:100px;margin-top:30px">
            <div
              style="border:1px solid #b2b2b2;width:140px;height:100px;margin:0 auto;border-radius:5px;position:relative;"
            >
              <img :src="cardUp" alt class="pic" @click="uploadUpImg()"/>
            </div>
          </div>
          <!-- <div style="height:100px;margin-top:30px" v-if="faceAuthStatus =='SUCCESS'">
            <div
              style="border:1px solid #b2b2b2;width:140px;height:100px;margin:0 auto;border-radius:5px;position:relative;"
            >
              <img :src="cardUp" alt class="pic" @click="previewImage(authAttachmentId)" />
            </div>
          </div>-->
          <p style="margin-top:10px;text-align:center;color:#636363">正面</p>
          <button
            style="width: 120px;height: 30px;border-radius: 15px;
            background-color:#09bb07;color: #ffffff;
            cursor: pointer;
            margin: 100px 0 0 -60px;
            position: relative;
            left: 50%;"
            @click="next_step()"
          >下一步</button>
          <p/>
          <button v-if="showStatus== 1"
                  @click="go_forword()"
                  class="next-step"
                  style="margin-top:20px"
          >退出
          </button>
        </div>

        <!-- 组织其他员工 -->
        <div v-if="staffType ==='组织其他员工'">
          <div class="info_list" v-if="faceAuthStatus =='SUCCESS'">
            <div class="list_left" style="width:39%;">
              <img
                src="../../../assets/userRegister/people.png"
                alt
                style="width:16px;height:16px;margin-right:5px;"
              />
              经办人姓名：
            </div>
            <div class="list_right" style="width:61%;">
              <input type="text" class="edit" v-model="jbName" @blur="goTop()"/>
            </div>
          </div>
          <div class="info_list" v-if="faceAuthStatus !='SUCCESS'">
            <div class="list_left" style="width:39%;">
              <img
                src="../../../assets/userRegister/people.png"
                alt
                style="width:16px;height:16px;margin-right:5px;"
              />
              经办人姓名：
            </div>
            <div class="list_right" style="width:61%;">
              <input type="text" class="edit" v-model="jbName" readonly/>
            </div>
          </div>

          <div class="info_list" v-if="faceAuthStatus =='SUCCESS'">
            <div class="list_left" style="width:41%;">
              <img
                src="../../../assets/userRegister/idCard.png"
                alt
                style="width:16px;height:16px;margin-right:5px;"
              />
              经办人身份证号：
            </div>
            <div class="list_right" style="width:59%;">
              <input type="text" class="edit" v-model="jbIdNumber" @blur="goTop()"/>
            </div>
          </div>
          <div class="info_list" v-if="faceAuthStatus !='SUCCESS'">
            <div class="list_left" style="width:41%;">
              <img
                src="../../../assets/userRegister/idCard.png"
                alt
                style="width:16px;height:16px;margin-right:5px;"
              />
              经办人身份证号：
            </div>
            <div class="list_right" style="width:59%;">
              <input type="text" class="edit" v-model="jbIdNumber" readonly/>
            </div>
          </div>
          <div class="info_list">
            <div class="list_left" style="width:30%;">
              <img
                src="../../../assets/userRegister/phone.png"
                alt
                style="width:16px;height:16px;margin-right:5px;"
              />
              手机号码：
            </div>
            <div class="list_right" style="width:70%;">
              <input
                type="text"
                class="edit"
                v-model="jbPhoneNumber"
                @blur="goTop()"
                placeholder="请输入手机号码"
              />
            </div>
          </div>
          <div style="margin: 10px 0 0 14px;color:#636363">
            <p>请上传身份证照片</p>
          </div>
          <div style="height:100px;margin-top:30px">
            <div
              style="border:1px solid #b2b2b2;width:140px;height:100px;margin:0 auto;border-radius:5px;position:relative;"
            >
              <img :src="cardUp1" alt class="pic" @click="uploadUpImg1()"/>
            </div>
          </div>
          <!-- <div style="height:100px;margin-top:30px" v-if="faceAuthStatus =='SUCCESS'">
            <div
              style="border:1px solid #b2b2b2;width:140px;height:100px;margin:0 auto;border-radius:5px;position:relative;"
            >
              <img :src="cardUp1" alt class="pic" @click="previewImage(authAttachmentId)" />
            </div>
          </div>-->
          <p style="margin-top:10px;text-align:center;color:#636363">正面</p>
          <div class="info_list" v-if="orgAuthStatus =='SUCCESS'">
            <div class="list_left" style="width:39%;">
              <img
                src="../../../assets/userRegister/company.png"
                alt
                style="width:16px;height:16px;margin-right:5px;"
              />
              组织机构名称：
            </div>
            <div class="list_right" style="width:61%;">
              <input type="text" class="edit" v-model="organizationName1" @blur="goTop()"/>
            </div>
          </div>
          <div class="info_list" v-if="orgAuthStatus !='SUCCESS'">
            <div class="list_left" style="width:39%;">
              <img
                src="../../../assets/userRegister/company.png"
                alt
                style="width:16px;height:16px;margin-right:5px;"
              />
              组织机构名称：
            </div>
            <div class="list_right" style="width:61%;">
              <input type="text" class="edit" v-model="organizationName1" readonly/>
            </div>
          </div>
          <div class="info_list" v-if="orgAuthStatus =='SUCCESS'">
            <div class="list_left" style="width:48%;">
              <img
                src="../../../assets/userRegister/idCard.png"
                alt
                style="width:16px;height:16px;margin-right:5px;"
              />
              统一社会信用代码：
            </div>
            <div class="list_right" style="width:52%;">
              <input type="text" class="edit" v-model="socialCode1" @blur="goTop()"/>
            </div>
          </div>
          <div class="info_list" v-if="orgAuthStatus !='SUCCESS'">
            <div class="list_left" style="width:48%;">
              <img
                src="../../../assets/userRegister/idCard.png"
                alt
                style="width:16px;height:16px;margin-right:5px;"
              />
              统一社会信用代码：
            </div>
            <div class="list_right" style="width:52%;">
              <input type="text" class="edit" v-model="socialCode1" readonly/>
            </div>
          </div>
          <div class="info_list" style="border-bottom:none;">
            <div class="list_left2">请上传营业执照照片</div>
          </div>
          <div class="bus-license">
            <img :src="busLic1" alt class="pic" @click="uploadBusLic1()"/>
          </div>
          <div class="info_list">
            <div class="list_left" style="width:43%;">
              <img
                src="../../../assets/userRegister/people.png"
                alt
                style="width:16px;height:16px;margin-right:5px;"
              />
              法定代表人姓名：
            </div>
            <div class="list_right" style="width:57%;">
              <input
                type="text"
                class="edit"
                v-model="legalRepresentativeName1"
                @blur="goTop()"
                placeholder="请输入姓名"
              />
            </div>
          </div>
          <div class="info_list">
            <div class="list_left" style="width:54%;">
              <img
                src="../../../assets/userRegister/idCard.png"
                alt
                style="width:16px;height:16px;margin-right:5px;"
              />
              法定代表人身份证号码：
            </div>
            <div class="list_right" style="width:46%;">
              <input
                type="text"
                class="edit"
                v-model="legalRepresentativeCardNumber1"
                @blur="goTop()"
                placeholder="请输入身份证号码"
              />
            </div>
          </div>
          <button class="next-step" @click="next_step_oth()">下一步</button>
          <p/>
          <button v-if="showStatus== 1"
                  @click="go_forword()"
                  class="next-step"
                  style="margin-top:20px"
          >退出</button>
        </div>
      </list-item>
    </h-content>
    <h-content v-if="status == '成功'">
      <list-item class="reg-content">
        <!-- <div class="repre-type">
          <input
            type="radio"
            name="agent"
            v-model="agentType"
            @change="isAgent"
            value="Y"
            disabled
          />代理店
          <input
          style="margin-left:36px"
            type="radio"
            name="agent"
            v-model="agentType"
            @change="isAgent"
            value="N"
            disabled
          />非代理店
        </div>-->
        <div class="repre-type">
          <span>经办人类型：</span>
          <input
            type="radio"
            name="peopleType"
            v-model="staffType"
            @change="getRadioVal"
            value="组织其他员工"
            disabled
          />组织其他员工
          <input
            type="radio"
            name="peopleType"
            v-model="staffType"
            @change="getRadioVal"
            value="法定代表人"
            disabled
          />法定代表人
        </div>
        <!-- 法定代表人 -->
        <div v-if="staffType == '法定代表人'">
          <div class="info_list">
            <div class="list_left" style="width:39%;">
              <img
                src="../../../assets/userRegister/company.png"
                alt
                style="width:16px;height:16px;margin-right:5px;"
              />
              组织机构名称：
            </div>
            <div class="list_right" style="width:61%;">
              <input type="text" class="edit" v-model="organizationName" readonly/>
            </div>
          </div>
          <div class="info_list">
            <div class="list_left" style="width:48%;">
              <img
                src="../../../assets/userRegister/idCard.png"
                alt
                style="width:16px;height:16px;margin-right:5px;"
              />
              统一社会信用代码：
            </div>
            <div class="list_right" style="width:52%;">
              <input type="text" class="edit" v-model="socialCode" readonly/>
            </div>
          </div>
          <!-- <div class="info_list" style="border-bottom:none;">
            <div class="list_left2">请上传营业执照照片</div>
          </div>-->
          <div class="bus-license">
            <!-- <input
              type="file"
              name="avatar"
              id="uppic"
              accept="image/gif, image/jpeg, image/jpg, image/png"
              ref="avatarInput"
              class="uppic"
              disabled
            />-->
            <img :src="busLic2" alt class="pic" @click="previewImage(authOrgAttachmentId)"/>
          </div>
          <div class="info_list">
            <div class="list_left" style="width:43%;">
              <img
                src="../../../assets/userRegister/people.png"
                alt
                style="width:16px;height:16px;margin-right:5px;"
              />
              法定代表人姓名：
            </div>
            <div class="list_right" style="width:57%;">
              <input type="text" class="edit" v-model="legalRepresentativeName" readonly/>
            </div>
          </div>
          <div class="info_list">
            <div class="list_left" style="width:54%;">
              <img
                src="../../../assets/userRegister/idCard.png"
                alt
                style="width:16px;height:16px;margin-right:5px;"
              />
              法定代表人身份证号码：
            </div>
            <div class="list_right" style="width:46%;">
              <input type="text" class="edit" v-model="legalRepresentativeCardNumber" readonly/>
            </div>
          </div>
          <div class="info_list">
            <div class="list_left" style="width:30%;">
              <img
                src="../../../assets/userRegister/phone.png"
                alt
                style="width:16px;height:16px;margin-right:5px;"
              />
              手机号码：
            </div>
            <div class="list_right" style="width:70%;">
              <input type="text" class="edit" v-model="legalPhoneNumber" readonly/>
            </div>
          </div>
          <!-- <div style="margin: 10px 0 0 14px;color:#636363">
            <p>请上传身份证照片</p>
          </div>-->
          <div style="height:100px;margin-top:30px">
            <div
              style="border:1px solid #b2b2b2;width:140px;height:100px;margin:0 auto;border-radius:5px;position:relative;"
            >
              <!-- <input
                type="file"
                name="avatar"
                id="uppic"
                accept="image/gif, image/jpeg, image/jpg, image/png"
                ref="avatarInput"
                class="uppic"
                disabled
              />-->
              <img :src="cardUp2" alt class="pic" @click="previewImage(authAttachmentId)"/>
            </div>
          </div>
          <p style="margin-top:10px;text-align:center;color:#636363">正面</p>
          <button
            class="next_step"
            style="width:120px;height:30px;border-radius:15px;background-color:#09bb07;color:#FFFFFF;margin:100px 0 0 -60px;position:relative;left:50%;"
            @click="logout()"
          >注销</button>
          <!-- <div class="button_all">
              <div v-if="isManagerFlag=='Y'"
                class="next_step"
                @click="goAutohrized()"
              >授权管理</div>
              <div
                class="next_step"
                @click="logout()"
              >注销</div>

          </div> -->
        </div>
        <!-- 组织其他员工 -->
        <div v-if="staffType ==='组织其他员工'">
          <div class="info_list">
            <div class="list_left" style="width:39%;">
              <img
                src="../../../assets/userRegister/people.png"
                alt
                style="width:16px;height:16px;margin-right:5px;"
              />
              经办人姓名：
            </div>
            <div class="list_right" style="width:61%;">
              <input type="text" class="edit" v-model="jbName" readonly/>
            </div>
          </div>

          <div class="info_list">
            <div class="list_left" style="width:48%;">
              <img
                src="../../../assets/userRegister/idCard.png"
                alt
                style="width:16px;height:16px;margin-right:5px;"
              />
              经办人身份证号：
            </div>
            <div class="list_right" style="width:52%;">
              <input type="text" class="edit" v-model="jbIdNumber" readonly/>
            </div>
          </div>
          <div class="info_list">
            <div class="list_left" style="width:30%;">
              <img
                src="../../../assets/userRegister/phone.png"
                alt
                style="width:16px;height:16px;margin-right:5px;"
              />
              手机号码：
            </div>
            <div class="list_right" style="width:70%;">
              <input type="text" class="edit" v-model="jbPhoneNumber" readonly/>
            </div>
          </div>
          <!-- <div style="margin: 10px 0 0 14px;color:#636363">
            <p>请上传身份证照片</p>
          </div>-->
          <div style="height:100px;margin-top:30px">
            <div
              style="border:1px solid #b2b2b2;width:140px;height:100px;margin:0 auto;border-radius:5px;position:relative;"
            >
              <!-- <input
                type="file"
                name="avatar"
                id="uppic"
                accept="image/gif, image/jpeg, image/jpg, image/png"
                ref="avatarInput"
                class="uppic"
                disabled
              />-->
              <img :src="cardUp3" alt class="pic" @click="previewImage(authAttachmentId)"/>
            </div>
          </div>
          <p style="margin-top:10px;text-align:center;color:#636363">正面</p>
          <div class="info_list">
            <div class="list_left" style="width:39%;">
              <img
                src="../../../assets/userRegister/company.png"
                alt
                style="width:16px;height:16px;margin-right:5px;"
              />
              组织机构名称：
            </div>
            <div class="list_right" style="width:61%;">
              <input type="text" class="edit" v-model="organizationName1" readonly/>
            </div>
          </div>
          <div class="info_list">
            <div class="list_left" style="width:48%;">
              <img
                src="../../../assets/userRegister/idCard.png"
                alt
                style="width:16px;height:16px;margin-right:5px;"
              />
              统一社会信用代码：
            </div>
            <div class="list_right" style="width:52%;">
              <input type="text" class="edit" v-model="socialCode1" readonly/>
            </div>
          </div>
          <!-- <div class="info_list" style="border-bottom:none;">
            <div class="list_left2">请上传营业执照照片</div>
          </div>-->
          <div class="bus-license">
            <!-- <input
              type="file"
              name="avatar"
              id="uppic"
              accept="image/gif, image/jpeg, image/jpg, image/png"
              ref="avatarInput"
              class="uppic"
              disabled
            />-->
            <img :src="busLic3" alt class="pic" @click="previewImage(authOrgAttachmentId)"/>
          </div>
          <div class="info_list">
            <div class="list_left" style="width:43%;">
              <img
                src="../../../assets/userRegister/people.png"
                alt
                style="width:16px;height:16px;margin-right:5px;"
              />
              法定代表人姓名：
            </div>
            <div class="list_right" style="width:57%;">
              <input type="text" class="edit" v-model="legalRepresentativeName1" readonly/>
            </div>
          </div>
          <div class="info_list">
            <div class="list_left" style="width:54%;">
              <img
                src="../../../assets/userRegister/idCard.png"
                alt
                style="width:16px;height:16px;margin-right:5px;"
              />
              法定代表人身份证号码：
            </div>
            <div class="list_right" style="width:46%;">
              <input type="text" class="edit" v-model="legalRepresentativeCardNumber1" readonly/>
            </div>
          </div>
          <button
            class="next_step"
            style="width:120px;height:30px;border-radius:15px;background-color:#09bb07;color:#FFFFFF;margin:100px 0 0 -60px;position:relative;left:50%;"
            @click="logout()"
          >注销</button>
        </div>
      </list-item>
    </h-content>
  </h-view>
</template>

<script>
  // import { Grid, GridItem } from "vux";
  import {getUrlParam} from "@/scripts/utils";

  export default {
    data() {
      return {
        // agentType: "Y",
        staffType: "法定代表人",
        cardUp: require("../../../assets/userRegister/camear.png"), //身份证照片url
        busLic: require("../../../assets/userRegister/camear.png"), //营业执照照片url
        organizationName: "", //组织机构名称
        socialCode: "", //统一社会信用代码
        legalRepresentativeName: "", //法定代表人姓名
        legalRepresentativeCardNumber: "", //法定代表人身份证号码
        legalPhoneNumber: "", //法定代表人电话号码
        jbName: "", //经办人姓名
        jbPhoneNumber: "", //经办人手机号码
        jbIdNumber: "", //经办人身份证号码
        status: "",
        cardUp1: require("../../../assets/userRegister/camear.png"), //身份证照片url
        busLic1: require("../../../assets/userRegister/camear.png"), //营业执照照片url
        organizationName1: "", //组织机构名称
        socialCode1: "", //统一社会信用代码
        legalRepresentativeName1: "", //法定代表人姓名
        legalRepresentativeCardNumber1: "", //法定代表人身份证号码
        //认证成功后
        cardUp2: "", //身份证照片url
        busLic2: "", //营业执照照片url
        organizationName2: "", //组织机构名称
        socialCode2: "", //统一社会信用代码
        legalRepresentativeName2: "", //法定代表人姓名
        legalRepresentativeCardNumber2: "", //法定代表人身份证号码
        jbName2: "", //经办人姓名
        jbPhoneNumber2: "", //经办人手机号码
        jbIdNumber2: "", //经办人身份证号码
        cardUp3: "", //身份证照片url
        busLic3: "", //营业执照照片url
        organizationName3: "", //组织机构名称
        socialCode3: "", //统一社会信用代码
        legalRepresentativeName3: "", //法定代表人姓名
        legalRepresentativeCardNumber3: "", //法定代表人身份证号码

        legalPhoneNumber2: "",
        // 11111
        attachmentId: "",
        attachmentId1: "",
        attachmentId2: "",
        attachmentId3: "",

        // 用户信息
        userInfo: null,
        faceAuthStatus: "",
        orgAuthStatus: "",
        authAttachmentId: "",
        authOrgAttachmentId: "",
        showStatus: "",
      };
    },

    created() {
      this.wxConfig();
      this.getUserInfo();
    },
    activated: function () {
      this.status = ""; //判断请求是否成功的状态
    },
    mounted() {
    },
    updated: function () {
    },
    methods: {
      // 是否是代理店
      // isAgent() {
      //   console.log(this.agentType);
      //   // window.localStorage.agentType = this.agentType;
      //   if (this.agentType == "N") {
      //     this.staffType = "法定代表人";
      //   }
      // },

      // 调用微信接口的基础配置
      wxConfig() {
        let clientUrl = "";
        let u = navigator.userAgent;
        let isAndroid = u.indexOf("Android") > -1 || u.indexOf("Linux") > -1; //g
        let isIOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios终端
        if (isAndroid) {
          //这个是安卓操作系统
          console.log("机型：android");
          clientUrl = location.href;
        }
        if (isIOS) {
          //这个是ios操作系统
          console.log("机型：ios");
          clientUrl = location.href.split("#")[0];
        }
        // let url = $config.rootPath + '/js/sdk/getWxConfig?wxCode=' + $config.wxCode + '&clientUrl=' + clientUrl
        let url = process.env.basePathRl + "getSignature";
        let param = {
          apiKey: "handexinxi",
          url: clientUrl
        };
        hlsHttp.post(url, param).then(function (res) {
          wx.config({
            beta: true,
            debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来，若要查看传入的参数，可以在pc端打开，参数信息会通过log打出，仅在pc端时才会打印。
            appId: res.result.appId, // 必填，公众号的唯一标识
            timestamp: res.result.timestamp, // 必填，生成签名的时间戳
            nonceStr: res.result.nonceStr, // 必填，生成签名的随机串
            signature: res.result.signature, // 必填，签名，见附录1
            jsApiList: [
              "chooseImage",
              "previewImage",
              "downloadImage",
              "getLocalImgData",
              "uploadImage",
              "hideOptionMenu"
            ] // 必填，需要使用的JS接口列表，所有JS接口列表见附录2
          });
          wx.ready(function () {
            wx.hideOptionMenu();
          });
        });
      },
      // 法人和其他人切换状态
      getRadioVal() {
        console.log(this.staffType);
      },
      // 图片上传
      uploadUpImg() {
        //身份证正面
        let self = this;
        wx.chooseImage({
          count: 1, //张数， 默认9
          sizeType: ["compressed"], //建议压缩图
          sourceType: ["album", "camera"], // 来源是相册、相机
          success: function (res) {
            self.cardUp = res.localIds[0];
            self.uploadToWeixinServer(res.localIds[0], "cardUp");
          }
        });
      },
      uploadUpImg1() {
        //身份证正面
        let self = this;
        wx.chooseImage({
          count: 1, //张数， 默认9
          sizeType: ["compressed"], //建议压缩图
          sourceType: ["album", "camera"], // 来源是相册、相机
          success: function (res) {
            self.cardUp1 = res.localIds[0];
            self.uploadToWeixinServer(res.localIds[0], "cardUp1");
          }
        });
      },
      uploadBusLic() {
        let self = this;
        wx.chooseImage({
          count: 1, //张数， 默认9
          sizeType: ["compressed"], //建议压缩图
          sourceType: ["album", "camera"], // 来源是相册、相机
          success: function (res) {
            self.busLic = res.localIds[0];
            self.uploadToWeixinServer(res.localIds[0], "busLic");
          }
        });
      },
      uploadBusLic1() {
        //上传营业执照
        let self = this;
        wx.chooseImage({
          count: 1, //张数， 默认9
          sizeType: ["compressed"], //建议压缩图
          sourceType: ["album", "camera"], // 来源是相册、相机
          success: function (res) {
            self.busLic1 = res.localIds[0];
            self.uploadToWeixinServer(res.localIds[0], "busLic1");
          }
        });
      },
      // 上传到微信服务器
      uploadToWeixinServer(localId, type) {
        let self = this;
        wx.uploadImage({
          localId: localId,
          isShowProgressTips: 1, // 默认为1，显示进度提示
          success: function (res) {
            if (type == "cardUp") {
              self.uploadCardToserver(res.serverId);
            } else if (type == "cardUp1") {
              self.uploadCard1Toserver(res.serverId);
            } else if (type == "busLic") {
              self.uploadBusLicToserver(res.serverId);
            } else if (type == "busLic1") {
              self.uploadBusLic1Toserver(res.serverId);
            }
          }
        });
      },
      // 上传到业务系统并且进行ocr识别
      uploadCardToserver(serverId) {
        // console.log("mediaId", serverId);
        let vm = this;
        let url = process.env.rootPath + "/auth/upload/image/hls/from/wx";
        let param = {
          openId: window.localStorage.openId,
          mediaId: serverId,
          sourceType: "app_file_id_card",
          fileName: new Date().getTime() + ".jpg"
        };
        vm.hlsPopup.showLoading("请稍等");
        vm.$post(url, param).then(function (res) {
          vm.hlsPopup.hideLoading();
          vm.legalRepresentativeName = res["姓名"];
          vm.legalRepresentativeCardNumber = res["公民身份号码"];
          vm.attachmentId = res["attchmentId"];
          window.sessionStorage.cardUp2_leg =
            process.env.rootPath +
            "/app/fileViewSvc?attachment_id=" +
            vm.attachmentId +
            "&apiName=download&sysName=HCL_UPLOAD_FILE&access_token=" +
            window.localStorage.access_token_rl;
        });
      },
      uploadCard1Toserver(serverId) {
        let vm = this;
        let url = process.env.rootPath + "/auth/upload/image/hls/from/wx";
        let param = {
          openId: window.localStorage.openId,
          mediaId: serverId,
          sourceType: "app_file_id_card",
          fileName: new Date().getTime() + ".jpg"
        };
        vm.hlsPopup.showLoading("请稍等");
        vm.$post(url, param).then(function (res) {
          vm.hlsPopup.hideLoading();
          vm.jbName = res["姓名"];
          vm.jbIdNumber = res["公民身份号码"];
          vm.attachmentId1 = res["attchmentId"];
          window.sessionStorage.cardUp3_oth =
            process.env.rootPath +
            "/app/fileViewSvc?attachment_id=" +
            vm.attachmentId1 +
            "&apiName=download&sysName=HCL_UPLOAD_FILE&access_token=" +
            window.localStorage.access_token_rl;
        });
      },
      uploadBusLicToserver(serverId) {
        let vm = this;
        let url = process.env.rootPath + "/auth/upload/image/hls/from/wx";
        let param = {
          openId: window.localStorage.openId,
          mediaId: serverId,
          sourceType: "app_file_bus_lic",
          fileName: new Date().getTime() + ".jpg"
        };
        vm.hlsPopup.showLoading("请稍等");
        vm.$post(url, param).then(function (res) {
          vm.hlsPopup.hideLoading();
          vm.socialCode = res["社会信用代码"];
          vm.organizationName = res["单位名称"];
          vm.attachmentId2 = res["attchmentId"];
          window.sessionStorage.busLic2_leg =
            process.env.rootPath +
            "/app/fileViewSvc?attachment_id=" +
            vm.attachmentId2 +
            "&apiName=download&sysName=HCL_UPLOAD_FILE&access_token=" +
            window.localStorage.access_token_rl;
        });
      },
      uploadBusLic1Toserver(serverId) {
        let vm = this;
        let url = process.env.rootPath + "/auth/upload/image/hls/from/wx";
        let param = {
          openId: window.localStorage.openId,
          mediaId: serverId,
          sourceType: "app_file_bus_lic",
          fileName: new Date().getTime() + ".jpg"
        };
        vm.hlsPopup.showLoading("请稍等");
        vm.$post(url, param).then(function (res) {
          vm.hlsPopup.hideLoading();
          vm.socialCode1 = res["社会信用代码"];
          vm.organizationName1 = res["单位名称"];
          vm.attachmentId3 = res["attchmentId"];
          window.sessionStorage.busLic3_oth =
            process.env.rootPath +
            "/app/fileViewSvc?attachment_id=" +
            vm.attachmentId3 +
            "&apiName=download&sysName=HCL_UPLOAD_FILE&access_token=" +
            window.localStorage.access_token_rl;
        });
      },
      //预览图片
      previewImage(id) {
        let vm = this;
        var preview_url =
          process.env.rootPath +
          "/app/fileViewSvc?attachment_id=" +
          id +
          "&apiName=download&sysName=HCL_UPLOAD_FILE&access_token=" +
          window.localStorage.access_token_rl;
        // window.open(url,"_self");
        hlsPopup.showBigPicture({
          imgUrl: preview_url
        });
      },
      // 下一步
      next_step() {
        let vm = this;
        if (
          !vm.organizationName ||
          !vm.socialCode ||
          !vm.legalRepresentativeName ||
          !vm.legalRepresentativeCardNumber ||
          !vm.legalPhoneNumber
        // ||
        // !vm.cardUp ||
        // !vm.busLic
        ) {
          vm.hlsPopup.showLongCenter("必输字端不能为空！");
          return;
        }
        if (vm.hlsUtil.isCardID(vm.legalRepresentativeCardNumber)) {
          vm.hlsPopup.showLongCenter("法定代表人身份证号有误");
          return;
        } else {
          sessionStorage.setItem("organizationName_leg", vm.organizationName);
          sessionStorage.setItem("cardUp_leg", vm.cardUp);
          sessionStorage.setItem("busLic_leg", vm.busLic);
          sessionStorage.setItem("socialCode_leg", vm.socialCode);
          sessionStorage.setItem(
            "legalRepresentativeName_leg",
            vm.legalRepresentativeName
          );
          sessionStorage.setItem(
            "legalRepresentativeCardNumber_leg",
            vm.legalRepresentativeCardNumber
          );
          sessionStorage.setItem("legalPhoneNumber_leg", vm.legalPhoneNumber);

          // alert("验证通过");
          // let url = 'http://101.133.225.167:8096/core/r/api?sysName=HLS_APP&apiName=' + 'getOpenId';//获取openId的接口
          let url = process.env.rootPath + "/auth/api/individual/face/Organ";
          let param = {
            openId: window.localStorage.openId,
            idNo: vm.socialCode,
            name: vm.organizationName,
            agentIdNo: vm.legalRepresentativeCardNumber,
            agentName: vm.legalRepresentativeName,
            mobile: vm.legalPhoneNumber,
            legalName: vm.legalRepresentativeName,
            legalIdNo: vm.legalRepresentativeCardNumber,
            agentType: "1",
            // dealerFlag: vm.agentType,
            redirectUrl:
              "http://sign.hitachics.com/www/#/UserRegister/CompanyRegister?Regstatus=1"
          };
          vm.hlsPopup.showLoading("请稍等");
          vm.$post(url, param).then(function (res) {
            vm.hlsPopup.hideLoading();
            if (res.code == 0) {
              vm.$vux.toast.text(res.message, "middle");
              if (res.url) {
                window.open(res.url, "_self");
              }
            } else {
              vm.$vux.toast.text(res.message, "middle");
            }
          });
        }
      },
      next_step_oth() {
        let vm = this;
        if (
          !vm.organizationName1 ||
          !vm.socialCode1 ||
          !vm.legalRepresentativeName1 ||
          !vm.legalRepresentativeCardNumber1 ||
          !vm.jbName ||
          !vm.jbPhoneNumber ||
          !vm.jbIdNumber
        // !vm.cardUp1 ||
        // !vm.busLic1
        ) {
          vm.hlsPopup.showLongCenter("必输字端不能为空！");
          return;
        }
        if (vm.hlsUtil.isCardID(vm.legalRepresentativeCardNumber1)) {
          vm.hlsPopup.showLongCenter("身份证号有误");
          return;
        } else {
          sessionStorage.setItem("organizationName_oth", vm.organizationName1);
          sessionStorage.setItem("cardUp_oth", vm.cardUp1);
          sessionStorage.setItem("busLic_oth", vm.busLic1);
          sessionStorage.setItem("socialCode_oth", vm.socialCode1);
          sessionStorage.setItem(
            "legalRepresentativeName_oth",
            vm.legalRepresentativeName1
          );
          sessionStorage.setItem(
            "legalRepresentativeCardNumber_oth",
            vm.legalRepresentativeCardNumber1
          );
          sessionStorage.setItem("jbName_oth", vm.jbName);
          sessionStorage.setItem("jbPhoneNumber_oth", vm.jbPhoneNumber);
          sessionStorage.setItem("jbIdNumber_oth", vm.jbIdNumber);
          // let url = 'http://101.133.225.167:8096/core/r/api?sysName=HLS_APP&apiName=' + 'getOpenId';//获取openId的接口
          let url = process.env.rootPath + "/auth/api/individual/face/Organ";
          let param = {
            openId: window.localStorage.openId,
            idNo: vm.socialCode1,
            agentIdNo: vm.jbIdNumber,
            agentName: vm.jbName,
            mobile: vm.jbPhoneNumber,
            name: vm.organizationName1,
            legalName: vm.legalRepresentativeName1,
            legalIdNo: vm.legalRepresentativeCardNumber1,
            agentType: "2",
            redirectUrl:
              "http://sign.hitachics.com/www/#/UserRegister/CompanyRegister?Regstatus=2"
          };
          vm.hlsPopup.showLoading("请稍等");
          vm.$post(url, param).then(function (res) {
            vm.hlsPopup.hideLoading();
            if (res.code == 0) {
              vm.$vux.toast.text(res.message, "middle");
              if (res.url) {
                window.open(res.url, "_self");
              }
            } else {
              vm.$vux.toast.text(res.message, "middle");
            }
          });
        }
      },
      UrlSearch() {
        var name, value;
        var str = window.location.href; //取得整个地址栏
        var num = str.indexOf("?");
        str = str.substr(num + 1); //取得所有参数   stringvar.substr(start [, length ]
        var arr = str.split("&"); //各个参数放到数组里
        for (var i = 0; i < arr.length; i++) {
          num = arr[i].indexOf("=");
          if (num > 0) {
            name = arr[i].substring(0, num);
            value = arr[i].substr(num + 1);
            this[name] = value;
          }
        }
      },
      logout() {
        let vm = this;
        hlsPopup.showConfirm({
          title: "提示",
          content: "请确认合同是否都已下载完成，注销后无法下载,请知悉,谢谢！",
          onConfirm: function (index) {
            if (index === 1) {
              let url =
                process.env.rootPath + "/organizations/outerOrgans/delete";
              let param = {
                openId: window.localStorage.openId
              };
              vm.hlsPopup.showLoading("请稍等");
              vm.$post(url, param).then(function (res) {
                vm.hlsPopup.hideLoading();
                if (res.code == 0) {
                  vm.$vux.toast.text(res.message, "middle");
                  window.open(
                    "http://sign.hitachics.com/www/#/UserRegister",
                    "_self"
                  );
                } else {
                  vm.$vux.toast.text(res.message, "middle");
                }
              });
            }
            // console.log(index);
          }
        });
      },
      // 退出
      go_forword() {
        let vm = this;
        let url = process.env.rootPath + "/accounts/outerAccounts/delete";
        let param = {
          openId: window.localStorage.openId
        };
        vm.hlsPopup.showLoading("请稍等");
        vm.$post(url, param).then(function (res) {
          vm.hlsPopup.hideLoading();
          if (res.code == 0) {
            vm.$vux.toast.text(res.message, "middle");
            window.open(
              "http://sign.hitachics.com/www/#/UserRegister",
              "_self"
            );
          } else {
            vm.$vux.toast.text(res.message, "middle");
          }
        });
      },
      // 认证结果返回给接口
      authResult(id, code, suc) {
        let vm = this;
        let url = "http://sign.hitachics.com/core/api/public/listen/auth/result";
        let param = {
          contextId: id,
          verifycode: code,
          success: suc
        };
        vm.hlsPopup.showLoading("请稍等");
        vm.$post(url, param).then(function (res) {
          vm.hlsPopup.hideLoading();
        });
      },
      // 键盘消失，页面返回顶部
      goTop() {
        setTimeout(function () {
          var scrollHeight =
            document.documentElement.scrollTop || document.body.scrollTop || 0;
          // console.log(scrollHeight);
          window.scrollTo(0, Math.max(scrollHeight, 0));
        }, 100);
      },
      // 进入授权管理
      // goAutohrized(){
      //   this.$router.push({
      //   name: 'AuthorizedAgent',
      //   params: {
      //     id: vm.socialCode
      //     },
      //   })
      // },
      // 查询用户信息
      getUserInfo() {
        var Request = new this.UrlSearch(); //实例化
        var status = Request.Regstatus;
        var contextId = Request.contextId;
        var verifycode = Request.verifycode;
        var success = Request.passed;
        let vm = this;
        let url =
          process.env.rootPath +
          "/sign/info/hclc/query/by/openid?openId=" +
          window.localStorage.openId;
        // let url =
        //   process.env.rootPath +
        //   "/sign/info/hclc/query/by/openid?openId=" +
        //   // "oBdoRwFp6UN_KzchaPIEPynR9poM"
        //   "oBdoRwI9gj9Brbe9iqlDCg5G2dDc";
        vm.hlsPopup.showLoading("请稍等");
        vm.$post(url).then(function (res) {
          vm.hlsPopup.hideLoading();
          // console.log(res.rows.length);
          if (res.rows) {
            if (res.rows.length > 0) {
              var data = res.rows[0];
              var historyFlag = data.historyFlag;
              if (historyFlag == 'N') {
                vm.userInfo = data;
                vm.faceAuthStatus = data.faceAuthStatus;
                vm.orgAuthStatus = data.orgAuthStatus;
                vm.agentType = data.dealerFlag ? data.dealerFlag : "Y";
                vm.showStatus = "1";
                if (data.ctitype == 2) {
                  if (data.agentType == 1) {
                    //法定代表人
                    vm.organizationName = data.name;
                    vm.socialCode = data.idNo;
                    vm.legalRepresentativeName = data.legalName;
                    vm.legalRepresentativeCardNumber = data.legalIdNo;
                    vm.legalPhoneNumber = data.mobile;
                    vm.authAttachmentId = data.attachmentId;
                    vm.authOrgAttachmentId = data.orgAttachmentId;
                    vm.cardUp =
                      process.env.rootPath +
                      "/app/fileViewSvc?attachment_id=" +
                      data.attachmentId +
                      "&apiName=download&sysName=HCL_UPLOAD_FILE&access_token=" +
                      window.localStorage.access_token_rl;
                    vm.cardUp2 =
                      process.env.rootPath +
                      "/app/fileViewSvc?attachment_id=" +
                      data.attachmentId +
                      "&apiName=download&sysName=HCL_UPLOAD_FILE&access_token=" +
                      window.localStorage.access_token_rl;
                    vm.busLic =
                      process.env.rootPath +
                      "/app/fileViewSvc?attachment_id=" +
                      data.orgAttachmentId +
                      "&apiName=download&sysName=HCL_UPLOAD_FILE&access_token=" +
                      window.localStorage.access_token_rl;
                    vm.busLic2 =
                      process.env.rootPath +
                      "/app/fileViewSvc?attachment_id=" +
                      data.orgAttachmentId +
                      "&apiName=download&sysName=HCL_UPLOAD_FILE&access_token=" +
                      window.localStorage.access_token_rl;
                    if (
                      data.faceAuthStatus == "SUCCESS" &&
                      data.orgAuthStatus == "SUCCESS"
                    ) {
                      vm.status = "成功";
                      vm.authResult(contextId, verifycode, success);
                      // 跳转到注销页面
                    }
                  } else if (data.agentType == 2) {
                    //组织机构其他员工
                    vm.staffType = "组织其他员工";
                    vm.jbName = data.agentName;
                    vm.jbPhoneNumber = data.mobile;
                    vm.jbIdNumber = data.agentIdNo;
                    vm.organizationName1 = data.name;
                    vm.socialCode1 = data.idNo;
                    vm.legalRepresentativeName1 = data.legalName;
                    vm.legalRepresentativeCardNumber1 = data.legalIdNo;
                    vm.authAttachmentId = data.attachmentId;
                    vm.authOrgAttachmentId = data.orgAttachmentId;
                    vm.cardUp1 =
                      process.env.rootPath +
                      "/app/fileViewSvc?attachment_id=" +
                      data.attachmentId +
                      "&apiName=download&sysName=HCL_UPLOAD_FILE&access_token=" +
                      window.localStorage.access_token_rl;
                    vm.busLic1 =
                      process.env.rootPath +
                      "/app/fileViewSvc?attachment_id=" +
                      data.orgAttachmentId +
                      "&apiName=download&sysName=HCL_UPLOAD_FILE&access_token=" +
                      window.localStorage.access_token_rl;
                    vm.cardUp3 =
                      process.env.rootPath +
                      "/app/fileViewSvc?attachment_id=" +
                      data.attachmentId +
                      "&apiName=download&sysName=HCL_UPLOAD_FILE&access_token=" +
                      window.localStorage.access_token_rl;
                    vm.busLic3 =
                      process.env.rootPath +
                      "/app/fileViewSvc?attachment_id=" +
                      data.orgAttachmentId +
                      "&apiName=download&sysName=HCL_UPLOAD_FILE&access_token=" +
                      window.localStorage.access_token_rl;
                    if (
                      data.faceAuthStatus == "SUCCESS" &&
                      data.orgAuthStatus == "SUCCESS"
                    ) {
                      vm.status = "成功";
                      vm.authResult(contextId, verifycode, success);
                      // 跳转到注销页面
                    }
                  }
                }
              }
            }
          }
        });
      }
    }
  };
</script>
<style lang="less" type="text/less" scoped>
  @import "../../../styles/vue-1px.less";

  .companyRegister {
    .reg-content {
      padding: 20px 10px;
      font-size: 14px;
      .repre-type {
        padding: 10px;
        border-bottom: 1px solid #d0d0d0;
        color: #11111187;
        font-size: 16px;
        font-weight: 700;
      }
      .info_list {
        width: 100%;
        // height: 48px;
        // border-bottom: 1px solid #f2f2f2;
        border-bottom: 1px solid #d0d0d0;
        display: flex;
        display: -webkit-flex;
        .list_left {
          width: 35%;
          // margin-left: 3%;
          height: 50px;
          font-family: "微软雅黑";
          font-size: 14px;
          color: #636363;
          line-height: 50px;
          // float: left;
        }
        .list_right {
          // width: auto;
          // margin-right: 3%;
          height: 50px;
          color: #636363;
          line-height: 50px;
          // float: right;
        }
        .edit {
          width: 100%;
          color: #898989;
          font-family: "微软雅黑";
          font-size: 14px;
          border: none;
        }
        .list_left2 {
          width: 97%;
          margin-left: 3%;
          height: 50px;
          font-family: "微软雅黑";
          font-size: 14px;
          color: #636363;
          line-height: 50px;
          // float: left;
        }
      }
      .button_all{
        width: 100%;
        font-size: 14px;
        display: -webkit-flex;
        display: flex;
        align-items: center;
        justify-content: space-around;
        -webkit-align-items: center;
        -webkit-justify-content: space-around;
        .next_step{
        // width:30%;
          height:30px;
          line-height: 30px;
          text-align: center;
          border-radius:15px;
          background-color:#09bb07;
          color:#FFFFFF;
        }
    }
      .uppic {
        height: 100%;
        width: 100%;
        margin: 0 auto;
        opacity: 0;
        z-index: 1000;
        position: absolute;
      }
      .pic {
        width: 100%;
        height: 100%;
        position: absolute;
      }
      .bus-license {
        width: 140px;
        height: 100px;
        margin: 10px auto;
        border: 1px solid #b2b2b2;
        border-radius: 8px;
        position: relative;
      }
      .next-step {
        width: 120px;
        height: 30px;
        border-radius: 15px;
        background-color: #09bb07;
        color: #ffffff;
        cursor: pointer;
        margin: 100px 0 0 -60px;
        position: relative;
        left: 50%;
      }
    }
  }

  // iPhoneX适配
  @media (device-width: 375px) and (device-height: 812px) and (-webkit-min-device-pixel-ratio: 3) {
    .platform-ios {
      #home {
      }
    }
  }

  // iPhoneX Max适配
  @media (device-width: 414px) and (device-height: 896px) {
    .platform-ios {
      .platform-ios {
        #home {
        }
      }
    }
  }
</style>
