enterprise.vue 45 KB
Newer Older
李晓兵's avatar
李晓兵 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
 * @LastEditTime: 2019-10-12 09:42:44
李晓兵's avatar
李晓兵 committed
6 7 8 9 10 11
 * @LastEditors: Please set LastEditors
 -->
<template>
  <h-view id="base-info" class="public-style" title="基本信息">
    <h-header :proportion="[5,1,1]" class="header">
      <div slot="left" class="h-header-btn" @click="$routeGo()">
linxin's avatar
linxin committed
12
        <img src="@/assets/userBind/arrow.png" >
李晓兵's avatar
李晓兵 committed
13 14 15
        <span>用户绑定</span>
      </div>
    </h-header>
linxin's avatar
linxin committed
16
    <Tab :tabNum="tabNum" @getTabNum="getTabNum" />
李晓兵's avatar
李晓兵 committed
17 18 19 20
    <h-content class="content">
      <div v-show="tabNum==0">
        <list-item :item-height="44">
          <item :showArrow="true">
李晓兵's avatar
李晓兵 committed
21
            <div slot="name" class="font-color required">客户类型</div>
李晓兵's avatar
李晓兵 committed
22 23
            <input
              slot="content"
linxin's avatar
linxin committed
24
              v-model="baseInfo.bp_type_n"
李晓兵's avatar
李晓兵 committed
25 26 27 28 29 30 31 32
              placeholder="请选择"
              type="text"
              readonly
              @click="selectIdType()"
            >
          </item>
          <item v-if="bp_type_flag">
            <div slot="name">{{ typeName }}</div>
linxin's avatar
linxin committed
33 34 35 36 37 38
            <input
              v-if="bpClass_flag"
              slot="content"
              :placeholder="type"
              v-model="baseInfo.agent_username"
            >
786817560's avatar
786817560 committed
39
            <!-- <input v-if="!bpClass_flag" slot="content" :placeholder="type" v-model="baseInfo.business_license_num" > -->
李晓兵's avatar
李晓兵 committed
40 41 42 43 44 45
          </item>
        </list-item>
        <div class="userInfo martop">企业信息</div>
        <div class="upload-id-card">
          <span class="font-color">营业执照照片上传</span>
          <div class="upload-box1">
李晓兵's avatar
李晓兵 committed
46
            <div v-if="!licenseImg" @click="ocrShow('license', '')">
linxin's avatar
linxin committed
47
              <img src="@/assets/userBind/camera.png" >
李晓兵's avatar
李晓兵 committed
48
            </div>
linxin's avatar
linxin committed
49 50 51 52 53 54
            <div
              v-if="licenseImg && !isApproved"
              style="width: 100%;height: 100%"
              @click="ocrShow('license', '')"
            >
              <img :src="licenseImg" style="width: 100%;height: 100%;margin: 0" >
李晓兵's avatar
李晓兵 committed
55
            </div>
李晓兵's avatar
李晓兵 committed
56 57 58 59 60 61 62
          </div>
        </div>

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

        <list-item :item-height="44" class="second-part">
          <item>
李晓兵's avatar
李晓兵 committed
63
            <div slot="name" class="font-color required">公司名称</div>
linxin's avatar
linxin committed
64
            <input
linxin's avatar
linxin committed
65 66 67 68 69 70
              slot="content"
              v-model="baseInfo.bp_name"
              readonly
              placeholder="上传营业执照自动填充"
              class="auto"
            >
李晓兵's avatar
李晓兵 committed
71 72
          </item>
          <item>
李晓兵's avatar
李晓兵 committed
73
            <div slot="name" class="font-color required">企业类型</div>
李晓兵's avatar
李晓兵 committed
74 75
            <input
              slot="content"
786817560's avatar
786817560 committed
76
              v-model="baseInfo.enterprise_type"
李晓兵's avatar
李晓兵 committed
77
              readonly
李晓兵's avatar
李晓兵 committed
78 79 80 81 82
              placeholder="上传营业执照自动填充"
              class="auto"
            >
          </item>
          <item>
李晓兵's avatar
李晓兵 committed
83
            <div slot="name" class="font-color required">统一社会信用代码</div>
李晓兵's avatar
李晓兵 committed
84
            <input
linxin's avatar
linxin committed
85 86 87 88 89 90
              slot="content"
              v-model="baseInfo.organization_code"
              readonly
              placeholder="上传营业执照自动填充"
              class="auto"
            >
李晓兵's avatar
李晓兵 committed
91 92
          </item>
          <item>
李晓兵's avatar
李晓兵 committed
93
            <div slot="name" class="font-color required">注册资本</div>
786817560's avatar
786817560 committed
94
            <input
linxin's avatar
linxin committed
95 96 97
              slot="content"
              v-model="baseInfo.registered_capital"
              readonly
linxin's avatar
linxin committed
98
              placeholder="上传营业执照自动填充"
linxin's avatar
linxin committed
99 100
              class="auto"
            >
李晓兵's avatar
李晓兵 committed
101 102
          </item>
          <item>
李晓兵's avatar
李晓兵 committed
103
            <div slot="name" class="font-color required">法定代表人</div>
linxin's avatar
linxin committed
104
            <input
linxin's avatar
linxin committed
105 106 107 108 109 110
              slot="content"
              v-model="baseInfo.legal_person"
              readonly
              placeholder="上传营业执照自动填充"
              class="auto"
            >
李晓兵's avatar
李晓兵 committed
111 112
          </item>
          <item>
李晓兵's avatar
李晓兵 committed
113
            <div slot="name" class="font-color required">注册地址</div>
linxin's avatar
linxin committed
114 115 116 117 118 119 120 121 122 123 124
            <textarea
              slot="content"
              ref="myTestarea"
              v-model="baseInfo.registered_place"
              cols="30"
              rows="1"
              readonly
              class="auto"
              placeholder="上传营业执照自动填充"
              @input="addRows(baseInfo.registered_place)"
            />
李晓兵's avatar
李晓兵 committed
125
          </item>
linxin's avatar
linxin committed
126 127 128 129 130 131 132 133 134 135 136
          <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()"
            >
linxin's avatar
linxin committed
137 138
          </item>
          <item :showArrow="true">
linxin's avatar
linxin committed
139 140 141 142 143 144 145 146 147 148
            <div slot="name" class="required">城市</div>
            <input
              slot="content"
              v-model="baseInfo.city_name"
              placeholder="请选择"
              type="text"
              readonly
              onfocus="this.blur()"
              @click="selectCity()"
            >
linxin's avatar
linxin committed
149 150
          </item>
          <item :showArrow="true">
linxin's avatar
linxin committed
151 152 153 154 155 156 157 158 159 160 161
            <div slot="name" class="required">区县</div>
            <input
              slot="content"
              v-model="baseInfo.district_name"
              placeholder="请选择"
              type="text"
              readonly
              onfocus="this.blur()"
              @click="selectDistrict()"
            >
          </item>
李晓兵's avatar
李晓兵 committed
162
          <item>
