mirror of
http://112.124.100.131/GFRS/ebiz-h5.git
synced 2025-12-09 05:16:44 +08:00
Merge branch 'feature/GFRS-860【0514】更换人脸识别厂商-微信端' into release/0526
# Conflicts: # src/api/ebiz/sale/sale.js
This commit is contained in:
@@ -20,7 +20,7 @@ let sale = [
|
||||
'/sale/order/orderDetail',
|
||||
'/customer/authcode/loginedSend',
|
||||
'/uploadImage',
|
||||
'/customer/recognition',
|
||||
// '/customer/recognition',
|
||||
'/sale/insure/underWrite',
|
||||
'/sale/insure/acceptInsurance',
|
||||
'/app/code/getCodeValue',
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
</template>
|
||||
<script>
|
||||
import { Uploader, button } from 'vant'
|
||||
import { uploadImg, recognition } from '@/api/ebiz/sale/sale'
|
||||
import { uploadImg, getRecognitionUrl, getRecognitionResult } from '@/api/ebiz/sale/sale'
|
||||
export default {
|
||||
name: 'UploadImageFile',
|
||||
props: {
|
||||
@@ -36,7 +36,11 @@ export default {
|
||||
file: '',
|
||||
imgName: '',
|
||||
fileListIdFront: [],
|
||||
isSuccess: false
|
||||
isSuccess: false,
|
||||
bizToken: '',
|
||||
requestId: '',
|
||||
recognizeResult: '', //人脸识别结果
|
||||
recognizeMessage: '' //人脸识别失败原因
|
||||
}
|
||||
},
|
||||
components: {
|
||||
@@ -93,6 +97,7 @@ export default {
|
||||
let formdata = new FormData()
|
||||
formdata.append('imgPath', that.file)
|
||||
},
|
||||
/*
|
||||
recognition(val, num) {
|
||||
let data = {}
|
||||
num++
|
||||
@@ -116,6 +121,59 @@ export default {
|
||||
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>
|
||||
|
||||
@@ -13,13 +13,15 @@
|
||||
需签署:
|
||||
<ul>
|
||||
<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" />
|
||||
</li>
|
||||
</ul>
|
||||
点击【开始】按钮,进行相关操作
|
||||
</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>
|
||||
</div>
|
||||
</template>
|
||||
@@ -113,6 +115,7 @@ export default {
|
||||
message: '加载中……'
|
||||
})
|
||||
EWebBridge.webCallAppInJs('face_auth', {
|
||||
businessSource: '2', //业务来源:1-电投,2-入司,3-理赔,4-保全
|
||||
number: that.agentInfo.idNo, //身份证号码
|
||||
name: that.agentInfo.name //姓名
|
||||
}).then(data => {
|
||||
|
||||
@@ -227,20 +227,29 @@
|
||||
}}</van-button>
|
||||
</van-cell-group>
|
||||
</van-dialog>
|
||||
<UploadImageFile
|
||||
<!-- <UploadImageFile
|
||||
:typeface="idcardData.typeface && faceAuthCount.weixin < smsAuthNum"
|
||||
:realName="idcardData.idcardName"
|
||||
:idno="idcardData.idcardNumber"
|
||||
@sendimage="sendimage"
|
||||
>
|
||||
</UploadImageFile>
|
||||
</UploadImageFile> -->
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<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 { 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 { weixinShare } from '@/assets/js/utils/wxShare.js'
|
||||
import IndexBar from '@/components/ebiz/sale/IndexBar'
|
||||
@@ -308,14 +317,22 @@ export default {
|
||||
// 空签时顶部姓名
|
||||
tipsName: '',
|
||||
idcardData: {
|
||||
typeface: false,
|
||||
idcardName: '',
|
||||
idcardNumber: ''
|
||||
realName: '',
|
||||
idno: '',
|
||||
redirectUrl: '',
|
||||
businessSource: '1' //微信端人脸识别业务来源:1-电投,2-入司,3-理赔,4-保全
|
||||
},
|
||||
// idcardData: {
|
||||
// typeface: false,
|
||||
// idcardName: '',
|
||||
// idcardNumber: ''
|
||||
// },
|
||||
appntSignStatus: '', //投保人电子签名状态
|
||||
insuredSignStatus: '', //被保险人电子签名状态
|
||||
changeCard: localStorage.changeCard,
|
||||
salePageFlag: '-10'
|
||||
salePageFlag: '-10',
|
||||
recognizeResult: '', //微信端-人脸识别结果
|
||||
recognizeMessage: '' //微信端-人脸识别失败原因
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
@@ -355,12 +372,12 @@ export default {
|
||||
if (this.$route.query.airSign) {
|
||||
sessionStorage.setItem('airSign', this.$route.query.airSign)
|
||||
}
|
||||
window.localStorage.setItem('saleInsuredInfo', this.$route.query.saleInsuredInfo)
|
||||
window.localStorage.setItem('saleInsuredPersonInfo', this.$route.query.saleInsuredPersonInfo)
|
||||
// window.localStorage.setItem('saleInsuredInfo', this.$route.query.saleInsuredInfo)
|
||||
// window.localStorage.setItem('saleInsuredPersonInfo', this.$route.query.saleInsuredPersonInfo)
|
||||
window.localStorage.setItem('token', this.$route.query.token)
|
||||
window.localStorage.setItem('orderNo', this.$route.query.orderNo)
|
||||
window.localStorage.setItem('relationToAppnt', this.$route.query.relationToAppnt)
|
||||
window.localStorage.setItem('productCode', this.$route.query.productCode)
|
||||
// window.localStorage.setItem('relationToAppnt', this.$route.query.relationToAppnt)
|
||||
// window.localStorage.setItem('productCode', this.$route.query.productCode)
|
||||
if (this.$route.query.changeCard == '0') {
|
||||
localStorage.setItem('changeCard', true)
|
||||
} else {
|
||||
@@ -387,6 +404,7 @@ export default {
|
||||
this.relationToAppnt = this.$route.query.relationToAppnt
|
||||
this.isShow = false
|
||||
this.getOrderDetail().then(() => {
|
||||
console.log('初始化this.appntSign ==', this.appntSign)
|
||||
if (
|
||||
(this.appntSignStatus == '3' && sessionStorage.getItem('shareCode') == '0') ||
|
||||
(this.appntSignStatus == '3' && sessionStorage.getItem('shareCode') == '2')
|
||||
@@ -399,6 +417,10 @@ export default {
|
||||
if (this.changeCard && this.appntSign.documentStatus == '1') {
|
||||
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') {
|
||||
console.log('进来被保险人')
|
||||
@@ -418,6 +440,9 @@ export default {
|
||||
// let params = {
|
||||
// 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 {
|
||||
// 获取详情消息
|
||||
|
||||
@@ -549,13 +574,16 @@ export default {
|
||||
if (val == '0' || val == '2') {
|
||||
//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') {
|
||||
if (JSON.parse(localStorage.saleInsuredInfo).idType != '1') {
|
||||
that.goUrl()
|
||||
} else {
|
||||
if (this.faceAuthCount.appnt < this.smsAuthNum) {
|
||||
this.idcardData.typeface = !this.idcardData.typeface
|
||||
this.idcardData.idcardName = JSON.parse(this.$route.query.saleInsuredInfo).name
|
||||
this.idcardData.idcardNumber = JSON.parse(this.$route.query.saleInsuredInfo).idNo
|
||||
// this.idcardData.typeface = !this.idcardData.typeface
|
||||
// this.idcardData.idcardName = JSON.parse(this.$route.query.saleInsuredInfo).name
|
||||
// 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 {
|
||||
this.operaFlag = 'appnt'
|
||||
this.realPeopelCheck()
|
||||
@@ -564,14 +592,17 @@ export default {
|
||||
} else {
|
||||
window.localStorage.setItem('sign-val', val)
|
||||
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') {
|
||||
that.insuredUrl()
|
||||
} else {
|
||||
if (this.faceAuthCount.insured < this.smsAuthNum) {
|
||||
this.idcardData.typeface = !this.idcardData.typeface
|
||||
this.idcardData.idcardName = JSON.parse(this.$route.query.saleInsuredPersonInfo).name
|
||||
this.idcardData.idcardNumber = JSON.parse(this.$route.query.saleInsuredPersonInfo).idNo
|
||||
// this.idcardData.typeface = !this.idcardData.typeface
|
||||
// this.idcardData.idcardName = JSON.parse(this.$route.query.saleInsuredPersonInfo).name
|
||||
// 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 {
|
||||
this.operaFlag = 'insured'
|
||||
this.realPeopelCheck()
|
||||
@@ -589,6 +620,7 @@ export default {
|
||||
if (this.faceAuthCount.appnt < this.smsAuthNum) {
|
||||
// 原人脸识别
|
||||
EWebBridge.webCallAppInJs('face_auth', {
|
||||
businessSource: '1', //业务来源:1-电投,2-入司,3-理赔,4-保全
|
||||
number: that.saleInsuredInfo.idNo, //身份证号码
|
||||
name: that.saleInsuredInfo.name //姓名
|
||||
}).then(data => {
|
||||
@@ -617,6 +649,7 @@ export default {
|
||||
if (this.faceAuthCount.insured < this.smsAuthNum) {
|
||||
// 调原生人脸识别
|
||||
EWebBridge.webCallAppInJs('face_auth', {
|
||||
businessSource: '1', //业务来源:1-电投,2-入司,3-理赔,4-保全
|
||||
number: that.saleInsuredPersonInfo.idNo, //身份证号码
|
||||
name: that.saleInsuredPersonInfo.name //姓名
|
||||
}).then(data => {
|
||||
@@ -641,9 +674,11 @@ export default {
|
||||
goUrl() {
|
||||
let that = this
|
||||
let path = ''
|
||||
console.log('that.appntSign 1 ==', that.appntSign)
|
||||
if (that.changeCard) {
|
||||
path = 'insuranceInformation'
|
||||
} else {
|
||||
console.log('that.appntSign.length ==', that.appntSign.length, typeof that.appntSign.length)
|
||||
for (let i = 0; i < that.appntSign.length; i++) {
|
||||
if (that.appntSign[i].documentCode == '1' && that.appntSign[0].documentStatus == 0) {
|
||||
//1投保须知 未读
|
||||
@@ -676,6 +711,7 @@ export default {
|
||||
}
|
||||
}*/
|
||||
}
|
||||
console.log('跳转页面path', path)
|
||||
that.$jump({
|
||||
flag: 'h5',
|
||||
extra: {
|
||||
@@ -745,10 +781,10 @@ export default {
|
||||
localStorage.orderNo +
|
||||
'&token=' +
|
||||
localStorage.token +
|
||||
'&saleInsuredInfo=' +
|
||||
encodeURI(localStorage.saleInsuredInfo) +
|
||||
'&saleInsuredPersonInfo=' +
|
||||
encodeURI(localStorage.saleInsuredPersonInfo) +
|
||||
// '&saleInsuredInfo=' +
|
||||
// encodeURI(localStorage.saleInsuredInfo) +
|
||||
// '&saleInsuredPersonInfo=' +
|
||||
// encodeURI(localStorage.saleInsuredPersonInfo) +
|
||||
'&relationToAppnt=' +
|
||||
JSON.parse(window.localStorage.getItem('saleInsuredPersonInfo')).relationToAppnt +
|
||||
'&shareCode=' +
|
||||
@@ -773,10 +809,10 @@ export default {
|
||||
localStorage.orderNo +
|
||||
'&token=' +
|
||||
localStorage.token +
|
||||
'&saleInsuredInfo=' +
|
||||
encodeURI(localStorage.saleInsuredInfo) +
|
||||
'&saleInsuredPersonInfo=' +
|
||||
encodeURI(localStorage.saleInsuredPersonInfo) +
|
||||
// '&saleInsuredInfo=' +
|
||||
// encodeURI(localStorage.saleInsuredInfo) +
|
||||
// '&saleInsuredPersonInfo=' +
|
||||
// encodeURI(localStorage.saleInsuredPersonInfo) +
|
||||
'&relationToAppnt=' +
|
||||
JSON.parse(window.localStorage.getItem('saleInsuredPersonInfo')).relationToAppnt +
|
||||
'&shareCode=' +
|
||||
@@ -934,19 +970,19 @@ export default {
|
||||
) {
|
||||
// const message = res.orderDTO.productDTO.special.content
|
||||
// Dialog({ message })
|
||||
let content = res.orderDTO.productDTO.special.content
|
||||
// {
|
||||
// title: '标题',
|
||||
// message: '内容',
|
||||
// confirmButtonText: '确认',
|
||||
// messageAlign: 'left'
|
||||
// }
|
||||
// title 需要标题则配置,不需要则不要配置
|
||||
// message 内容,\n换行
|
||||
// confirmButtonText:确认按钮的文字
|
||||
// messageAlign: 对齐方式,固定左对齐,为'left'
|
||||
let content = res.orderDTO.productDTO.special.content
|
||||
// {
|
||||
// title: '标题',
|
||||
// message: '内容',
|
||||
// confirmButtonText: '确认',
|
||||
// messageAlign: 'left'
|
||||
// }
|
||||
// title 需要标题则配置,不需要则不要配置
|
||||
// message 内容,\n换行
|
||||
// confirmButtonText:确认按钮的文字
|
||||
// messageAlign: 对齐方式,固定左对齐,为'left'
|
||||
try {
|
||||
const config = JSON.parse(content);
|
||||
const config = JSON.parse(content)
|
||||
config.message = '  ' + config.message
|
||||
config.message = config.message.split('\\n').join('\n  ')
|
||||
// {
|
||||
@@ -970,7 +1006,6 @@ export default {
|
||||
// confirmButtonText: '本人已阅读并同意上述特别约定内容',
|
||||
// messageAlign: 'left'
|
||||
// })
|
||||
|
||||
}
|
||||
/* if (isShowDialog) {
|
||||
//记录每次弹框的订单号。再次进入页面,订单号改变才会弹窗。
|
||||
@@ -1129,7 +1164,7 @@ export default {
|
||||
// 微信人脸验证后 返回值 操作
|
||||
sendimage(e) {
|
||||
// let that = this
|
||||
if (e) {
|
||||
if (e == '0') {
|
||||
// this.$toast.clear()
|
||||
// this.$toast('人脸检测成功')
|
||||
// 1 为被保险人
|
||||
@@ -1140,6 +1175,7 @@ export default {
|
||||
}
|
||||
} else {
|
||||
this.faceAuthCount.weixin++
|
||||
console.log('腾讯人脸识别失败', this.faceAuthCount.weixin, typeof this.faceAuthCount.weixin)
|
||||
if (this.faceAuthCount.weixin >= this.smsAuthNum) {
|
||||
if (window.sessionStorage.shareCode == '1') {
|
||||
this.operaFlag = 'insured'
|
||||
@@ -1149,6 +1185,72 @@ export default {
|
||||
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() {
|
||||
@@ -1187,7 +1289,7 @@ export default {
|
||||
[Cell.name]: Cell,
|
||||
[CellGroup.name]: CellGroup,
|
||||
[Collapse.name]: Collapse,
|
||||
UploadImageFile: UploadImageFile,
|
||||
// UploadImageFile: UploadImageFile,
|
||||
[CollapseItem.name]: CollapseItem,
|
||||
[Dialog.name]: Dialog,
|
||||
[Field.name]: Field,
|
||||
|
||||
Reference in New Issue
Block a user