Merge branch 'feature/GFRS-860【0514】更换人脸识别厂商-微信端' into release/0526

# Conflicts:
#	src/api/ebiz/sale/sale.js
This commit is contained in:
tian.guangyuan
2020-05-25 14:59:17 +08:00
4 changed files with 211 additions and 48 deletions

View File

@@ -20,7 +20,7 @@ let sale = [
'/sale/order/orderDetail', '/sale/order/orderDetail',
'/customer/authcode/loginedSend', '/customer/authcode/loginedSend',
'/uploadImage', '/uploadImage',
'/customer/recognition', // '/customer/recognition',
'/sale/insure/underWrite', '/sale/insure/underWrite',
'/sale/insure/acceptInsurance', '/sale/insure/acceptInsurance',
'/app/code/getCodeValue', '/app/code/getCodeValue',

View File

@@ -9,7 +9,7 @@
</template> </template>
<script> <script>
import { Uploader, button } from 'vant' import { Uploader, button } from 'vant'
import { uploadImg, recognition } from '@/api/ebiz/sale/sale' import { uploadImg, getRecognitionUrl, getRecognitionResult } from '@/api/ebiz/sale/sale'
export default { export default {
name: 'UploadImageFile', name: 'UploadImageFile',
props: { props: {
@@ -36,7 +36,11 @@ export default {
file: '', file: '',
imgName: '', imgName: '',
fileListIdFront: [], fileListIdFront: [],
isSuccess: false isSuccess: false,
bizToken: '',
requestId: '',
recognizeResult: '', //人脸识别结果
recognizeMessage: '' //人脸识别失败原因
} }
}, },
components: { components: {
@@ -93,6 +97,7 @@ export default {
let formdata = new FormData() let formdata = new FormData()
formdata.append('imgPath', that.file) formdata.append('imgPath', that.file)
}, },
/*
recognition(val, num) { recognition(val, num) {
let data = {} let data = {}
num++ num++
@@ -116,6 +121,59 @@ export default {
this.$emit('sendimage', this.isSuccess) this.$emit('sendimage', this.isSuccess)
}) })
} }
*/
async recognition(val, num) {
num++
await this.getRecognitionUrl(val, num)
if (this.requestId && this.bizToken) {
await this.getRecognitionResult(this.requestId, this.bizToken)
} else {
return
}
this.$emit('sendimage', this.isSuccess)
},
getRecognitionUrl(val, num) {
return new Promise((resolve, reject) => {
let data = { realName: this.realName, idno: this.idno, redirectUrl: '/sale/' }
console.log('获取URL请求参数', data)
getRecognitionUrl(data).then(
res => {
console.log('getRecognitionUrl', res)
if (res.result == '0') {
this.requestId = res.content.requestId
this.bizToken = res.content.bizToken
window.location.href = res.content.url
} else {
this.$toast(res.resultMessage)
}
},
error => {
console.log(error)
}
)
})
},
getRecognitionResult(requestId, bizToken) {
return new Promise((resolve, reject) => {
getRecognitionResult({ requestId, bizToken }).then(
res => {
console.log('getRecognitionResult', res)
if (res.result == '0') {
this.recognizeResult = res.content.result
this.recognizeMessage = res.content.result == '1' ? res.content.resultMessage : ''
this.isSuccess = true
} else {
this.$toast(res.resultMessage)
}
},
error => {
console.log(error)
}
)
})
}
} }
} }
</script> </script>

View File