李晓兵's avatar
李晓兵 committed
163
            <div slot="name" class="font-color required">经营地址</div>
linxin's avatar
linxin committed
164 165 166 167 168 169 170 171 172
            <textarea
              slot="content"
              ref="myTestareaLive"
              v-model="baseInfo.business_address"
              cols="34"
              rows="1"
              placeholder="请输入经营地址"
              @input="addRowsLive(baseInfo.business_address)"
            />
李晓兵's avatar
李晓兵 committed
173 174
          </item>
          <item>
李晓兵's avatar
李晓兵 committed
175
            <div slot="name" class="font-color required">固定电话</div>
linxin's avatar
linxin committed
176
            <input slot="content" v-model="baseInfo.phone" placeholder="请输入固定电话" >
李晓兵's avatar
李晓兵 committed
177 178 179 180 181 182 183 184
          </item>
        </list-item>

        <!-- 授权切换 -->

        <div class="authorize">
          <p class="authorize-select font-color">是否授权</p>
          <div class="authorize-checklist" @click="authorizeChange">
linxin's avatar
linxin committed
185 186
            <div v-if="flag" />
            <img v-if="!flag" src="@/assets/userBind/org/checklist.png" alt >
李晓兵's avatar
李晓兵 committed
187 188 189 190 191 192
          </div>
        </div>
        <div class="userInfo types">{{ text }}</div>
        <div class="upload-id-cards">
          <span>身份证照片上传</span>
          <div class="upload-box">
李晓兵's avatar
李晓兵 committed
193
            <div v-if="!idCardFront" @click="ocrShow('idCard', 'front')">
linxin's avatar
linxin committed
194
              <img src="@/assets/userBind/org/front.png" >
李晓兵's avatar
李晓兵 committed
195 196
              <p>正面</p>
            </div>
李晓兵's avatar
李晓兵 committed
197
            <div v-if="idCardFront && !isApproved" @click="ocrShow('idCard', 'front')">
linxin's avatar
linxin committed
198
              <img :src="idCardFront" style="width: 100%;height: 100%;margin: 0" >
李晓兵's avatar
李晓兵 committed
199 200
            </div>
            <div v-if="!idCardBack" @click="ocrShow('idCard', 'back')">
linxin's avatar
linxin committed
201
              <img src="@/assets/userBind/org/back.png" >
李晓兵's avatar
李晓兵 committed
202 203
              <p>反面</p>
            </div>
李晓兵's avatar
李晓兵 committed
204
            <div v-if="idCardBack && !isApproved" @click="ocrShow('idCard', 'back')">
linxin's avatar
linxin committed
205
              <img :src="idCardBack" style="width: 100%;height: 100%;margin: 0" >
李晓兵's avatar
李晓兵 committed
206
            </div>
李晓兵's avatar
李晓兵 committed
207 208 209 210 211 212 213
          </div>
        </div>

        <!-- 已授权 -->

        <list-item v-if="!flag" :item-height="44" class="second-part">
          <item>
李晓兵's avatar
李晓兵 committed
214
            <div slot="name" class="font-color required">姓名</div>
李晓兵's avatar
李晓兵 committed
215 216 217
            <input
              slot="content"
              v-model="authMsg.auth_person_name"
李晓兵's avatar
李晓兵 committed
218
              readonly
李晓兵's avatar
李晓兵 committed
219
              placeholder="上传身份证自动填充"
786817560's avatar
786817560 committed
220
              class="auto"
李晓兵's avatar
李晓兵 committed
221 222 223
            >
          </item>
          <item>
李晓兵's avatar
李晓兵 committed
224
            <div slot="name" class="font-color required">身份证号</div>
李晓兵's avatar
李晓兵 committed
225 226 227
            <input
              slot="content"
              v-model="authMsg.auth_person_id_card"
李晓兵's avatar
李晓兵 committed
228
              readonly
李晓兵's avatar
李晓兵 committed
229
              placeholder="上传身份证自动填充"
786817560's avatar
786817560 committed
230
              class="auto"
李晓兵's avatar
李晓兵 committed
231 232 233
            >
          </item>
          <item>
李晓兵's avatar
李晓兵 committed
234
            <div slot="name" class="font-color required">公司职务</div>
linxin's avatar
linxin committed
235
            <input slot="content" v-model="authMsg.auth_person_position" placeholder="请输入公司职务" >
李晓兵's avatar
李晓兵 committed
236 237
          </item>
          <item>
李晓兵's avatar
李晓兵 committed
238
            <div slot="name" class="font-color required">授权事项</div>
linxin's avatar
linxin committed
239
            <input slot="content" v-model="authMsg.auth_person_matter" placeholder="请输入授权事项" >
李晓兵's avatar
李晓兵 committed
240 241 242 243 244 245 246
          </item>
        </list-item>

        <!-- 未授权 -->

        <list-item v-if="flag" :item-height="44" class="second-part">
          <item>
李晓兵's avatar
李晓兵 committed
247
            <div slot="name" class="font-color required">姓名</div>
linxin's avatar
linxin committed
248
            <input
linxin's avatar
linxin committed
249 250 251 252 253 254
              slot="content"
              v-model="baseInfo.legal_person"
              readonly
              placeholder="上传身份证自动填充"
              class="auto"
            >
李晓兵's avatar
李晓兵 committed
255 256
          </item>
          <item>
李晓兵's avatar
李晓兵 committed
257
            <div slot="name" class="font-color required">身份证号</div>
linxin's avatar
linxin committed
258
            <input
linxin's avatar
linxin committed
259 260 261 262 263 264
              slot="content"
              v-model="legal_personMsg.id_card_no"
              readonly
              placeholder="上传身份证自动填充"
              class="auto"
            >
李晓兵's avatar
李晓兵 committed
265 266
          </item>
          <item>
李晓兵's avatar
李晓兵 committed
267
            <div slot="name" class="font-color required">手机号</div>
linxin's avatar
linxin committed
268
            <input slot="content" v-model="legal_personMsg.cell_phone" placeholder="请输入手机号" >
李晓兵's avatar
李晓兵 committed
269 270
          </item>
          <item>
李晓兵's avatar
李晓兵 committed
271
            <div slot="name" class="font-color required">居住地址</div>
linxin's avatar
linxin committed
272 273 274 275 276 277 278 279 280
            <textarea
              ref="address"
              slot="content"
              v-model="legal_personMsg.living_address"
              cols="30"
              rows="1"
              placeholder="请输入居住地址"
              @input="addAddressRows(legal_personMsg.living_address)"
            />
李晓兵's avatar
李晓兵 committed
281 282 283 284 285 286
          </item>
        </list-item>
        <div v-if="!flag" class="upload-id-card">
          <span>授权书证件上传</span>
          <div class="upload-box1">
            <!-- <div> -->
linxin's avatar
linxin committed
287
            <img src="@/assets/userBind/camera.png" >
