base-info.vue 59.9 KB
Newer Older
linxin's avatar
linxin committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
<template>
  <h-view id="np-base-info">
    <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>
      <list-item :item-height="44">
        <item v-if="(isApproved&&!isMultiRole)||!isApproved" :showArrow="true">
          <div slot="name" class="required">客户类型</div>
          <input
            slot="content"
            v-model="baseInfo.bp_type_n"
            placeholder="请选择"
            type="text"
            readonly
            onfocus="this.blur()"
            @click="selectIdTypeOnly()"
          >
        </item>
linxin's avatar
linxin committed
23
        <item v-if="isApproved&&isMultiRole&&!hasMultiRole" :showArrow="true" @click.native="selectIdType()">
linxin's avatar
linxin committed
24 25 26 27 28 29 30 31 32
          <div slot="name" class="required">客户类型</div>
          <div slot="content" class="typeBP">
            <span>{{ baseInfo.bp_type_n }}</span>
            <span>
              {{ multiBpType.bp_type_n }}
              <img v-if="multiBpType.bp_type_n" src="@/assets/userBind/deleteTag.png" @click.stop @click="deleteBP" >
            </span>
          </div>
        </item>
linxin's avatar
linxin committed
33 34 35 36 37 38 39
        <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>
            <span v-if="multiRole.bp_type_n">{{ multiRole.bp_type_n }}</span>
          </div>
        </item>
linxin's avatar
linxin committed
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 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
        <item v-if="(isPaople&&from)||(isPaople&&isSelected)">
          <div slot="name" class="required">业务经办人</div>
          <input slot="content" v-model="baseInfo.agent_username" placeholder="请输入业务经办员工代码" >
        </item>
        <item v-if="(isLesons&&from)||(isLesons&&isSelected)">
          <div slot="name" class="required">营业执照</div>
          <input slot="content" v-model="baseInfo.business_license_num" placeholder="请输入营业执照号" >
        </item>
        <item v-if="(isMatter&&from)||(isMatter&&isSelected)">
          <div slot="name" class="required">办事处代码</div>
          <input slot="content" v-model="baseInfo.business_license_num" placeholder="请输入办事处代码" >
        </item>
        <button v-if="isAddNewType" class="type-save" @click="addNewRole">新增角色</button>
      </list-item>
      <div class="userInfo">客户信息</div>
      <div class="upload-id-card">
        <span>身份证照片上传</span>
        <div class="upload-box">
          <div v-if="!idCardFront" @click="ocrShow('idCard', 'front')">
            <img src="@/assets/userBind/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/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="required">姓名</div>
          <input
            slot="content"
            v-model="baseInfo.bp_name"
            readonly
            placeholder="上传身份证自动填充"
            class="auto"
          >
        </item>
        <item>
          <div slot="name" class="required">身份证号码</div>
          <input
            slot="content"
            v-model="baseInfo.id_card_no"
            readonly
            placeholder="上传身份证自动填充"
            class="auto"
          >
        </item>
        <item>
          <div slot="name" class="required">户籍地址</div>
          <textarea
            slot="content"
            ref="myTestarea"
            v-model="baseInfo.address_on_resident_booklit"
            readonly
            cols="22"
            rows="1"
            placeholder="上传身份证自动填充"
            class="auto"
            @input="addRows(baseInfo.address_on_resident_booklit)"
          />
        </item>
        <item>
          <div slot="name" class="required">身份证有效期从</div>
          <input
            slot="content"
            v-model="baseInfo.id_card_date_from"
            readonly
            placeholder="上传身份证自动填充"
            class="auto"
          >
linxin's avatar
linxin committed
134
          <!-- <span class="auto">{{ baseInfo.id_card_date_from|dateFormat }}</span> -->
linxin's avatar
linxin committed
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 199 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 238 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
        </item>
        <item>
          <div slot="name" class="required">身份证有效期到</div>
          <input
            slot="content"
            v-model="baseInfo.id_card_date_to"
            readonly
            placeholder="上传身份证自动填充"
            class="auto"
          >
        </item>
        <item>
          <div slot="name" class="required">手机号码</div>
          <input slot="content" v-model="baseInfo.cell_phone" readonly placeholder="请输入手机号码" >
        </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>
          <div slot="name" class="required">联系地址</div>
          <textarea
            slot="content"
            ref="myTestareaLive"
            v-model="baseInfo.living_address"
            rows="1"
            cols="22"
            placeholder="请输入联系地址"
            @input="addRowsLive(baseInfo.living_address)"
          />
        </item>
        <item :showArrow="true">
          <div slot="name" class="required">学历</div>
          <input
            slot="content"
            v-model="baseInfo.academic_background_n"
            placeholder="请选择学历"
            readonly
            onfocus="this.blur()"
            @click="selectBackType"
          >
        </item>
        <item
          v-if="baseInfo.bp_type === 'TENANT' || baseInfo.bp_type === 'GUTA'"
          :showArrow="true"
        >
          <div slot="name" class="required">婚姻状况</div>
          <input
            slot="content"
            v-model="baseInfo.marital_status_n"
            placeholder="请选择"
            readonly
            onfocus="this.blur()"
            @click="selectMarital"
          >
        </item>
      </list-item>
      <div
        v-if="(hasSP && baseInfo.bp_type === 'TENANT') || (hasSP && baseInfo.bp_type === 'GUTA')"
      >
        <!-- 主承租人活担保人为已婚显示-->
        <div class="userInfo">配偶信息</div>
        <div class="upload-id-card">
          <span>身份证照片上传</span>
          <div class="upload-box">
            <div v-if="!idCardFrontSp" @click="ocrShow('idCardSp', 'front')">
              <img src="@/assets/userBind/front.png" >
              <p>正面</p>
            </div>
            <div v-if="idCardFrontSp && !isApproved" @click="ocrShow('idCardSp', 'front')">
              <img :src="idCardFrontSp" style="width: 100%;height: 100%;margin: 0" >
            </div>
            <div v-if="isApproved && idCardFrontSp">
              <img
                v-if="idCardFrontSp"
                :src="idCardFrontSp"
                style="width: 100%;height: 100%;margin: 0"
                @click="showBigPicture(idCardFrontSp)"
              >
            </div>
            <div v-if="!idCardBackSp" @click="ocrShow('idCardSp', 'back')">
              <img src="@/assets/userBind/back.png" >
              <p>反面</p>
            </div>
            <div v-if="idCardBackSp && !isApproved" @click="ocrShow('idCardSp', 'back')">
              <img :src="idCardBackSp" style="width: 100%;height: 100%;margin: 0" >
            </div>
            <div v-if="isApproved && idCardBackSp">
              <img
                v-if="idCardBackSp"
                :src="idCardBackSp"
                style="width: 100%;height: 100%;margin: 0"
                @click="showBigPicture(idCardBackSp)"
              >
            </div>
          </div>
        </div>
        <list-item :item-height="44">
          <item>
            <div slot="name" class="required">姓名</div>
            <input slot="content" v-model="baseInfo.bp_name_sp" readonly placeholder="上传身份证自动填充" >
          </item>
          <item>
            <div slot="name" class="required">配偶身份证号</div>
            <input
              slot="content"
              v-model="baseInfo.id_card_no_sp"
              readonly
              placeholder="上传身份证自动填充"
            >
          </item>
          <item>
            <div slot="name" class="required">身份证有效期从</div>
            <input
              slot="content"
              v-model="baseInfo.id_card_date_from_sp"
              readonly
              placeholder="上传身份证自动填充"
            >
          </item>
          <item>
            <div slot="name" class="required">身份证有效期到</div>
            <input
              slot="content"
              v-model="baseInfo.id_card_date_to_sp"
              readonly
              placeholder="上传身份证自动填充"
            >
          </item>
          <item>
            <div slot="name" class="required">手机号码</div>
            <input slot="content" v-model="baseInfo.spouse_phone" placeholder="请输入手机号码" >
          </item>
          <item>
            <div slot="name" class="required">工作单位</div>
            <input slot="content" v-model="baseInfo.working_place_sp" placeholder="请输入工作单位" >
          </item>
          <item>
            <div slot="name" class="required">联系地址</div>
            <input slot="content" v-model="baseInfo.address_sp" placeholder="请输入联系地址" >
          </item>
        </list-item>
      </div>
    </h-content>
    <bottom-tab class="footer-button">
      <tab-button class="save" @click.native="verified">下一步</tab-button>
    </bottom-tab>
  </h-view>
</template>
<script>
export default {
  data () {
    return {
      list: {},
      isAddNewType: false,
      hasSP: false,
      isPaople: false,
      isLesons: false,
      isMatter: false,
      isApproved: false,
      isSave: false,
      isAGENT: this.$route.params.isAGENT,
linxin's avatar
linxin committed
329
      isMultiRole: this.$route.params.isMultiRole, // 能否选择多角色
linxin's avatar
linxin committed
330
      isSelected: false,
linxin's avatar
linxin committed
331
      hasMultiRole: false, // 是否有第二个角色
linxin's avatar
linxin committed
332 333 334 335 336 337 338 339 340 341 342 343 344 345 346
      from: false,
      multiBpType: {
        bp_type_n: '',
        bp_type: '',
      },
      cityList: [],
      provinceList: [],
      upload_list: [], // 上传图片列表
      dowload_list: [], // 下载图片列表
      typeList: [],
      backList: [],
      bankList: [],
      maritalList: [],
      districtList: [],
      img_url: {},
linxin's avatar
linxin committed
347 348 349 350
      multiRole: {
        bp_type_n: '',
        bp_type: '',
      }, // 查询出来的第二个角色
linxin's avatar
linxin committed
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 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 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 442 443 444 445 446 447
      baseInfo: {
        bp_type_n: '',
        academic_background_n: '',
        marital_status_n: '',
        bp_type: '',
        bp_class: this.$route.params.bp_class,
        bp_name: '',
        province_name: '',
        province_id: '',
        city_name: '',
        city_id: '',
        id_card_no: null,
        id_card_date_from: '', // 身份证有效期从
        id_card_date_to: '', // 身份证有效期到
        cell_phone: window.localStorage.getItem('user_phone'),
        living_address: '',
        address_on_resident_booklit: '',
        marital_status: '',
        academic_background: '',
        bp_name_sp: '',
        id_card_no_sp: '', // 配偶身份证号
        id_card_date_from_sp: '', // 配偶身份证有效期从
        id_card_date_to_sp: '', // 配偶身份证有效期到
        district_id: '',
        district_name: '',
        spouse_phone: '',
        working_place_sp: '',
        address_sp: '',
        user_phone: window.localStorage.user_phone,
      },
      idCardFront: '', // 身份证正面图片
      idCardBack: '', // 身份证反面图片
      idCardFrontSp: '', // 配偶身份证正面图片
      idCardBackSp: '', // 配偶身份证反面图片
      idCardFrontUrlFlag: false, // 身份证正面图片查看标识,为false则用查询出来的,为true则用拍照出来的
      idCardBackUrlFlag: false, // 身份证反面图片,为false则用查询出来的,为true则用拍照出来的
      idCardFrontSpUrlFlag: false, // 配偶身份证正面图片,为false则用查询出来的,为true则用拍照出来的
      idCardBackSpUrlFlag: false, // 配偶身份证反面图片,为false则用查询出来的,为true则用拍照出来的
      bankImg: '', // 银行卡图片
      cddItemList: [], // 资料清单列表
      idCardFrontCheck_id: '', // 身份证正面check_id
      idCardBackCheck_id: '', // 身份证反面check_id
      idCardFrontSpCheck_id: '', // 配偶身份证正面check_id
      idCardBackSpCheck_id: '', // 配偶身份证反面check_id
      idCardFrontAttachmentId: '', // 身份证正面AttachmentId
      idCardBackAttachmentId: '', // 身份证反面AttachmentId
      idCardFrontSpAttachmentId: '', // 配偶身份证正面AttachmentId
      idCardBackSpAttachmentId: '', // 配偶身份证反面AttachmentId
      // idCardImgList: [], // 存身份证图片列表
      idCardFrontEditFlag: false, // 身份证正面修改标识,为true则标识已修改,后续需要重新上传此照片
      idCardBackEditFlag: false, // 身份证反面修改标识,为true则标识已修改,后续需要重新上传此照片
      idCardFrontSpEditFlag: false, // 配偶身份证正面修改标识,为true则标识已修改,后续需要重新上传此照片
      idCardBackSpEditFlag: false, // 配偶身份证反面修改标识,为true则标识已修改,后续需要重新上传此照片
      isClear: false,
    }
  },
  watch: {
    'baseInfo.bp_type_n' (newVal, oldVal) {
      let vm = this
      if (vm.baseInfo.bp_type === 'TENANT' || vm.baseInfo.bp_type === 'GUTA') {
        vm.isPaople = true
        vm.isMatter = false
        vm.isLesons = false
      } else if (
        vm.baseInfo.bp_type === 'AGENT' ||
        vm.baseInfo.bp_type === 'FACTORY'
      ) {
        vm.isPaople = false
        vm.isMatter = false
        vm.isLesons = true
      } else if (vm.baseInfo.bp_type === 'OFFICE') {
        vm.isMatter = true
        vm.isPaople = false
        vm.isLesons = false
      }
    },
    'baseInfo.marital_status_n': function (newVal, oldVal) {
      if (newVal === '已婚') {
        this.hasSP = true
      } else {
        this.hasSP = false
        this.baseInfo.bp_name_sp = ''
        this.baseInfo.spouse_phone = ''
        this.baseInfo.working_place_sp = ''
        this.baseInfo.address_sp = ''
      }
    },
  },
  created () {
    this.getBpType()
    this.getEducationBackground()
    this.getMarital()
    this.getProvince()
  },
  beforeRouteEnter (to, from, next) {
    // 绑定查询入口
    next(vm => {
linxin's avatar
linxin committed
448 449 450 451 452 453
      if (vm.$route.params.status === 'APPROVED') {
        vm.isApproved = true
      } else {
        vm.isApproved = false
      }
      vm.isMultiRole = vm.$route.params.isMultiRole
linxin's avatar
linxin committed
454
      if (from.fullPath === '/tab/my-info') {
李晓兵's avatar
李晓兵 committed
455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482
        vm.list = {}
        vm.multiBpType = {}
        vm.upload_list = [] // 上传图片列表
        vm.dowload_list = [] // 下载图片列表
        vm.img_url = {}
        vm.baseInfo = {}
        vm.idCardFront = '' // 身份证正面图片
        vm.idCardBack = '' // 身份证反面图片
        vm.idCardFrontSp = '' // 配偶身份证正面图片
        vm.idCardBackSp = '' // 配偶身份证反面图片
        vm.idCardFrontUrlFlag = false // 身份证正面图片查看标识,为false则用查询出来的,为true则用拍照出来的
        vm.idCardBackUrlFlag = false // 身份证反面图片,为false则用查询出来的,为true则用拍照出来的
        vm.idCardFrontSpUrlFlag = false // 配偶身份证正面图片,为false则用查询出来的,为true则用拍照出来的
        vm.idCardBackSpUrlFlag = false // 配偶身份证反面图片,为false则用查询出来的,为true则用拍照出来的
        vm.cddItemList = [] // 资料清单列表
        vm.idCardFrontCheck_id = '' // 身份证正面check_id
        vm.idCardBackCheck_id = '' // 身份证反面check_id
        vm.idCardFrontSpCheck_id = '' // 配偶身份证正面check_id
        vm.idCardBackSpCheck_id = '' // 配偶身份证反面check_id
        vm.idCardFrontAttachmentId = '' // 身份证正面AttachmentId
        vm.idCardBackAttachmentId = '' // 身份证反面AttachmentId
        vm.idCardFrontSpAttachmentId = '' // 配偶身份证正面AttachmentId
        vm.idCardBackSpAttachmentId = '' // 配偶身份证反面AttachmentId
        vm.idCardFrontEditFlag = false // 身份证正面修改标识,为true则标识已修改,后续需要重新上传此照片
        vm.idCardBackEditFlag = false // 身份证反面修改标识,为true则标识已修改,后续需要重新上传此照片
        vm.idCardFrontSpEditFlag = false // 配偶身份证正面修改标识,为true则标识已修改,后续需要重新上传此照片
        vm.idCardBackSpEditFlag = false // 配偶身份证反面修改标识,为true则标识已修改,后续需要重新上传此照片
        vm.isClear = false
linxin's avatar
linxin committed
483
        vm.from = true
linxin's avatar
linxin committed
484
        window.localStorage.setItem('from', true)
linxin's avatar
linxin committed
485 486
        vm.basicInfoQuery()
        vm.loadItemList() // 附件查询
linxin's avatar
linxin committed
487
        vm.checkHasmultiple()// 查询是否有新角色
linxin's avatar
linxin committed
488
      } else if (from.name === 'UserBind') {
李晓兵's avatar
李晓兵 committed
489
        vm.list = {}
linxin's avatar
linxin committed
490 491
        window.localStorage.setItem('from', false)
        vm.from = false
李晓兵's avatar
李晓兵 committed
492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 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
        vm.multiBpType = {
          bp_type_n: '',
          bp_type: '',
        }
        vm.upload_list = [] // 上传图片列表
        vm.dowload_list = [] // 下载图片列表
        vm.img_url = {}
        vm.baseInfo = {
          bp_type_n: '',
          academic_background_n: '',
          marital_status_n: '',
          bp_type: '',
          bp_class: vm.$route.params.bp_class,
          bp_name: '',
          province_name: '',
          province_id: '',
          city_name: '',
          city_id: '',
          id_card_no: null,
          id_card_date_from: '', // 身份证有效期从
          id_card_date_to: '', // 身份证有效期到
          cell_phone: window.localStorage.getItem('user_phone'),
          living_address: '',
          address_on_resident_booklit: '',
          marital_status: '',
          academic_background: '',
          bp_name_sp: '',
          id_card_no_sp: '', // 配偶身份证号
          id_card_date_from_sp: '', // 配偶身份证有效期从
          id_card_date_to_sp: '', // 配偶身份证有效期到
          district_id: '',
          district_name: '',
          spouse_phone: '',
          working_place_sp: '',
          address_sp: '',
          user_phone: window.localStorage.user_phone,
        }
        vm.idCardFront = '' // 身份证正面图片
        vm.idCardBack = '' // 身份证反面图片
        vm.idCardFrontSp = '' // 配偶身份证正面图片
        vm.idCardBackSp = '' // 配偶身份证反面图片
        vm.idCardFrontUrlFlag = false // 身份证正面图片查看标识,为false则用查询出来的,为true则用拍照出来的
        vm.idCardBackUrlFlag = false // 身份证反面图片,为false则用查询出来的,为true则用拍照出来的
        vm.idCardFrontSpUrlFlag = false // 配偶身份证正面图片,为false则用查询出来的,为true则用拍照出来的
        vm.idCardBackSpUrlFlag = false // 配偶身份证反面图片,为false则用查询出来的,为true则用拍照出来的
        vm.cddItemList = [] // 资料清单列表
        vm.idCardFrontCheck_id = '' // 身份证正面check_id
        vm.idCardBackCheck_id = '' // 身份证反面check_id
        vm.idCardFrontSpCheck_id = '' // 配偶身份证正面check_id
        vm.idCardBackSpCheck_id = '' // 配偶身份证反面check_id
        vm.idCardFrontAttachmentId = '' // 身份证正面AttachmentId
        vm.idCardBackAttachmentId = '' // 身份证反面AttachmentId
        vm.idCardFrontSpAttachmentId = '' // 配偶身份证正面AttachmentId
        vm.idCardBackSpAttachmentId = '' // 配偶身份证反面AttachmentId
        vm.idCardFrontEditFlag = false // 身份证正面修改标识,为true则标识已修改,后续需要重新上传此照片
        vm.idCardBackEditFlag = false // 身份证反面修改标识,为true则标识已修改,后续需要重新上传此照片
        vm.idCardFrontSpEditFlag = false // 配偶身份证正面修改标识,为true则标识已修改,后续需要重新上传此照片
        vm.idCardBackSpEditFlag = false // 配偶身份证反面修改标识,为true则标识已修改,后续需要重新上传此照片
        vm.isClear = false
李晓兵's avatar
李晓兵 committed
551
        // vm.baseInfo.bp_class = vm.$route.params.bp_class
linxin's avatar
linxin committed
552 553 554 555
      }
    })
  },
  methods: {
李晓兵's avatar
李晓兵 committed
556 557 558
    timeFormat (str) {
      return `${str.substring(0, 4)}-${str.substring(4, 6)}-${str.substring(6)}`
    },
linxin's avatar
linxin committed
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 588 589 590 591 592 593
    deleteBP () {
      this.multiBpType.bp_type_n = ''
      this.multiBpType.bp_type = ''
      this.isAddNewType = false
    },
    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
        } else {
          hlsPopup.showLongCenter(res.message)
        }
      })
    },
    basicInfoQuery () {
      let vm = this
      let url = process.env.basePath + 'bp_np_info_query'
      let param = {
        bp_id: window.localStorage.getItem('bp_id'),
      }
      hlsPopup.showLoading('请稍候')
      vm.$post(url, param).then(function (res) {
        vm.hlsPopup.hideLoading()
        if (res.result === 'S') {
594
          vm.baseInfo = res.info
linxin's avatar
linxin committed
595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 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
          vm.from = true
          vm.addRows(vm.baseInfo.address_on_resident_booklit)
          vm.addRowsLive(vm.baseInfo.living_address)
        } else {
          hlsPopup.showLongCenter(res.message)
        }
      })
    },
    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 'NP_ID_CARD_F': // 承租人身份证正面
              if (!vm.idCardFrontUrlFlag) {
                vm.idCardFront = res.lists[0].url
              }
              vm.idCardFrontAttachmentId = res.lists[0].attachment_id
              break
            case 'NP_ID_CARD_B': // 承租人身份证背面
              if (!vm.idCardBackUrlFlag) {
                vm.idCardBack = res.lists[0].url
              }
              vm.idCardBackAttachmentId = res.lists[0].attachment_id
              break
            case 'MATE_ID_CARD_F': // 配偶身份证正面
              if (!vm.idCardFrontSpUrlFlag) {
                vm.idCardFrontSp = res.lists[0].url
              }
              vm.idCardFrontSpAttachmentId = res.lists[0].attachment_id
              break
            case 'MATE_ID_CARD_B': // 配偶身份证背面
              if (!vm.idCardBackSpUrlFlag) {
                vm.idCardBackSp = res.lists[0].url
              }
              vm.idCardBackSpAttachmentId = res.lists[0].attachment_id
              break
            default:
              vm.dowload_list.push(res.lists)
          }
        } else {
          hlsPopup.showLongCenter(res.message)
        }
      })
    },
    async verified () {
linxin's avatar
linxin committed
656 657 658 659 660 661 662
      this.dowload_list = [] // 保存之前将图片下载列表清空,防止出现重复的图片
      this.upload_list = [] // 保存之前将待上传列表清空,防止出现重复的图片
      let res = await this.saveWord()
      if (res) {
        // 查询资料清单
        this.loadItemList()
      }
linxin's avatar
linxin committed
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 695 696 697 698 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 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783
    },
    loadItemList () {
      let vm = this
      let bpId = window.localStorage.getItem('bp_id')
      let url = process.env.basePath + 'prj_cdd_check_list'
      let param = {
        master: {
          document_id: bpId,
          document_table: 'HLS_BP_MASTER',
          tab_group: 'HLS_NP',
        },
      }
      // 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 'NP_ID_CARD_F': // 承租人身份证正面
                vm.idCardFrontCheck_id = item.check_id
                break
              case 'NP_ID_CARD_B': // 承租人身份证背面
                vm.idCardBackCheck_id = item.check_id
                break
              case 'MATE_ID_CARD_F': // 配偶身份证正面
                vm.idCardFrontSpCheck_id = item.check_id
                break
              case 'MATE_ID_CARD_B': // 配偶身份证背面
                vm.idCardBackSpCheck_id = item.check_id
                break
              case 'BANK_CARD':
                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)// 先删除之前识别的图片
            // 身份证正面图片已修改,重新上传
            var list = []
            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)// 先删除之前识别的图片
            // 身份证反面图片已修改,重新上传
            var list = []
            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.idCardFrontSpEditFlag) {
            vm.idCardFrontSpUrlFlag = true
            vm.delete_pic_to_ocr(vm.idCardFrontSpAttachmentId)// 先删除之前识别的图片
            // 配偶身份证正面图片已修改,重新上传
            var list = []
            let obj = {
              pkvalue: vm.idCardFrontSpCheck_id,
              source_type: 'PRJ_CDD_ITEM_CHECK',
              picture: '',
              check_id: vm.idCardFrontSpCheck_id,
              filePath: vm.idCardFrontSp,
              attachment_id: '',
              user_id: 1,
              fileName: '配偶身份证正面',
            }
            list.push(obj)
            vm.save_picture(list)
            vm.idCardFrontSpEditFlag = false // 置为false,防止再次保存重复上传,只有重新识别才会重新上传
          }
          if (vm.idCardBackSpEditFlag) {
            vm.idCardBackSpUrlFlag = true
            vm.delete_pic_to_ocr(vm.idCardBackSpAttachmentId)// 先删除之前识别的图片
            // 配偶身份证背面图片已修改,重新上传
            var list = []
            let obj = {
              pkvalue: vm.idCardBackSpCheck_id,
              source_type: 'PRJ_CDD_ITEM_CHECK',
              picture: '',
              check_id: vm.idCardBackSpCheck_id,
              filePath: vm.idCardBackSp,
              attachment_id: '',
              user_id: 1,
              fileName: '配偶身份证背面',
            }
            list.push(obj)
            vm.save_picture(list)
            vm.idCardBackSpEditFlag = false // 置为false,防止再次保存重复上传,只有重新识别才会重新上传
          }
        }
      })
    },
