baseInfo.vue 77.8 KB
Newer Older
786817560's avatar
786817560 committed
1 2 3 4
<!--
 * @Description: In User Settings Edit
 * @Author: your name
 * @Date: 2019-09-19 09:31:19
786817560's avatar
786817560 committed
5 6
 * @LastEditTime : 2019-12-24 15:36:17
 * @LastEditors  : Please set LastEditors
786817560's avatar
786817560 committed
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
 -->
<template>
  <h-view id="base-info" class="public-style" title="基本信息">
    <h-header :proportion="[5,1,1]" class="bar-custom">
      <div slot="left" class="h-header-btn" @click="$routeGo()">
        <img src="@/assets/userBind/arrow.png">
        <span>用户绑定</span>
      </div>
    </h-header>
    <h-content class="content">
      <div>
        <list-item :item-height="44">
          <item v-if="(isApproved&&!isMultiRole)||!isApproved" :showArrow="true">
            <div slot="name" class="font-color required">客户类型</div>
            <input
              slot="content"
              v-model="baseInfo.bp_type_n"
              placeholder="请选择"
              type="text"
              readonly
              @click="selectIdType()"
            >
          </item>
linxin's avatar
linxin committed
30
          <item v-if="isApproved&&isMultiRole&&!hasMultiRole" :showArrow="true" @click.native="selectIdType">
786817560's avatar
786817560 committed
31 32 33
            <div slot="name" class="required">客户类型</div>
            <div slot="content" class="typeBP">
              <span>{{ baseInfo.bp_type_n }}</span>
linxin's avatar
linxin committed
34 35 36 37
              <span v-for="(item,index) in multiRoleList" :key="index">{{ item.bp_type_n }}</span>
              <span v-for="(item,index) in multiBpTypeSelectList" :key="item.bp_type">
                {{ item.bp_type_n }}
                <img v-if="item.bp_type_n" src="@/assets/userBind/deleteTag.png" @click.stop @click="deleteBP(item)" >
786817560's avatar
786817560 committed
38 39 40
              </span>
            </div>
          </item>
linxin's avatar
linxin committed
41 42 43 44
          <item v-if="isApproved&&isMultiRole&&hasMultiRole" :showArrow="true">
            <div slot="name" class="required">客户类型</div>
            <div slot="content" class="typeBP">
              <span>{{ baseInfo.bp_type_n }}</span>
linxin's avatar
linxin committed
45
              <span v-for="(item,index) in multiRoleList" :key="index">{{ item.bp_type_n }}</span>
linxin's avatar
linxin committed
46 47
            </div>
          </item>
786817560's avatar
786817560 committed
48 49 50 51 52 53 54 55 56 57
          <item v-if="bp_type_flag">
            <div slot="name" class="required">{{ typeName }}</div>
            <input
              v-if="bpClass_flag"
              slot="content"
              :placeholder="type"
              v-model="baseInfo.agent_username"
            >
            <!-- <input v-if="!bpClass_flag" slot="content" :placeholder="type" v-model="baseInfo.business_license_num" > -->
          </item>
linxin's avatar
linxin committed
58
          <button v-if="isAddNewType" class="type-save" @click="addNewRole">新增角色</button>
786817560's avatar
786817560 committed
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198
        </list-item>
        <div class="userInfo martop">企业信息</div>
        <div class="upload-id-card">
          <span class="font-color">营业执照照片上传</span>
          <div class="upload-box1">
            <div v-if="!licenseImg" @click="ocrShow('license', '')">
              <img src="@/assets/userBind/camera.png">
            </div>
            <div
              v-if="licenseImg && !isApproved" style="width: 100%;height: 100%" class="licenseBox"
              @click="ocrShow('license', '')">
              <img :src="licenseImg" style="width: 100%;height: 100%;margin: 0">
            </div>
            <div v-if="isApproved" class="licenseBox"><!--v-if="licenseImg && isApproved"-->
              <img
                v-if="licenseImg" :src="licenseImg" style="width: 100%;height: 100%;margin: 0"
                @click="showBigPicture(licenseImg)">
            </div>
          </div>
        </div>

        <!-- 营业执照识别信息 -->

        <list-item :item-height="44" class="second-part">
          <item>
            <div slot="name" class="font-color required">公司名称</div>
            <input
              slot="content"
              v-model="baseInfo.bp_name"
              readonly
              placeholder="上传营业执照自动填充"
              class="auto"
            >
          </item>
          <item>
            <div slot="name" class="font-color required">企业类型</div>
            <input
              slot="content"
              v-model="baseInfo.enterprise_type"
              readonly
              placeholder="上传营业执照自动填充"
              class="auto"
            >
          </item>
          <item>
            <div slot="name" class="font-color required">统一社会信用代码</div>
            <input
              slot="content"
              v-model="baseInfo.organization_code"
              readonly
              placeholder="上传营业执照自动填充"
              class="auto"
            >
          </item>
          <item>
            <div slot="name" class="font-color required">注册资本</div>
            <input
              slot="content"
              v-model="baseInfo.registered_capital"
              readonly
              placeholder="上传营业执照自动填充"
              class="auto"
            >
          </item>
          <item>
            <div slot="name" class="font-color required">法定代表人</div>
            <input
              slot="content"
              v-model="baseInfo.legal_person"
              readonly
              placeholder="上传营业执照自动填充"
              class="auto"
            >
          </item>
          <item>
            <div slot="name" class="font-color required">注册地址</div>
            <textarea
              slot="content"
              ref="myTestarea"
              v-model="baseInfo.registered_place"
              cols="22"
              rows="1"
              readonly
              class="auto"
              placeholder="上传营业执照自动填充"
              @input="addRows(baseInfo.registered_place)"
            />
          </item>
          <item :showArrow="true">
            <div slot="name" class="required">业务办理省</div>
            <input
              slot="content"
              v-model="baseInfo.province_name"
              placeholder="请选择"
              type="text"
              readonly
              onfocus="this.blur()"
              @click="selectProvince()"
            >
          </item>
          <item :showArrow="true">
            <div slot="name" class="required">业务办理市</div>
            <input
              slot="content"
              v-model="baseInfo.city_name"
              placeholder="请选择"
              type="text"
              readonly
              onfocus="this.blur()"
              @click="selectCity()"
            >
          </item>
          <item :showArrow="true">
            <div slot="name" class="required">业务办理区/县</div>
            <input
              slot="content"
              v-model="baseInfo.district_name"
              placeholder="请选择"
              type="text"
              readonly
              onfocus="this.blur()"
              @click="selectDistrict()"
            >
          </item>
          <item :proportion="[2,2]">
            <div slot="name" class="font-color required">经营地址</div>
            <textarea
              slot="content"
              ref="myTestareaLive"
              v-model="baseInfo.business_address"
              cols="22"
              rows="1"
              placeholder="请输入经营地址"
              @input="addRowsLive(baseInfo.business_address)"
            />
          </item>
          <item>
            <div slot="name" class="font-color required">固定电话</div>
            <input
              slot="content" v-model="baseInfo.phone" placeholder="请输入固定电话"
linxin's avatar
linxin committed
199
            >
786817560's avatar
786817560 committed
200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237
          </item>
        </list-item>
        <!-- 法定代表人信息-->
        <div class="userInfo types">法定代表人</div>
        <div class="upload-id-cards">
          <span>身份证照片上传</span>
          <div class="upload-box">
            <div v-if="!idCardFront" @click="ocrShow('idCard', 'front')">
              <img src="@/assets/userBind/org/front.png">
              <p>正面</p>
            </div>
            <div v-if="idCardFront && !isApproved" @click="ocrShow('idCard', 'front')">
              <img :src="idCardFront" style="width: 100%;height: 100%;margin: 0">
            </div>
            <div v-if="isApproved && idCardFront">
              <img
                v-if="idCardFront" :src="idCardFront" style="width: 100%;height: 100%;margin: 0"
                @click="showBigPicture(idCardFront)">
            </div>
            <div v-if="!idCardBack" @click="ocrShow('idCard', 'back')">
              <img src="@/assets/userBind/org/back.png">
              <p>反面</p>
            </div>
            <div v-if="idCardBack && !isApproved" @click="ocrShow('idCard', 'back')">
              <img :src="idCardBack" style="width: 100%;height: 100%;margin: 0">
            </div>
            <div v-if="isApproved && idCardBack">
              <img
                v-if="idCardBack" :src="idCardBack" style="width: 100%;height: 100%;margin: 0"
                @click="showBigPicture(idCardBack)">
            </div>
          </div>
        </div>
        <list-item :item-height="44" class="second-part">
          <item>
            <div slot="name" class="font-color required">姓名</div>
            <input
              slot="content"
李晓兵's avatar
李晓兵 committed
238
              v-model="legal_personMsg.bp_legal_name"