李晓兵's avatar
李晓兵 committed
288 289 290 291 292 293 294 295 296 297 298
            <!-- </div> -->
          </div>
        </div>

        <!-- 资产信息 -->

        <div :class="{martop: flag,types:!flag}" class="userInfo">资产信息</div>
        <div class="card2">
          <span>房产证件</span>
          <div class="img-content">
            <div class="card-upload">
linxin's avatar
linxin committed
299
              <img src="@/assets/userBind/camera.png" >
李晓兵's avatar
李晓兵 committed
300 301 302 303 304 305 306
            </div>
          </div>
        </div>
        <div class="card2">
          <span>车辆证件</span>
          <div class="img-content">
            <div class="card-upload">
linxin's avatar
linxin committed
307
              <img src="@/assets/userBind/camera.png" >
李晓兵's avatar
李晓兵 committed
308 309 310 311
            </div>
          </div>
        </div>
        <div class="card2">
786817560's avatar
786817560 committed
312
          <span>其他资产证件</span>
李晓兵's avatar
李晓兵 committed
313 314
          <div class="img-content">
            <div class="card-upload">
linxin's avatar
linxin committed
315
              <img src="@/assets/userBind/camera.png" >
李晓兵's avatar
李晓兵 committed
316 317 318 319
            </div>
          </div>
        </div>
      </div>
320
      <!-- <BankInfo v-show="tabNum==1" :bp_id="bp_id" @getInfo="getInfo" /> -->
linxin's avatar
linxin committed
321
      <BankInfo v-show="tabNum==1" :getBankList="getBankList" @getInfo="getInfo" />
linxin's avatar
linxin committed
322
      <InvoiceInfo
linxin's avatar
linxin committed
323 324 325 326 327 328
        v-show="tabNum==2"
        :tabNum="tabNum"
        :baseInfo="baseInfo"
        :orgCode="baseInfo.organization_code"
        @getinvoiceList="getinvoiceList"
      />
李晓兵's avatar
李晓兵 committed
329 330
    </h-content>
    <bottom-tab class="footer-button">
linxin's avatar
linxin committed
331 332
      <tab-button :class="[isApproved?'put-approved':'put']" @click.native="handSubmit">提交</tab-button>
      <tab-button v-if="!isApproved" class="save" @click.native="verified">保存</tab-button>
李晓兵's avatar
李晓兵 committed
333
    </bottom-tab>
李晓兵's avatar
李晓兵 committed
334
    <h-modal ref="modal" v-model="showModalValue" position="bottom">
李晓兵's avatar
李晓兵 committed
335 336 337 338
      <h-view>
        <div class="modal-content">
          <div class="modal-content-add-top">
            <span>添加银行卡</span>
linxin's avatar
linxin committed
339
            <img src="@/assets/userBind/close.png" @click="hideModal" >
李晓兵's avatar
李晓兵 committed
340
          </div>
李晓兵's avatar
李晓兵 committed
341
          <img
linxin's avatar
linxin committed
342 343 344 345 346 347 348 349 350 351 352 353
            v-if="!bankImg"
            src="@/assets/userBind/addBack.png"
            class="addBack"
            @click="ocrShow('bankCard', '')"
          >
          <img
            v-if="bankImg && !isApproved"
            :src="bankImg"
            class="addBack"
            style="height: 38%;"
            @click="ocrShow('bankCard', '')"
          >
李晓兵's avatar
李晓兵 committed
354 355 356 357 358 359
          <list-item :item-height="44" class="card-Info">
            <item>
              <div slot="name">银行卡卡号</div>
              <input
                slot="content"
                v-model="bank_lists.bank_account_num"
李晓兵's avatar
李晓兵 committed
360 361
                readonly
                placeholder="识别银行卡自动填充"
李晓兵's avatar
李晓兵 committed
362 363 364 365
              >
            </item>
            <item>
              <div slot="name">账户姓名</div>
linxin's avatar
linxin committed
366
              <input slot="content" v-model="bank_lists.bank_account_name" placeholder="请输入账户名称" >
李晓兵's avatar
李晓兵 committed
367 368 369 370 371 372
            </item>
            <item>
              <div slot="name">银行名称</div>
              <input
                slot="content"
                v-model="bank_lists.bank_full_name"
李晓兵's avatar
李晓兵 committed
373 374
                readonly
                placeholder="识别银行卡自动填充"
李晓兵's avatar
李晓兵 committed
375 376 377 378
              >
            </item>
            <item>
              <div slot="name">支行名称</div>
linxin's avatar
linxin committed
379
              <input slot="content" v-model="bank_lists.bank_branch_name" placeholder="请输入支行名称" >
李晓兵's avatar
李晓兵 committed
380 381
            </item>
          </list-item>
李晓兵's avatar
李晓兵 committed
382
        </div>
李晓兵's avatar
李晓兵 committed
383
      </h-view>
李晓兵's avatar
李晓兵 committed
384
      <bottom-tab class="add-box">
786817560's avatar
786817560 committed
385
        <tab-button class="add-card" @click.native="addBankInfo">添加</tab-button>
李晓兵's avatar
李晓兵 committed
386 387 388 389 390 391 392 393 394
      </bottom-tab>
    </h-modal>
  </h-view>
</template>

<script>
import Tab from '@/components/tab'
import InvoiceInfo from './invoiceInfo'
import BankInfo from './bankInfo'
李晓兵's avatar
李晓兵 committed
395