@@ -13,13 +13,15 @@
需签署 需签署
<ul> <ul>
<li class="flex" v-for="(sign, index) in signList" :key="index"> <li class="flex" v-for="(sign, index) in signList" :key="index">
<div class="w260 blue" >{{ sign.name }}</div> <div class="w260 blue">{{ sign.name }}</div>
<van-icon v-if="sign.signState === '1'" color="green" name="checked" /> <van-icon v-if="sign.signState === '1'" color="green" name="checked" />
</li> </li>
</ul> </ul>
点击开始按钮进行相关操作 点击开始按钮进行相关操作
</div> </div>
<div class="text-center mt20"><van-button @click="faceAuth" v-no-more-click="1000" :disabled="isSubmit" type="danger" size="normal" style="width:30%">开始</van-button></div> <div class="text-center mt20">
<van-button @click="faceAuth" v-no-more-click="1000" :disabled="isSubmit" type="danger" size="normal" style="width:30%">开始</van-button>
</div>
<van-button v-if="isSubmit" class="fixed bottom0" type="danger" v-no-more-click="1000" @click="clickSubmit" size="large">提交</van-button> <van-button v-if="isSubmit" class="fixed bottom0" type="danger" v-no-more-click="1000" @click="clickSubmit" size="large">提交</van-button>
</div> </div>
</template> </template>
@@ -113,6 +115,7 @@ export default {
message: '加载中……' message: '加载中……'
}) })
EWebBridge.webCallAppInJs('face_auth', { EWebBridge.webCallAppInJs('face_auth', {
businessSource: '2', //业务来源:1-电投2-入司3-理赔4-保全
number: that.agentInfo.idNo, //身份证号码 number: that.agentInfo.idNo, //身份证号码
name: that.agentInfo.name //姓名 name: that.agentInfo.name //姓名
}).then(data => { }).then(data => {

View File

@@ -227,20 +227,29 @@
}}</van-button> }}</van-button>
</van-cell-group> </van-cell-group>
</van-dialog> </van-dialog>
<UploadImageFile <!-- <UploadImageFile
:typeface="idcardData.typeface && faceAuthCount.weixin < smsAuthNum" :typeface="idcardData.typeface && faceAuthCount.weixin < smsAuthNum"
:realName="idcardData.idcardName" :realName="idcardData.idcardName"
:idno="idcardData.idcardNumber" :idno="idcardData.idcardNumber"
@sendimage="sendimage" @sendimage="sendimage"
> >
</UploadImageFile> </UploadImageFile> -->
</div> </div>
</template> </template>
<script> <script>
import UploadImageFile from '@/components/ebiz/sale/UploadImageFile' // import UploadImageFile from '@/components/ebiz/sale/UploadImageFile'
import { Field, Cell, CellGroup, Collapse, CollapseItem, Dialog } from 'vant' import { Field, Cell, CellGroup, Collapse, CollapseItem, Dialog } from 'vant'
import { underWrite, getOrderDetail, getSignInvalid, checkSignInvalid, getAuthCode, autchCodeCheck } from '@/api/ebiz/sale/sale' import {
underWrite,
getOrderDetail,
getSignInvalid,
checkSignInvalid,
getAuthCode,
autchCodeCheck,
getRecognitionUrl,
getRecognitionResult
} from '@/api/ebiz/sale/sale'
import { checkPhone } from '@/api/ebiz/customer/customer' import { checkPhone } from '@/api/ebiz/customer/customer'
import { weixinShare } from '@/assets/js/utils/wxShare.js' import { weixinShare } from '@/assets/js/utils/wxShare.js'
import IndexBar from '@/components/ebiz/sale/IndexBar' import IndexBar from '@/components/ebiz/sale/IndexBar'
@@ -308,14 +317,22 @@ export default {
// 空签时顶部姓名 // 空签时顶部姓名
tipsName: '', tipsName: '',
idcardData: { idcardData: {
typeface: false, realName: '',
idcardName: '', idno: '',
idcardNumber: '' redirectUrl: '',
businessSource: '1' //微信端人脸识别业务来源:1-电投2-入司3-理赔4-保全
}, },
// idcardData: {
// typeface: false,
// idcardName: '',
// idcardNumber: ''
// },
appntSignStatus: '', //投保人电子签名状态 appntSignStatus: '', //投保人电子签名状态
insuredSignStatus: '', //被保险人电子签名状态 insuredSignStatus: '', //被保险人电子签名状态
changeCard: localStorage.changeCard, changeCard: localStorage.changeCard,
salePageFlag: '-10' salePageFlag: '-10',
recognizeResult: '', //微信端-人脸识别结果
recognizeMessage: '' //微信端-人脸识别失败原因
} }
}, },
methods: { methods: {
@@ -355,12 +372,12 @@ export default {
if (this.$route.query.airSign) { if (this.$route.query.airSign) {
sessionStorage.setItem('airSign', this.$route.query.airSign) sessionStorage.setItem('airSign', this.$route.query.airSign)
} }
window.localStorage.setItem('saleInsuredInfo', this.$route.query.saleInsuredInfo) // window.localStorage.setItem('saleInsuredInfo', this.$route.query.saleInsuredInfo)
window.localStorage.setItem('saleInsuredPersonInfo', this.$route.query.saleInsuredPersonInfo) // window.localStorage.setItem('saleInsuredPersonInfo', this.$route.query.saleInsuredPersonInfo)
window.localStorage.setItem('token', this.$route.query.token) window.localStorage.setItem('token', this.$route.query.token)
window.localStorage.setItem('orderNo', this.$route.query.orderNo) window.localStorage.setItem('orderNo', this.$route.query.orderNo)
window.localStorage.setItem('relationToAppnt', this.$route.query.relationToAppnt) // window.localStorage.setItem('relationToAppnt', this.$route.query.relationToAppnt)
window.localStorage.setItem('productCode', this.$route.query.productCode) // window.localStorage.setItem('productCode', this.$route.query.productCode)
if (this.$route.query.changeCard == '0') { if (this.$route.query.changeCard == '0') {
localStorage.setItem('changeCard', true) localStorage.setItem('changeCard', true)
} else { } else {
@@ -387,6 +404,7 @@ export default {
this.relationToAppnt = this.$route.query.relationToAppnt this.relationToAppnt = this.$route.query.relationToAppnt
this.isShow = false this.isShow = false
this.getOrderDetail().then(() => { this.getOrderDetail().then(() => {
console.log('初始化this.appntSign ==', this.appntSign)
if ( if (
(this.appntSignStatus == '3' && sessionStorage.getItem('shareCode') == '0') || (this.appntSignStatus == '3' && sessionStorage.getItem('shareCode') == '0') ||
(this.appntSignStatus == '3' && sessionStorage.getItem('shareCode') == '2') (this.appntSignStatus == '3' && sessionStorage.getItem('shareCode') == '2')
@@ -399,6 +417,10 @@ export default {
if (this.changeCard && this.appntSign.documentStatus == '1') { if (this.changeCard && this.appntSign.documentStatus == '1') {
Dialog.alert({ title: '提示', message: '确认完成,请联系业务员完成后续流程!' }) Dialog.alert({ title: '提示', message: '确认完成,请联系业务员完成后续流程!' })
} }
// localStorage['faceAuthWeXin-requestId'] localStorage['faceAuthWeXin-bizToken']--微信端人脸识别获取腾讯认证url接口获得认证相关参数
if (localStorage['faceAuthWeXin-requestId'] && localStorage['faceAuthWeXin-bizToken'] && this.$route.query.faceAuthCountWeixin != undefined) {
this.getRecognitionResult(JSON.parse(localStorage['faceAuthWeXin-requestId']), JSON.parse(localStorage['faceAuthWeXin-bizToken']))
}
}) })
if (sessionStorage.shareCode == '1') { if (sessionStorage.shareCode == '1') {
console.log('进来被保险人') console.log('进来被保险人')
@@ -418,6 +440,9 @@ export default {
// let params = { // let params = {
// orderNo: '' // orderNo: ''
// } // }
this.faceAuthCount.appnt = this.$route.query.faceAuthCountAppnt == undefined ? 0 : Number(this.$route.query.faceAuthCountAppnt)
this.faceAuthCount.insured = this.$route.query.faceAuthCountInsured == undefined ? 0 : Number(this.$route.query.faceAuthCountInsured)
this.faceAuthCount.weixin = this.$route.query.faceAuthCountWeixin == undefined ? 0 : Number(this.$route.query.faceAuthCountWeixin)
} else { } else {
// 获取详情消息 // 获取详情消息
@@ -549,13 +574,16 @@ export default {
if (val == '0' || val == '2') { if (val == '0' || val == '2') {
//idtype不为身份证跳过人脸识别 //idtype不为身份证跳过人脸识别
// if (JSON.parse(this.$route.query.saleInsuredInfo).idType != '1' || JSON.parse(this.$route.query.saleInsuredInfo).age < '18') { // if (JSON.parse(this.$route.query.saleInsuredInfo).idType != '1' || JSON.parse(this.$route.query.saleInsuredInfo).age < '18') {
if (JSON.parse(this.$route.query.saleInsuredInfo).idType != '1') { if (JSON.parse(localStorage.saleInsuredInfo).idType != '1') {
that.goUrl() that.goUrl()
} else { } else {
if (this.faceAuthCount.appnt < this.smsAuthNum) { if (this.faceAuthCount.appnt < this.smsAuthNum) {
this.idcardData.typeface = !this.idcardData.typeface // this.idcardData.typeface = !this.idcardData.typeface
this.idcardData.idcardName = JSON.parse(this.$route.query.saleInsuredInfo).name // this.idcardData.idcardName = JSON.parse(this.$route.query.saleInsuredInfo).name
this.idcardData.idcardNumber = JSON.parse(this.$route.query.saleInsuredInfo).idNo // this.idcardData.idcardNumber = JSON.parse(this.$route.query.saleInsuredInfo).idNo
this.idcardData.realName = JSON.parse(localStorage.saleInsuredInfo).name
this.idcardData.idno = JSON.parse(localStorage.saleInsuredInfo).idNo
this.recognition()
} else { } else {
this.operaFlag = 'appnt' this.operaFlag = 'appnt'
this.realPeopelCheck() this.realPeopelCheck()
@@ -564,14 +592,17 @@ export default {
} else { } else {
window.localStorage.setItem('sign-val', val) window.localStorage.setItem('sign-val', val)
window.localStorage.setItem('sign-insured', JSON.stringify(that.insuredSign)) window.localStorage.setItem('sign-insured', JSON.stringify(that.insuredSign))
if (JSON.parse(this.$route.query.saleInsuredPersonInfo).idType != '1' || JSON.parse(this.$route.query.saleInsuredPersonInfo).age < '18') { if (JSON.parse(localStorage.saleInsuredPersonInfo).idType != '1' || JSON.parse(localStorage.saleInsuredPersonInfo).age < '18') {
// if (JSON.parse(this.$route.query.saleInsuredPersonInfo).idType != '1') { // if (JSON.parse(this.$route.query.saleInsuredPersonInfo).idType != '1') {
that.insuredUrl() that.insuredUrl()
} else { } else {
if (this.faceAuthCount.insured < this.smsAuthNum) { if (this.faceAuthCount.insured < this.smsAuthNum) {
this.idcardData.typeface = !this.idcardData.typeface // this.idcardData.typeface = !this.idcardData.typeface
this.idcardData.idcardName = JSON.parse(this.$route.query.saleInsuredPersonInfo).name // this.idcardData.idcardName = JSON.parse(this.$route.query.saleInsuredPersonInfo).name
this.idcardData.idcardNumber = JSON.parse(this.$route.query.saleInsuredPersonInfo).idNo // this.idcardData.idcardNumber = JSON.parse(this.$route.query.saleInsuredPersonInfo).idNo
this.idcardData.realName = JSON.parse(localStorage.saleInsuredPersonInfo).name
this.idcardData.idno = JSON.parse(localStorage.saleInsuredPersonInfo).idNo
this.recognition()
} else { } else {
this.operaFlag = 'insured' this.operaFlag = 'insured'
this.realPeopelCheck() this.realPeopelCheck()
@@ -589,6 +620,7 @@ export default {
if (this.faceAuthCount.appnt < this.smsAuthNum) { if (this.faceAuthCount.appnt < this.smsAuthNum) {
// 原人脸识别 // 原人脸识别
EWebBridge.webCallAppInJs('face_auth', { EWebBridge.webCallAppInJs('face_auth', {
businessSource: '1', //业务来源:1-电投2-入司3-理赔4-保全
number: that.saleInsuredInfo.idNo, //身份证号码 number: that.saleInsuredInfo.idNo, //身份证号码
name: that.saleInsuredInfo.name //姓名 name: that.saleInsuredInfo.name //姓名
}).then(data => { }).then(data => {
@@ -617,6 +649,7 @@ export default {
if (this.faceAuthCount.insured < this.smsAuthNum) { if (this.faceAuthCount.insured < this.smsAuthNum) {
// 调原生人脸识别 // 调原生人脸识别
EWebBridge.webCallAppInJs('face_auth', { EWebBridge.webCallAppInJs('face_auth', {
businessSource: '1', //业务来源:1-电投2-入司3-理赔4-保全
number: that.saleInsuredPersonInfo.idNo, //身份证号码 number: that.saleInsuredPersonInfo.idNo, //身份证号码
name: that.saleInsuredPersonInfo.name //姓名 name: that.saleInsuredPersonInfo.name //姓名
}).then(data => { }).then(data => {
@@ -641,9 +674,11 @@ export default {
goUrl() { goUrl() {
let that = this let that = this
let path = '' let path = ''
console.log('that.appntSign 1 ==', that.appntSign)
if (that.changeCard) { if (that.changeCard) {
path = 'insuranceInformation' path = 'insuranceInformation'
} else { } else {
console.log('that.appntSign.length ==', that.appntSign.length, typeof that.appntSign.length)
for (let i = 0; i < that.appntSign.length; i++) { for (let i = 0; i < that.appntSign.length; i++) {
if (that.appntSign[i].documentCode == '1' && that.appntSign[0].documentStatus == 0) { if (that.appntSign[i].documentCode == '1' && that.appntSign[0].documentStatus == 0) {
//1投保须知 未读 //1投保须知 未读
@@ -676,6 +711,7 @@ export default {
} }
}*/ }*/
} }
console.log('跳转页面path', path)
that.$jump({ that.$jump({
flag: 'h5', flag: 'h5',
extra: { extra: {
@@ -745,10 +781,10 @@ export default {
localStorage.orderNo + localStorage.orderNo +
'&token=' + '&token=' +
localStorage.token + localStorage.token +
'&saleInsuredInfo=' + // '&saleInsuredInfo=' +
encodeURI(localStorage.saleInsuredInfo) + // encodeURI(localStorage.saleInsuredInfo) +
'&saleInsuredPersonInfo=' + // '&saleInsuredPersonInfo=' +
encodeURI(localStorage.saleInsuredPersonInfo) + // encodeURI(localStorage.saleInsuredPersonInfo) +
'&relationToAppnt=' + '&relationToAppnt=' +
JSON.parse(window.localStorage.getItem('saleInsuredPersonInfo')).relationToAppnt + JSON.parse(window.localStorage.getItem('saleInsuredPersonInfo')).relationToAppnt +
'&shareCode=' + '&shareCode=' +
@@ -773,10 +809,10 @@ export default {
localStorage.orderNo + localStorage.orderNo +
'&token=' + '&token=' +
localStorage.token + localStorage.token +
'&saleInsuredInfo=' + // '&saleInsuredInfo=' +
encodeURI(localStorage.saleInsuredInfo) + // encodeURI(localStorage.saleInsuredInfo) +
'&saleInsuredPersonInfo=' + // '&saleInsuredPersonInfo=' +
encodeURI(localStorage.saleInsuredPersonInfo) + // encodeURI(localStorage.saleInsuredPersonInfo) +
'&relationToAppnt=' + '&relationToAppnt=' +
JSON.parse(window.localStorage.getItem('saleInsuredPersonInfo')).relationToAppnt + JSON.parse(window.localStorage.getItem('saleInsuredPersonInfo')).relationToAppnt +
'&shareCode=' + '&shareCode=' +
@@ -934,19 +970,19 @@ export default {
) { ) {
// const message = res.orderDTO.productDTO.special.content // const message = res.orderDTO.productDTO.special.content
// Dialog({ message }) // Dialog({ message })
let content = res.orderDTO.productDTO.special.content let content = res.orderDTO.productDTO.special.content
// { // {
// title: '标题', // title: '标题',
// message: '内容', // message: '内容',
// confirmButtonText: '确认', // confirmButtonText: '确认',
// messageAlign: 'left' // messageAlign: 'left'
// } // }
// title 需要标题则配置,不需要则不要配置 // title 需要标题则配置,不需要则不要配置
// message 内容,\n换行 // message 内容,\n换行
// confirmButtonText确认按钮的文字 // confirmButtonText确认按钮的文字
// messageAlign 对齐方式,固定左对齐,为'left' // messageAlign 对齐方式,固定左对齐,为'left'
try { try {
const config = JSON.parse(content); const config = JSON.parse(content)
config.message = '&emsp;&emsp;' + config.message config.message = '&emsp;&emsp;' + config.message
config.message = config.message.split('\\n').join('\n&emsp;&emsp;') config.message = config.message.split('\\n').join('\n&emsp;&emsp;')
// { // {
@@ -970,7 +1006,6 @@ export default {
// confirmButtonText: '本人已阅读并同意上述特别约定内容', // confirmButtonText: '本人已阅读并同意上述特别约定内容',
// messageAlign: 'left' // messageAlign: 'left'
// }) // })
} }
/* if (isShowDialog) { /* if (isShowDialog) {
//记录每次弹框的订单号。再次进入页面,订单号改变才会弹窗。 //记录每次弹框的订单号。再次进入页面,订单号改变才会弹窗。
@@ -1129,7 +1164,7 @@ export default {
// 微信人脸验证后 返回值 操作 // 微信人脸验证后 返回值 操作
sendimage(e) { sendimage(e) {
// let that = this // let that = this
if (e) { if (e == '0') {
// this.$toast.clear() // this.$toast.clear()
// this.$toast('人脸检测成功') // this.$toast('人脸检测成功')
// 1 为被保险人 // 1 为被保险人
@@ -1140,6 +1175,7 @@ export default {
} }
} else { } else {
this.faceAuthCount.weixin++ this.faceAuthCount.weixin++
console.log('腾讯人脸识别失败', this.faceAuthCount.weixin, typeof this.faceAuthCount.weixin)
if (this.faceAuthCount.weixin >= this.smsAuthNum) { if (this.faceAuthCount.weixin >= this.smsAuthNum) {
if (window.sessionStorage.shareCode == '1') { if (window.sessionStorage.shareCode == '1') {
this.operaFlag = 'insured' this.operaFlag = 'insured'
@@ -1149,6 +1185,72 @@ export default {
this.realPeopelCheck() this.realPeopelCheck()
} }
} }
},
async recognition() {
localStorage.setItem('faceAuthWeXin-requestId', '')
localStorage.setItem('faceAuthWeXin-bizToken', '')
await this.getRecognitionUrl()
},
//替换redirectUrl
replaceSearch() {
let obj = this.$route.query,
str = '/#/sale/signatureConfirmation?'
obj.faceAuthCountAppnt = this.faceAuthCount.appnt
obj.faceAuthCountInsured = this.faceAuthCount.insured
obj.faceAuthCountWeixin = this.faceAuthCount.weixin
for (let key in obj) {
str += `&${key}=${obj[key]}`
}
return str
},
getRecognitionUrl() {
return new Promise((resolve, reject) => {
this.idcardData.redirectUrl = location.origin + this.replaceSearch()
let data = {
realName: this.idcardData.realName,
idno: this.idcardData.idno,
redirectUrl: this.idcardData.redirectUrl,
businessSource: this.idcardData.businessSource
}
console.log('获取URL请求参数', data)
getRecognitionUrl(data).then(
res => {
console.log('getRecognitionUrl', res)
if (res.result == '0') {
localStorage.setItem('faceAuthWeXin-requestId', JSON.stringify(res.content.requestId))
localStorage.setItem('faceAuthWeXin-bizToken', JSON.stringify(res.content.bizToken))
window.location.href = res.content.url
} else {
this.$toast(res.resultMessage)
}
},
error => {
console.log(error)
}
)
})
},
getRecognitionResult(requestId, bizToken) {
return new Promise((resolve, reject) => {
getRecognitionResult({ requestId, bizToken }).then(
res => {
console.log('getRecognitionResult', res)
if (res.result == '0') {
this.recognizeResult = res.result
} else {
this.$toast(res.resultMessage || '人脸识别认证失败')
}
this.sendimage(this.recognizeResult)
},
error => {
console.log(error)
}
)
localStorage.setItem('faceAuthWeXin-requestId', '')
localStorage.setItem('faceAuthWeXin-bizToken', '')
})
} }
}, },
created() { created() {
@@ -1187,7 +1289,7 @@ export default {
[Cell.name]: Cell, [Cell.name]: Cell,
[CellGroup.name]: CellGroup, [CellGroup.name]: CellGroup,
[Collapse.name]: Collapse, [Collapse.name]: Collapse,
UploadImageFile: UploadImageFile, // UploadImageFile: UploadImageFile,
[CollapseItem.name]: CollapseItem, [CollapseItem.name]: CollapseItem,
[Dialog.name]: Dialog, [Dialog.name]: Dialog,
[Field.name]: Field, [Field.name]: Field,