786817560's avatar
786817560 committed
239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391
              readonly
              placeholder="上传身份证自动填充"
              class="auto"
            >
          </item>
          <item>
            <div slot="name" class="font-color required">身份证号</div>
            <input
              slot="content"
              v-model="legal_personMsg.id_card_no"
              readonly
              placeholder="上传身份证自动填充"
              class="auto"
            >
          </item>
          <item>
            <div slot="name" class="required">身份证有效期从</div>
            <input
              slot="content"
              v-model="legal_personMsg.id_card_date_from"
              readonly
              placeholder="上传身份证自动填充"
              class="auto"
            >
          </item>
          <item>
            <div slot="name" class="required">身份证有效期到</div>
            <input
              slot="content"
              v-model="legal_personMsg.id_card_date_to"
              readonly
              placeholder="上传身份证自动填充"
              class="auto"
            >
          </item>
          <item>
            <div slot="name" class="font-color required">手机号</div>
            <input
              slot="content" v-model="legal_personMsg.cell_phone" placeholder="请输入手机号"
              @blur="phoneCheck(legal_personMsg.cell_phone)">
          </item>
          <item>
            <div slot="name" class="font-color required">联系地址</div>
            <textarea
              ref="address"
              slot="content"
              v-model="legal_personMsg.living_address"
              cols="30"
              rows="1"
              placeholder="请输入联系地址"
              @input="addAddressRows(legal_personMsg.living_address)"
            />
          </item>
        </list-item>
        <!-- 授权切换 -->

        <div class="authorize">
          <p class="authorize-select font-color">是否授权</p>
          <div class="authorize-checklist" @click="authorizeChange">
            <div v-if="flag"/>
            <img v-if="!flag" src="@/assets/userBind/org/checklist.png" alt>
          </div>
        </div>
        <div v-if="!flag" class="userInfo types">授权人信息</div>
        <div v-if="!flag" class="upload-id-cards">
          <span>身份证照片上传</span>
          <div class="upload-box">
            <div v-if="!authidCardFront" @click="ocrShow('authidCard', 'front')">
              <img src="@/assets/userBind/org/front.png">
              <p>正面</p>
            </div>
            <div v-if="authidCardFront" @click="ocrShow('authidCard', 'front')">
              <img :src="authidCardFront" style="width: 100%;height: 100%;margin: 0">
            </div>
            <!-- <div v-if="authidCardFront && !isApproved" @click="ocrShow('authidCard', 'front')">
              <img :src="authidCardFront" style="width: 100%;height: 100%;margin: 0" >
            </div>
            <div v-if="isApproved && authidCardFront">
              <img v-if="authidCardFront" :src="authidCardFront" style="width: 100%;height: 100%;margin: 0" @click="showBigPicture(authidCardFront)">
            </div>-->
            <div v-if="!authidCardBack" @click="ocrShow('authidCard', 'back')">
              <img src="@/assets/userBind/org/back.png">
              <p>反面</p>
            </div>
            <div v-if="authidCardBack" @click="ocrShow('authidCard', 'back')">
              <img :src="authidCardBack" style="width: 100%;height: 100%;margin: 0">
            </div>
            <!--  <div v-if="authidCardBack && !isApproved" @click="ocrShow('authidCard', 'back')">
                <img :src="authidCardBack" style="width: 100%;height: 100%;margin: 0" >
              </div>
              <div v-if="isApproved && authidCardBack">
                <img v-if="authidCardBack" :src="authidCardBack" style="width: 100%;height: 100%;margin: 0" @click="showBigPicture(authidCardBack)">
              </div>-->
          </div>
        </div>
        <!-- 已授权 -->
        <list-item v-if="!flag" :item-height="44" class="second-part">
          <item>
            <div slot="name" class="font-color required">姓名</div>
            <input
              slot="content"
              v-model="authMsg.auth_person_name"
              readonly
              placeholder="上传身份证自动填充"
              class="auto"
            >
          </item>
          <item>
            <div slot="name" class="font-color required">身份证号</div>
            <input
              slot="content"
              v-model="authMsg.auth_person_id_card"
              readonly
              placeholder="上传身份证自动填充"
              class="auto"
            >
          </item>
          <item>
            <div slot="name" class="required">身份证有效期从</div>
            <input
              slot="content"
              v-model="authMsg.auth_id_card_date_from"
              readonly
              placeholder="上传身份证自动填充"
              class="auto"
            >
          </item>
          <item>
            <div slot="name" class="required">身份证有效期到</div>
            <input
              slot="content"
              v-model="authMsg.auth_id_card_date_to"
              readonly
              placeholder="上传身份证自动填充"
              class="auto"
            >
          </item>
          <item>
            <div slot="name" class="font-color required">手机号</div>
            <input
              slot="content" v-model="authMsg.auth_cell_phone" placeholder="请输入手机号"
              @blur="phoneCheck(authMsg.auth_cell_phone)">
          </item>
          <item>
            <div slot="name" class="font-color required">公司职务</div>
            <input slot="content" v-model="authMsg.auth_person_position" placeholder="请输入公司职务">
          </item>
          <item>
            <div slot="name" class="font-color required">授权事项</div>
            <input slot="content" v-model="authMsg.auth_person_matter" placeholder="请输入授权事项">
          </item>
        </list-item>

李晓兵's avatar
李晓兵 committed
392
        <div v-if="!flag" class="upload-id-card" style="margin-bottom: 30px;">
786817560's avatar
786817560 committed
393 394 395 396 397
          <span>授权书证件上传</span>
          <div class="upload-box1">
            <div v-if="!laImg" @click="LaUpload()">
              <img src="@/assets/userBind/camera.png">
            </div>
李晓兵's avatar
李晓兵 committed
398
            <div v-if="laImg && !isApproved" class="licenseBox" @click="LaUpload('')">
786817560's avatar
786817560 committed
399 400
              <img :src="laImg" style="width: 100%;height: 100%;margin: 0">
            </div>
李晓兵's avatar
李晓兵 committed
401
            <div v-if="isApproved" class="licenseBox"><!--v-if="licenseImg && isApproved"-->
786817560's avatar
786817560 committed
402 403 404 405
              <img v-if="laImg" :src="laImg" style="width: 100%;height: 100%;margin: 0" @click="showBigPicture(laImg)">
            </div>
          </div>
        </div>
linxin's avatar
linxin committed
406
        <!--
786817560's avatar
786817560 committed
407 408 409 410 411 412 413 414
        <div v-if="from&&isApproved&&isAGENT" class="tax" @click="changeUndertake">
          <img src="@/assets/userBind/tax.png" class="left-img">
          <div>
            <span>缴纳保证金</span>
            <p>已缴纳:500000</p>
          </div>
          <img src="@/assets/userBind/arrow-right.png" class="right-img">
        </div>
linxin's avatar
linxin committed
415 416
      </div> -->
    </div></h-content>
786817560's avatar
786817560 committed
417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441
    <bottom-tab class="footer-button">
      <!-- <tab-button class="put" @click.native="handSubmit">提交</tab-button> -->
      <tab-button class="save" @click.native="verified">下一步</tab-button>
    </bottom-tab>
  </h-view>
</template>