李晓兵's avatar
李晓兵 committed
396 397 398 399 400 401 402 403 404 405
export default {
  name: 'Enterprise',
  components: {
    Tab,
    BankInfo,
    InvoiceInfo,
  },
  data () {
    return {
      tabNum: 0,
786817560's avatar
786817560 committed
406
      bp_id: '',
李晓兵's avatar
李晓兵 committed
407
      flag: true,
786817560's avatar
786817560 committed
408
      bpClass: '',
linxin's avatar
linxin committed
409 410
      from: false,
      isApproved: false,
李晓兵's avatar
李晓兵 committed
411 412 413
      img_url: {},
      typeList: [],
      backList: [],
786817560's avatar
786817560 committed
414
      saveInfo: {},
李晓兵's avatar
李晓兵 committed
415
      lastInfo: {},
786817560's avatar
786817560 committed
416
      msg_flag: false,
李晓兵's avatar
李晓兵 committed
417 418
      invoiceInfo: {},
      maritalList: [],
419
      getBankList: [],
linxin's avatar
linxin committed
420 421 422
      cityList: [],
      provinceList: [],
      districtList: [],
李晓兵's avatar
李晓兵 committed
423
      academic_bg_n: '',
786817560's avatar
786817560 committed
424
      bpClass_flag: false,
李晓兵's avatar
李晓兵 committed
425 426
      text: '法人代表信息',
      bp_type_flag: false,
786817560's avatar
786817560 committed
427
      typeName: '',
李晓兵's avatar
李晓兵 committed
428
      marital_status_n: '',
786817560's avatar
786817560 committed
429
      bank_card_flag: false,
李晓兵's avatar
李晓兵 committed
430 431 432 433
      showModalValue: false,
      type: '请输入业务经办姓名',
      legal_personMsg: {
        id_card_no: null,
linxin's avatar
linxin committed
434
        // legal_person: '',
李晓兵's avatar
李晓兵 committed
435 436 437 438
        cell_phone: null,
        living_address: '',
      },
      baseInfo: {
linxin's avatar
linxin committed
439 440 441 442 443 444
        district_id: '',
        district_name: '',
        province_name: '',
        province_id: '',
        city_name: '',
        city_id: '',
李晓兵's avatar
李晓兵 committed
445
        bp_type: '',
linxin's avatar
linxin committed
446
        bp_type_n: '',
李晓兵's avatar
李晓兵 committed
447
        bp_name: '',
linxin's avatar
linxin committed
448
        phone: '',
李晓兵's avatar
李晓兵 committed
449
        auth_flag: '',
786817560's avatar
786817560 committed
450
        user_phone: window.localStorage.user_phone,
李晓兵's avatar
李晓兵 committed
451 452
        legal_person: '',
        agent_username: '',
786817560's avatar
786817560 committed
453 454
        enterprise_type: '',
        business_address: '',
李晓兵's avatar
李晓兵 committed
455
        registered_place: '',
linxin's avatar
linxin committed
456 457
        organization_code: '',
        registered_capital: '',
linxin's avatar
linxin committed
458
        // business_license_num: '',
李晓兵's avatar
李晓兵 committed
459 460 461 462 463
        bp_class: this.$route.params.bp_class,
      },
      bank_lists: {
        bank_account_num: '',
        bank_account_name: '',
李晓兵's avatar
李晓兵 committed
464
        bank_card_type: '',
李晓兵's avatar
李晓兵 committed
465 466 467 468 469 470 471 472 473
        bank_full_name: '',
        bank_branch_name: '',
      },
      authMsg: {
        auth_person_name: '',
        auth_person_matter: '',
        auth_person_id_card: '',
        auth_person_position: '',
      },
李晓兵's avatar
李晓兵 committed
474 475 476
      idCardFront: '', // 身份证正面图片
      idCardBack: '', // 身份证反面图片
      licenseImg: '', // 营业执照照片
李晓兵's avatar
李晓兵 committed
477
      bankImg: '', // 银行卡图片
李晓兵's avatar
李晓兵 committed
478 479 480 481
    }
  },
  computed: {},
  watch: {
linxin's avatar
linxin committed
482 483 484
    'baseInfo.auth_flag' (newVal, oldVal) {
      if (newVal === '是') {
        this.flag = false
linxin's avatar
linxin committed
485
      } else if (newVal === '否') {
linxin's avatar
linxin committed
486 487 488
        this.flag = true
      }
    },
李晓兵's avatar
李晓兵 committed
489
    // 监听客户类型
linxin's avatar
linxin committed
490
    'baseInfo.bp_type_n' () {
李晓兵's avatar
李晓兵 committed
491 492 493
      let vm = this
      if (vm.baseInfo.bp_type === 'TENANT' || vm.baseInfo.bp_type === 'GUTA') {
        vm.type = '请输入业务经办员工代码'
786817560's avatar
786817560 committed
494
        vm.typeName = '业务经办人'
linxin's avatar
linxin committed
495
        // vm.baseInfo.agent_username = ''
李晓兵's avatar
李晓兵 committed
496 497
      } else if (
        vm.baseInfo.bp_type === 'AGENT' ||
linxin's avatar
linxin committed
498 499
        vm.baseInfo.bp_type === 'OFFICE' ||
        vm.baseInfo.bp_type === 'FACTORY'
李晓兵's avatar
李晓兵 committed
500
      ) {
786817560's avatar
786817560 committed
501 502 503 504
        vm.bp_type_flag = false
        // vm.typeName = '营业执照'
        // vm.type = '请输入营业执照号'
        // vm.baseInfo.agent_username = ''
李晓兵's avatar
李晓兵 committed
505 506 507 508 509 510 511 512 513
      }
    },
    flag () {
      if (this.flag) {
        this.text = '法人代表信息'
      } else {
        this.text = '授权信息'
      }
    },
786817560's avatar
786817560 committed
514 515 516 517 518 519 520 521 522
    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
      }
    },
linxin's avatar
linxin committed
523 524
    tabNum: function (newVal, oldVal) {
      if (newVal === 1 && !this.bp_id && !this.from) {
786817560's avatar
786817560 committed
525 526
        this.hlsPopup.showError('请先保存基本信息')
        this.tabNum = oldVal
李晓兵's avatar
李晓兵 committed
527
      }
786817560's avatar
786817560 committed
528
    },
李晓兵's avatar
李晓兵 committed
529 530 531
  },
  created () {
    this.getBpType()
linxin's avatar
linxin committed
532
    this.getProvince()
linxin's avatar
linxin committed
533 534 535
    if (this.$route.params.status === 'APPROVED') {
      this.isApproved = true
    }
536
    // this.getBankInfo()
李晓兵's avatar
李晓兵 committed
537
  },
linxin's avatar
linxin committed
538 539 540 541 542 543 544 545 546 547
  beforeRouteEnter (to, from, next) {
    if (from.fullPath === '/tab/my-info') {
      next(vm => {
        vm.from = true
        vm.getbaseInfo()
        vm.getBankInfo()
      })
    }
    next()
  },