linxin's avatar
linxin committed
784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808
    checkHasmultiple () {
      let vm = this
      let url = process.env.basePath + 'bp_role_check'
      let param = {
        bp_id: window.localStorage.getItem('bp_id'),
      }
      // vm.hlsPopup.showLoading('请稍后')
      vm.hlsHttp.post(url, param).then(function (res) {
        // vm.hlsPopup.hideLoading()
        if (res.result === 'S') {
          vm.hasMultiRole = true
          if (vm.baseInfo.bp_type === 'TENANT') {
            vm.multiRole.bp_type_n = '担保人'
            vm.multiRole.bp_type = 'GUTA'
          } else if (vm.baseInfo.bp_type === 'GUTA') {
            vm.multiRole.bp_type_n = '承租人'
            vm.multiRole.bp_type = 'TENANT'
          }
        } else {
          vm.hasMultiRole = false
          vm.multiRole.bp_type = ''
          vm.multiRole.bp_type_n = ''
        }
      })
    },
李晓兵's avatar
李晓兵 committed
809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833
    // 基本信息保存前校验
    bindCheck () {
      let vm = this
      var business_num = ''
      if (vm.baseInfo.bp_type === 'TENANT' || vm.baseInfo.bp_type === 'GUTA') {
        business_num = vm.baseInfo.agent_username
      } else if (vm.baseInfo.bp_type === 'AGENT' || vm.baseInfo.bp_type === 'FACTORY') {
        business_num = vm.baseInfo.business_license_num
      } else if (vm.baseInfo.bp_type === 'OFFICE') {
        business_num = vm.baseInfo.business_license_num
      }
      let url = process.env.basePath + 'bp_bind_check'
      let param = {
        bp_class: 'NP',
        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: 'NPInvoiceInfo',
          })
        } else {
李晓兵's avatar
李晓兵 committed
834
          hlsPopup.showError(res.message)
李晓兵's avatar
李晓兵 committed
835 836 837
        }
      })
    },