<script>
export default {
  name: 'Enterprise',
  data () {
    return {
      bp_id: '',
      flag: true, // 显示未授权框
      bpClass: '',
      from: false,
      isApproved: false, // 审批通过为true
      isAddNewType: false,
      isAGENT: this.$route.params.isAGENT, // 是否为经销商
      isMultiRole: this.$route.params.isMultiRole, // 担保人/承租人为true
      img_url: {},
      typeList: [],
      backList: [],
      saveInfo: {},
      lastInfo: {},
linxin's avatar
linxin committed
442 443
      multiBpTypeSelectList: [], // 添加的角色
      multiRoleList: [], // 查询出来的多角色
786817560's avatar
786817560 committed
444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460
      msg_flag: false,
      maritalList: [],
      getBankList: [],
      cityList: [],
      provinceList: [],
      districtList: [],
      academic_bg_n: '',
      bpClass_flag: false,
      // text: '法人代表信息',
      bp_type_flag: false,
      typeName: '',
      marital_status_n: '',
      bank_card_flag: false,
      type: '请输入业务经办姓名',
      multiBpType: {
        bp_type_n: '',
        bp_type: '',
linxin's avatar
linxin committed
461 462 463 464 465
      }, // 客户选择的第二个角色
      multiRole: {
        bp_type_n: '',
        bp_type: '',
      }, // 查询出来的第二个角色
786817560's avatar
786817560 committed
466 467
      legal_personMsg: {
        id_card_no: null,
李晓兵's avatar
李晓兵 committed
468
        bp_legal_name: '',
786817560's avatar
786817560 committed
469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511
        cell_phone: window.localStorage.getItem('user_phone'),
        living_address: '',
        id_card_date_from: '', // 法定代表人身份证有效期从
        id_card_date_to: '', // 法定代表人身份证有效期到
      },
      baseInfo: {
        agent_username: '',
        district_id: '',
        district_name: '',
        province_name: '',
        province_id: '',
        city_name: '',
        city_id: '',
        bp_type: '',
        bp_type_n: '',
        bp_name: '',
        phone: '',
        auth_flag: 'N',
        user_phone: window.localStorage.user_phone,
        legal_person: '',
        enterprise_type: '',
        business_address: '',
        registered_place: '',
        organization_code: '',
        registered_capital: '',
        // business_license_num: '',
        bp_class: this.$route.params.bp_class,
      },
      authMsg: {
        auth_person_name: '',
        auth_person_matter: '',
        auth_person_id_card: '',
        auth_cell_phone: '',
        auth_person_position: '',
        auth_id_card_date_from: '', // 授权人身份证有效期从
        auth_id_card_date_to: '', // 授权人身份证有效期到
      },
      idCardFront: '', // 身份证正面图片
      idCardBack: '', // 身份证反面图片
      authidCardFront: '', // 授权人身份证正面图片
      authidCardBack: '', // 授权人身份证反面图片
      licenseImg: '', // 营业执照照片
      laImg: '', // 授权书图片
linxin's avatar
linxin committed
512
      hasMultiRole: false, // 是否有第二个角色
786817560's avatar
786817560 committed
513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587

      idCardFrontUrlFlag: false, // 身份证正面图片,为false则用查询出来的,为true则用拍照出来的
      idCardBackUrlFlag: false, // 身份证反面图片,为false则用查询出来的,为true则用拍照出来的
      authidCardFrontUrlFlag: false, // 授权人身份证正面图片,为false则用查询出来的,为true则用拍照出来的
      authidCardBackUrlFlag: false, // 授权人身份证反面图片,为false则用查询出来的,为true则用拍照出来的
      licenseImgUrlFlag: false, // 营业执照照片,为false则用查询出来的,为true则用拍照出来的
      laImgUrlFlag: false, // 授权书图片,为false则用查询出来的,为true则用拍照出来的
      upload_list: [], // 上传图片列表
      dowload_list: [], // 下载图片列表
      cddItemList: [], // 资料清单列表
      idCardFrontCheck_id: '', // 身份证正面check_id
      idCardBackCheck_id: '', // 身份证背面check_id
      authidCardFrontCheck_id: '', // 授权人身份证正面check_id
      authidCardBackCheck_id: '', // 授权人身份证背面check_id
      bankCardCheck_id: '', // 银行卡check_id
      licenseCheck_id: '', // 营业执照check_id
      laCheck_id: '', // 授权书check_id

      idCardFrontAttachmentId: '', // 身份证正面AttachmentId
      idCardBackAttachmentId: '', // 身份证背面AttachmentId
      authidCardFrontAttachmentId: '', // 授权人身份证正面AttachmentId
      authidCardBackAttachmentId: '', // 授权人身份证背面AttachmentId
      licenseAttachmentId: '', // 营业执照AttachmentId
      laAttachmentId: '', // 授权书AttachmentId
      bankCardImgList: [], // 存上传银行卡图片列表
      idCardFrontEditFlag: false, // 身份证正面修改标识,为true则标识已修改,后续需要重新上传此照片
      idCardBackEditFlag: false, // 身份证正面修改标识,为true则标识已修改,后续需要重新上传此照片
      authidCardFrontEditFlag: false, // 授权人身份证正面修改标识,为true则标识已修改,后续需要重新上传此照片
      authidCardBackEditFlag: false, // 授权人身份证正面修改标识,为true则标识已修改,后续需要重新上传此照片
      licenseEditFlag: false, // 营业执照照片修改标识,为true则标识已修改,后续需要重新上传此照片
      LaEditFlag: false, // 授权书图片修改标识,为true则标识已修改,后续需要重新上传此照片
      isClear: false,
    }
  },
  computed: {},
  watch: {
    'baseInfo.auth_flag' (newVal, oldVal) {
      if (newVal === '是') {
        this.flag = false
      } else if (newVal === '否') {
        this.flag = true
      }
    },
    // 监听客户类型
    'baseInfo.bp_type_n' () {
      let vm = this
      if (vm.baseInfo.bp_type === 'TENANT' || vm.baseInfo.bp_type === 'GUTA') {
        vm.type = '请输入业务经办员工代码'
        vm.typeName = '业务经办人'
        vm.bp_type_flag = true
      } else if (
        vm.baseInfo.bp_type === 'AGENT' ||
          vm.baseInfo.bp_type === 'OFFICE' ||
          vm.baseInfo.bp_type === 'FACTORY'
      ) {
        vm.bp_type_flag = false
        vm.typeName = ''
      }
    },
    typeName () {
      if (this.typeName === '业务经办人') {
        this.bpClass = this.baseInfo.agent_username
        this.bpClass_flag = true
      } else {
        this.bpClass = this.baseInfo.business_license_num
        this.bpClass_flag = false
      }
    },
  },
  created () {},
  beforeRouteEnter (to, from, next) {
    next(vm => {
      vm.getBpType()
      vm.getProvince()
      if (from.fullPath === '/tab/my-info') { /* || from.fullPath === '/margin-first-pay' */
李晓兵's avatar
李晓兵 committed
588
        vm.legal_personMsg = {}
linxin's avatar
linxin committed
589 590 591 592 593
        if (vm.$route.params.status === 'APPROVED') {
          vm.isApproved = true
          window.localStorage.setItem('isApproved', vm.isApproved)
        }
        vm.isMultiRole = vm.$route.params.isMultiRole
linxin's avatar
linxin committed
594
        window.localStorage.setItem('from', true)
李晓兵's avatar
李晓兵 committed
595 596
        vm.baseInfo = {}
        vm.authMsg = {}
linxin's avatar
linxin committed
597 598
        vm.multiBpTypeSelectList = []// 选择的角色
        vm.multiRoleList = []// 查询的角色
786817560's avatar
786817560 committed
599
        vm.bp_id = vm.$route.params.bp_id
李晓兵's avatar
李晓兵 committed
600 601 602 603 604 605 606 607
        vm.idCardFront = '' // 身份证正面图片
        vm.idCardBack = '' // 身份证反面图片
        vm.authidCardFront = '' // 授权人身份证正面图片
        vm.authidCardBack = '' // 授权人身份证反面图片
        vm.licenseImg = '' // 营业执照照片
        vm.laImg = '' // 授权书图片
        vm.upload_list = [] // 上传图片列表
        vm.dowload_list = [] // 下载图片列表
786817560's avatar
786817560 committed
608
        vm.from = true
李晓兵's avatar
李晓兵 committed
609 610 611 612 613 614 615 616 617 618 619 620 621 622 623

        vm.idCardFrontEditFlag = false // 身份证正面修改标识,为true则标识已修改,后续需要重新上传此照片
        vm.idCardBackEditFlag = false // 身份证正面修改标识,为true则标识已修改,后续需要重新上传此照片
        vm.authidCardFrontEditFlag = false // 授权人身份证正面修改标识,为true则标识已修改,后续需要重新上传此照片
        vm.authidCardBackEditFlag = false // 授权人身份证正面修改标识,为true则标识已修改,后续需要重新上传此照片
        vm.licenseEditFlag = false // 营业执照照片修改标识,为true则标识已修改,后续需要重新上传此照片
        vm.LaEditFlag = false // 授权书图片修改标识,为true则标识已修改,后续需要重新上传此照片
        vm.isClear = false

        vm.idCardFrontUrlFlag = false // 身份证正面图片,为false则用查询出来的,为true则用拍照出来的
        vm.idCardBackUrlFlag = false // 身份证反面图片,为false则用查询出来的,为true则用拍照出来的
        vm.authidCardFrontUrlFlag = false // 授权人身份证正面图片,为false则用查询出来的,为true则用拍照出来的
        vm.authidCardBackUrlFlag = false // 授权人身份证反面图片,为false则用查询出来的,为true则用拍照出来的
        vm.licenseImgUrlFlag = false // 营业执照照片,为false则用查询出来的,为true则用拍照出来的
        vm.laImgUrlFlag = false // 授权书图片,为false则用查询出来的,为true则用拍照出来的
786817560's avatar
786817560 committed
624
        vm.getbaseInfo()
linxin's avatar
linxin committed
625
        vm.getMultipleRole()// 获取第二角色
李晓兵's avatar
李晓兵 committed
626
      } else if (from.name === 'UserBind') {
linxin's avatar
linxin committed
627
        window.localStorage.setItem('from', false)
李晓兵's avatar
李晓兵 committed
628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694
        vm.multiBpType = {
          bp_type_n: '',
          bp_type: '',
        },
        vm.legal_personMsg = {
          id_card_no: null,
          bp_legal_name: '',
          cell_phone: window.localStorage.getItem('user_phone'),
          living_address: '',
          id_card_date_from: '', // 法定代表人身份证有效期从
          id_card_date_to: '', // 法定代表人身份证有效期到
        }
        vm.baseInfo = {
          agent_username: '',
          district_id: '',
          district_name: '',
          province_name: '',
          province_id: '',
          city_name: '',
          city_id: '',
          bp_type: '',
          bp_type_n: '',
          bp_name: '',
          phone: '',
          auth_flag: 'N',
          user_phone: window.localStorage.user_phone,
          legal_person: '',
          enterprise_type: '',
          business_address: '',
          registered_place: '',
          organization_code: '',
          registered_capital: '',
          // business_license_num: '',
          bp_class: vm.$route.params.bp_class,
        }
        vm.authMsg = {
          auth_person_name: '',
          auth_person_matter: '',
          auth_person_id_card: '',
          auth_cell_phone: '',
          auth_person_position: '',
          auth_id_card_date_from: '', // 授权人身份证有效期从
          auth_id_card_date_to: '', // 授权人身份证有效期到
        }
        vm.idCardFront = '' // 身份证正面图片
        vm.idCardBack = '' // 身份证反面图片
        vm.authidCardFront = '' // 授权人身份证正面图片
        vm.authidCardBack = '' // 授权人身份证反面图片
        vm.licenseImg = '' // 营业执照照片
        vm.laImg = '' // 授权书图片
        vm.upload_list = [] // 上传图片列表
        vm.dowload_list = [] // 下载图片列表

        vm.idCardFrontEditFlag = false // 身份证正面修改标识,为true则标识已修改,后续需要重新上传此照片
        vm.idCardBackEditFlag = false // 身份证正面修改标识,为true则标识已修改,后续需要重新上传此照片
        vm.authidCardFrontEditFlag = false // 授权人身份证正面修改标识,为true则标识已修改,后续需要重新上传此照片
        vm.authidCardBackEditFlag = false // 授权人身份证正面修改标识,为true则标识已修改,后续需要重新上传此照片
        vm.licenseEditFlag = false // 营业执照照片修改标识,为true则标识已修改,后续需要重新上传此照片
        vm.LaEditFlag = false // 授权书图片修改标识,为true则标识已修改,后续需要重新上传此照片
        vm.isClear = false

        vm.idCardFrontUrlFlag = false // 身份证正面图片,为false则用查询出来的,为true则用拍照出来的
        vm.idCardBackUrlFlag = false // 身份证反面图片,为false则用查询出来的,为true则用拍照出来的
        vm.authidCardFrontUrlFlag = false // 授权人身份证正面图片,为false则用查询出来的,为true则用拍照出来的
        vm.authidCardBackUrlFlag = false // 授权人身份证反面图片,为false则用查询出来的,为true则用拍照出来的
        vm.licenseImgUrlFlag = false // 营业执照照片,为false则用查询出来的,为true则用拍照出来的
        vm.laImgUrlFlag = false // 授权书图片,为false则用查询出来的,为true则用拍照出来的
786817560's avatar
786817560 committed
695 696 697 698
      }
    })
    next()
  },
李晓兵's avatar
李晓兵 committed
699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742
  /*  beforeRouteEnter (to, from, next) {
    next(vm => {

      vm.getBpType()
      vm.getProvince()
      if (vm.$route.params.status === 'APPROVED') {
        vm.isApproved = true
        window.localStorage.setItem('isApproved', vm.isApproved)
      }
      if (from.fullPath === '/tab/my-info') { /!* || from.fullPath === '/margin-first-pay' *!/
        vm.legal_personMsg = {}
        vm.baseInfo = {}
        vm.bank_lists = {}
        vm.authMsg = {}
        vm.idCardFront = '' // 身份证正面图片
        vm.idCardBack = '' // 身份证反面图片
        vm.authidCardFront = '' // 授权人身份证正面图片
        vm.authidCardBack = '' // 授权人身份证反面图片
        vm.licenseImg = '' // 营业执照照片
        vm.laImg = '' // 授权书图片
        vm.upload_list = [] // 上传图片列表
        vm.dowload_list = [] // 下载图片列表

        vm.idCardFrontEditFlag = false // 身份证正面修改标识,为true则标识已修改,后续需要重新上传此照片
        vm.idCardBackEditFlag = false // 身份证正面修改标识,为true则标识已修改,后续需要重新上传此照片
        vm.authidCardFrontEditFlag = false // 授权人身份证正面修改标识,为true则标识已修改,后续需要重新上传此照片
        vm.authidCardBackEditFlag = false // 授权人身份证正面修改标识,为true则标识已修改,后续需要重新上传此照片
        vm.licenseEditFlag = false // 营业执照照片修改标识,为true则标识已修改,后续需要重新上传此照片
        vm.LaEditFlag = false // 授权书图片修改标识,为true则标识已修改,后续需要重新上传此照片
        vm.isClear = false

        vm.idCardFrontUrlFlag = false // 身份证正面图片,为false则用查询出来的,为true则用拍照出来的
        vm.idCardBackUrlFlag = false // 身份证反面图片,为false则用查询出来的,为true则用拍照出来的
        vm.authidCardFrontUrlFlag = false // 授权人身份证正面图片,为false则用查询出来的,为true则用拍照出来的
        vm.authidCardBackUrlFlag = false // 授权人身份证反面图片,为false则用查询出来的,为true则用拍照出来的
        vm.licenseImgUrlFlag = false // 营业执照照片,为false则用查询出来的,为true则用拍照出来的
        vm.laImgUrlFlag = false // 授权书图片,为false则用查询出来的,为true则用拍照出来的
        vm.bp_id = vm.$route.params.bp_id
        vm.from = true
        vm.getbaseInfo()
      }
    })
    next()
  }, */
786817560's avatar
786817560 committed
743
  methods: {
linxin's avatar
linxin committed
744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767
    async getMultipleRole () {
      let vm = this
      let url = process.env.basePath + 'bp_role_query'
      let flag = vm.checkHasmultiple()
      let param = {
        master: {
          bp_id: window.localStorage.getItem('bp_id'),
          bp_type: window.localStorage.getItem('bp_type'),
        },
      }
      if (flag) {
        vm.hlsHttp.post(url, param).then(function (res) {
          if (res.result === 'S') {
            vm.multiRoleList = res.lists
            if (res.lists.length === 0 || res.lists.length === 1) {
              vm.hasMultiRole = false
            } else if (res.lists.length === 2) {
              vm.hasMultiRole = true
            }
          }
        })
      }
    },
    async checkHasmultiple () {
linxin's avatar
linxin committed
768 769 770 771 772
      let vm = this
      let url = process.env.basePath + 'bp_role_check'
      let param = {
        bp_id: window.localStorage.getItem('bp_id'),
      }
linxin's avatar
linxin committed
773 774 775 776 777 778 779 780
      let res = await vm.hlsHttp.post(url, param)
      if (res.result === 'S') {
        // vm.hasMultiRole = true
        return true
      } else {
        vm.hasMultiRole = false
        return false
      }
linxin's avatar
linxin committed
781
    },
李晓兵's avatar
李晓兵 committed
782 783 784
    timeFormat (str) {
      return `${str.substring(0, 4)}-${str.substring(4, 6)}-${str.substring(6)}`
    },
linxin's avatar
linxin committed
785 786 787 788 789 790 791 792
    deleteBP (e) {
      let deleteIndex
      this.multiBpTypeSelectList.forEach((i, index, arr) => {
        if (arr[index].bp_type.indexOf(e.bp_type) !== -1) {
          deleteIndex = index
        }
      })
      this.multiBpTypeSelectList.splice(deleteIndex, 1)
786817560's avatar
786817560 committed
793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818
      this.isAddNewType = false
    },
    selectIdMultiType (e) {
      let vm = this
      let List
      if (vm.baseInfo.bp_type === 'TENANT') {
        List = vm.typeList.filter(i => {
          return i.code === 'GUTA'
        })
      } else if (vm.baseInfo.bp_type === 'GUTA') {
        List = vm.typeList.filter(i => {
          return i.code === 'TENANT'
        })
      }
      vm.hlsPopup.selectList({
        list: List,
        code: 'bp_type',
        object: {},
        returnItem: function (index, obj) {
          vm.multiBpType.bp_type = obj.bp_type
          vm.multiBpType.bp_type_n = obj.bp_type_n
          vm.isAddNewType = true
          vm.isSelected = true
        },
      })
    },
linxin's avatar
linxin committed
819 820 821 822 823 824 825 826 827 828
    // changeUndertake () {
    //   this.$router.push({
    //     name: 'MarginFirstPay',
    //     params: {
    //       bp_id: this.$route.params.bp_id,
    //       status: this.$route.params.status,
    //       isAGENT: this.isAGENT,
    //     },
    //   })
    // },
786817560's avatar
786817560 committed
829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885
    addRows (e) {
      let addNum = parseInt(e.length / 16)
      if (addNum === 0) {
        this.$refs.myTestarea.rows = 1
      } else if (addNum >= addNum - 1 && addNum < addNum + 1) {
        this.$refs.myTestarea.rows = addNum + 1
      }
    },
    addRowsLive (e) {
      let addNum = parseInt(e.length / 16)
      if (addNum === 0) {
        this.$refs.myTestareaLive.rows = 1
      } else if (addNum >= addNum - 1 && addNum < addNum + 1) {
        this.$refs.myTestareaLive.rows = addNum + 1
      }
    },
    addAddressRows (e) {
      let addNum = parseInt(e.length / 16)
      if (addNum === 0) {
        this.$refs.address.rows = 1
      } else if (addNum >= addNum - 1 && addNum < addNum + 1) {
        this.$refs.address.rows = addNum + 1
      }
    },
    handSubmit () {
      let bp_id = this.from ? this.$route.params.bp_id : this.bp_id
      if (bp_id) {
        this.hlsPopup.showConfirm({
          title: '提示',
          content: '您确认提交吗?',
          onConfirm: data => {
            console.log(data)
            if (data) {
              let url = $config.basePath + 'bp_bind_submit'
              let param = {
                master: {
                  // bp_id: window.localStorage.getItem('user_id'),
                  bp_id: this.from ? this.$route.params.bp_id : this.bp_id,
                  company_id: '2145',
                },
              }
              let vm = this
              this.hlsHttp.post(url, param).then(function (res) {
                if (res.result === 'S') {
                  vm.hlsPopup.showSuccess('提交成功')
                  vm.$router.push({
                    name: 'HomePage',
                  })
                }
              })
            }
          },
        })
      } else {
        this.hlsPopup.showLongCenter('请先保存!')
      }
    },
linxin's avatar
linxin committed
886 887 888 889 890 891 892
    // 基本信息保存前校验
    bindCheck () {
      let vm = this
      var business_num = ''
      if (vm.baseInfo.bp_type === 'TENANT' || vm.baseInfo.bp_type === 'GUTA') {
        business_num = vm.baseInfo.agent_username
      }
linxin's avatar
linxin committed
893
      window.localStorage.setItem('business_num', business_num)
linxin's avatar
linxin committed
894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917
      let url = process.env.basePath + 'bp_bind_check'
      let param = {
        bp_class: 'ORG',
        bp_type: vm.baseInfo.bp_type,
        business_num: business_num,
      }
      vm.hlsPopup.showLoading('正在校验数据有效性')
      vm.hlsHttp.post(url, param).then(function (res) {
        vm.hlsPopup.hideLoading()
        if (res.result === 'S') {
          vm.$router.push({
            name: 'Invoice',
            params: {
              bp_id: vm.bp_id,
              organization_code: vm.baseInfo.organization_code,
              from: vm.from,
              bp_name: vm.baseInfo.bp_name,
            },
          })
        } else {
          hlsPopup.showError(res.message)
        }
      })
    },
786817560's avatar
786817560 committed
918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953
    // 校验手机号
    phoneCheck (phone) {
      if (!hlsUtil.phoneNumber(phone) && !hlsUtil.phoneNumber86(phone)) {
        hlsPopup.showLongCenter('请输入正确的手机号')
      }
    },
    // 校验固定电话
    fixedPhoneCheck (phone) {
      let reg = /^((0\d{2,3})-)(\d{7,8})(-(\d{3,}))?$/
      if (!reg.test(phone)) {
        hlsPopup.showLongCenter('请输入正确的固定电话')
      }
    },

    verified () {
      window.localStorage.setItem('authFlag', this.flag)
      if (!this.flag) { // 已授权
        this.baseInfo.auth_flag = 'Y'
        this.lastInfo = {...this.baseInfo, ...this.legal_personMsg, ...this.authMsg}
        this.saveInfo = {...this.lastInfo}
      } else { // 未授权
        this.baseInfo.auth_flag = 'N'
        this.lastInfo = {...this.baseInfo, ...this.legal_personMsg}
        this.saveInfo = {
          ...this.lastInfo,
          ...this.authMsg,
        }
      }
      let vm = this

      // 校验基本信息
      if (this.bpClass_flag) { // 业务经办人
        console.log(this.lastInfo)
        delete this.lastInfo.business_license_num
        delete this.lastInfo.id_card_name
        for (var key in vm.lastInfo) {
linxin's avatar
linxin committed
954
          if (!vm.lastInfo[key] && key !== 'phone') {
786817560's avatar
786817560 committed
955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000
            switch (key) {
              case 'province_id':
                vm.hlsPopup.showLongCenter('请选择省份')
                break
              case 'city_id':
                vm.hlsPopup.showLongCenter('请选择城市')
                break
              case 'district_id':
                vm.hlsPopup.showLongCenter('请选择区县')
                break
              case 'bp_type':
                vm.hlsPopup.showLongCenter('客户类型未填写')
                break
              case 'agent_username':
                vm.hlsPopup.showLongCenter('业务经办员工代码未填写')
                break
              case 'bp_name':
                vm.hlsPopup.showLongCenter('公司名称未填写')
                break
              case 'enterprise_type':
                vm.hlsPopup.showLongCenter('企业类型未填写')
                break
              case 'organization_code':
                vm.hlsPopup.showLongCenter('统一社会信用代码未填写')
                break
              case 'registered_capital':
                vm.hlsPopup.showLongCenter('注册资本未填写')
                break
              case 'legal_person':
                vm.hlsPopup.showLongCenter('法定代表人未填写')
                break
              case 'registered_place':
                vm.hlsPopup.showLongCenter('注册地址未填写')
                break
              case 'business_address':
                vm.hlsPopup.showLongCenter('经营地址未填写')
                break
              case 'id_card_no':
                vm.hlsPopup.showLongCenter('身份证未填写')
                break
              case 'cell_phone':
                vm.hlsPopup.showLongCenter('手机号未填写')
                break
              case 'living_address':
                vm.hlsPopup.showLongCenter('联系地址未填写')
                break
李晓兵's avatar
李晓兵 committed
1001 1002 1003
              case 'bp_legal_name':
                vm.hlsPopup.showLongCenter('法定代表人姓名未填写')
                break
786817560's avatar
786817560 committed
1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047
              case 'id_card_date_from':
                vm.hlsPopup.showLongCenter('身份证有效期从未填写')
                break
              case 'id_card_date_to':
                vm.hlsPopup.showLongCenter('身份证有效期到未填写')
                break
              case 'auth_person_name':
                vm.hlsPopup.showLongCenter('授权人姓名未填写')
                break
              case 'auth_person_id_card':
                vm.hlsPopup.showLongCenter('授权人身份证号未填写')
                break
              case 'auth_cell_phone':
                vm.hlsPopup.showLongCenter('授权人手机号未填写')
                break
              case 'auth_id_card_date_from':
                vm.hlsPopup.showLongCenter('授权人身份证有效期从未填写')
                break
              case 'auth_id_card_date_to':
                vm.hlsPopup.showLongCenter('授权人身份证有效期到未填写')
                break
              case 'user_phone':
                vm.hlsPopup.showLongCenter('您还未登录')
                break
              case 'auth_person_position':
                vm.hlsPopup.showLongCenter('公司职务未填写')
                break
              case 'auth_person_matter':
                vm.hlsPopup.showLongCenter('授权事项未填写')
                break
            }
            // vm.hlsPopup.showLongCenter('基本信息不完整!')
            vm.msg_flag = false
            return
          } else {
            vm.msg_flag = true
          }
        }
        this.lastInfo.business_license_num = ''
        this.lastInfo.id_card_name = ''
      } else { // 非业务经办人
        delete this.lastInfo.agent_username
        delete this.lastInfo.id_card_name
        for (var key1 in vm.lastInfo) {
linxin's avatar
linxin committed
1048
          if (!vm.lastInfo[key1] && key1 !== 'phone') {
786817560's avatar
786817560 committed
1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092
            console.log('key', key1)
            switch (key1) {
              case 'bp_type':
                vm.hlsPopup.showLongCenter('客户类型未填写')
                break
              case 'province_id':
                vm.hlsPopup.showLongCenter('请选择省份')
                break
              case 'city_id':
                vm.hlsPopup.showLongCenter('请选择城市')
                break
              case 'district_id':
                vm.hlsPopup.showLongCenter('请选择区县')
                break
              case 'bp_name':
                vm.hlsPopup.showLongCenter('公司名称未填写')
                break
              case 'enterprise_type':
                vm.hlsPopup.showLongCenter('企业类型未填写')
                break
              case 'organization_code':
                vm.hlsPopup.showLongCenter('统一社会信用代码未填写')
                break
              case 'registered_capital':
                vm.hlsPopup.showLongCenter('注册资本未填写')
                break
              case 'legal_person':
                vm.hlsPopup.showLongCenter('法定代表人未填写')
                break
              case 'registered_place':
                vm.hlsPopup.showLongCenter('注册地址未填写')
                break
              case 'business_address':
                vm.hlsPopup.showLongCenter('经营地址未填写')
                break
              case 'id_card_no':
                vm.hlsPopup.showLongCenter('身份证未填写')
                break
              case 'cell_phone':
                vm.hlsPopup.showLongCenter('手机号未填写')
                break
              case 'living_address':
                vm.hlsPopup.showLongCenter('联系地址未填写')
                break
李晓兵's avatar
李晓兵 committed
1093 1094 1095 1096 1097 1098 1099 1100 1101
              case 'bp_legal_name':
                vm.hlsPopup.showLongCenter('法定代表人姓名未填写')
                break
              case 'id_card_date_from':
                vm.hlsPopup.showLongCenter('身份证有效期从未填写')
                break
              case 'id_card_date_to':
                vm.hlsPopup.showLongCenter('身份证有效期到未填写')
                break
786817560's avatar
786817560 committed
1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156
              case 'auth_person_name':
                vm.hlsPopup.showLongCenter('授权人姓名未填写')
                break
              case 'auth_person_id_card':
                vm.hlsPopup.showLongCenter('授权人身份证号未填写')
                break
              case 'auth_cell_phone':
                vm.hlsPopup.showLongCenter('授权人手机号未填写')
                break
              case 'auth_id_card_date_from':
                vm.hlsPopup.showLongCenter('授权人身份证有效期从未填写')
                break
              case 'auth_id_card_date_to':
                vm.hlsPopup.showLongCenter('授权人身份证有效期到未填写')
                break
              case 'user_phone':
                vm.hlsPopup.showLongCenter('您还未登录')
                break
              case 'auth_person_position':
                vm.hlsPopup.showLongCenter('公司职务未填写')
                break
              case 'auth_person_matter':
                vm.hlsPopup.showLongCenter('授权事项未填写')
                break
            }
            // vm.hlsPopup.showLongCenter('基本信息不完整!')
            vm.msg_flag = false
            return
          } else {
            vm.msg_flag = true
          }
        }
        this.lastInfo.agent_username = ''
        this.lastInfo.id_card_name = ''
      }

      if (vm.hlsUtil.isCardID(vm.saveInfo.id_card_no)) {
        vm.msg_flag = false
        vm.hlsPopup.showLongCenter('身份证不正确')
      }
      if (!vm.flag) {
        if (vm.hlsUtil.isCardID(vm.saveInfo.auth_person_id_card)) {
          vm.msg_flag = false
          vm.hlsPopup.showLongCenter('授权人身份证不正确')
        }
      }

      if (vm.msg_flag) {
        vm.dowload_list = [] // 保存之前将图片下载列表清空,防止出现重复的图片
        vm.upload_list = [] // 保存之前将待上传列表清空,防止出现重复的图片
        vm.hlsPopup.showLoading('请稍后')
        let url = $config.basePath + 'bp_org_bind_save'
        let param = {
          master: vm.saveInfo,
        }
786817560's avatar
786817560 committed
1157
        vm.hlsPopup.showLoading('请稍候')
786817560's avatar
786817560 committed
1158 1159 1160 1161 1162
        vm.hlsHttp.post(url, param).then(function (res) {
          vm.hlsPopup.hideLoading()
          if (res.result === 'S') {
            // vm.hlsPopup.showSuccess('保存成功,请去维护附件信息')
            vm.bp_id = res.bp_id
linxin's avatar
linxin committed
1163
            vm.bindCheck()
786817560's avatar
786817560 committed
1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286
            // 查询资料清单
            vm.loadItemList()
          } else {
            vm.hlsPopup.showLongCenter(res.message)
          }
        })
      }
    },
    // 授权切换
    authorizeChange () {
      this.flag = !this.flag
      if (this.flag) {
        this.auth_flag = '未授权'
      } else {
        this.auth_flag = '已授权'
      }
    },
    // 选择省份
    selectProvince (e) {
      let vm = this
      vm.hlsPopup.selectList({
        list: vm.provinceList,
        code: 'bp_type',
        object: {},
        returnItem: function (index, obj) {
          vm.baseInfo.province_id = obj.bp_type
          vm.baseInfo.province_name = obj.bp_type_n
          vm.getCity()
        },
      })
    },
    // 选择城市
    selectCity (e) {
      let vm = this
      if (vm.baseInfo.province_id === '') {
        hlsPopup.showLongCenter('请先选择省份')
      }
      vm.hlsPopup.selectList({
        list: vm.cityList,
        code: 'bp_type',
        object: {},
        returnItem: function (index, obj) {
          vm.baseInfo.city_id = obj.bp_type
          vm.baseInfo.city_name = obj.bp_type_n
          vm.getDistrict()
        },
      })
    },
    // 选择区县
    selectDistrict (e) {
      let vm = this
      if (vm.baseInfo.city_id === '' || vm.baseInfo.province_id === '') {
        hlsPopup.showLongCenter('请先选择城市')
      }
      vm.hlsPopup.selectList({
        list: vm.districtList,
        code: 'bp_type',
        object: {},
        returnItem: function (index, obj) {
          vm.baseInfo.district_id = obj.bp_type
          vm.baseInfo.district_name = obj.bp_type_n
        },
      })
    },
    // 省份查询
    getProvince () {
      let vm = this
      let url = process.env.basePath + 'fnd_province_query'
      let param = {}
      vm.hlsPopup.showLoading('请稍候')
      vm.hlsHttp.post(url, param).then(function (res) {
        vm.hlsPopup.hideLoading()
        if (res.result === 'S') {
          vm.provinceList = res.lists.map(item => {
            return {
              code: item.province_id,
              code_name: item.province_name,
            }
          })
        }
      })
    },
    // 城市查询
    getCity () {
      let vm = this
      let url = process.env.basePath + 'fnd_city_query'
      let param = {
        province_id: vm.baseInfo.province_id,
      }
      // vm.hlsPopup.showLoading('请稍候')
      vm.hlsHttp.post(url, param).then(function (res) {
        // vm.hlsPopup.hideLoading()
        if (res.result === 'S') {
          vm.cityList = res.lists.map(item => {
            return {
              code: item.city_id,
              code_name: item.city_name,
            }
          })
        }
      })
    },
    // 区县查询
    getDistrict () {
      let vm = this
      let url = process.env.basePath + 'fnd_district_query'
      let param = {
        city_id: vm.baseInfo.city_id,
      }
      // vm.hlsPopup.showLoading('请稍候')
      vm.hlsHttp.post(url, param).then(function (res) {
        // vm.hlsPopup.hideLoading()
        if (res.result === 'S') {
          vm.districtList = res.lists.map(item => {
            return {
              code: item.district_id,
              code_name: item.district_name,
            }
          })
        }
      })
    },
    // 客户类型下拉框
linxin's avatar
linxin committed
1287
    selectIdType () {
786817560's avatar
786817560 committed
1288
      let vm = this
linxin's avatar
linxin committed
1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302
      let List
      if (vm.baseInfo.bp_type === 'TENANT') {
        List = vm.typeList.filter(i => {
          return i.code === 'GUTA' || i.code === 'AGENT'
        })
      } else if (vm.baseInfo.bp_type === 'GUTA') {
        List = vm.typeList.filter(i => {
          return i.code === 'TENANT' || i.code === 'AGENT'
        })
      } else if (vm.baseInfo.bp_type === 'AGENT') {
        List = vm.typeList.filter(i => {
          return i.code === 'TENANT' || i.code === 'GUTA'
        })
      }
786817560's avatar
786817560 committed
1303
      vm.hlsPopup.selectList({
linxin's avatar
linxin committed
1304
        list: List,
786817560's avatar
786817560 committed
1305 1306 1307
        code: 'bp_type',
        object: {},
        returnItem: function (index, obj) {
linxin's avatar
linxin committed
1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333
          vm.multiBpType.bp_type = obj.bp_type
          vm.multiBpType.bp_type_n = obj.bp_type_n
          let selectList = false
          let queryList = false
          let baseInfo = false
          vm.multiBpTypeSelectList.forEach((item, index, arr) => {
            if (item.bp_type === vm.multiBpType.bp_type) {
              selectList = true
            }
          })
          vm.multiRoleList.forEach((item, index, arr) => {
            if (item.bp_type === vm.multiBpType.bp_type) {
              queryList = true
            }
          })
          if (vm.baseInfo.bp_type === vm.multiBpType.bp_type) {
            baseInfo = true
          }
          if (baseInfo || queryList || selectList) {
            hlsPopup.showLongCenter('您已经添加了该角色')
            vm.isAddNewType = false
            vm.isSelected = false
          } else {
            vm.multiBpTypeSelectList.push(vm.multiBpType)
            vm.isAddNewType = true
            vm.isSelected = true
786817560's avatar
786817560 committed
1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399
          }
        },
      })
    },
    fileSuccess (fileList, result) {
      this.fileList = fileList
      this.fileList.forEach((itemFile, index) => {
        if (
          result.response &&
            itemFile.file &&
            !itemFile.attachment_id &&
            result.response.fileName === itemFile.file.name
        ) {
          itemFile.attachment_id = result.response.attachment_id
        }
      })
    },

    //  客户类型请求
    getBpType () {
      let vm = this
      let url = process.env.basePath + 'bp_type_select'
      let param = {}
      vm.hlsPopup.showLoading('请稍候')
      vm.hlsHttp.post(url, param).then(function (res) {
        vm.hlsPopup.hideLoading()
        if (res.result === 'S') {
          console.log('客户类型。。。。。。', res.lists)
          vm.typeList = res.lists
            .filter(item => item.bp_type !== 'OFFICE')
            .map(item => {
              return {
                code: item.bp_type,
                code_name: item.bp_type_n,
              }
            })
            // vm.typeList = res.lists.map(item => {
            //   return {
            //     code: item.bp_type,
            //     code_name: item.bp_type_n,
            //   }
            // })
        }
      })
    },
    getbaseInfo () {
      let vm = this
      let url = process.env.basePath + 'bp_org_info_query'
      let param = {
        bp_id: vm.$route.params.bp_id,
      }
      hlsPopup.showLoading('请稍候')
      vm.$post(url, param).then(function (res) {
        vm.hlsPopup.hideLoading()
        if (res.result === 'S') {
          delete res.info.bp_id
          vm.baseInfo = {...res.info}
          vm.authMsg.auth_person_name = res.info.auth_person_name
          vm.authMsg.auth_person_matter = res.info.auth_person_matter
          vm.authMsg.auth_person_id_card = res.info.auth_person_id_card
          vm.authMsg.auth_person_position = res.info.auth_person_position
          vm.authMsg.auth_id_card_date_from = res.info.auth_id_card_date_from
          vm.authMsg.auth_id_card_date_to = res.info.auth_id_card_date_to
          vm.authMsg.auth_cell_phone = res.info.auth_cell_phone
          // delete res.info.agent_username
          vm.legal_personMsg.id_card_no = res.info.id_card_no
李晓兵's avatar
李晓兵 committed
1400
          vm.legal_personMsg.bp_legal_name = res.info.bp_legal_name
786817560's avatar
786817560 committed
1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418
          vm.legal_personMsg.cell_phone = res.info.cell_phone
          vm.legal_personMsg.living_address = res.info.living_address
          vm.legal_personMsg.id_card_date_from = res.info.id_card_date_from
          vm.legal_personMsg.id_card_date_to = res.info.id_card_date_to
          Object.assign(vm.saveInfo, res.info)
          vm.addRows(vm.baseInfo.registered_place)
          vm.addRowsLive(vm.baseInfo.business_address)
          if (vm.baseInfo.auth_flag === '是') {
            vm.flag = false
          } else if (vm.baseInfo.auth_flag === '否') {
            vm.flag = true
          }
          vm.loadItemList()// 附件查询
        } else {
          hlsPopup.showLongCenter(res.message)
        }
      })
    },
linxin's avatar
linxin committed
1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433
    addNewRole () { // 增加角色
      let vm = this
      let url = process.env.basePath + 'bp_type_save'
      let param = {
        master: {
          bp_id: window.localStorage.getItem('bp_id'),
          bp_type: vm.multiBpType.bp_type,
        },
      }
      hlsPopup.showLoading('请稍候')
      vm.$post(url, param).then(function (res) {
        vm.hlsPopup.hideLoading()
        if (res.result === 'S') {
          hlsPopup.showLongCenter('新增成功')
          vm.isAddNewType = false
linxin's avatar
linxin committed
1434 1435
          let item = vm.multiBpTypeSelectList.pop()
          vm.multiRoleList.push(item)
linxin's avatar
linxin committed
1436 1437 1438 1439 1440
        } else {
          hlsPopup.showLongCenter(res.message)
        }
      })
    },
786817560's avatar
786817560 committed
1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520
    // ocr识别入口
    ocrShow (ocrType, type) {
      let vm = this
      hlsPopup.showActionSheet({
        titleText: '请选择照片',
        buttonArray: ['拍照', '从相册取'],
        callback: index => {
          if (index === 0) {
            vm.openCamera(ocrType, type)
          } else {
            vm.takePicture(ocrType, type)
          }
        },
      })
    },
    openCamera (ocrType, type) {
      let vm = this
      let cameraoptions = {
        quality: 60,
        width: 1843,
        height: 1382,
      }
      let success = function (imgdata) {
        if (!imgdata) {
          hlsPopup.showLongCenter('请拍照')
        } else {
          if (ocrType === 'idCard') {
            type === 'front' ? (vm.idCardFront = imgdata, vm.idCardIdentify(imgdata, 'idCard'), vm.idCardFrontEditFlag = true) : (vm.idCardBack = imgdata, vm.idCardBackIdentify(imgdata, 'idCard'), vm.idCardBackEditFlag = true)
          } else if (ocrType === 'authidCard') {
            type === 'front' ? (vm.authidCardFront = imgdata, vm.idCardIdentify(imgdata, 'authidCard'), vm.authidCardFrontEditFlag = true) : (vm.authidCardBack = imgdata, vm.idCardBackIdentify(imgdata, 'authidCard'), vm.authidCardBackEditFlag = true)
          } else if (ocrType === 'license') {
            vm.licenseEditFlag = true // 营业执照图片状态已修改
            vm.licenseImg = imgdata
            vm.licenseIdentify(imgdata)
          }
        }
      }
      let error = function () {
        hlsPopup.showLongCenter('请拍照')
      }
      hlsUtil.openCamera(cameraoptions, success, error)
    },
    takePicture (ocrType, type) {
      let vm = this
      var cameraoptions = {
        quality: 70,
        width: 1843,
        height: 1382,
        maxCount: 1,
      }
      let success = function (imgUrl) {
        if (imgUrl.length === 0) {
          hlsPopup.showLongCenter('请选择一张图片')
        } else {
          if (ocrType === 'idCard') {
            type === 'front' ? (vm.idCardFront = imgUrl[0], vm.idCardIdentify(imgUrl[0], 'idCard'), vm.idCardFrontEditFlag = true) : (vm.idCardBack = imgUrl[0], vm.idCardBackIdentify(imgUrl[0], 'idCard'), vm.idCardBackEditFlag = true)
          } else if (ocrType === 'authidCard') {
            type === 'front' ? (vm.authidCardFront = imgUrl[0], vm.idCardIdentify(imgUrl[0], 'authidCard'), vm.authidCardFrontEditFlag = true) : (vm.authidCardBack = imgUrl[0], vm.idCardBackIdentify(imgUrl[0], 'authidCard'), vm.authidCardBackEditFlag = true)
          } else if (ocrType === 'license') {
            vm.licenseEditFlag = true // 营业执照图片状态已修改
            vm.licenseImg = imgUrl[0]
            vm.licenseIdentify(imgUrl[0])
          }
        }
      }
      let error = function () {
        hlsPopup.showLongCenter(error)
      }
      vm.hlsUtil.takePicture(cameraoptions, success, error)
    },
    // 身份证识别
    idCardIdentify (fileUrl, cardType) {
      let vm = this
      hlsPopup.showLoading('正在识别')
      let url = process.env.ocrPath + '/baidu/ocr/idCard'
      hlsUtil.baiduOcr(fileUrl, url, function (res) {
        hlsPopup.hideLoading()
        let result = res.result.words_result
        if (cardType === 'idCard') { // 法定代表人
          // 未授权 姓名,身份证号
李晓兵's avatar
李晓兵 committed
1521
          vm.legal_personMsg.bp_legal_name = result.姓名.words
786817560's avatar
786817560 committed
1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540
          vm.legal_personMsg.id_card_no = result.公民身份号码.words
          vm.legal_personMsg.living_address = result.住址.words // 联系地址默认为户籍地址,支持修改
        } else { // 授权人
          // 已授权  姓名,身份证号
          vm.authMsg.auth_person_name = result.姓名.words
          vm.authMsg.auth_person_id_card = result.公民身份号码.words
        }
      })
    },
    // 身份证背面识别
    idCardBackIdentify (fileUrl, cardType) {
      let vm = this
      hlsPopup.showLoading('正在识别')
      let url = process.env.ocrPath + '/baidu/ocr/idCardBack'
      hlsUtil.baiduOcr(fileUrl, url, function (res) {
        hlsPopup.hideLoading()
        let result = res.result.words_result
        if (cardType === 'idCard') { // 法定代表人
          // 未授权 身份证有效期从,身份证有效期到
李晓兵's avatar
李晓兵 committed
1541 1542
          vm.legal_personMsg.id_card_date_from = vm.timeFormat(result.签发日期.words)
          vm.legal_personMsg.id_card_date_to = vm.timeFormat(result.失效日期.words)
786817560's avatar
786817560 committed
1543 1544
        } else {
          // 已授权  身份证有效期从,身份证有效期到
李晓兵's avatar
李晓兵 committed
1545 1546
          vm.authMsg.auth_id_card_date_from = vm.timeFormat(result.签发日期.words)
          vm.authMsg.auth_id_card_date_to = vm.timeFormat(result.失效日期.words)
786817560's avatar
786817560 committed
1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628
        }
      })
    },
    // 营业执照识别
    licenseIdentify (fileUrl) {
      let vm = this
      hlsPopup.showLoading('正在识别')
      let url = process.env.ocrPath + '/baidu/ocr/businessLicense'
      hlsUtil.baiduOcr(fileUrl, url, function (res) {
        hlsPopup.hideLoading()
        let result = res.result.words_result
        vm.baseInfo.bp_name = result.单位名称.words
        vm.baseInfo.enterprise_type = result.类型.words
        vm.baseInfo.registered_capital = result.注册资本.words
        vm.baseInfo.legal_person = result.法人.words
        vm.baseInfo.registered_place = result.地址.words
        vm.baseInfo.organization_code = result.社会信用代码.words
        vm.baseInfo.business_address = vm.baseInfo.registered_place // 经营地址默认为注册地址,支持修改
      })
    },
    load_picture (check_id, index, cdd_item) {
      let vm = this
      let url = process.env.basePath + 'attachment_list_query' + '&index' + index // 附件查询
      let param = {
        check_id: check_id,
      }
      hlsPopup.showLoading('请稍候')
      vm.$post(url, param).then(function (res) {
        vm.hlsPopup.hideLoading()
        if (res.result === 'S') {
          res.lists.forEach(item => {
            item['url'] = process.env.filePath + 'attachment_id=' + item.attachment_id + '&access_token=' + window.localStorage.access_token
          })
          switch (cdd_item) {
            case 'LEGAL_ID_CARD_F': // 法定代表人身份证正面
              if (!vm.idCardFrontUrlFlag) {
                vm.idCardFront = res.lists[0].url
              }
              vm.idCardFrontAttachmentId = res.lists[0].attachment_id
              break
            case 'LEGAL_ID_CARD_B': // 法定代表人身份证背面
              if (!vm.idCardBackUrlFlag) {
                vm.idCardBack = res.lists[0].url
              }
              vm.idCardBackAttachmentId = res.lists[0].attachment_id
              break
            case 'AUTHOR_ID_CARD_F': // 授权人身份证正面
              if (!vm.authidCardFrontUrlFlag) {
                vm.authidCardFront = res.lists[0].url
              }
              vm.authidCardFrontAttachmentId = res.lists[0].attachment_id
              break
            case 'AUTHOR_ID_CARD_B': // 授权人身份证背面
              if (!vm.authidCardBackUrlFlag) {
                vm.authidCardBack = res.lists[0].url
              }
              vm.authidCardBackAttachmentId = res.lists[0].attachment_id
              break
            case 'ORG_CODE':
              if (!vm.licenseImgUrlFlag) {
                vm.licenseImg = res.lists[0].url
              }
              vm.licenseAttachmentId = res.lists[0].attachment_id
              break
            case 'L/A':
              if (!vm.laImgUrlFlag) {
                vm.laImg = res.lists[0].url
              }
              vm.laAttachmentId = res.lists[0].attachment_id
              break
            default:
              vm.dowload_list.push(res.lists)
          }
        } else {
          hlsPopup.showLongCenter(res.message)
        }
      })
    },
    // 附件查询
    loadItemList () {
      let vm = this
      let bpId = vm.from ? vm.$route.params.bp_id : vm.bp_id
Jennie Shi's avatar
Jennie Shi committed
1629 1630 1631
      if (bpId === 'undefined') {
        bpId = null
      }
786817560's avatar
786817560 committed
1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679
      let url = process.env.basePath + 'prj_cdd_check_list'
      let param = {
        master: {
          'document_id': bpId,
          'document_table': 'HLS_BP_MASTER',
          'tab_group': vm.flag ? 'HLS_ORG_NAUTH' : 'HLS_ORG_AUTH',
        },
      }
      // vm.hlsPopup.showLoading('请稍候')
      vm.hlsHttp.post(url, param).then(function (res) {
        // vm.hlsPopup.hideLoading()
        if (res.result === 'S') {
        //   vm.cddItemList = []
          var listTemp = [...res.lists]
          listTemp.forEach(item => {
            switch (item.cdd_item) {
              case 'LEGAL_ID_CARD_F': // 法定代表人身份证正面
                vm.idCardFrontCheck_id = item.check_id
                break
              case 'LEGAL_ID_CARD_B': // 法定代表人身份证背面
                vm.idCardBackCheck_id = item.check_id
                break
              case 'AUTHOR_ID_CARD_F': // 授权人身份证正面
                vm.authidCardFrontCheck_id = item.check_id
                break
              case 'AUTHOR_ID_CARD_B': //  授权人身份证背面
                vm.authidCardBackCheck_id = item.check_id
                break
              case 'ORG_CODE':
                vm.licenseCheck_id = item.check_id
                break
              case 'BANK_CARD':

                break
              case 'L/A':
                vm.laCheck_id = item.check_id
                break
              default:
                // vm.cddItemList.push(item)
            }
          })
          // 查询图片
          listTemp.forEach((item, index) => {
            vm.load_picture(item.check_id, index, item.cdd_item)
          })
          if (vm.idCardFrontEditFlag) { // 法定代表人身份证正面图片已修改,重新上传
            vm.idCardFrontUrlFlag = true
            vm.delete_pic_to_ocr(vm.idCardFrontAttachmentId)// 先删除之前识别的图片
786817560's avatar
786817560 committed
1680
            let list = []
786817560's avatar
786817560 committed
1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697
            let obj = {
              'pkvalue': vm.idCardFrontCheck_id,
              'source_type': 'PRJ_CDD_ITEM_CHECK',
              'picture': '',
              'check_id': vm.idCardFrontCheck_id,
              'filePath': vm.idCardFront,
              'attachment_id': '',
              'user_id': 1,
              'fileName': '法人身份证正面',
            }
            list.push(obj)
            vm.save_picture(list)
            vm.idCardFrontEditFlag = false // 置为false,防止再次保存重复上传,只有重新识别才会重新上传
          }
          if (vm.idCardBackEditFlag) { // 法定代表人身份证背面图片已修改,重新上传
            vm.idCardBackUrlFlag = true
            vm.delete_pic_to_ocr(vm.idCardBackAttachmentId)// 先删除之前识别的图片
786817560's avatar
786817560 committed
1698
            let list = []
786817560's avatar
786817560 committed
1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715
            let obj = {
              'pkvalue': vm.idCardBackCheck_id,
              'source_type': 'PRJ_CDD_ITEM_CHECK',
              'picture': '',
              'check_id': vm.idCardBackCheck_id,
              'filePath': vm.idCardBack,
              'attachment_id': '',
              'user_id': 1,
              'fileName': '法人身份证背面',
            }
            list.push(obj)
            vm.save_picture(list)
            vm.idCardBackEditFlag = false // 置为false,防止再次保存重复上传,只有重新识别才会重新上传
          }
          if (vm.authidCardFrontEditFlag) { // 授权人身份证正面图片已修改,重新上传
            vm.authidCardFrontUrlFlag = true
            vm.delete_pic_to_ocr(vm.authidCardFrontAttachmentId)// 先删除之前识别的图片
786817560's avatar
786817560 committed
1716
            let list = []
786817560's avatar
786817560 committed
1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733
            let obj = {
              'pkvalue': vm.authidCardFrontCheck_id,
              'source_type': 'PRJ_CDD_ITEM_CHECK',
              'picture': '',
              'check_id': vm.authidCardFrontCheck_id,
              'filePath': vm.authidCardFront,
              'attachment_id': '',
              'user_id': 1,
              'fileName': '授权人身份证正面',
            }
            list.push(obj)
            vm.save_picture(list)
            vm.authidCardFrontEditFlag = false // 置为false,防止再次保存重复上传,只有重新识别才会重新上传
          }
          if (vm.authidCardBackEditFlag) { // 授权人身份证背面图片已修改,重新上传
            vm.authidCardBackUrlFlag = true
            vm.delete_pic_to_ocr(vm.authidCardBackAttachmentId)// 先删除之前识别的图片
786817560's avatar
786817560 committed
1734
            let list = []
786817560's avatar
786817560 committed
1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751
            let obj = {
              'pkvalue': vm.authidCardBackCheck_id,
              'source_type': 'PRJ_CDD_ITEM_CHECK',
              'picture': '',
              'check_id': vm.authidCardBackCheck_id,
              'filePath': vm.authidCardBack,
              'attachment_id': '',
              'user_id': 1,
              'fileName': '授权人身份证背面',
            }
            list.push(obj)
            vm.save_picture(list)
            vm.authidCardBackEditFlag = false // 置为false,防止再次保存重复上传,只有重新识别才会重新上传
          }
          if (vm.licenseEditFlag) { // 营业执照图片已修改,重新上传
            vm.licenseImgUrlFlag = true
            vm.delete_pic_to_ocr(vm.licenseAttachmentId)// 先删除之前识别的图片
786817560's avatar
786817560 committed
1752
            let list = []
786817560's avatar
786817560 committed
1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769
            let obj = {
              'pkvalue': vm.licenseCheck_id,
              'source_type': 'PRJ_CDD_ITEM_CHECK',
              'picture': '',
              'check_id': vm.licenseCheck_id,
              'filePath': vm.licenseImg,
              'attachment_id': '',
              'user_id': 1,
              'fileName': '企业营业执照',
            }
            list.push(obj)
            vm.save_picture(list)
            vm.licenseEditFlag = false // 置为false,防止再次保存重复上传,只有重新识别才会重新上传
          }
          if (vm.LaEditFlag) { // 授权书图片已修改,重新上传
            vm.laImgUrlFlag = true
            vm.delete_pic_to_ocr(vm.laAttachmentId)// 先删除之前识别的图片
786817560's avatar
786817560 committed
1770
            let list = []
786817560's avatar
786817560 committed
1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191
            let obj = {
              'pkvalue': vm.laCheck_id,
              'source_type': 'PRJ_CDD_ITEM_CHECK',
              'picture': '',
              'check_id': vm.laCheck_id,
              'filePath': vm.laImg,
              'attachment_id': '',
              'user_id': 1,
              'fileName': '授权证书',
            }
            list.push(obj)
            vm.save_picture(list)
            vm.LaEditFlag = false // 置为false,防止再次保存重复上传,只有重新识别才会重新上传
          }
        }
      })
    },
    // 身份证重新识别后,先删除之前的照片
    delete_pic_to_ocr (attachment_id) {
      let vm = this
      var delete_list = []
      let obj = {attachment_id: attachment_id}
      delete_list.push(obj)
      let url = process.env.basePath + 'app_delete_attment' // 附件删除
      let param = {
        picturelist: delete_list,
      }
      vm.hlsHttp.post(url, param).then(function (res) {
        hlsPopup.hideLoading()
        if (res.result === 'S') {

        } else if (res.result === 'E') {

        }
      })
    },
    // 授权书上传入口
    LaUpload () {
      let vm = this
      hlsPopup.showActionSheet({
        titleText: '请选择照片',
        buttonArray: ['拍照', '从相册取'],
        callback: index => {
          if (index === 0) {
            vm.LaUploadOpenCamera()
          } else {
            vm.LaUploadTakePicture()
          }
        },
      })
    },
    LaUploadOpenCamera () {
      let vm = this
      let cameraoptions = {
        quality: 100,
      }
      let success = function (imgdata) {
        vm.LaEditFlag = true
        vm.laImg = imgdata
      }
      let error = function () {
        hlsPopup.showLongCenter('请拍照')
      }
      hlsUtil.openCamera(cameraoptions, success, error)
    },
    LaUploadTakePicture () {
      let vm = this
      let cameraoptions = {
        quality: 100,
      }
      let success = function (imgUrl) {
        if (imgUrl.length === 0) {
          hlsPopup.showLongCenter('请选择一张图片')
        } else {
          vm.LaEditFlag = true
          vm.laImg = imgUrl[0]
        }
      }
      let error = function () {
      }
      vm.hlsUtil.takePicture(cameraoptions, success, error)
    },
    // 图片保存
    save_picture (list) {
      let vm = this
      if (list.length) {
        // hlsPopup.showLoading('图片上传请稍候')
        var alreadyUploadNum = 0
        var attLength = 0
        var recordUploadInterval = setInterval(function () {
          if (alreadyUploadNum === attLength) {
            clearInterval(recordUploadInterval)
            /*  hlsPopup.hideLoading()
                hlsPopup.showLongCenter('图片上传成功') */
          }
        }, 500)
        for (var i = 0; i < list.length; i++) {
          let uploadSuccess = function (res) {
            if (res.result === 'S') {
              alreadyUploadNum++
              for (var j = 0; j < list.length; j++) {
                if (list[j].filePath === res.response.filePath) {
                  list[j].attachment_id = res.response.attachment_id
                  vm.upload_list.push(list[j])
                  break
                }
              }
            } else {
              hlsPopup.hideLoading()
            }
          }
          if (!list[i].attachment_id) {
            attLength++
            hlsUtil.fileUploadSvc(list[i], uploadSuccess)
          }
        }
      } else {
        hlsPopup.hideLoading()
      }
    },
    // 查看大图
    showBigPicture (pic) {
      let vm = this
      vm.hlsPopup.showBigPicture({
        imgUrl: pic,
        width: '100%',
      })
    },
  },
}
</script>
<style lang='less'>
  #base-info {
    font-family: PingFangSC-Regular;

    input::placeholder {
      color: #b4b4b5;
    }

    textarea::placeholder {
      color: #b4b4b5;
    }

    textarea {
      // height: 28px;
      text-align: right;
      color: #666;
      // padding-top:16px;
    }

    .type-save {
      color: #fff;
      width: 80px;
      height: 25px;
      font-size: 10px;
      border-radius: 5px;
      margin: 5px 15px 5px 0px;
      float: right;
      background-color: @headerColor;
    }

    .typeBP {
      span {
        display: inline-block;
        padding: 1px 5px;
        border-radius: 5px;
        text-align: center;
        line-height: 20px;
        background-color: rgba(220, 220, 221, 0.26);
        color: #666;
        margin-right: 5px;
        margin-top: 3px;
      }

      img {
        width: 10px;
        height: 10px;
        margin-left: 1px;
      }
    }

    .tax {
      width: 351px;
      height: 78px;
      background: #fff;
      margin: 0 auto;
      margin-bottom: 15px;
      display: flex;
      align-items: center;

      .left-img {
        width: 24px;
        height: 28px;
        flex: 2.5;
        padding-left: 24px;
      }

      div {
        flex: 25;
        padding-left: 24px;

        span {
          font-family: PingFangSC-Regular;
          font-size: 14px;
          color: #383F45;
          letter-spacing: 0;
          line-height: 22px;
        }

        p {
          font-family: PingFangSC-Regular;
          font-size: 12px;
          color: rgba(56, 63, 69, 0.50);
          letter-spacing: 0;
          line-height: 22px;
        }
      }

      .right-img {
        width: 10px;
        height: 16px;
        flex: 1;
        padding-right: 21px;
      }
    }

    .content {
      margin-top: 3px;
      height: 76%;
      padding-bottom: 40px;

      .font-color {
        color: #656464;
      }

      .martop {
        margin-top: -10px;
      }

      .userInfo {
        height: 40px;
        line-height: 40px;
        background-color: #fafafa;
        color: @headerColor;
        font-size: 15px;
        margin-left: 16px;
        position: relative;
      }

      .userInfo::before {
        content: "";
        display: block;
        width: 4px;
        height: 20px;
        background-color: @headerColor;
        position: absolute;
        left: -15px;
        top: 10px;
      }

      .types {
        margin-top: 0;
      }

      .authorize {
        width: 100%;
        height: 32px;
        display: flex;
        flex-direction: row;
        align-items: center;
        background: rgba(0, 70, 156, 0.03);
        margin-bottom: 10px;

        .authorize-select {
          // width: 48px;
          height: 20px;
          font-family: PingFangSC-Regular;
          font-size: 12px;
          color: #656464;
          line-height: 20px;
          margin-left: 16px;
        }

        .authorize-checklist {
          width: 16px;
          height: 16px;
          margin-left: 8px;

          div {
            width: 100%;
            height: 100%;
            border: 1px solid @headerColor;
            border-radius: 3px;
          }
        }
      }

      .upload-id-cards {
        height: 176px;
        background-color: #fff;

        span {
          display: block;
          color: #656464;
          margin-left: 16px;
          padding-top: 16px;
          font-size: 13px;
        }

        .upload-box {
          display: flex;
          justify-content: center;
          margin-top: 15px;

          div {
            width: 172px;
            height: 120px;
            border: 1px dashed #dcdcdd;
            text-align: center;
            font-size: 14px;
            color: #b4b4b5;

            .front,
            .back {
              width: 172px;
              height: 120px;
            }
          }

          div:nth-of-type(2) {
            margin-left: 7px;
          }

          img {
            margin-top: 32px;
            width: 58px;
            height: 45px;
          }

          p {
            margin-top: 12px;
            font-size: 13px;
          }
        }
      }

      .upload-id-card {
        height: 122px;
        background-color: #fff;

        span {
          display: block;
          color: #656464;
          margin-left: 16px;
          padding-top: 16px;
          font-size: 13px;
        }

        .upload-box1 {
          width: 80px;
          height: 80px;
          border: 1px dashed #dcdcdd;
          text-align: center;
          margin-top: 8px;
          margin-left: 16px;

          .licenseBox {
            width: 100%;
            height: 100%;
            display: flex;
            justify-content: center;
            align-items: center;
          }

          img {
            margin-top: 30px;
            width: 25px;
            height: 25px;
          }
        }
      }

      .second-part {
        margin-top: 9px;

        .auto {
          color: #b4b4b5;
        }
      }
    }

    .put-approved {
      width: 90%;
      height: 45px;
      color: #fff;
      border-radius: 4px;
      background-color: @headerColor;
    }

    .save {
      width: 100%;
      height: 45px;
      color: #fff;
      border-radius: 4px;
      background-color: @headerColor;
    }

    .footer-button {
      //height: 88px;
      padding-top: 15px;
      padding-bottom: 15px;
    }

    .front,
    .photo,
    .backphoto,
    .back {
      display: none;
    }
  }
</style>