李晓兵's avatar
李晓兵 committed
548
  methods: {
549 550
    getBankInfo () {
      let vm = this
786817560's avatar
786817560 committed
551
      // let bpId = window.localStorage.getItem('user_id')
linxin's avatar
linxin committed
552 553
      let id = vm.from ? vm.$route.params.bp_id : vm.bp_id
      // let bpId = vm.bp_id
554 555
      let url = process.env.basePath + 'bp_bank_query'
      let param = {
linxin's avatar
linxin committed
556
        bp_id: id,
557 558 559 560 561
      }
      vm.hlsPopup.showLoading('请稍候')
      vm.hlsHttp.post(url, param).then(function (res) {
        vm.hlsPopup.hideLoading()
        if (res.result === 'S') {
562
          vm.getBankList = res.lists
563 564 565
        }
      })
    },
linxin's avatar
linxin committed
566
    addRows (e) {
linxin's avatar
linxin committed
567
      let addNum = parseInt(e.length / 16)
linxin's avatar
linxin committed
568 569 570 571 572 573 574
      if (addNum === 0) {
        this.$refs.myTestarea.rows = 1
      } else if (addNum >= addNum - 1 && addNum < addNum + 1) {
        this.$refs.myTestarea.rows = addNum + 1
      }
    },
    addRowsLive (e) {
linxin's avatar
linxin committed
575
      let addNum = parseInt(e.length / 16)
linxin's avatar
linxin committed
576 577 578 579 580 581 582
      if (addNum === 0) {
        this.$refs.myTestareaLive.rows = 1
      } else if (addNum >= addNum - 1 && addNum < addNum + 1) {
        this.$refs.myTestareaLive.rows = addNum + 1
      }
    },
    addAddressRows (e) {
linxin's avatar
linxin committed
583
      let addNum = parseInt(e.length / 16)
linxin's avatar
linxin committed
584 585 586 587 588 589
      if (addNum === 0) {
        this.$refs.address.rows = 1
      } else if (addNum >= addNum - 1 && addNum < addNum + 1) {
        this.$refs.address.rows = addNum + 1
      }
    },
786817560's avatar
786817560 committed
590
    handSubmit () {
786817560's avatar
786817560 committed
591 592 593 594
      if (this.bp_id) {
        this.hlsPopup.showConfirm({
          title: '提示',
          content: '您确认提交吗?',
linxin's avatar
linxin committed
595
          onConfirm: data => {
786817560's avatar
786817560 committed
596 597 598 599 600
            console.log(data)
            if (data) {
              let url = $config.basePath + 'bp_bind_submit'
              let param = {
                master: {
linxin's avatar
linxin committed
601
                  // bp_id: window.localStorage.getItem('user_id'),
786817560's avatar
786817560 committed
602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620
                  bp_id: this.bp_id,
                  company_id: '2145',
                },
              }
              let vm = this
              this.hlsHttp.post(url, param).then(function (res) {
                console.log('企业信息提交', res)
                if (res.result === 'S') {
                  vm.hlsPopup.showSuccess('提交成功')
                  vm.$router.push({
                    name: 'Home',
                  })
                }
              })
            }
          },
        })
      } else {
        this.hlsPopup.showLongCenter('基本信息未保存!')
786817560's avatar
786817560 committed
621
      }
786817560's avatar
786817560 committed
622 623
    },
    addBankInfo () {
786817560's avatar
786817560 committed
624 625 626
      this.hlsPopup.showConfirm({
        title: '提示',
        content: '您确认添加吗?',
linxin's avatar
linxin committed
627
        onConfirm: data => {
786817560's avatar
786817560 committed
628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647
          console.log(data)
          if (data) {
            for (var key in this.bank_lists) {
              if (!this.bank_lists[key]) {
                this.bank_card_flag = false
                this.hlsPopup.showLongCenter('银行信息不完整!')
                return
              } else {
                this.bank_card_flag = true
              }
            }
            // 银行卡验证this.hlsUtil.isBankAccount(this.bank.bank_account_num)
            if (this.hlsUtil.isBankAccount(this.bank_lists.bank_account_num)) {
              this.bank_card_flag = false
              this.hlsPopup.showLongCenter('请输入正确银行卡号!')
            }
            // 验证账户名称与承租人名称一致
            if (this.bank_lists.bank_account_name !== this.saveInfo.bp_name) {
              this.bank_card_flag = false
              this.hlsPopup.showLongCenter('企业名称与账户名称不一致')
786817560's avatar
786817560 committed
648
            }
786817560's avatar
786817560 committed
649 650
            if (this.bank_card_flag) {
              this.hlsPopup.showLoading('请稍后')
linxin's avatar
linxin committed
651 652 653 654 655 656
              let id
              if (this.from) {
                id = this.$route.params.bp_id
              } else {
                id = this.bp_id
              }
786817560's avatar
786817560 committed
657 658
              let url = $config.basePath + 'bp_bank_save'
              let param = {
linxin's avatar
linxin committed
659 660 661
                master: {
                  bp_id: id,
                  bank_lists: [this.bank_lists],
786817560's avatar
786817560 committed
662 663 664 665
                },
              }
              let vm = this
              vm.hlsHttp.post(url, param).then(function (res) {
linxin's avatar
linxin committed
666
                //   console.log(res)
786817560's avatar
786817560 committed
667 668 669 670 671 672
                if (res.result === 'S') {
                  vm.hlsPopup.hideLoading()
                  vm.showModalValue = false
                  vm.hlsPopup.showSuccess('添加成功')
                  let url = $config.basePath + 'bp_bank_query'
                  let param = {
linxin's avatar
linxin committed
673
                    bp_id: id,
786817560's avatar
786817560 committed
674 675 676 677 678 679 680 681 682
                  }

                  vm.hlsHttp.post(url, param).then(function (res) {
                    console.log('银行卡查询', res)
                    vm.getBankList = [...vm.getBankList, ...res.lists]
                  })
                }
              })
            }
786817560's avatar
786817560 committed
683
          }
786817560's avatar
786817560 committed
684 685
        },
      })
786817560's avatar
786817560 committed
686 687
    },

李晓兵's avatar
李晓兵 committed
688
    verified () {
689
      // debugger
李晓兵's avatar
李晓兵 committed
690
      if (this.flag) {
linxin's avatar
linxin committed
691 692 693 694 695
        // this.flag = false
        for (let i in this.authMsg) {
          this.authMsg[i] = ''
        }

786817560's avatar
786817560 committed
696
        this.baseInfo.auth_flag = 'N'
linxin's avatar
linxin committed
697 698 699 700 701 702
        this.lastInfo = { ...this.baseInfo, ...this.legal_personMsg }
        this.saveInfo = {
          ...this.lastInfo,
          ...this.authMsg,
          ...this.invoiceInfo,
        }
linxin's avatar
linxin committed
703
        this.saveInfo.auth_flag = 'N'
李晓兵's avatar
李晓兵 committed
704
      } else {
linxin's avatar
linxin committed
705 706 707 708 709
        // this.flag = false
        for (let i in this.legal_personMsg) {
          this.legal_personMsg[i] = ''
        }

786817560's avatar
786817560 committed
710
        this.baseInfo.auth_flag = 'Y'
linxin's avatar
linxin committed
711 712 713 714 715 716
        this.lastInfo = { ...this.baseInfo, ...this.authMsg }
        this.saveInfo = {
          ...this.lastInfo,
          ...this.legal_personMsg,
          ...this.invoiceInfo,
        }
linxin's avatar
linxin committed
717
        this.saveInfo.auth_flag = 'Y'
李晓兵's avatar
李晓兵 committed
718
      }
786817560's avatar
786817560 committed
719
      console.log('last', this.lastInfo, this.invoiceInfo)
李晓兵's avatar
李晓兵 committed
720
      let vm = this
721

786817560's avatar
786817560 committed
722
      // 校验基本信息
786817560's avatar
786817560 committed
723
      if (this.bpClass_flag) {
724 725 726 727
        delete this.lastInfo.business_license_num
        delete this.lastInfo.id_card_name
        for (var key in vm.lastInfo) {
          if (!vm.lastInfo[key]) {
786817560's avatar
786817560 committed
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 784 785 786
            console.log('key', key, vm.bpClass)
            switch (key) {
              case 'bp_type':
                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 'phone':
                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
              case 'auth_person_name':
                vm.hlsPopup.showLongCenter('授权人姓名未填写')
                break
              case 'auth_person_id_card':
                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
787
          }
李晓兵's avatar
李晓兵 committed
788
        }
789 790
        this.lastInfo.business_license_num = ''
        this.lastInfo.id_card_name = ''
786817560's avatar
786817560 committed
791
      } else {
792 793 794 795
        delete this.lastInfo.agent_username
        delete this.lastInfo.id_card_name
        for (var key1 in vm.lastInfo) {
          if (!vm.lastInfo[key1]) {
786817560's avatar
786817560 committed
796
            console.log('key', key1)
linxin's avatar
linxin committed
797
            debugger
786817560's avatar
786817560 committed
798 799 800 801 802 803 804 805 806 807 808 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 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857
            switch (key1) {
              case 'bp_type':
                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 'phone':
                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
              case 'auth_person_name':
                vm.hlsPopup.showLongCenter('授权人姓名未填写')
                break
              case 'auth_person_id_card':
                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
          }
        }
858 859
        this.lastInfo.agent_username = ''
        this.lastInfo.id_card_name = ''
李晓兵's avatar
李晓兵 committed
860
      }
786817560's avatar
786817560 committed
861 862 863 864 865

      // if (!vm.bp_type_flag) {
      // vm.baseInfo.agent_username = ''
      // vm.saveInfo.agent_username = ''
      // }
786817560's avatar
786817560 committed
866
      // 校验电话号
786817560's avatar
786817560 committed
867 868
      let re = this.hlsUtil.phoneNumber(this.saveInfo.cell_phone)
      if (!re && this.baseInfo.auth_flag === 'N') {
786817560's avatar
786817560 committed
869
        vm.msg_flag = false
786817560's avatar
786817560 committed
870
        vm.hlsPopup.showLongCenter('请输入正确手机号')
786817560's avatar
786817560 committed
871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888
      }
      // 校验身份证号vm.hlsUtil.isCardID(vm.baseInfo.id_card_no)
      if (vm.flag) {
        if (vm.hlsUtil.isCardID(vm.saveInfo.id_card_no)) {
          vm.msg_flag = false
          vm.hlsPopup.showLongCenter('身份证不正确')
        }
      } else {
        if (vm.hlsUtil.isCardID(vm.saveInfo.auth_person_id_card)) {
          vm.msg_flag = false
          vm.hlsPopup.showLongCenter('身份证不正确')
        }
      }

      if (vm.msg_flag) {
        vm.hlsPopup.showLoading('请稍后')
        let url = $config.basePath + 'bp_org_bind_save'
        let param = {
linxin's avatar
linxin committed
889
          master: vm.saveInfo,
786817560's avatar
786817560 committed
890 891 892 893 894
        }
        vm.hlsHttp.post(url, param).then(function (res) {
          console.log(res)
          if (res.result === 'S') {
            vm.hlsPopup.hideLoading()
786817560's avatar
786817560 committed
895
            vm.hlsPopup.showSuccess('保存成功')
786817560's avatar
786817560 committed
896 897
            // window.localStorage.setItem('user_id', res.bp_id)
            // window.sessionStorage.setItem('user_id', res.bp_id)
786817560's avatar
786817560 committed
898
            vm.bp_id = res.bp_id
899
            vm.getBankInfo()
786817560's avatar
786817560 committed
900 901 902
          }
        })
      }
李晓兵's avatar
李晓兵 committed
903 904 905 906 907 908 909 910 911 912
    },
    hideModal () {
      this.showModalValue = false
    },
    getInfo (i) {
      this.showModalValue = i
    },
    getinvoiceList (val) {
      console.log(val)
      this.invoiceInfo = val
913
      this.baseInfo.organization_code = val.organization_code
李晓兵's avatar
李晓兵 committed
914 915 916 917 918 919 920 921 922
    },
    authorizeChange () {
      this.flag = !this.flag
      if (this.flag) {
        this.auth_flag = '未授权'
      } else {
        this.auth_flag = '已授权'
      }
    },
linxin's avatar
linxin committed
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
    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
linxin's avatar
linxin committed
954
      if (vm.baseInfo.city_id === '' || vm.baseInfo.province_id === '') {
linxin's avatar
linxin 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 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021
        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,
            }
          })
        }
      })
    },