linxin's avatar
linxin committed
838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853
    async saveProtocol () {
      let vm = this
      let url = process.env.basePath + 'bp_np_bind_save'
      let param = {
        master: this.baseInfo,
      }
      vm.hlsPopup.showLoading('保存中!')
      let res = await vm.hlsHttp.post(url, param)
      if (res.result === 'S') {
        hlsPopup.hideLoading()
        // vm.hlsPopup.showSuccess('保存成功,请去维护附件信息')
        vm.isSave = true
        window.localStorage.setItem('user_id', res.bp_id)
        window.localStorage.setItem('bp_id', res.bp_id)
        window.localStorage.setItem('bp_name', vm.baseInfo.bp_name)
        window.localStorage.setItem('bp_type', vm.baseInfo.bp_type)
linxin's avatar
linxin committed
854 855
        // vm.bindCheck()
        vm.$router.push({
linxin's avatar
linxin committed
856
          name: 'NPInvoiceInfo',
李晓兵's avatar
李晓兵 committed
857
        })
linxin's avatar
linxin committed
858 859 860 861 862 863 864 865 866
        return res.bp_id
      } else {
        vm.hlsPopup.showLongCenter(res.message)
      }
    },
    async saveWord () {
      let vm = this
      if (!vm.baseInfo.bp_type) {
        vm.hlsPopup.showLongCenter('客户类型不能为空!')
李晓兵's avatar
李晓兵 committed
867
      } else if (vm.isPaople && !vm.baseInfo.agent_username) {
linxin's avatar
linxin committed
868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 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 954 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 1001 1002 1003 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 1048 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 1093 1094 1095 1096 1097 1098 1099 1100 1101 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 1157 1158 1159 1160 1161 1162 1163 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
        vm.hlsPopup.showLongCenter('业务经办员工代码不能为空!')
      } else if (
        !vm.isPaople &&
        !vm.baseInfo.business_license_num
      ) {
        vm.hlsPopup.showLongCenter('营业执照号不能为空!')
      } else if (!vm.baseInfo.bp_name) {
        vm.hlsPopup.showLongCenter('客户姓名不能为空!')
      } else if (!vm.baseInfo.id_card_no) {
        vm.hlsPopup.showLongCenter('身份证号不能为空!')
      } else if (!vm.baseInfo.id_card_date_from) {
        vm.hlsPopup.showLongCenter('身份证有效期从不能为空!')
      } else if (!vm.baseInfo.id_card_date_to) {
        vm.hlsPopup.showLongCenter('身份证有效期到不能为空!')
      } else if (!vm.baseInfo.cell_phone) {
        vm.hlsPopup.showLongCenter('手机号不能为空!')
      } else if (!vm.baseInfo.living_address) {
        vm.hlsPopup.showLongCenter('联系地址不能为空!')
      } else if (!vm.baseInfo.address_on_resident_booklit) {
        vm.hlsPopup.showLongCenter('户籍地址不能为空!')
      } else if (!vm.baseInfo.academic_background) {
        vm.hlsPopup.showLongCenter('学历不能为空!')
      } else if (!vm.baseInfo.marital_status && (vm.baseInfo.bp_type === 'TENANT' || vm.baseInfo.bp_type === 'GUTA')) {
        vm.hlsPopup.showLongCenter('婚姻状况不能为空!')
      } else if (vm.marital_status_n === '已婚' && !vm.baseInfo.bp_name_sp) {
        vm.hlsPopup.showLongCenter('配偶姓名不能为空!')
      } else if (vm.marital_status_n === '已婚' && !vm.baseInfo.id_card_no_sp) {
        vm.hlsPopup.showLongCenter('配偶身份证号不能为空!')
      } else if (
        vm.marital_status_n === '已婚' &&
        !vm.baseInfo.id_card_date_from_sp
      ) {
        vm.hlsPopup.showLongCenter('配偶身份证有效期从不能为空!')
      } else if (
        vm.marital_status_n === '已婚' &&
        !vm.baseInfo.id_card_date_to_sp
      ) {
        vm.hlsPopup.showLongCenter('配偶身份证有效期到不能为空!')
      } else if (vm.marital_status_n === '已婚' && !vm.baseInfo.spouse_phone) {
        vm.hlsPopup.showLongCenter('配偶手机号不能为空!')
      } else if (
        vm.marital_status_n === '已婚' &&
        !vm.baseInfo.working_place_sp
      ) {
        vm.hlsPopup.showLongCenter('配偶工作单位不能为空!')
      } else if (vm.marital_status_n === '已婚' && !vm.baseInfo.address_sp) {
        vm.hlsPopup.showLongCenter('配偶联系地址不能为空!')
      } else if (!vm.hlsUtil.phoneNumber(vm.baseInfo.cell_phone)) {
        vm.hlsPopup.showLongCenter('手机号码有误!')
      } else {
        let bpId = await vm.saveProtocol()
        return true
      }
    },
    // 图片上传入口
    imgUploadShow (description, check_id) {
      let vm = this
      // vm.upload_list = []
      hlsPopup.showActionSheet({
        titleText: '请选择照片',
        buttonArray: ['拍照', '从相册取'],
        callback: index => {
          if (index === 0) {
            vm.imgUploadOpenCamera(description, check_id)
          } else {
            vm.imgUploadTakePicture(description, check_id)
          }
        },
      })
    },
    imgUploadOpenCamera (description, check_id) {
      let vm = this
      let obj = {
        pkvalue: check_id,
        source_type: 'PRJ_CDD_ITEM_CHECK',
        picture: '',
        check_id: check_id,
        filePath: '',
        attachment_id: '',
        user_id: 1,
        fileName: description + '_' + new Date().getTime(),
      }
      let cameraoptions = {
        quality: 100,
      }
      let success = function (imgdata) {
        obj.picture = imgdata
        obj.filePath = imgdata
        let list = []
        list.push(obj)
        // vm.upload_list.push(obj)
        // 拍完一张立马执行保存图片逻辑
        vm.save_picture(list)
      }
      let error = function () {
        hlsPopup.showLongCenter('请拍照')
      }
      hlsUtil.openCamera(cameraoptions, success, error)
    },
    imgUploadTakePicture (description, check_id) {
      let vm = this
      let cameraoptions = {
        quality: 100,
      }
      let success = function (imgUrl) {
        var list = []
        for (let i = 0; i < imgUrl.length; i++) {
          let obj = {
            pkvalue: check_id,
            source_type: 'PRJ_CDD_ITEM_CHECK',
            picture: '',
            check_id: check_id,
            filePath: '',
            attachment_id: '',
            user_id: 1,
            fileName: description + '_' + new Date().getTime(),
          }
          obj.picture = imgUrl[i]
          obj.filePath = imgUrl[i]
          list.push(obj)
        }
        // 拍完一张立马执行保存图片逻辑
        vm.save_picture(list)
      }
      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()
      }
    },
    // 移除图片
    remove_pic (attachment_id, index) {
      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,
      }
      hlsPopup.showLoading('请稍候')
      vm.hlsHttp.post(url, param).then(function (res) {
        hlsPopup.hideLoading()
        if (res.result === 'S') {
          hlsPopup.showLongCenter('删除成功!')
          vm.remove_upload_list(attachment_id, index)
        } else if (res.result === 'E') {
          hlsPopup.showShortCenter(res.message)
        }
      })
    },
    remove_upload_list (attachment_id, index) {
      let vm = this
      vm.upload_list.remove(index)
      vm.upload_list.sort()
    },
    // 删除图片
    delete_pic (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,
      }
      hlsPopup.showLoading('请稍候')
      vm.hlsHttp.post(url, param).then(function (res) {
        hlsPopup.hideLoading()
        if (res.result === 'S') {
          hlsPopup.showLongCenter('删除成功!')
          vm.remove_dowload_list(attachment_id)
        } else if (res.result === 'E') {
          hlsPopup.showShortCenter(res.message)
        }
      })
    },
    // 身份证重新识别后,先删除之前的照片
    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') {

        }
      })
    },
    remove_dowload_list (attachment_id) {
      let vm = this
      for (let i = 0; i < vm.dowload_list.length; i++) {
        let list = vm.dowload_list[i]
        for (let j = 0; j < list.length; j++) {
          let li = list[j]
          if (parseFloat(li.attachment_id) === parseFloat(attachment_id)) {
            list.remove(j)
            break
          }
        }
      }
      vm.dowload_list.sort()
    },
    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 === 'idCardSp') {
            // 配偶身份证识别
            type === 'front'
              ? ((vm.idCardFrontSp = imgdata),
              vm.idCardIdentify(imgdata, 'idCardSp'),
              (vm.idCardFrontSpEditFlag = true))
              : ((vm.idCardBackSp = imgdata),
              vm.idCardBackIdentify(imgdata, 'idCardSp'),
              (vm.idCardBackSpEditFlag = true))
          } else if (ocrType === 'bankCard') {
            vm.bankImg = imgdata
            vm.bankCardIdentify(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 === 'idCardSp') {
            // 配偶身份证识别
            type === 'front'
              ? ((vm.idCardFrontSp = imgUrl[0]),
              vm.idCardIdentify(imgUrl[0], 'idCardSp'),
              (vm.idCardFrontSpEditFlag = true))
              : ((vm.idCardBackSp = imgUrl[0]),
              vm.idCardBackIdentify(imgUrl[0], 'idCardSp'),
              (vm.idCardBackSpEditFlag = true))
          } else if (ocrType === 'bankCard') {
            vm.bankImg = imgUrl[0]
            vm.bankCardIdentify(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') {
          vm.baseInfo.bp_name = result.姓名.words
          vm.baseInfo.id_card_no = result.公民身份号码.words
          vm.baseInfo.address_on_resident_booklit = result.住址.words
          vm.baseInfo.living_address = vm.baseInfo.address_on_resident_booklit // 联系地址默认为户籍地址,支持修改
        } else {
          vm.baseInfo.bp_name_sp = result.姓名.words
          vm.baseInfo.id_card_no_sp = result.公民身份号码.words
          vm.baseInfo.address_sp = 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
1235 1236
          vm.baseInfo.id_card_date_from = vm.timeFormat(result.签发日期.words)
          vm.baseInfo.id_card_date_to = vm.timeFormat(result.失效日期.words)
linxin's avatar
linxin committed
1237
        } else {
李晓兵's avatar
李晓兵 committed
1238 1239
          vm.baseInfo.id_card_date_from_sp = vm.timeFormat(result.签发日期.words)
          vm.baseInfo.id_card_date_to_sp = vm.timeFormat(result.失效日期.words)
linxin's avatar
linxin committed
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 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 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 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 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 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 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 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 1629 1630 1631 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 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 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
        }
      })
    },
    // 银行卡识别
    bankCardIdentify (fileUrl) {
      let vm = this
      hlsPopup.showLoading('正在识别')
      let url = process.env.ocrPath + '/baidu/ocr/bankCard'
      hlsUtil.baiduOcr(fileUrl, url, function (res) {
        hlsPopup.hideLoading()
        let result = res.result.result
        vm.bank.bank_account_num = result.bank_card_number.replace(/\s*/g, '')
        vm.bank.bank_full_name = result.bank_name
        vm.bank.bank_card_type = result.bank_card_type
      })
    },
    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
      }
    },
    selectIdType (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
        },
      })
    },
    selectIdTypeOnly (e) {
      let vm = this
      vm.hlsPopup.selectList({
        list: vm.typeList,
        code: 'bp_type',
        object: {},
        returnItem: function (index, obj) {
          vm.baseInfo.bp_type = obj.bp_type
          vm.baseInfo.bp_type_n = obj.bp_type_n
        },
      })
      vm.isSelected = true
    },
    selectBackType (e) {
      let vm = this
      vm.hlsPopup.selectList({
        list: vm.backList,
        code: 'bp_type',
        object: {},
        returnItem: function (index, obj) {
          vm.baseInfo.academic_background = obj.bp_type
          vm.baseInfo.academic_background_n = obj.bp_type_n
        },
      })
    },
    selectMarital (e) {
      let vm = this
      vm.hlsPopup.selectList({
        list: vm.maritalList,
        code: 'bp_type',
        object: {},
        returnItem: function (index, obj) {
          vm.baseInfo.marital_status = obj.bp_type
          vm.baseInfo.marital_status_n = obj.bp_type_n
        },
      })
    },
    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,
            }
          })
        }
      })
    },
    getMarital () {
      let vm = this
      let url = process.env.basePath + 'bp_marital_status_query'
      let param = {}
      vm.hlsPopup.showLoading('请稍候')
      vm.hlsHttp.post(url, param).then(function (res) {
        vm.hlsPopup.hideLoading()
        if (res.result === 'S') {
          vm.maritalList = res.lists.map(item => {
            return {
              code: item.marital_status,
              code_name: item.marital_status_n,
            }
          })
        }
      })
    },
    getEducationBackground () {
      let vm = this
      let url = process.env.basePath + 'bp_academic_bg_query'
      let param = {}
      vm.hlsPopup.showLoading('请稍候')
      vm.hlsHttp.post(url, param).then(function (res) {
        vm.hlsPopup.hideLoading()
        if (res.result === 'S') {
          vm.backList = res.lists.map(item => {
            return {
              code: item.academic_bg,
              code_name: item.academic_bg_n,
            }
          })
        }
      })
    },
    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') {
          vm.typeList = res.lists.map(item => {
            return {
              code: item.bp_type,
              code_name: item.bp_type_n,
            }
          })
        }
      })
    },
    // 查看大图
    showBigPicture (pic) {
      let vm = this
      vm.hlsPopup.showBigPicture({
        imgUrl: pic,
        width: '100% !important',
      })
    },
  },
}
</script>
<style lang="less" scoped>
#np-base-info{
  font-family: PingFangSC-Regular;
  input::placeholder {
    color: #b4b4b5;
  }
  textarea::placeholder {
    color: #b4b4b5;
  }
  textarea {
    text-align: right;
    color: #666;
  }
  .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: 30px;
    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.5);
        letter-spacing: 0;
        line-height: 22px;
      }
    }
    .right-img {
      width: 10px;
      height: 16px;
      flex: 1;
      padding-right: 21px;
    }
  }
  .content {
    height: 76%;
    .userInfo {
      height: 45px;
      line-height: 45px;
      color: @headerColor;
      margin-top: -10px;
      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: 12px;
    }
    .upload-id-card {
      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;
        }
      }
    }
    .second-part {
      margin-top: 9px;
      .auto {
        color: #b4b4b5;
      }
    }
    .card {
      padding-bottom: 8px;
      height: auto;
      background-color: #fff;
      margin-bottom: 10px;

      display: flex;
      flex-direction: column;
      span {
        color: #656464;
        font-size: 13px;
        line-height: 18px;
        padding-top: 8px;
        display: block;
        margin-left: 16px;
      }
      .img-content {
        /*display: flex;
        flex-flow: row wrap;
        justify-content: flex-start;
        align-items: center;*/
      }
      .plus {
        display: flex;
        justify-content: center;
        align-items: center;
      }
      .card-upload {
        position: relative;
        width: 80px;
        height: 80px;
        border: 1px dashed #dcdcdd;
        /* display: flex;
         justify-content: center;
         align-items: center;*/
        margin-top: 12px;
        margin-left: 16px;
        float: left;
        .close {
          /* position: relative;
          color: #F96F68;
          margin-top: -100%;
          margin-left: -10%;*/
          position: absolute;
          color: #f96f68;
          top: -6px;
          right: -6px;
          img {
            width: 14px;
            height: 14px;
          }
        }
        img {
          /*width: 88px;
          height: 88px;*/
          width: 100%;
          height: 100%;
        }
        .upload-btn {
          width: 24px;
          height: 24px;
        }
      }
    }
  }
  .put {
    width: 175px;
    height: 45px;
    color: #fdb62f;
    border-radius: 4px;
    border: 1px solid #fdb62f;
    background-color: #fafafa;
  }
  .put-approved {
    width: 90%;
    height: 45px;
    color: #fff;
    border-radius: 4px;
    background-color: @headerColor;
  }
  .save {
    color: #fff;
    border-radius: 4px;
    background-color: @headerColor;
  }
  .front,
  .photo,
  .backphoto,
  .back {
    display: none;
  }
  .modal-content {
    width: 100%;
    height: 75%;
    position: absolute;
    top: 25%;
    background-color: #fff;
    overflow-y: scroll;
    .modal-content-add-top {
      width: 320px;
      height: 34px;
      line-height: 34px;
      padding-top: 10px;
      background-color: #fff;
      padding-bottom: 40px;
      position: fixed;
      left: 28px;
      span {
        font-family: PingFangSC-Semibold;
        font-size: 15px;
        color: @headerColor;
        letter-spacing: 0.47px;
      }
      img {
        width: 34px;
        height: 34px;
        float: right;
      }
    }
    .addBack {
      display: block;
      width: 320px;
      margin: 0 auto;
      margin-top: 50px;
      border-radius: 6px;
      margin-bottom: 17px;
    }

    .card-Info {
      margin-bottom: 220px;
    }
  }
  .add-card {
    width: 358px;
    height: 40px;
    background: @headerColor;
    border-radius: 4px;
    color: #fff;
  }
}
.modal {
  background-color: rgba(0, 0, 0, 0) !important;
}
.hls-notify-wrap {
  height: 50px;
  line-height: 34px !important;
}
</style>