bank-info.vue 24.8 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 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
<template>
  <h-view id="np-bank-card">
    <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>
      <div id="bank-card">
        <div class="info">
          <div class="info-icon">
            <img src="@/assets/userBind/info.png" >
            <span>温馨提示</span>
          </div>
          <p>推荐使用农行卡,农行卡支付免收手续费!</p>
        </div>
        <div class="my-card">
          <div class="top">
            <div class="left">
              <img src="@/assets/userBind/bankIcon.png" class="icon" >
              <span class="top-word">
                我的卡
                <span class="sum">(共{{ getBankList.length }}张)</span>
              </span>
            </div>
            <img src="@/assets/userBind/add.png" class="icon-right" @click="showModal" >
          </div>
          <div class="clear" />
          <div class="card-content">
            <ul>
              <li v-for="(item,index) in getBankList" :key="index" >
                <item-option class="slider">
                  <div
                    :style="'background-image: url('+ changeBgImg (item) +')'"
                    class="my-bank-card"
                    @click="showModalInfo(item)"
                  >
                    <div class="card-info">
                      <span class="name">{{ item.bank_full_name }}</span>
                      <span class="card-type">{{ selectType(item.bank_card_type) }}</span>
                      <span class="number">卡号</span>
                      <span class="card-number">**** **** **** {{ selectLast (item) }}</span>
                    </div>
                  </div>
                  <div slot="buttons" class="button">
Jennie Shi's avatar
Jennie Shi committed
47
                    <option-button type="warn" @click.native="deleteFun(item.bank_account_num)" />
linxin's avatar
linxin committed
48 49 50 51 52 53 54 55 56
                  </div>
                </item-option>
              </li>
            </ul>
          </div>
        </div>
      </div>
    </h-content>
    <bottom-tab class="footer-button">
57
      <tab-button class="save" @click.native="saveBankInfo">提交</tab-button>
linxin's avatar
linxin committed
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
    </bottom-tab>
    <h-modal ref="modal" v-model="showModalValue" position="bottom">
      <h-view>
        <div class="modal-content">
          <div class="modal-content-add-top">
            <span>添加银行卡</span>
            <img src="@/assets/userBind/close.png" @click="hideModal" >
          </div>
          <img
            v-if="!bankImg && !isApproved"
            src="@/assets/userBind/addBack.png"
            class="addBack"
            @click="ocrShow('bankCard', '')"
          >
          <img
            v-if="bankImg"
            :src="bankImg"
            class="addBack"
            style="height: 38%;"
            @click="ocrShow('bankCard', '')"
          >
          <img
            v-if="isClear && isApproved && !bankImg"
            src="@/assets/userBind/addBack.png"
            class="addBack"
            @click="ocrShow('bankCard', '')"
          >
          <img
            v-if="!bankImg && isApproved && !isClear"
            src="@/assets/userBind/addBack.png"
            class="addBack"
            @click="ocrShow('bankCard', '')"
          >
          <list-item :item-height="44" class="card-Info">
            <item>
              <div slot="name">银行卡卡号</div>
              <input
                slot="content"
                v-model="bank.bank_account_num"
                readonly
                placeholder="识别银行卡自动填充"
              >
            </item>
            <item>
              <div slot="name">账户姓名</div>
              <input slot="content" v-model="bank.bank_account_name" readonly placeholder="请输入账户名称" >
            </item>
            <item>
              <div slot="name">银行名称</div>
              <input slot="content" v-model="bank.bank_full_name" readonly placeholder="识别银行卡自动填充" >
            </item>
            <item>
              <div slot="name">支行名称</div>
              <input slot="content" v-model="bank.bank_branch_name" placeholder="请输入支行名称" >
            </item>
          </list-item>
        </div>
      </h-view>
      <bottom-tab class="add-box">
        <!-- v-if="!isApproved || (isClear && isApproved)"-->
        <tab-button class="add-card" @click.native="addBankInfo">添加</tab-button>
      </bottom-tab>
    </h-modal>
  </h-view>
</template>
<script>
import backImg1 from '@/assets/userBind/nong.png'
import backImg2 from '@/assets/userBind/unNong.png'
export default {
  data () {
    return {
      backImg: null,
      showModalValue: false,
131
      bp_identity: JSON.parse(window.localStorage.getItem('handleUser')).bp_identity,
linxin's avatar
linxin committed
132 133
      bankList: [],
      isClear: false,
linxin's avatar
linxin committed
134 135
      certification_status: '',
      authUrl: '',
linxin's avatar
linxin committed
136 137 138 139 140 141 142 143 144
      bank: {
        bank_account_num: '',
        bank_account_name: '',
        bank_card_type: '',
        bank_full_name: '',
        bank_branch_name: '',
      },
      bankImg: '', // 银行卡图片
      getBankList: [],
145
      mysetTimeout: null,
linxin's avatar
linxin committed
146 147 148 149
    }
  },
  computed: {
    isApproved () {
150
      return JSON.parse(window.localStorage.getItem('handleUser')).bp_status === 'APPROVED'
linxin's avatar
linxin committed
151 152 153 154 155
    },
  },
  beforeRouteEnter (to, from, next) {
    next(vm => {
      vm.getBankInfo()
Jennie Shi's avatar
Jennie Shi committed
156
      vm.checkElectonic()
linxin's avatar
linxin committed
157
    })
158
  },
linxin's avatar
linxin committed
159 160 161 162 163
  methods: {
    successCall () {
      this.hideModal()
      this.getBankInfo()
      this.bank.bank_account_num = ''
164
      this.bank.bank_account_name = ''
linxin's avatar
linxin committed
165 166 167 168 169 170 171
      this.bank.bank_full_name = ''
      this.bank.bank_branch_name = ''
    },
    hideModal () {
      this.showModalValue = false
      this.isClear = true
      this.bank.bank_account_num = ''
172
      this.bank.bank_account_name = ''
linxin's avatar
linxin committed
173 174 175 176 177 178
      this.bank.bank_card_type = ''
      this.bank.bank_full_name = ''
      this.bank.bank_branch_name = ''
    },
    showModal () {
      this.showModalValue = true
linxin's avatar
linxin committed
179
      this.bankImg = ''
180
      this.bank.bank_account_name = JSON.parse(window.localStorage.getItem('handleUser')).bp_name
linxin's avatar
linxin committed
181
    },
linxin's avatar
linxin committed
182 183
    async checkElectonic () {
      let vm = this
184
      let id = JSON.parse(window.localStorage.getItem('handleUser')).bp_id
linxin's avatar
linxin committed
185 186 187 188 189 190
      let url = process.env.basePath + 'bp_elec_check'
      let param = {
        bp_id: id,
      }
      vm.hlsPopup.showLoading('请稍候')
      let res = await vm.$post(url, param)
Jennie Shi's avatar
Jennie Shi committed
191
      vm.hlsPopup.hideLoading()
linxin's avatar
linxin committed
192 193 194
      if (res.result === 'S') {
        vm.certification_status = res.info.certification_status
      } else {
Jennie Shi's avatar
Jennie Shi committed
195
        vm.hlsPopup.showLongCenter(res.message)
linxin's avatar
linxin committed
196 197
      }
    },
198 199 200 201 202 203 204 205 206 207 208 209
    saveBankInfo () {
      if (this.mysetTimeout !== null) {
        clearTimeout(this.mysetTimeout)
        this.mysetTimeout = setTimeout(() => {
          this.putData()
        }, 1000)
      } else {
        this.mysetTimeout = setTimeout(() => {
          this.putData()
        }, 1000)
      }
    },
Jennie Shi's avatar
Jennie Shi committed
210
    // 提交
linxin's avatar
linxin committed
211 212
    async putData () {
      let vm = this
Jennie Shi's avatar
Jennie Shi committed
213 214 215 216 217 218
      // 个人或授权人
      vm.hlsPopup.showConfirm({
        title: '提示',
        content: '您确认提交吗?',
        onConfirm: d => {
          if (d) {
胡's avatar
committed
219
            if (vm.bp_identity === 'NP_NO' || vm.bp_identity === 'ORG_L_NO' || vm.bp_identity === 'ORG_AUTH_NO' || !vm.bp_identity) {
Jennie Shi's avatar
Jennie Shi committed
220 221
              vm.hlsPopup.showConfirm({
                title: '提示',
Jennie Shi's avatar
Jennie Shi committed
222
                content: '当前用户尚未认证,是否需要认证',
Jennie Shi's avatar
Jennie Shi committed
223 224
                cancelText: '直接提交',
                confirmText: '先去认证',
Jennie Shi's avatar
Jennie Shi committed
225 226 227 228 229
                onConfirm: c => {
                  if (c) {
                    // 只有自然人需要认证
                    let url = process.env.basePath + 'bp_query'
                    let param = {
230
                      bp_id: JSON.parse(window.localStorage.getItem('handleUser')).bp_id,
Jennie Shi's avatar
Jennie Shi committed
231 232 233 234 235 236
                    }
                    hlsPopup.showLoading('请稍候')
                    vm.hlsHttp.post(url, param).then((result) => {
                      hlsPopup.hideLoading()
                      if (result.result === 'S') {
                        let data = result.lists[0]
237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260

                        cordova.plugins.IdCardPlugin.registerNotary(
                          async function (suc) {
                            console.log(suc)
                            let success = JSON.parse(suc)
                            let successString = JSON.stringify(suc)
                            console.log(success)
                            console.log(successString)
                            // 成功后需要回调hls bp master 表,更新字段 是否签署码设置
                            vm.updateSigningCode(JSON.parse(window.localStorage.getItem('handleUser')).bp_id, 'Y', '')
                            vm.getNpCertificationUrl()
                          },
                          function (reason) {
                            console.log(reason)
                            let error = JSON.parse(reason)
                            let errorString = JSON.stringify(reason)
                            console.log(error)
                            console.log(errorString)
                          },
                          data.id_card_no,
                          data.bp_name,
                          true
                        )
                        /* cordova.plugins.IdCardPlugin.idCardIdentify(
Jennie Shi's avatar
Jennie Shi committed
261 262 263 264 265 266 267 268 269 270
                          {
                            idNum: data.id_card_no,
                            idName: data.bp_name,
                            phoneNum: window.localStorage.user_phone,
                          },
                          function (suc) {
                            let success = JSON.parse(suc)
                            if (success.code === 1) {
                              vm.getNpCertificationUrl()
                            }
linxin's avatar
linxin committed
271
                          },
Jennie Shi's avatar
Jennie Shi committed
272 273 274 275
                          function (reason) {
                            let error = JSON.parse(reason)
                            vm.hlsPopup.showLongCenter('认证失败: ' + error.message)
                          }
276
                        ) */
Jennie Shi's avatar
Jennie Shi committed
277 278
                      } else {
                        vm.hlsPopup.showLongCenter(result.message)
linxin's avatar
linxin committed
279
                      }
linxin's avatar
linxin committed
280
                    })
linxin's avatar
linxin committed
281
                  } else {
Jennie Shi's avatar
Jennie Shi committed
282 283
                    // 不校验的也直接提交
                    vm.submitBind()
linxin's avatar
linxin committed
284
                  }
Jennie Shi's avatar
Jennie Shi committed
285 286 287 288 289
                },
              })
            } else {
              // 已认证过的用户直接提交
              vm.submitBind()
linxin's avatar
linxin committed
290
            }
Jennie Shi's avatar
Jennie Shi committed
291 292 293 294 295 296 297 298 299
          }
        },
      })
    },
    async submitBind () {
      let vm = this
      let url = $config.basePath + 'bp_bind_submit'
      let param = {
        master: {
300
          bp_id: JSON.parse(window.localStorage.getItem('handleUser')).bp_id,
Jennie Shi's avatar
Jennie Shi committed
301
          bp_class: 'ORG',
302
          bp_type: JSON.parse(window.localStorage.getItem('handleUser')).bp_type,
Jennie Shi's avatar
Jennie Shi committed
303 304
          business_num: window.localStorage.getItem('business_num'),
        },
linxin's avatar
linxin committed
305
      }
Jennie Shi's avatar
Jennie Shi committed
306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322
      vm.hlsPopup.showLoading('请稍候')
      vm.hlsHttp.post(url, param).then(function (res) {
        vm.hlsPopup.hideLoading()
        if (res.result === 'S') {
          vm.hlsPopup.showSuccess('提交成功')
          vm.$router.push({
            name: 'MyInfo',
          })
        } else if (res.result === 'P') {
          vm.hlsPopup.showLongCenter(res.message)
          vm.$router.push({
            name: 'MyInfo',
          })
        } else {
          vm.hlsPopup.showLongCenter(res.message)
        }
      })
linxin's avatar
linxin committed
323
    },
Jennie Shi's avatar
Jennie Shi committed
324
    // 获取个人认证url
李晓兵's avatar
李晓兵 committed
325
    async getNpCertificationUrl () {
linxin's avatar
linxin committed
326 327 328 329
      let vm = this
      let url = $config.basePath + 'auth_user_sign'
      let param = {
        phone: window.localStorage.user_phone,
330
        bp_id: JSON.parse(window.localStorage.getItem('handleUser')).bp_id,
linxin's avatar
linxin committed
331 332
      }
      hlsPopup.showLoading('请稍候')
李晓兵's avatar
李晓兵 committed
333 334
      let res = await vm.$post(url, param)
      hlsPopup.hideLoading()
Jennie Shi's avatar
Jennie Shi committed
335 336 337 338 339
      if (res.info.code === 0 && res.info.data.authUrl) {
        hlsPopup.showLongCenter('绑定失败!')
      } else if (res.info.code === 0 && res.info.data.openId) {
        hlsPopup.showLongCenter('绑定成功!')
        vm.submitBind()
李晓兵's avatar
李晓兵 committed
340
      } else {
Jennie Shi's avatar
Jennie Shi committed
341
        hlsPopup.showLongCenter(res.info.msg)
李晓兵's avatar
李晓兵 committed
342
      }
linxin's avatar
linxin committed
343
    },
linxin's avatar
linxin committed
344 345 346 347 348 349
    addBankInfo () {
      this.hlsPopup.showConfirm({
        title: '提示',
        content: '您确认添加吗?',
        onConfirm: data => {
          if (data === 1) {
350
            let bpName = JSON.parse(window.localStorage.getItem('handleUser')).bp_name
linxin's avatar
linxin committed
351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367
            if (
              this.bank.bank_account_num === '' ||
              this.bank.bank_account_name === '' ||
              this.bank.bank_full_name === ''
            ) {
              this.hlsPopup.showLongCenter('请输入完整字段')
            } else if (this.hlsUtil.isBankAccount(this.bank.bank_account_num)) {
              this.hlsPopup.showLongCenter('银行卡号有误')
            } else if (this.bank.bank_account_name !== bpName) {
              this.hlsPopup.showLongCenter('请输入本人银行卡')
            } else {
              let list = JSON.parse(JSON.stringify(this.bank))
              this.bankList.push(list)
              let vm = this
              let url = process.env.basePath + 'bp_bank_save'
              let param = {
                master: {
368
                  bp_id: JSON.parse(window.localStorage.getItem('handleUser')).bp_id,
linxin's avatar
linxin committed
369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385
                  bank_lists: this.bankList,
                },
              }
              vm.hlsPopup.showLoading('请稍候')
              vm.hlsHttp.post(url, param).then(function (res) {
                vm.hlsPopup.hideLoading()
                if (res.result === 'S') {
                  vm.successCall()
                  vm.hlsPopup.showLongCenter('保存成功')
                  setTimeout(vm.successCall, 2000)
                }
              })
            }
          }
        },
      })
    },
386 387 388 389 390 391 392 393 394 395 396 397 398 399 400
    updateSigningCode (bp_id, flag, code) {
      let vm = this
      let url = $config.basePath + 'update_signing_code'
      let param = {
        bp_id: bp_id,
        signing_code_flag: flag,
        signing_code: code,
      }
      let res = vm.$post(url, param)
      if (res.result === 'S') {

      } else {
        hlsPopup.showLongCenter(res.info.msg)
      }
    },
linxin's avatar
linxin committed
401 402 403 404 405 406 407 408 409 410 411 412 413 414
    selectType (e) {
      if (e === '0') {
        return '未知类型'
      } else if (e === '1') {
        return '借记卡'
      } else if (e === '2') {
        return '信用卡'
      }
    },
    showModalInfo (item) {
      Object.assign(this.bank, item)
      this.showModalValue = true
    },
    getBankInfo () {
415
      let vm = this
linxin's avatar
linxin committed
416 417
      let url = process.env.basePath + 'bp_bank_query'
      let param = {
418
        bp_id: JSON.parse(window.localStorage.getItem('handleUser')).bp_id,
linxin's avatar
linxin committed
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 448 449 450 451 452 453 454 455 456 457 458 459
      }
      vm.hlsPopup.showLoading('请稍候')
      vm.hlsHttp
        .post(url, param)
        .then(function (res) {
          vm.hlsPopup.hideLoading()
          if (res.result === 'S') {
            vm.getBankList = res.lists
          }
        })
        .catch(() => {
          this.hlsPopup.showLongCenter('传入参数异常')
        })
    },
    changeBgImg (item) {
      if (item.bank_full_name.indexOf('农业银行') !== -1) {
        return backImg1
      } else {
        return backImg2
      }
    },
    selectLast (item) {
      let num = item.bank_account_num
      return num.substring(num.length - 4)
    },
    deleteFun (e) {
      this.hlsPopup.showConfirm({
        title: '提示',
        content: '您确认删除吗?',
        onConfirm: data => {
          if (data === 1) {
            let index = this.getBankList.findIndex(item => {
              if (item.bank_account_num === e) {
                return true
              }
            })
            this.getBankList.splice(index, 1)
            let vm = this
            let url = process.env.basePath + 'bp_bank_delete'
            let param = {
              'master': {
460
                'bp_id': JSON.parse(window.localStorage.getItem('handleUser')).bp_id,
linxin's avatar
linxin committed
461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503
                'bank_account_num': e,
              },
            }
            vm.hlsPopup.showLoading('请稍候')
            vm.hlsHttp.post(url, param).then(function (res) {
              vm.hlsPopup.hideLoading()
              if (res.result === 'S') {
                vm.hlsPopup.showSuccess('删除成功')
              } else {
                vm.hlsPopup.showLongCenter(res.message)
              }
            })
          }
        },
      })
    },
    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'
Jennie Shi's avatar
Jennie Shi committed
504
              ? ((vm.idCardFront = hlsUtil.convertImageUrl(imgdata)),
linxin's avatar
linxin committed
505 506
              vm.idCardIdentify(imgdata, 'idCard'),
              (vm.idCardFrontEditFlag = true))
Jennie Shi's avatar
Jennie Shi committed
507
              : ((vm.idCardBack = hlsUtil.convertImageUrl(imgdata)),
linxin's avatar
linxin committed
508 509 510 511 512
              vm.idCardBackIdentify(imgdata, 'idCard'),
              (vm.idCardBackEditFlag = true))
          } else if (ocrType === 'idCardSp') {
            // 配偶身份证识别
            type === 'front'
Jennie Shi's avatar
Jennie Shi committed
513
              ? ((vm.idCardFrontSp = hlsUtil.convertImageUrl(imgdata)),
linxin's avatar
linxin committed
514 515
              vm.idCardIdentify(imgdata, 'idCardSp'),
              (vm.idCardFrontSpEditFlag = true))
Jennie Shi's avatar
Jennie Shi committed
516
              : ((vm.idCardBackSp = hlsUtil.convertImageUrl(imgdata)),
linxin's avatar
linxin committed
517 518 519
              vm.idCardBackIdentify(imgdata, 'idCardSp'),
              (vm.idCardBackSpEditFlag = true))
          } else if (ocrType === 'bankCard') {
Jennie Shi's avatar
Jennie Shi committed
520
            vm.bankImg = hlsUtil.convertImageUrl(imgdata)
linxin's avatar
linxin committed
521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543
            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'
Jennie Shi's avatar
Jennie Shi committed
544
              ? ((vm.idCardFront = hlsUtil.convertImageUrl(imgUrl[0])),
linxin's avatar
linxin committed
545 546
              vm.idCardIdentify(imgUrl[0], 'idCard'),
              (vm.idCardFrontEditFlag = true))
Jennie Shi's avatar
Jennie Shi committed
547
              : ((vm.idCardBack = hlsUtil.convertImageUrl(imgUrl[0])),
linxin's avatar
linxin committed
548 549 550 551 552
              vm.idCardBackIdentify(imgUrl[0], 'idCard'),
              (vm.idCardBackEditFlag = true))
          } else if (ocrType === 'idCardSp') {
            // 配偶身份证识别
            type === 'front'
Jennie Shi's avatar
Jennie Shi committed
553
              ? ((vm.idCardFrontSp = hlsUtil.convertImageUrl(imgUrl[0])),
linxin's avatar
linxin committed
554 555
              vm.idCardIdentify(imgUrl[0], 'idCardSp'),
              (vm.idCardFrontSpEditFlag = true))
Jennie Shi's avatar
Jennie Shi committed
556
              : ((vm.idCardBackSp = hlsUtil.convertImageUrl(imgUrl[0])),
linxin's avatar
linxin committed
557 558 559
              vm.idCardBackIdentify(imgUrl[0], 'idCardSp'),
              (vm.idCardBackSpEditFlag = true))
          } else if (ocrType === 'bankCard') {
Jennie Shi's avatar
Jennie Shi committed
560
            vm.bankImg = hlsUtil.convertImageUrl(imgUrl[0])
linxin's avatar
linxin committed
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 594 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 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 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
            vm.bankCardIdentify(imgUrl[0])
          }
        }
      }
      let error = function () {
        hlsPopup.showLongCenter(error)
      }
      vm.hlsUtil.takePicture(cameraoptions, success, error)
    },
    // 银行卡识别
    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
      })
    },
  },
}
</script>
<style lang="less">
  #np-bank-card {
      .info {
        height: 70px;
        background-color: rgba(142, 195, 30, 0.1);
        .info-icon {
          height: 20px;
          padding-top: 20px;
          display: flex;
          align-items: center;
          img {
            width: 15.8px;
            height: 15.8px;
            margin-left: 17.1px;
          }
          span {
            font-family: PingFangSC-Semibold;
            font-size: 14px;
            color: #8ec31e;
            margin-left: 9px;
            letter-spacing: 0.5px;
            line-height: 20px;
          }
        }
        p {
          font-family: PingFangSC-Regular;
          font-size: 13px;
          color: #656464;
          width: 310px;
          margin-left: 42px;
          letter-spacing: 0.4px;
          line-height: 18px;
          margin-top: 8px;
        }
      }
      .my-card {
        .top {
          width: 320px;
          margin: 0 auto;
          margin-top: 13px;
          .left {
            height: 32px;
            display: flex;
            align-items: center;
            float: left;
            .icon {
              width: 18px;
              height: 20px;
              margin-right: 4px;
            }
            .top-word {
              font-family: PingFangSC-Semibold;
              font-size: 15px;
              color: @headerColor;
              letter-spacing: 0.46px;
              .sum {
                font-family: PingFangSC-Semibold;
                font-size: 15px;
                color: #4d5d6c;
                letter-spacing: 0.46px;
              }
            }
          }
          .icon-right {
            width: 34px;
            height: 34px;
            float: right;
          }
        }
        .clear {
          clear: both;
        }
        .card-content {
          width: 350px;
          padding-left: 28px;
          overflow: hidden;
          margin-top: 16px;
          li {
            margin-bottom: 10px;
            .slider {
              height: 100%;
              margin-left: -14px;
            }
          }
          .my-bank-card {
            width: 320px;
            height: 190px;
            box-shadow: 0 5px 20px 0 rgba(101, 101, 101, 0.25);
            border-radius: 6px;
            background-size: 370px 240px;
            background-position: -20px;
            .card-info {
              font-family: PingFangSC-Medium;
              color: #ffffff;
              margin-left: 18px;
              padding-top: 15px;
              .name,
              .card-type {
                font-size: 16px;
                letter-spacing: 5.5px;
                line-height: 24px;
              }
              .card-type {
                display: block;
                margin-top: 9px;
              }
              .number {
                font-size: 12px;
                letter-spacing: 0;
                line-height: 16px;
                margin-top: 33px;
                display: block;
                margin-top: 33px;
              }
              .card-number {
                display: block;
                font-family: Avenir-Heavy;
                font-size: 16px;
                color: #ffffff;
                letter-spacing: 6px;
                line-height: 24px;
              }
            }
          }
        }
      }
      .swipeout-list .item .function {
        left: 330px;
        border-radius: 6px;
        width: 54px;
        height: 190px;
        background: url("../../../assets/userBind/delete.png") 16px 84.9px #fde5e8
        no-repeat;
        background-size: 20px 20px;
      }
    .save {
    color: #fdb62f;
    border-radius: 4px;
    border: 1px solid #fdb62f;
    background-color: #fafafa;
  }
       .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;
}
</style>