李晓兵's avatar
李晓兵 committed
1022 1023 1024 1025 1026 1027 1028 1029 1030
    // 客户类型下拉框
    selectIdType (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
linxin's avatar
linxin committed
1031
          vm.baseInfo.bp_type_n = obj.bp_type_n
linxin's avatar
linxin committed
1032 1033 1034 1035
          if (
            vm.baseInfo.bp_type === 'TENANT' ||
            vm.baseInfo.bp_type === 'GUTA'
          ) {
linxin's avatar
linxin committed
1036 1037
            vm.bp_type_flag = true
          }
李晓兵's avatar
李晓兵 committed
1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048
        },
      })
    },
    getTabNum (i) {
      this.tabNum = i
    },
    fileSuccess (fileList, result) {
      this.fileList = fileList
      this.fileList.forEach((itemFile, index) => {
        if (
          result.response &&
linxin's avatar
linxin committed
1049 1050 1051
          itemFile.file &&
          !itemFile.attachment_id &&
          result.response.fileName === itemFile.file.name
李晓兵's avatar
李晓兵 committed
1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066
        ) {
          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') {
786817560's avatar
786817560 committed
1067
          console.log('客户类型。。。。。。', res.lists)
linxin's avatar
linxin committed
1068 1069 1070 1071 1072 1073 1074 1075
          vm.typeList = res.lists
            .filter(item => item.bp_type !== 'OFFICE')
            .map(item => {
              return {
                code: item.bp_type,
                code_name: item.bp_type_n,
              }
            })
786817560's avatar
786817560 committed
1076 1077 1078 1079 1080 1081
          // vm.typeList = res.lists.map(item => {
          //   return {
          //     code: item.bp_type,
          //     code_name: item.bp_type_n,
          //   }
          // })
李晓兵's avatar
李晓兵 committed
1082 1083 1084
        }
      })
    },
linxin's avatar
linxin committed
1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095
    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
linxin's avatar
linxin committed
1096
          vm.baseInfo = { ...res.info }
linxin's avatar
linxin committed
1097 1098 1099 1100 1101 1102
          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
          // delete res.info.agent_username
          vm.legal_personMsg.id_card_no = res.info.id_card_no
linxin's avatar
linxin committed
1103
          // vm.legal_personMsg.legal_person = res.info.legal_person
linxin's avatar
linxin committed
1104 1105 1106 1107 1108 1109 1110 1111
          vm.legal_personMsg.cell_phone = res.info.cell_phone
          vm.legal_personMsg.living_address = res.info.living_address
          Object.assign(vm.saveInfo, res.info)
        } else {
          hlsPopup.showLongCenter(res.message)
        }
      })
    },
李晓兵's avatar
李晓兵 committed
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

    // 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 (ocrType === 'idCard') {
李晓兵's avatar
李晓兵 committed
1137
          type === 'front' ? (vm.idCardFront = imgdata, vm.idCardIdentify(imgdata)) : (vm.idCardBack = imgdata)
