Commit 62aca5b5 authored by 24776's avatar 24776

Merge branch 'develop' of hel.hand-china.com:xugong/hls-xcmg-vue-app

into develop
parents c6179b4e cd93bc20
...@@ -46,18 +46,18 @@ ...@@ -46,18 +46,18 @@
<div class="upload-id-card"> <div class="upload-id-card">
<span>身份证照片上传</span> <span>身份证照片上传</span>
<div class="upload-box"> <div class="upload-box">
<div v-if="!idCardFront" @click="idCardshow('front')"> <div v-if="!idCardFront" @click="ocrShow('idCard', 'front')">
<img src="@/assets/userBind/front.png" > <img src="@/assets/userBind/front.png" >
<p>正面</p> <p>正面</p>
</div> </div>
<div v-if="idCardFront && !isApproved" @click="idCardshow('front')"> <div v-if="idCardFront && !isApproved" @click="ocrShow('idCard', 'front')">
<img :src="idCardFront" style="width: 100%;height: 100%;margin: 0"> <img :src="idCardFront" style="width: 100%;height: 100%;margin: 0">
</div> </div>
<div v-if="!idCardBack" @click="idCardshow('back')"> <div v-if="!idCardBack" @click="ocrShow('idCard', 'back')">
<img src="@/assets/userBind/back.png" > <img src="@/assets/userBind/back.png" >
<p>反面</p> <p>反面</p>
</div> </div>
<div v-if="idCardBack && !isApproved" @click="idCardshow('back')"> <div v-if="idCardBack && !isApproved" @click="ocrShow('idCard', 'back')">
<img :src="idCardBack" style="width: 100%;height: 100%;margin: 0"> <img :src="idCardBack" style="width: 100%;height: 100%;margin: 0">
</div> </div>
</div> </div>
...@@ -215,11 +215,12 @@ ...@@ -215,11 +215,12 @@
<span>添加银行卡</span> <span>添加银行卡</span>
<img src="@/assets/userBind/close.png" @click="hideModal" > <img src="@/assets/userBind/close.png" @click="hideModal" >
</div> </div>
<img src="@/assets/userBind/addBack.png" class="addBack" > <img v-if="!bankImg" src="@/assets/userBind/addBack.png" class="addBack" @click="ocrShow('bankCard', '')">
<img v-if="bankImg && !isApproved" :src="bankImg" class="addBack">
<list-item :item-height="44" class="card-Info"> <list-item :item-height="44" class="card-Info">
<item> <item>
<div slot="name">银行卡卡号</div> <div slot="name">银行卡卡号</div>
<input slot="content" v-model="bank.bank_account_num" placeholder="银行卡卡号自动填充" > <input slot="content" v-model="bank.bank_account_num" readonly placeholder="识别银行卡自动填充" >
</item> </item>
<item> <item>
<div slot="name">账户姓名</div> <div slot="name">账户姓名</div>
...@@ -227,7 +228,7 @@ ...@@ -227,7 +228,7 @@
</item> </item>
<item> <item>
<div slot="name">银行名称</div> <div slot="name">银行名称</div>
<input slot="content" v-model="bank.bank_full_name" placeholder="请输入银行名称" > <input slot="content" v-model="bank.bank_full_name" readonly placeholder="识别银行卡自动填充" >
</item> </item>
<item> <item>
<div slot="name">支行名称</div> <div slot="name">支行名称</div>
...@@ -277,7 +278,7 @@ export default { ...@@ -277,7 +278,7 @@ export default {
bank: { bank: {
bank_account_num: '', bank_account_num: '',
bank_account_name: '', bank_account_name: '',
bank_card_type: '信用卡', bank_card_type: '',
bank_full_name: '', bank_full_name: '',
bank_branch_name: '', bank_branch_name: '',
}, },
...@@ -314,6 +315,7 @@ export default { ...@@ -314,6 +315,7 @@ export default {
}, },
idCardFront: '', // 身份证正面图片 idCardFront: '', // 身份证正面图片
idCardBack: '', // 身份证反面图片 idCardBack: '', // 身份证反面图片
bankImg: '', // 银行卡图片
} }
}, },
watch: { watch: {
...@@ -337,12 +339,12 @@ export default { ...@@ -337,12 +339,12 @@ export default {
} }
}, },
tabNum: function (newVal, oldVal) { tabNum: function (newVal, oldVal) {
if ( /* if (
(newVal === 1 && !this.isSave) && !this.from (newVal === 1 && !this.isSave) && !this.from
) { ) {
this.hlsPopup.showError('请先保存基本信息') this.hlsPopup.showError('请先保存基本信息')
this.tabNum = oldVal this.tabNum = oldVal
} } */
}, },
'baseInfo.marital_status_n': function (newVal, oldVal) { 'baseInfo.marital_status_n': function (newVal, oldVal) {
if (newVal === '已婚') { if (newVal === '已婚') {
...@@ -471,21 +473,21 @@ export default { ...@@ -471,21 +473,21 @@ export default {
} }
}) })
}, },
idCardshow (type) { ocrShow (ocrType, type) {
let vm = this let vm = this
hlsPopup.showActionSheet({ hlsPopup.showActionSheet({
titleText: '请选择照片', titleText: '请选择照片',
buttonArray: ['拍照', '从相册取'], buttonArray: ['拍照', '从相册取'],
callback: index => { callback: index => {
if (index === 0) { if (index === 0) {
vm.openCamera(type) vm.openCamera(ocrType, type)
} else { } else {
vm.takePicture(type) vm.takePicture(ocrType, type)
} }
}, },
}) })
}, },
openCamera (type) { openCamera (ocrType, type) {
let vm = this let vm = this
let cameraoptions = { let cameraoptions = {
quality: 60, quality: 60,
...@@ -493,15 +495,20 @@ export default { ...@@ -493,15 +495,20 @@ export default {
height: 1382, height: 1382,
} }
let success = function (imgdata) { let success = function (imgdata) {
if (ocrType === 'idCard') {
type === 'front' ? vm.idCardFront = imgdata : vm.idCardBack = imgdata type === 'front' ? vm.idCardFront = imgdata : vm.idCardBack = imgdata
vm.idCardIdentify(imgdata) vm.idCardIdentify(imgdata)
} else if (ocrType === 'bankCard') {
vm.bankImg = imgdata
vm.bankCardIdentify(imgdata)
}
} }
let error = function () { let error = function () {
hlsPopup.showLongCenter(error) hlsPopup.showLongCenter(error)
} }
hlsUtil.openCamera(cameraoptions, success, error) hlsUtil.openCamera(cameraoptions, success, error)
}, },
takePicture (type) { takePicture (ocrType, type) {
let vm = this let vm = this
var cameraoptions = { var cameraoptions = {
quality: 70, quality: 70,
...@@ -510,8 +517,13 @@ export default { ...@@ -510,8 +517,13 @@ export default {
maxCount: 1, maxCount: 1,
} }
let success = function (imgUrl) { let success = function (imgUrl) {
if (ocrType === 'idCard') {
type === 'front' ? vm.idCardFront = imgUrl[0] : vm.idCardBack = imgUrl[0] type === 'front' ? vm.idCardFront = imgUrl[0] : vm.idCardBack = imgUrl[0]
vm.idCardIdentify(imgUrl[0]) vm.idCardIdentify(imgUrl[0])
} else if (ocrType === 'bankCard') {
vm.bankImg = imgUrl[0]
vm.bankCardIdentify(imgUrl[0])
}
} }
let error = function () { let error = function () {
hlsPopup.showLongCenter(error) hlsPopup.showLongCenter(error)
...@@ -526,13 +538,24 @@ export default { ...@@ -526,13 +538,24 @@ export default {
hlsUtil.baiduOcr(fileUrl, url, function (res) { hlsUtil.baiduOcr(fileUrl, url, function (res) {
hlsPopup.hideLoading() hlsPopup.hideLoading()
let result = res.result.words_result let result = res.result.words_result
console.log('识别结果: ' + result)
console.log('姓名: '+ result.姓名.words)
vm.baseInfo.bp_name = result.姓名.words vm.baseInfo.bp_name = result.姓名.words
vm.baseInfo.id_card_no = result.公民身份号码.words vm.baseInfo.id_card_no = result.公民身份号码.words
vm.baseInfo.address_on_resident_booklit = result.住址.words vm.baseInfo.address_on_resident_booklit = 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.bank_account_num = result.bank_card_number
vm.bank.bank_full_name = result.bank_name
vm.bank.bank_card_type = result.bank_card_type
})
},
successCall () { successCall () {
this.hideModal() this.hideModal()
this.getBankInfo() this.getBankInfo()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment