Commit 12c399c6 authored by 李晓兵's avatar 李晓兵

'法人识别'

parent cd93bc20
......@@ -216,7 +216,7 @@
<img src="@/assets/userBind/close.png" @click="hideModal" >
</div>
<img v-if="!bankImg" src="@/assets/userBind/addBack.png" class="addBack" @click="ocrShow('bankCard', '')">
<img v-if="bankImg && !isApproved" :src="bankImg" class="addBack">
<img v-if="bankImg && !isApproved" :src="bankImg" class="addBack" style="height: 38%;">
<list-item :item-height="44" class="card-Info">
<item>
<div slot="name">银行卡卡号</div>
......@@ -339,12 +339,12 @@ export default {
}
},
tabNum: function (newVal, oldVal) {
/* if (
if (
(newVal === 1 && !this.isSave) && !this.from
) {
this.hlsPopup.showError('请先保存基本信息')
this.tabNum = oldVal
} */
}
},
'baseInfo.marital_status_n': function (newVal, oldVal) {
if (newVal === '已婚') {
......
......@@ -38,9 +38,12 @@
<div class="upload-id-card">
<span class="font-color">营业执照照片上传</span>
<div class="upload-box1">
<!-- <div> -->
<div v-if="!licenseImg" @click="ocrShow('license', '')">
<img src="@/assets/userBind/camera.png">
<!-- </div> -->
</div>
<div v-if="licenseImg && !isApproved">
<img :src="licenseImg">
</div>
</div>
</div>
......@@ -50,40 +53,42 @@
<item>
<div slot="name" class="font-color required">公司名称</div>
<input
slot="content" :readonly="isApproved" v-model="baseInfo.bp_name" placeholder="上传营业执照自动填充"
slot="content" v-model="baseInfo.bp_name" readonly placeholder="上传营业执照自动填充"
class="auto">
</item>
<item>
<div slot="name" class="font-color required">企业类型</div>
<input
slot="content"
:readonly="isApproved"
v-model="baseInfo.enterprise_type"
readonly
placeholder="上传营业执照自动填充"
class="auto"
>
</item>
<item>
<div slot="name" class="font-color">统一社会信用代码</div>
<input slot="content" v-model="baseInfo.organization_code" placeholder="上传营业执照自动填充" class="auto">
<input
slot="content" v-model="baseInfo.organization_code" readonly placeholder="上传营业执照自动填充"
class="auto">
</item>
<item>
<div slot="name" class="font-color">注册资本</div>
<input
slot="content" :readonly="isApproved" v-model="baseInfo.registered_capital" type="number"
slot="content" v-model="baseInfo.registered_capital" readonly type="number"
placeholder="上传营业执照自动填充"
class="auto">
</item>
<item>
<div slot="name" class="font-color">法定代表人</div>
<input
slot="content" :readonly="isApproved" v-model="baseInfo.legal_person" placeholder="上传营业执照自动填充"
slot="content" v-model="baseInfo.legal_person" readonly placeholder="上传营业执照自动填充"
class="auto">
</item>
<item>
<div slot="name" class="font-color required">注册地址</div>
<input
slot="content" :readonly="isApproved" v-model="baseInfo.registered_place" class="auto"
slot="content" v-model="baseInfo.registered_place" readonly class="auto"
placeholder="上传营业执照自动填充">
</item>
<item :showArrow="true">
......@@ -143,14 +148,20 @@
<div class="upload-id-cards">
<span>身份证照片上传</span>
<div class="upload-box">
<div>
<div v-if="!idCardFront" @click="ocrShow('idCard', 'front')">
<img src="@/assets/userBind/org/front.png">
<p>正面</p>
</div>
<div>
<div v-if="idCardFront && !isApproved" @click="ocrShow('idCard', 'front')">
<img :src="idCardFront" style="width: 100%;height: 100%;margin: 0">
</div>
<div v-if="!idCardBack" @click="ocrShow('idCard', 'back')">
<img src="@/assets/userBind/org/back.png">
<p>反面</p>
</div>
<div v-if="idCardBack && !isApproved" @click="ocrShow('idCard', 'back')">
<img :src="idCardBack" style="width: 100%;height: 100%;margin: 0">
</div>
</div>
</div>
......@@ -161,8 +172,8 @@
<div slot="name" class="font-color required">姓名</div>
<input
slot="content"
:readonly="isApproved"
v-model="authMsg.auth_person_name"
readonly
placeholder="上传身份证自动填充"
class="auto"
>
......@@ -171,8 +182,8 @@
<div slot="name" class="font-color required">身份证号</div>
<input
slot="content"
:readonly="isApproved"
v-model="authMsg.auth_person_id_card"
readonly
placeholder="上传身份证自动填充"
class="auto"
>
......@@ -191,15 +202,15 @@
<list-item v-if="flag" :item-height="44" class="second-part">
<item>
<div slot="name" class="font-color">姓名</div>
<div slot="name" class="font-color required">姓名</div>
<input
slot="content" :readonly="isApproved" v-model="baseInfo.legal_person" placeholder="上传身份证自动填充"
slot="content" v-model="baseInfo.legal_person" readonly placeholder="上传身份证自动填充"
class="auto">
</item>
<item>
<div slot="name" class="font-color">身份证号</div>
<div slot="name" class="font-color required">身份证号</div>
<input
slot="content" :readonly="isApproved" v-model="legal_personMsg.id_card_no" placeholder="上传身份证自动填充"
slot="content" v-model="legal_personMsg.id_card_no" readonly placeholder="上传身份证自动填充"
class="auto">
</item>
<item>
......@@ -265,14 +276,16 @@
<span>添加银行卡</span>
<img src="@/assets/userBind/close.png" @click="hideModal">
</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" style="height: 38%;">
<list-item :item-height="44" class="card-Info">
<item>
<div slot="name">银行卡卡号</div>
<input
slot="content"
v-model="bank_lists.bank_account_num"
placeholder="银行卡卡号自动填充"
readonly
placeholder="识别银行卡自动填充"
>
</item>
<item>
......@@ -288,7 +301,8 @@
<input
slot="content"
v-model="bank_lists.bank_full_name"
placeholder="请输入银行名称"
readonly
placeholder="识别银行卡自动填充"
>
</item>
<item>
......@@ -382,7 +396,7 @@ export default {
bank_lists: {
bank_account_num: '',
bank_account_name: '',
bank_card_type: '储蓄卡',
bank_card_type: '',
bank_full_name: '',
bank_branch_name: '',
},
......@@ -392,6 +406,9 @@ export default {
auth_person_id_card: '',
auth_person_position: '',
},
idCardFront: '', // 身份证正面图片
idCardBack: '', // 身份证反面图片
licenseImg: '', // 营业执照照片
}
},
computed: {},
......@@ -438,14 +455,10 @@ export default {
}
},
'tabNum': function (newVal, oldVal) {
// if ((newVal === 1 && !window.sessionStorage.user_id) || (newVal === 2 && !window.sessionStorage.user_id)) {
// this.hlsPopup.showError('清先保存基本信息')
// this.tabNum = oldVal
// }
if ((newVal === 1 && !this.bp_id) && !this.from) {
/*if ((newVal === 1 && !this.bp_id) && !this.from) {
this.hlsPopup.showError('请先保存基本信息')
this.tabNum = oldVal
}
}*/
},
},
created () {
......@@ -994,6 +1007,117 @@ export default {
}
})
},
// 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') {
type === 'front' ? vm.idCardFront = imgdata : vm.idCardBack = imgdata
vm.idCardIdentify(imgdata)
} 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') {
type === 'front' ? vm.idCardFront = imgUrl[0] : vm.idCardBack = imgUrl[0]
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
if (flag) { // 未授权 姓名,身份证号
vm.baseInfo.legal_person = result.姓名.words
vm.legal_personMsg.id_card_no = result.公民身份号码.words
} else { // 已授权 姓名,身份证号
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
})
},
},
}
</script>
......
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