李晓兵's avatar
李晓兵 committed
1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160
        } else if (ocrType === 'bankCard') {
          vm.bankImg = imgdata
          vm.bankCardIdentify(imgdata)
        } else if (ocrType === 'license') {
          vm.licenseImg = imgdata
          vm.licenseIdentify(imgdata)
        }
      }
      let error = function () {
        hlsPopup.showLongCenter(error)
      }
      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 (ocrType === 'idCard') {
linxin's avatar
linxin committed
1161 1162 1163
          type === 'front'
            ? (vm.idCardFront = imgUrl[0])
            : (vm.idCardBack = imgUrl[0])
李晓兵's avatar
李晓兵 committed
1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185
          vm.idCardIdentify(imgUrl[0])
        } else if (ocrType === 'bankCard') {
          vm.bankImg = imgUrl[0]
          vm.bankCardIdentify(imgUrl[0])
        } else if (ocrType === 'license') {
          vm.licenseImg = imgUrl[0]
          vm.licenseIdentify(imgUrl[0])
        }
      }
      let error = function () {
        hlsPopup.showLongCenter(error)
      }
      vm.hlsUtil.takePicture(cameraoptions, success, error)
    },
    // 身份证识别
    idCardIdentify (fileUrl) {
      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
linxin's avatar
linxin committed
1186 1187
        if (vm.flag) {
          // 未授权 姓名,身份证号
李晓兵's avatar
李晓兵 committed
1188 1189
          vm.baseInfo.legal_person = result.姓名.words
          vm.legal_personMsg.id_card_no = result.公民身份号码.words
linxin's avatar
linxin committed
1190 1191
        } else {
          // 已授权  姓名,身份证号
李晓兵's avatar
李晓兵 committed
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
          vm.authMsg.auth_person_name = result.姓名.words
          vm.authMsg.auth_person_id_card = result.公民身份号码.words
        }
      })
    },
    // 银行卡识别
    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_lists.bank_account_num = result.bank_card_number
        vm.bank_lists.bank_full_name = result.bank_name
        vm.bank_lists.bank_card_type = result.bank_card_type
      })
    },
    // 营业执照识别
    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
      })
    },
李晓兵's avatar
李晓兵 committed
1226 1227 1228
  },
}
</script>
李晓兵's avatar
李晓兵 committed
1229
<style lang='less'>
linxin's avatar
linxin committed
1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246
#base-info {
  font-family: PingFangSC-Regular;

  input::placeholder {
    color: #b4b4b5;
  }
  textarea::placeholder {
    color: #b4b4b5;
  }
  textarea {
    // height: 28px;
    text-align: right;
    // padding-top:16px;
  }
  .header {
    background-color: #00469c;
    color: #fff;
李晓兵's avatar
李晓兵 committed
1247

linxin's avatar
linxin committed
1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262
    .h-header-btn {
      img {
        width: 16px;
        height: 16px;
        margin-left: 4px;
      }

      span {
        font-family: PingFangSC-Semibold;
        color: #fff;
        margin-left: 16px;
        font-size: 17px;
        letter-spacing: 0.6px;
        line-height: 24px;
      }
李晓兵's avatar
李晓兵 committed
1263
    }
linxin's avatar
linxin committed
1264
  }
李晓兵's avatar
李晓兵 committed
1265

