Files
ebiz-h5/src/views/ebiz/insureAgain/SignatureConfirmation.vue
2024-12-24 14:24:55 +08:00

1521 lines
56 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<template>
<div class="insure-again">
<div class="signature-content pb40">
<div v-if="!isWeixin">
<ProgressBar :active.sync="active" />
</div>
<div v-if="isWeixin" class="bg-white mt10 p20 fs14 tips">
<p>
尊敬的
<span>{{ tipsName }}</span
>先生/女士您好
</p>
<p>该保单由国富人寿保险股份有限公司进行承保具体确认信息如下</p>
</div>
<van-cell-group class="mt10">
<van-cell title="销售人员工号" :value="recmd.agentCode" />
<van-cell title="销售人员姓名" :value="recmd.name" />
<van-cell title="投保单号" :value="orderInfo.orderNo" @click="toTest"></van-cell>
<van-cell title="投保日期" :value="date" />
<van-cell title="保费合计(元)" :value="orderInfo.orderAmount == undefined ? '' : orderInfo.orderAmount | moneyFormat" />
</van-cell-group>
<div v-if="!isWeixin">
<!-- 不再微信 -->
<van-collapse v-model="activeNames" class="mt10">
<van-collapse-item name="1">
<div slot="title">
投保人
<span class="ml20">{{ appnt.name }}</span>
</div>
<p class="mb20">以下内容需要您按照顺序阅读并签字确认:</p>
<div v-if="changeCard">
<p>需阅读</p>
<p class="mb20">
<span class="text">{{ appntSign.documentName }}</span>
<img :src="src" v-if="appntSign.documentStatus == '1'" />
</p>
</div>
<div v-else>
<div v-for="(item, index) in appntSign" :key="index">
<p>{{ item.documentCode == '1' || item.documentCode == '8' ? '需阅读' : '需签署' }}</p>
<p class="mb20">
<span class="text">{{ item.documentName }}</span>
<img :src="src" v-if="(item.documentCode == '1' || item.documentCode == '8') && item.documentStatus == '1'" />
<img :src="src" v-if="!(item.documentCode == '1' || item.documentCode == '8') && item.documentStatus == '3'" />
</p>
</div>
</div>
<p class="start" v-if="airSign != '1'">点击开始分享进行相关操作</p>
<div v-if="!isInvalid" class="flex justify-content-a mt20">
<van-button
v-if="isShow"
type="danger"
size="normal"
class="w150"
plain
v-no-more-click="1000"
:disabled="changeCard ? appntSign.documentStatus == '1' : appntSignStatus == '3'"
@click="share(saleInsuredPersonInfo.relationToAppnt == '1' ? '2' : '0')"
>分享</van-button
>
<van-button
type="danger"
size="normal"
class="w150"
plain
:disabled="changeCard ? appntSign.documentStatus == '1' : appntSignStatus == '3'"
v-no-more-click="1000"
@click="start_ocr(saleInsuredPersonInfo.relationToAppnt == '1' ? '2' : '0')"
>开始</van-button
>
</div>
<div class="text" v-else>操作时间已失效请联系销售人员</div>
</van-collapse-item>
</van-collapse>
<div v-if="relationToAppnt != '1' && !changeCard" class="mt10">
<van-collapse v-model="activeNames" v-for="(item, index) in insured" :key="index">
<van-collapse-item :name="index + 2">
<div slot="title">
被保险人
<span class="ml20">{{ item.name }}</span>
</div>
<p class="mb20">以下内容需要您按照顺序阅读并签字确认:</p>
<div v-for="(item, index) in insuredSign" :key="index">
<p>{{ item.documentCode == '1' || item.documentCode == '8' ? '需阅读' : '需签署' }}</p>
<p class="mb20">
<span class="text">{{ item.documentName }}</span>
<img :src="src" v-if="(item.documentCode == '1' || item.documentCode == '8') && item.documentStatus == '1'" />
<img :src="src" v-if="!(item.documentCode == '1' || item.documentCode == '8') && item.documentStatus == '3'" />
</p>
</div>
<p class="start" v-if="airSign != '1'">点击开始分享进行相关操作</p>
<div v-if="!isInvalid" class="flex justify-content-a mt20">
<van-button
v-if="isShow"
type="danger"
size="normal"
class="w150"
:disabled="insuredSignStatus == '3'"
@click="share('1')"
plain
v-no-more-click="1000"
>分享</van-button
>
<van-button type="danger" size="normal" plain class="w150" :disabled="insuredSignStatus == '3'" @click="start_ocr('1')" v-no-more-click="1000"
>开始</van-button
>
</div>
<div class="text" v-else>操作时间已失效请联系销售人员</div>
</van-collapse-item>
</van-collapse>
</div>
</div>
<div v-else>
<!-- 在微信 -->
<div v-if="shareCode != '1'" class="mt10">
<van-collapse v-model="activeNames">
<van-collapse-item name="1">
<div slot="title">
投保人
<span class="ml20">{{ appnt.name }}</span>
</div>
<p class="mb20">以下内容需要您按照顺序阅读并签字确认:</p>
<div v-if="changeCard">
<p>需阅读</p>
<p class="mb20">
<span class="text">{{ appntSign.documentName }}</span>
<img :src="src" v-if="appntSign.documentStatus == '1'" />
</p>
</div>
<div v-else>
<div v-for="(item, index) in appntSign" :key="index">
<p>{{ item.documentCode == '1' || item.documentCode == '8' ? '需阅读' : '需签署' }}</p>
<p class="mb20">
<span class="text">{{ item.documentName }}</span>
<img :src="src" v-if="(item.documentCode == '1' || item.documentCode == '8') && item.documentStatus == '1'" />
<img :src="src" v-if="!(item.documentCode == '1' || item.documentCode == '8') && item.documentStatus == '3'" />
</p>
</div>
</div>
<p class="start" v-if="airSign != '1'">点击开始分享进行相关操作</p>
<div v-if="!isInvalid" class="flex justify-content-a mt20">
<van-button
type="danger"
size="normal"
style="width: 157px;"
plain
:disabled="changeCard ? appntSign.documentStatus == '1' : appntSignStatus == '3'"
v-no-more-click="1000"
@click="start_ocr(saleInsuredPersonInfo.relationToAppnt == '1' ? '2' : '0')"
>开始</van-button
>
</div>
<div class="text" v-else>操作时间已失效请联系销售人员</div>
</van-collapse-item>
</van-collapse>
</div>
<div v-else class="mt10">
<van-collapse v-model="activeNames" v-for="(item, index) in insured" :key="index">
<van-collapse-item :name="index + 2">
<div slot="title">
被保险人
<span class="ml20">{{ item.name }}</span>
</div>
<p class="mb20">以下内容需要您按照顺序阅读并签字确认:</p>
<div v-for="(item, index) in insuredSign" :key="index">
<p>{{ item.documentCode == '1' || item.documentCode == '8' ? '需阅读' : '需签署' }}</p>
<p class="mb20">
<span class="text">{{ item.documentName }}</span>
<img :src="src" v-if="(item.documentCode == '1' || item.documentCode == '8') && item.documentStatus == '1'" />
<img :src="src" v-if="(item.documentCode == '1' || item.documentCode == '8') && item.documentStatus == '3'" />
</p>
</div>
<p class="start" v-if="airSign != '1'">点击开始分享进行相关操作</p>
<div v-if="!isInvalid" class="flex justify-content-a mt20">
<van-button
type="danger"
size="normal"
plain
style="width: 157px;"
:disabled="insuredSignStatus == '3'"
@click="start_ocr('1')"
v-no-more-click="1000"
>开始</van-button
>
</div>
<div class="text" v-else>操作时间已失效请联系销售人员</div>
</van-collapse-item>
</van-collapse>
</div>
</div>
</div>
<div v-if="!isWeixin">
<div v-if="changeCard">
<div class="bottom-btn bg-white" v-if="appntSign.documentStatus == '1'">
<van-button
type="danger"
v-if="relationToAppnt == '1' ? true : appntSign.documentStatus == '1' ? true : false"
size="large"
@click="rePayMent"
v-no-more-click="1000"
>支付</van-button
>
</div>
</div>
<div v-else>
<div class="bottom-btn bg-white" v-if="appntSignStatus == '3'">
<van-button
type="danger"
v-if="relationToAppnt == '1' ? true : insuredSignStatus == '3' ? true : false"
size="large"
@click="next"
v-no-more-click="1000"
>提交</van-button
>
</div>
</div>
</div>
<!-- 短信验证 -->
<van-dialog v-model="show" title="提示" show-cancel-button @confirm="authConfirm(authCode)" @cancel="clearTimer">
<p class="p10 fs14">为确保是您本人操作短信验证码已发送至您手机号{{ encyCustomerMobile }}请您输入验证码以完成后续投保操作</p>
<van-cell-group class="flex align-items-c pr5 mb15">
<van-field maxlength="6" placeholder="请输入短信验证码" v-model="authCode" clearable label-width="0" />
<van-button type="danger" plain size="small" class="w160 p0" @click="getAuthCode" :disabled="codeDisabled" v-no-more-click="2000">{{
codeDisabled ? `${countDown}s后重新获取` : '获取验证码'
}}</van-button>
</van-cell-group>
</van-dialog>
</div>
</template>
<script>
// import UploadImageFile from '@/components/ebiz/sale/UploadImageFile'
import ProgressBar from '@/components/ebiz/insureAgain/ProgressBar'
import { Field, Cell, CellGroup, Collapse, CollapseItem, Dialog } from 'vant'
import {
underWrite,
getOrderDetail,
getSignInvalid,
checkSignInvalid,
getAuthCode,
autchCodeCheck,
getRecognitionUrl,
getRecognitionResult,
saveCustomerRid
} from '@/api/ebiz/sale/sale'
import { checkPhone } from '@/api/ebiz/customer/customer'
import { weixinShare } from '@/assets/js/utils/wxShare.js'
import Formatter from '@/assets/js/utils/date-utils.js'
import { getWhitelist } from '@/api/ebiz/whitelist'
import CacheUtils from '@/assets/js/utils/cacheUtils'
export default {
data() {
let isWeixin = this.$utils.device().isWeixin //判断环境
return {
show: false, // 获取短信验证码
codeDisabled: false, // 获取验证码按钮是否禁用
timeId: null, // 计时器ID
countDown: 60, // 倒计时
authCode: '', // 验证码
smsAuthNum: 3,
operaFlag: null,
encyCustomerMobile: null,
sid: null,
//人脸识别认证次数
faceAuthCount: {
appnt: 0,
insured: 0,
weixin: 0
},
customerMobile: '',
//保险产品名称
riskName: '',
// 员工信息
recmd: {},
// 投保时间
date: '',
// 订单信息
orderInfo: {},
// 投保人信息
appnt: {},
// 被保险人信息
insured: [],
// 投保人签名阅读信息
appntSign: [],
// 被保险人签名阅读信息
insuredSign: [],
// 折叠面板
activeNames: ['1', '2'],
// 图片路径
src: this.$assetsUrl + 'images/u6490.png',
// 被保险人信息
saleInsuredPersonInfo: {},
// 投保人信息
saleInsuredInfo: {},
// 是否在微信
isWeixin,
// 是否显示 在微信中不显示
isShow: true,
// 调微信人脸的token
tokenInweixin: '',
// 投保人被保险人是否同一个人,1代表是同一个人
relationToAppnt: '',
// 微信分享校验值
signInvalid: '',
// 微信分享链接是否失效 false 为未失效 true为已失效
isInvalid: false,
// 是谁分享的微信链接 1为被保险人 0或2为投保人
shareCode: '',
// 是否从空签成功跳转过来 1为是 其他为不是
airSign: '',
// 空签时顶部姓名
tipsName: '',
idcardData: {
realName: '',
idno: '',
redirectUrl: '',
businessSource: '1' //微信端人脸识别业务来源:1-电投2-入司3-理赔4-保全
},
// idcardData: {
// typeface: false,
// idcardName: '',
// idcardNumber: ''
// },
appntSignStatus: '', //投保人电子签名状态
insuredSignStatus: '', //被保险人电子签名状态
changeCard: localStorage.changeCard,
salePageFlag: '-10',
recognizeResult: '', //微信端-人脸识别结果
recognizeMessage: '', //微信端-人脸识别失败原因
realPeopleRidInfo: {
appntRidFlag: null,
insureRidFlag: null
},
active: 3
}
},
components: {
[Cell.name]: Cell,
[CellGroup.name]: CellGroup,
[Collapse.name]: Collapse,
[CollapseItem.name]: CollapseItem,
[Dialog.name]: Dialog,
[Field.name]: Field,
ProgressBar
},
methods: {
fakeFaceAuth(expect) {
console.log('模拟调用人脸识别')
return new Promise(function(resolve, reject) {
setTimeout(() => {
console.log('模拟人脸识别完成')
if (expect) {
resolve({ state: '0' })
} else {
reject({ state: '0' })
}
}, 2000)
})
},
appCallBack(data) {
if (data.trigger == 'left_button_click') {
return this.$dialog
.confirm({
className: 'dialog-delete',
title: '提示',
message: '退出流程可能会丢失部分数据,是否确认退出?',
cancelButtonColor: '#E9332E',
confirmButtonColor: '#FFFFFF'
})
.then(() => {
this.$jump({
flag: 'h5',
extra: {
title: '可申请重新投保保单列表',
forbidSwipeBack: 1, //当前页面禁止右滑返回
url: location.origin + `/#/insureAgain`
},
routerInfo: {
path: `/insureAgain`,
type: '1'
}
})
})
.catch(() => {
return
})
}
},
// 初始化
async init() {
localStorage.doubleRecordFlag = '0' //0不是双录单 1是双录单
if (this.isWeixin) {
if (this.$route.query.airSign) {
sessionStorage.setItem('airSign', this.$route.query.airSign)
}
// this.$CacheUtils.setLocItem('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)
if (this.$route.query.changeCard == '0') {
localStorage.setItem('changeCard', true)
} else {
localStorage.removeItem('changeCard')
}
if (this.$route.query.signInvalid) {
sessionStorage.setItem('signInvalid', this.$route.query.signInvalid)
}
if (this.$route.query.shareCode) {
sessionStorage.setItem('shareCode', this.$route.query.shareCode)
}
let signInvalid = sessionStorage.getItem('signInvalid')
let rs = await this.checkSignInvalid(signInvalid)
console.log('````````````')
console.log('rs: ' + rs)
if (rs == '1') {
this.isInvalid = false
} else {
this.isInvalid = true
}
this.airSign = sessionStorage.getItem('airSign')
this.shareCode = sessionStorage.getItem('shareCode')
this.changeCard = localStorage.getItem('changeCard')
this.relationToAppnt = this.$route.query.relationToAppnt
this.isShow = false
await this.getOrderDetail()
console.log('初始化this.appntSign ==', this.appntSign)
if (
(this.appntSignStatus == '3' && sessionStorage.getItem('shareCode') == '0') ||
(this.appntSignStatus == '3' && sessionStorage.getItem('shareCode') == '2')
) {
// this.$toast('签名成功,请联系业务员进行后续流程!')
Dialog.alert({ title: '提示', message: '签名成功,请联系业务员进行后续流程!' })
} else if (this.insuredSignStatus == '3' && sessionStorage.getItem('shareCode') == '1') {
Dialog.alert({ title: '提示', message: '签名成功,请联系业务员进行后续流程!' })
}
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']), localStorage.getItem('orderNo'))
}
if (sessionStorage.shareCode == '1') {
console.log('进来被保险人')
this.tipsName = JSON.parse(this.$CacheUtils.getLocItem('saleInsuredPersonInfo')).name
} else {
console.log('进来投保人')
this.tipsName = JSON.parse(this.$CacheUtils.getLocItem('saleInsuredInfo')).name
// console.log('localStorage.saleInsuredInfo', localStorage.saleInsuredInfo)
// console.log('localStorage.saleInsuredInfo.name', localStorage.saleInsuredInfo.name)
// console.log('this.tipName', this.tipsName)
}
weixinShare({
title: '国富人寿计划书',
imgUrl: 'http://47.96.143.111:8000/app/images/logo.png',
desc: '国富为您量身定制的保险产品,请查收'
})
// 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 {
// 获取详情消息
this.getOrderDetail()
this.getSignInvalid()
this.isShow = true
}
},
// 获取消息和阅读状态
realPeopelCheck() {
this.$toast.loading({
// 持续展示 toast
duration: 0,
// 禁用背景点击s
forbidClick: true,
loadingType: 'spinner',
message: '加载中……'
})
let data = {}
this.authCode = null
if ('appnt' == this.operaFlag) {
let appntData = JSON.parse(this.$CacheUtils.getLocItem('saleInsuredInfo'))
data = {
name: appntData.name,
idType: appntData.idType,
idNo: appntData.idNo,
mobile: appntData.mobile
}
this.customerMobile = appntData.mobile
this.encyCustomerMobile = this.customerMobile.replace(/^(\d{3})\d{4}(\d{4})$/, '$1****$2')
} else if ('insured' == this.operaFlag) {
let insuredData = JSON.parse(this.$CacheUtils.getLocItem('saleInsuredPersonInfo'))
data = {
name: insuredData.name,
idType: insuredData.idType,
idNo: insuredData.idNo,
mobile: insuredData.mobile
}
this.customerMobile = insuredData.mobile
this.encyCustomerMobile = this.customerMobile.replace(/^(\d{3})\d{4}(\d{4})$/, '$1****$2')
}
// eslint-disable-next-line no-unused-vars
return new Promise((resolve, reject) => {
checkPhone(data).then(res => {
if (res.result == '0') {
console.log(res)
this.show = true
} else {
Dialog.confirm({
title: '提示',
message: '抱歉,您预留的手机号非您本人的手机号!',
showCancelButton: false
})
}
})
})
},
// 手机号鉴权
async realPeopleCheckMobile(type) {
this.$toast.loading({
// 持续展示 toast
duration: 0,
// 禁用背景点击s
forbidClick: true,
loadingType: 'spinner',
message: '加载中……'
})
let data = {}
if ('appnt' == type) {
let appntData = JSON.parse(this.$CacheUtils.getLocItem('saleInsuredInfo'))
data = {
name: appntData.name,
idType: appntData.idType,
idNo: appntData.idNo,
mobile: appntData.mobile
}
} else if ('insured' == type) {
let insuredData = JSON.parse(this.$CacheUtils.getLocItem('saleInsuredPersonInfo'))
data = {
name: insuredData.name,
idType: insuredData.idType,
idNo: insuredData.idNo,
mobile: insuredData.mobile
}
}
let res = await checkPhone(data)
return res
},
// 验证码确认事件
async authConfirm() {
//清理计时器
this.clearTimer()
this.changeSubmit()
},
// 获取短信验证码
getAuthCode() {
this.codeDisabled = true
//倒计时
this.timeId = setInterval(() => {
this.countDown--
if (this.countDown <= 0) {
window.clearInterval(this.timeId)
this.codeDisabled = false
this.countDown = 60
}
}, 1000)
getAuthCode({
operateType: 'appntInfoEntry',
type: 'H5',
operateCode: this.customerMobile,
system: 'agentApp',
operateCodeType: '0'
}).then(res => {
console.log(res)
if (res.result == 0) {
this.sid = res.sessionId
} else {
this.$toast(res.resultMessage)
}
})
},
// 清理计时器
clearTimer() {
window.clearInterval(this.timeId)
this.timeId = null
this.countDown = 60
this.codeDisabled = false
},
//提交变更申请
async changeSubmit() {
let that = this
if (null == this.sid) {
this.$toast('请先进行发送短信验证码')
return
}
let res = await autchCodeCheck({
smsId: this.sid,
code: this.authCode
})
if (res.result == 0) {
if ('appnt' == this.operaFlag) {
that.saveCustomerRidInfo('appnt_rid', 'A')
this.goUrl()
} else if ('insured' == this.operaFlag) {
that.saveCustomerRidInfo('insured_rid', 'A')
this.insuredUrl()
}
} else {
this.$toast(res.resultMessage)
}
},
beforeDestroy() {
//清理计时器
this.clearTimer()
},
// 人脸识别
async start_ocr(val) {
// val 0投保人 1被保险人 2本人
let that = this
if (this.isWeixin) {
localStorage.setItem('sign-val', val)
localStorage.setItem('sign-appnt', JSON.stringify(that.appntSign))
if (val == '0' || val == '2') {
//idtype不为身份证跳过人脸识别
if (JSON.parse(this.$CacheUtils.getLocItem('saleInsuredInfo')).idType != '1') {
that.goUrl()
} else {
// 白名单校验
const res = await getWhitelist({
idNo: this.saleInsuredInfo.idNo,
name: this.saleInsuredInfo.name,
whiteType: 'sale_face_show'
})
if (res.result === '0') {
// 在白名单内
if (res.content && res.content.length) {
this.goUrl()
return
}
} else {
this.$toast(res.resultMessage)
}
//RID 状态--有效
if (this.realPeopleRidInfo.appntRidFlag && this.realPeopleRidInfo.appntRidFlag == '0') {
// 手机号鉴权 --通过
let res = await this.realPeopleCheckMobile('appnt')
if (res && res.result == '0') {
that.goUrl()
return
}
}
// 人脸识别
if (this.faceAuthCount.appnt < this.smsAuthNum) {
this.idcardData.realName = JSON.parse(this.$CacheUtils.getLocItem('saleInsuredInfo')).name
this.idcardData.idno = JSON.parse(this.$CacheUtils.getLocItem('saleInsuredInfo')).idNo
this.recognition()
} else {
this.operaFlag = 'appnt'
this.realPeopelCheck()
}
}
} else {
window.localStorage.setItem('sign-val', val)
window.localStorage.setItem('sign-insured', JSON.stringify(that.insuredSign))
if (
JSON.parse(this.$CacheUtils.getLocItem('saleInsuredPersonInfo')).idType != '1' ||
JSON.parse(this.$CacheUtils.getLocItem('saleInsuredPersonInfo')).age < '18'
) {
that.insuredUrl()
} else {
// 白名单校验
const res = await getWhitelist({
idNo: this.saleInsuredPersonInfo.idNo,
name: this.saleInsuredPersonInfo.name,
whiteType: 'sale_face_show'
})
if (res.result === '0') {
// 用户在白名单内
if (res.content && res.content.length) {
this.insuredUrl()
return
}
} else {
this.$toast(res.resultMessage)
}
//RID 状态--有效
if (this.realPeopleRidInfo.insureRidFlag && this.realPeopleRidInfo.insureRidFlag == '0') {
// 手机号鉴权 --通过
let res = await this.realPeopleCheckMobile('insured')
if (res && res.result == '0') {
that.insuredUrl()
return
}
}
// 人脸识别
if (this.faceAuthCount.insured < this.smsAuthNum) {
this.idcardData.realName = JSON.parse(this.$CacheUtils.getLocItem('saleInsuredPersonInfo')).name
this.idcardData.idno = JSON.parse(this.$CacheUtils.getLocItem('saleInsuredPersonInfo')).idNo
this.recognition()
} else {
this.operaFlag = 'insured'
this.realPeopelCheck()
}
}
}
} else {
if (val == '0' || val == '2') {
window.localStorage.setItem('sign-val', val)
window.localStorage.setItem('sign-appnt', JSON.stringify(that.appntSign))
this.saleInsuredInfo.idType = '1'
if (this.saleInsuredInfo.idType != '1') {
that.goUrl()
} else {
//RID 状态--有效
if (this.realPeopleRidInfo.appntRidFlag && this.realPeopleRidInfo.appntRidFlag == '0') {
// 手机号鉴权 --通过
let res = await this.realPeopleCheckMobile('appnt')
if (res && res.result == '0') {
that.goUrl()
return
}
}
// 白名单校验
const res = await getWhitelist({
idNo: this.saleInsuredInfo.idNo,
name: this.saleInsuredInfo.name,
whiteType: 'sale_face_show'
})
if (res.result === '0') {
// 在白名单内
if (res.content && res.content.length) {
this.goUrl()
return
}
} else {
this.$toast(res.resultMessage)
}
if (this.faceAuthCount.appnt < this.smsAuthNum) {
// eslint-disable-next-line no-undef
const authRes = await EWebBridge.webCallAppInJs('face_auth', {
businessSource: '1', //业务来源:1-电投2-入司3-理赔4-保全
number: that.saleInsuredInfo.idNo, //身份证号码
name: that.saleInsuredInfo.name //姓名
}).then(data => {
if (JSON.parse(data).state == '1') {
// 保存rid 数据
that.saveCustomerRidInfo('appnt_rid', 'B')
that.goUrl()
} else {
that.faceAuthCount.appnt++
if (this.faceAuthCount.appnt >= this.smsAuthNum) {
this.operaFlag = 'appnt'
this.realPeopelCheck()
}
}
})
// todo 测试去掉人脸识别 start=====================
// 保存rid 数据
// that.saveCustomerRidInfo('appnt_rid', 'B')
// that.goUrl()
// todo 测试去掉人脸识别 end=====================
// const authRes = await this.fakeFaceAuth(true)
if (JSON.parse(authRes).state == '1') {
this.goUrl()
} else {
this.faceAuthCount.appnt++
if (this.faceAuthCount.appnt >= this.smsAuthNum) {
this.operaFlag = 'appnt'
this.realPeopelCheck()
}
}
} else {
this.operaFlag = 'appnt'
this.realPeopelCheck()
}
}
} else {
window.localStorage.setItem('sign-val', val)
window.localStorage.setItem('sign-insured', JSON.stringify(that.insuredSign))
if (this.saleInsuredPersonInfo.idType != '1' || this.saleInsuredPersonInfo.age < '18') {
that.insuredUrl()
} else {
//RID 状态--有效
if (this.realPeopleRidInfo.insureRidFlag && this.realPeopleRidInfo.insureRidFlag == '0') {
// 手机号鉴权 --通过
let res = await this.realPeopleCheckMobile('insured')
if (res && res.result == '0') {
that.insuredUrl()
return
}
}
// 白名单校验
const res = await getWhitelist({
idNo: this.saleInsuredPersonInfo.idNo,
name: this.saleInsuredPersonInfo.name,
whiteType: 'sale_face_show'
})
if (res.result === '0') {
// 用户在白名单内
if (res.content && res.content.length) {
this.insuredUrl()
return
}
} else {
this.$toast(res.resultMessage)
}
// 人脸识别
if (this.faceAuthCount.insured < this.smsAuthNum) {
// 调原生人脸识别
// eslint-disable-next-line no-undef
const authRes = await EWebBridge.webCallAppInJs('face_auth', {
businessSource: '1', //业务来源:1-电投2-入司3-理赔4-保全
number: that.saleInsuredPersonInfo.idNo, //身份证号码
name: that.saleInsuredPersonInfo.name //姓名
}).then(data => {
if (JSON.parse(data).state == '1') {
that.saveCustomerRidInfo('insured_rid', 'B')
that.insuredUrl()
} else {
that.faceAuthCount.insured++
if (this.faceAuthCount.insured >= this.smsAuthNum) {
this.operaFlag = 'insured'
this.realPeopelCheck()
}
}
})
// const authRes = await this.fakeFaceAuth(true)
if (JSON.parse(authRes).state == '1') {
this.insuredUrl()
} else {
this.faceAuthCount.insured++
if (this.faceAuthCount.insured >= this.smsAuthNum) {
this.operaFlag = 'insured'
this.realPeopelCheck()
}
}
} else {
this.operaFlag = 'insured'
this.realPeopelCheck()
}
}
}
}
},
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[i].documentCode == '8') && that.appntSign[i].documentStatus == 0) {
//1投保须知 未读
path = that.appntSign[i].routePath
break
} else {
if (that.appntSign[i].documentStatus == 2) {
path = that.appntSign[i].routePath
break
}
}
}
/* if (localStorage.productCode == 'GFRS_M0003' || localStorage.productCode == 'GFRS_M0015' || this.productCode == 'GFRS_M0017') {
if (that.appntSign[0].documentStatus == 0) {
path = 'insuranceInformation'
} else if (that.appntSign[1].documentStatus == 2) {
path = 'productTip'
} else if (that.appntSign[2].documentStatus == 2) {
path = 'InsuranceTip'
} else if (that.appntSign[3].documentStatus == 2) {
path = 'SignatureOfElectronic'
}
} else {
if (that.appntSign[0].documentStatus == 0) {
path = 'insuranceInformation'
} else if (that.appntSign[1].documentStatus == 2) {
path = 'InsuranceTip'
} else if (that.appntSign[2].documentStatus == 2) {
path = 'SignatureOfElectronic'
}
}*/
}
console.log('跳转页面path', path)
if (path)
that.$jump({
flag: 'h5',
extra: {
url: location.origin + '/#/insureAgain/' + path
},
routerInfo: {
path: '/insureAgain/' + path
}
})
},
insuredUrl() {
let that = this
let path = ''
if (that.insuredSign[0].documentStatus == 0) {
path = 'insuranceInformation'
} else {
path = 'SignatureOfElectronic'
}
that.$jump({
flag: 'h5',
extra: {
url: location.origin + '/#/insureAgain/' + path
},
routerInfo: {
path: '/insureAgain/' + path
}
})
},
toTest() {},
// 微信分享
share(code) {
let shareName = ''
if (code == '1') {
shareName = '被保险人'
} else {
shareName = '投保人'
}
console.log('`````````````测试安卓url`````````````````')
console.log(
location.origin +
'/#/insureAgain/signatureConfirmation?orderNo=' +
localStorage.orderNo +
'&token=' +
localStorage.token +
'&saleInsuredInfo=' +
this.$CacheUtils.getLocItem('saleInsuredInfo') +
'&saleInsuredPersonInfo=' +
this.$CacheUtils.getLocItem('saleInsuredPersonInfo') +
'&relationToAppnt=' +
JSON.parse(this.$CacheUtils.getLocItem('saleInsuredPersonInfo')).relationToAppnt +
'&shareCode=' +
code +
'&signInvalid=' +
this.signInvalid +
'&productCode=' +
localStorage.productCode
)
if (this.changeCard) {
// eslint-disable-next-line no-undef
EWebBridge.webCallAppInJs('bridge', {
flag: 'share',
extra: {
title: '国富人寿修改银行卡号确认',
content: '签字进行',
url:
location.origin +
'/#/insureAgain/signatureConfirmation?orderNo=' +
localStorage.orderNo +
'&token=' +
localStorage.token +
'&relationToAppnt=' +
JSON.parse(this.$CacheUtils.getLocItem('saleInsuredPersonInfo')).relationToAppnt +
'&shareCode=' +
code +
'&signInvalid=' +
this.signInvalid +
'&productCode=' +
localStorage.productCode +
'&changeCard=0',
img: this.$assetsUrl + 'images/logo.png'
}
})
} else {
console.log(location.origin +
'/#/insureAgain/signatureConfirmation?orderNo=' +
localStorage.orderNo +
'&token=' +
localStorage.token +
'&relationToAppnt=' +
JSON.parse(this.$CacheUtils.getLocItem('saleInsuredPersonInfo')).relationToAppnt +
'&shareCode=' +
code +
'&signInvalid=' +
this.signInvalid +
'&productCode=' +
localStorage.productCode)
// eslint-disable-next-line no-undef
EWebBridge.webCallAppInJs('bridge', {
flag: 'share',
extra: {
title: `国富人寿电子投保单(${shareName})签字`,
content: '签字进行',
url:
location.origin +
'/#/insureAgain/signatureConfirmation?orderNo=' +
localStorage.orderNo +
'&token=' +
localStorage.token +
'&relationToAppnt=' +
JSON.parse(this.$CacheUtils.getLocItem('saleInsuredPersonInfo')).relationToAppnt +
'&shareCode=' +
code +
'&signInvalid=' +
this.signInvalid +
'&productCode=' +
localStorage.productCode,
img: this.$assetsUrl + 'images/logo.png'
}
})
}
},
// 提交
next() {
//需要全部提交
this.$toast.loading({
duration: 0, // 持续展示 toast
forbidClick: true, // 禁用背景点击
loadingType: 'spinner',
message: '加载中……'
})
let data = {
platform: 'app',
type: '1',
orderDTO: {
orderInfoDTO: {
orderNo: window.localStorage.getItem('orderNo')
}
}
}
// /insure/selfToHuman
underWrite(data).then(res => {
this.$toast.clear()
let that = this
if (res.result == '0') {
window.localStorage.setItem('underWriteData', JSON.stringify(res))
if (res.uwResult == '02') {
// 去支付
// window.localStorage.setItem('uwResult', res.uwResult)
that.$jump({
flag: 'h5',
extra: {
url: location.origin + '/#/insureAgain/PayMent'
},
routerInfo: {
path: '/insureAgain/PayMent'
}
})
} else if (res.uwResult == '07') {
// 核保失败
window.localStorage.setItem('uwResult', res.uwResult)
window.localStorage.setItem('resultMessage', res.message)
that.$jump({
flag: 'h5',
extra: {
url: location.origin + '/#/insureAgain/Result',
backToFirst: '1'
},
routerInfo: {
path: '/insureAgain/Result'
}
})
} else if (res.uwResult == '46') {
// 转人核
window.localStorage.setItem('uwResult', res.uwResult)
window.localStorage.setItem('resultMessage', res.message)
that.$jump({
flag: 'h5',
extra: {
url: location.origin + '/#/insureAgain/Result',
backToFirst: '1'
},
routerInfo: {
path: '/insureAgain/Result'
}
})
} else if (res.uwResult == '47') {
// 核心系统繁忙,请稍后重试
window.localStorage.setItem('uwResult', res.uwResult)
that.$jump({
flag: 'h5',
extra: {
url: location.origin + '/#/insureAgain/Result',
backToFirst: '1'
},
routerInfo: {
path: '/insureAgain/Result'
}
})
} else {
//其他-系统繁忙,请稍后重试
window.localStorage.setItem('uwResult', res.uwResult)
that.$jump({
flag: 'h5',
extra: {
url: location.origin + '/#/insureAgain/Result',
backToFirst: '1'
},
routerInfo: {
path: '/insureAgain/Result'
}
})
}
} else {
this.$toast(res.resultMessage)
}
})
},
// 重新支付
rePayMent() {
// 再次支付 salelist为 0
localStorage.salelist = '0'
this.$jump({
flag: 'h5',
extra: {
url: location.origin + '/#/insureAgain/Payment'
},
routerInfo: {
path: '/insureAgain/PayMent'
}
})
},
// 获取消息和阅读状态
getOrderDetail() {
let that = this
this.$toast.loading({
// 持续展示 toast
duration: 0,
// 禁用背景点击s
forbidClick: true,
loadingType: 'spinner',
message: '加载中……'
})
let data = {
orderNo: CacheUtils.getLocItem('orderNo'),
getOtherType: 'RID'
}
localStorage.setItem('riskName', '')
return new Promise(resolve => {
getOrderDetail(data).then(res => {
if (res.result == '0') {
if (res.orderDTO && res.orderDTO.prtType) {
localStorage.setItem('readingProtocolType', res.orderDTO.prtType)
}
//弹框展示是否有社保、赔付比例和免赔额信息
const isMedical = res.orderDTO.insuredDTOs[0].medical === '0'
const mainRiskCode = res.orderDTO.insuredDTOs[0].riskDTOLst[0].mainRiskCode
// const isShowDialog = mainRiskCode === 'GFRS_M0005' || mainRiskCode === 'GFRS_M0016'
const isShowDialog = mainRiskCode === 'GFRS_M0016'
if (
!!res.orderDTO.productDTO &&
!!res.orderDTO.productDTO.special &&
!!res.orderDTO.productDTO.special.content &&
res.orderDTO.productDTO.special.content !== ''
) {
let content = res.orderDTO.productDTO.special.content
try {
const config = JSON.parse(content)
config.message = '&emsp;&emsp;' + config.message
config.message = config.message.split('\\n').join('\n&emsp;&emsp;')
Dialog(config)
} catch (error) {
const message = '&emsp;&emsp;' + content
Dialog({
message: message.split('\\n').join('\n&emsp;&emsp;'),
confirmButtonText: '本人已阅读并同意上述特别约定内容',
messageAlign: 'left'
})
}
}
localStorage.setItem('lastOrderNo', data.orderNo)
localStorage.setItem('AppntidType', res.orderDTO.appntDTO.idType)
this.$toast.clear()
this.$utils.intLocalStorage(res)
// 获取被保险人信息recmd
this.saleInsuredPersonInfo = JSON.parse(this.$CacheUtils.getLocItem('saleInsuredPersonInfo'))
// 获取投保人信息
this.saleInsuredInfo = JSON.parse(this.$CacheUtils.getLocItem('saleInsuredInfo'))
this.relationToAppnt = this.saleInsuredPersonInfo.relationToAppnt //将缓存中的与被保险人关系赋值给页面
that.recmd = res.orderDTO.recmdDTO
that.orderInfo = res.orderDTO.orderInfoDTO
that.insured = res.orderDTO.insuredDTOs
// 初始化RID状态
this.realPeopleRidInfo.appntRidFlag = res.orderDTO.appntDTO.ridStatus
this.realPeopleRidInfo.insureRidFlag = res.orderDTO.insuredDTOs[0].ridStatus
//存code区分万能型产品
let productCode, riskName
let isDoubleMailRisk = that.orderInfo.isDoubleMailRisk
if (isDoubleMailRisk == '1') {
productCode = 'GFRS_M0017'
riskName = res.orderDTO.insuredDTOs[0].riskDTOLst[1].riskName
} else {
productCode = that.insured[0].riskDTOLst[0].mainRiskCode
riskName = res.orderDTO.insuredDTOs[0].riskDTOLst[0].riskName
}
localStorage.setItem('productCode', productCode)
this.riskName = riskName
localStorage.setItem('riskName', riskName)
if (this.relationToAppnt != '1') {
this.activeNames.push(res.orderDTO.insuredDTOs.length + 1)
} else {
this.activeNames.push('1')
}
that.appnt = res.orderDTO.appntDTO
that.date = res.orderDTO.orderInfoDTO.appntDateLabel
res.orderDTO.ebizSignDTOS.map(item => {
if (item.signType == '0' || item.signType == '2') {
if (!localStorage.changeCard) {
if (item.documentCode != '5') {
that.appntSign.push(item) //投保
that.addKey(item)
}
} else {
//阅读授权书
if (item.documentCode == '5') {
that.appntSign = item //投保
}
}
} else {
that.insuredSign.push(item) //被保
}
})
if (!that.changeCard) {
//将投保人数组排序
that.appntSign.sort(function(a, b) {
return a.key - b.key
})
//获取投保和被保险人电子投保单签字状态
that.appntSign.map(item => {
// 判断是否双录
if (item.documentCode == '6') {
localStorage.doubleRecordFlag = '1'
}
if (item.documentCode == '2') {
that.appntSignStatus = item.documentStatus
}
})
that.insuredSign.map(item => {
if (item.documentCode == '2') {
that.insuredSignStatus = item.documentStatus
}
})
}
resolve('success')
}
})
})
},
//自定义key值排序用
addKey(item) {
//ducumentCode 1投保须知 2投保单 3产品说明书 4提示书 6免除保险人责任条款说明书 7保险销售行为双录说明
if (item.documentCode == '1') {
item.key = 2
item.routePath = 'InsuranceInformation'
} else if (item.documentCode == '2') {
item.key = 7
item.routePath = 'SignatureOfElectronic'
} else if (item.documentCode == '3') {
item.key = 3
item.routePath = 'ProductTip'
} else if (item.documentCode == '4') {
item.key = 4
item.routePath = 'InsuranceTip'
} else if (item.documentCode == '6') {
item.key = 5
item.routePath = 'AvoidDutyTip'
} else if (item.documentCode == '7') {
item.key = 6
item.routePath = 'DoubleRecordTip'
} else if (item.documentCode == '8') {
item.key = 1
item.routePath = 'ApointValidDoc'
}
},
getSignInvalid() {
this.$toast.loading({
duration: 0, // 持续展示 toast
forbidClick: true, // 禁用背景点击
loadingType: 'spinner',
message: '加载中……'
})
let data = {}
getSignInvalid(data).then(res => {
if (res.result == '0') {
this.$toast.clear()
this.signInvalid = res.content.sign
}
})
},
async checkSignInvalid(signInvalid) {
let that = this
this.$toast.loading({
duration: 0, // 持续展示 toast
forbidClick: true, // 禁用背景点击
loadingType: 'spinner',
message: '加载中……'
})
let data = {
sign: signInvalid
}
return new Promise(resolve => {
checkSignInvalid(data).then(res => {
if (res.result == '0') {
that.$toast.clear()
let status = res.content.status
resolve(status)
}
})
})
},
// 微信人脸验证后 返回值 操作
sendimage(e) {
if (e == '0') {
// 1 为被保险人
if (window.sessionStorage.shareCode == '1') {
// 被保人微信端人脸识别成功
this.saveCustomerRidInfo('insured_rid', 'B')
this.insuredUrl()
} else {
// 投保人微信端人脸识别成功
this.saveCustomerRidInfo('appnt_rid', 'B')
this.goUrl()
}
} 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'
} else {
this.operaFlag = 'appnt'
}
this.realPeopelCheck()
}
}
},
async recognition() {
localStorage.setItem('faceAuthWeXin-requestId', '')
localStorage.setItem('faceAuthWeXin-bizToken', '')
await this.getRecognitionUrl()
},
//替换redirectUrl
replaceSearch() {
let obj = this.$route.query,
str = '/#/insureAgain/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(() => {
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
}
getRecognitionUrl(data).then(
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, orderNo) {
return new Promise(() => {
getRecognitionResult({ requestId, bizToken, orderNo: orderNo }).then(
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', '')
})
},
// 保存客户rid 认证结果
saveCustomerRidInfo(type, ridType) {
// 判断类型初始化入参
// eslint-disable-next-line no-unused-vars
let param = {}
if (type == 'appnt_rid') {
param = {
name: this.appnt.name,
sex: this.appnt.sex,
idType: this.appnt.idType,
idNo: this.appnt.idNo,
certificateValidate: this.appnt.effectiveDateType == true ? '9999-12-31' : this.appnt.certiexpiredate,
ridType: ridType,
ridDate: Formatter.formatDate(new Date(), 'yyyy-MM-dd'),
ridPhone: this.appnt.mobile,
orderNo: this.orderInfo.orderNo
}
} else if (type == 'insured_rid') {
param = {
name: this.insured[0].name,
sex: this.insured[0].sex,
idType: this.insured[0].idType,
idNo: this.insured[0].idNo,
certificateValidate: this.insured[0].effectiveDateType == true ? '9999-12-31' : this.insured[0].certiexpiredate,
ridType: ridType,
ridDate: Formatter.formatDate(new Date(), 'yyyy-MM-dd'),
ridPhone: this.insured[0].mobile,
orderNo: this.orderInfo.orderNo
}
}
// 保存rid 认证结果 不阻断流程
saveCustomerRid(param).then(res => {
console.log('saveCustomerRid', res)
})
}
},
created() {
setTimeout(() => {
EWebBridge.webCallAppInJs('webview_left_button', {
img: this.$assetsUrl + 'images/del-close-btn@3x.png',
intercept: '1' //是否拦截原生返回事件 1是 其他否
})
}, 100)
window.appCallBack = this.appCallBack
},
mounted() {
//若进入签名页,则不允许回到签名页前面的页面
// localStorage.setItem('salePageFlag', this.salePageFlag)
if (!this.$route.query.salePageFlag) {
CacheUtils.setLocItem('active', this.active)
}
let that = this
document.title = this.changeCard ? '修改银行卡号确认' : '签名确认'
// 初始化
that.init()
if (window.localStorage.getItem('jumpFromSign') != '1' && window.localStorage.getItem('attachmentShow') == '0') {
Dialog.confirm({
title: '提示',
message: '当前投保单件需进行双录,请手动切换至双录系统,进行双录操作,完成后进行后续操作',
showCancelButton: false
}).then(() => {
// 获取投被保险人是否同一个人
that.relationToAppnt = JSON.parse(this.$CacheUtils.getLocItem('saleInsuredPersonInfo')).relationToAppnt
})
} else if (window.localStorage.getItem('jumpFromSign') == '1' || window.localStorage.getItem('attachmentShow') == '1') {
// 获取投被保险人是否同一个人
that.relationToAppnt = JSON.parse(this.$CacheUtils.getLocItem('saleInsuredPersonInfo')).relationToAppnt
}
},
beforeRouteLeave(to, from, next) {
document.body.style.backgroundColor = ''
next()
}
}
</script>
<style lang="scss" scoped>
.file-name {
display: flex;
align-items: center;
}
.files {
p {
font-size: 14px;
}
}
.text {
color: #4a90e2;
}
.start {
color: #4fc6b3;
}
.tips {
line-height: 30px;
}
.tips {
line-height: 30px;
}
</style>