linxin's avatar
linxin committed
1266 1267 1268
  .content {
    margin-top: 3px;
    height: 76%;
李晓兵's avatar
李晓兵 committed
1269

linxin's avatar
linxin committed
1270 1271 1272
    .font-color {
      color: #656464;
    }
李晓兵's avatar
李晓兵 committed
1273

linxin's avatar
linxin committed
1274 1275
    .martop {
      margin-top: -10px;
李晓兵's avatar
李晓兵 committed
1276
    }
李晓兵's avatar
李晓兵 committed
1277

linxin's avatar
linxin committed
1278 1279 1280 1281 1282 1283 1284 1285 1286
    .userInfo {
      height: 40px;
      line-height: 40px;
      background-color: #fafafa;
      color: #00469c;
      font-size: 15px;
      margin-left: 16px;
      position: relative;
    }
李晓兵's avatar
李晓兵 committed
1287

linxin's avatar
linxin committed
1288 1289 1290 1291 1292 1293 1294 1295 1296 1297
    .userInfo::before {
      content: "";
      display: block;
      width: 4px;
      height: 20px;
      background-color: #00469c;
      position: absolute;
      left: -15px;
      top: 10px;
    }
李晓兵's avatar
李晓兵 committed
1298

linxin's avatar
linxin committed
1299 1300 1301
    .types {
      margin-top: 0;
    }
李晓兵's avatar
李晓兵 committed
1302

linxin's avatar
linxin committed
1303 1304 1305 1306 1307 1308 1309
    .authorize {
      width: 100%;
      height: 32px;
      display: flex;
      flex-direction: row;
      align-items: center;
      background: rgba(0, 70, 156, 0.03);
李晓兵's avatar
李晓兵 committed
1310

linxin's avatar
linxin committed
1311 1312
      .authorize-select {
        // width: 48px;
李晓兵's avatar
李晓兵 committed
1313
        height: 20px;
linxin's avatar
linxin committed
1314 1315 1316 1317 1318
        font-family: PingFangSC-Regular;
        font-size: 12px;
        color: #656464;
        line-height: 20px;
        margin-left: 16px;
李晓兵's avatar
李晓兵 committed
1319
      }
李晓兵's avatar
李晓兵 committed
1320

linxin's avatar
linxin committed
1321 1322 1323 1324
      .authorize-checklist {
        width: 16px;
        height: 16px;
        margin-left: 8px;
李晓兵's avatar
李晓兵 committed
1325

linxin's avatar
linxin committed
1326 1327 1328 1329 1330
        div {
          width: 100%;
          height: 100%;
          border: 1px solid #00469c;
          border-radius: 3px;
李晓兵's avatar
李晓兵 committed
1331
        }
linxin's avatar
linxin committed
1332 1333
      }
    }
李晓兵's avatar
李晓兵 committed
1334

linxin's avatar
linxin committed
1335 1336 1337
    .upload-id-cards {
      height: 176px;
      background-color: #fff;
李晓兵's avatar
李晓兵 committed
1338

linxin's avatar
linxin committed
1339 1340 1341 1342 1343 1344
      span {
        display: block;
        color: #656464;
        margin-left: 16px;
        padding-top: 16px;
        font-size: 13px;
李晓兵's avatar
李晓兵 committed
1345 1346
      }

linxin's avatar
linxin committed
1347 1348 1349 1350
      .upload-box {
        display: flex;
        justify-content: center;
        margin-top: 15px;
李晓兵's avatar
李晓兵 committed
1351

linxin's avatar
linxin committed
1352 1353 1354 1355 1356 1357 1358
        div {
          width: 172px;
          height: 120px;
          border: 1px dashed #dcdcdd;
          text-align: center;
          font-size: 14px;
          color: #b4b4b5;
李晓兵's avatar
李晓兵 committed
1359

linxin's avatar
linxin committed
1360 1361
          .front,
          .back {
李晓兵's avatar
李晓兵 committed
1362 1363
            width: 172px;
            height: 120px;
李晓兵's avatar
李晓兵 committed
1364
          }
linxin's avatar
linxin committed
1365
        }
李晓兵's avatar
李晓兵 committed
1366

linxin's avatar
linxin committed
1367 1368 1369
        div:nth-of-type(2) {
          margin-left: 7px;
        }
李晓兵's avatar
李晓兵 committed
1370

linxin's avatar
linxin committed
1371 1372 1373 1374 1375
        img {
          margin-top: 32px;
          width: 58px;
          height: 45px;
        }
李晓兵's avatar
李晓兵 committed
1376

linxin's avatar
linxin committed
1377 1378 1379
        p {
          margin-top: 12px;
          font-size: 13px;
李晓兵's avatar
李晓兵 committed
1380
        }
李晓兵's avatar
李晓兵 committed
1381
      }
linxin's avatar
linxin committed
1382
    }
李晓兵's avatar
李晓兵 committed
1383

linxin's avatar
linxin committed
1384 1385 1386
    .upload-id-card {
      height: 122px;
      background-color: #fff;
李晓兵's avatar
李晓兵 committed
1387

linxin's avatar
linxin committed
1388 1389 1390 1391 1392 1393 1394
      span {
        display: block;
        color: #656464;
        margin-left: 16px;
        padding-top: 16px;
        font-size: 13px;
      }
李晓兵's avatar
李晓兵 committed
1395

linxin's avatar
linxin committed
1396 1397 1398 1399 1400 1401 1402
      .upload-box1 {
        width: 80px;
        height: 80px;
        border: 1px dashed #dcdcdd;
        text-align: center;
        margin-top: 8px;
        margin-left: 16px;
李晓兵's avatar
李晓兵 committed
1403

linxin's avatar
linxin committed
1404 1405 1406 1407
        img {
          margin-top: 30px;
          width: 25px;
          height: 25px;
李晓兵's avatar
李晓兵 committed
1408
        }
李晓兵's avatar
李晓兵 committed
1409
      }
linxin's avatar
linxin committed
1410
    }
李晓兵's avatar
李晓兵 committed
1411

linxin's avatar
linxin committed
1412 1413
    .second-part {
      margin-top: 9px;
李晓兵's avatar
李晓兵 committed
1414

linxin's avatar
linxin committed
1415 1416
      .auto {
        color: #b4b4b5;
李晓兵's avatar
李晓兵 committed
1417
      }
linxin's avatar
linxin committed
1418 1419 1420 1421 1422 1423
    }
    .card2 {
      padding-bottom: 8px;
      height: auto;
      background-color: #fff;
      margin-bottom: 10px;
李晓兵's avatar
李晓兵 committed
1424

linxin's avatar
linxin committed
1425 1426 1427 1428 1429 1430 1431 1432
      span {
        color: #656464;
        font-size: 13px;
        line-height: 18px;
        padding-top: 8px;
        display: block;
        margin-left: 16px;
      }
李晓兵's avatar
李晓兵 committed
1433

linxin's avatar
linxin committed
1434 1435 1436 1437 1438 1439
      .img-content {
        display: flex;
        flex-flow: row wrap;
        justify-content: flex-start;
        align-items: center;
      }
李晓兵's avatar
李晓兵 committed
1440

linxin's avatar
linxin committed
1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453
      .card-upload {
        width: 80px;
        height: 80px;
        border: 1px dashed #dcdcdd;
        display: flex;
        justify-content: center;
        align-items: center;
        margin-top: 12px;
        margin-left: 16px;
        // float: left;
        img {
          width: 24px;
          height: 24px;
李晓兵's avatar
李晓兵 committed
1454 1455 1456
        }
      }
    }
linxin's avatar
linxin committed
1457
  }
李晓兵's avatar
李晓兵 committed
1458

linxin's avatar
linxin committed
1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475
  .put {
    width: 175px;
    height: 45px;
    color: #00469c;
    border-radius: 4px;
    border: 1px solid #00469c;
    background-color: #fafafa;
  }
  .put-approved {
    width: 90%;
    height: 45px;
    color: #fff;
    border-radius: 4px;
    background-color: #00469c;
  }
  .save {
    width: 175px;
linxin's avatar
linxin committed
1476 1477 1478 1479 1480
    height: 45px;
    color: #fff;
    border-radius: 4px;
    background-color: #00469c;
  }
李晓兵's avatar
李晓兵 committed
1481

linxin's avatar
linxin committed
1482 1483 1484 1485 1486
  .footer-button {
    //height: 88px;
    padding-top: 15px;
    padding-bottom: 15px;
  }
李晓兵's avatar
李晓兵 committed
1487

linxin's avatar
linxin committed
1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500
  .front,
  .photo,
  .backphoto,
  .back {
    display: none;
  }
  .modal-content {
    width: 100%;
    height: 75%;
    position: absolute;
    top: 25%;
    background-color: #fff;
    overflow-y: scroll;
李晓兵's avatar
李晓兵 committed
1501

linxin's avatar
linxin committed
1502 1503 1504 1505 1506 1507 1508 1509 1510
    .modal-content-add-top {
      width: 320px;
      height: 34px;
      line-height: 34px;
      padding-top: 10px;
      background-color: #fff;
      padding-bottom: 40px;
      position: fixed;
      left: 28px;
李晓兵's avatar
李晓兵 committed
1511

linxin's avatar
linxin committed
1512 1513 1514 1515 1516
      span {
        font-family: PingFangSC-Semibold;
        font-size: 15px;
        color: #00469c;
        letter-spacing: 0.47px;
李晓兵's avatar
李晓兵 committed
1517
      }
李晓兵's avatar
李晓兵 committed
1518

linxin's avatar
linxin committed
1519 1520 1521 1522
      img {
        width: 34px;
        height: 34px;
        float: right;
李晓兵's avatar
李晓兵 committed
1523 1524 1525
      }
    }

linxin's avatar
linxin committed
1526 1527 1528 1529 1530 1531 1532
    .addBack {
      display: block;
      width: 320px;
      margin: 0 auto;
      margin-top: 50px;
      border-radius: 6px;
      margin-bottom: 17px;
李晓兵's avatar
李晓兵 committed
1533
    }
linxin's avatar
linxin committed
1534 1535 1536

    .card-Info {
      margin-bottom: 220px;
李晓兵's avatar
李晓兵 committed
1537
    }
李晓兵's avatar
李晓兵 committed
1538
  }
linxin's avatar
linxin committed
1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550

  .add-card {
    width: 358px;
    height: 40px;
    background: #00469c;
    border-radius: 4px;
    color: #fff;
  }
  .modal {
    background-color: rgba(0, 0, 0, 0) !important;
  }
}
李晓兵's avatar
李晓兵 committed
1551
</style>