Files
ebiz-h5/src/views/ebiz/sale/SignatureOfElectronic.vue
2023-12-22 21:27:57 +08:00

1185 lines
48 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="redRadioCheckbox">
<div class="pb60" v-if="detailJump == '1'">
<!-- config.imgDomain + `/returnDirectStream?imgPath=${window.localStorage.getItem('insurance-policyUrl')}` -->
<iframe :src="src + pdfUrl" class="iframe"></iframe>
<van-radio-group v-model="radioSure" class="pb10 pt20 pl5 fs14">
<van-radio name="1">
我已充分了解上述提示内容并同意通过电子方式签收
</van-radio>
</van-radio-group>
<!-- <div id="pdf"></div>-->
<!-- <img :src="'data:image/jpeg;base64,' + url" /> -->
<!-- 我已充分了解上述提示内容并同意通过电子方式签收 -->
<div class="pt30 pl30 flex align-items-c">
<span class="mr10">投保人签名 :</span>
<div>
<!-- <van-button type="danger" size="small" @click="chaolu('0')" v-no-more-click="1000">抄录</van-button> -->
<van-button type="danger" size="small" @click="sign('0')" :disabled="isSure" v-no-more-click="1000">{{ isSign ? '签名' : '已签名' }}</van-button>
</div>
</div>
</div>
<div class="pb60" v-else>
<van-notice-bar :scrollable="false" v-if="!Time" class="notice">{{ `提示阅读时长需在${this.Time ? this.time : this.number}秒以上` }}</van-notice-bar>
<iframe :src="src + pdfUrl" class="iframe"></iframe>
<!-- <img :src="'data:image/jpeg;base64,' + url" /> -->
<!-- <van-radio-group v-model="radio" class="pb10 pt20 pl30 fs14" v-if="!dayShow && chooseProductCodes[0] == 'GFRS_M0011'">
<van-radio name="1" @click="click" class="ml-25 pl10 pr10">
本人确认已阅读
<span>{{ `${pdfName}并指定本保险合同生效日为2020年1月1日` }}</span>
</van-radio>
</van-radio-group> -->
<van-radio-group v-model="radio" class="pb10 pt20 pl30 fs14">
<van-radio name="1" @click="click">
本人确认已阅读
<span>{{ `${pdfName}` }}</span>
</van-radio>
</van-radio-group>
<div class="pt20 pl30 flex align-items-c">
<span class="mr10">投保人签名 :</span>
<div v-if="signVal == '0' || signVal == '2'">
<div v-if="isComment">
<van-button type="danger" size="small" :disabled="signVal == '1' ? true : isDisable" @click="chaolu('0')" v-no-more-click="1000" class="mr10">{{
appntSign.documentStatus == '2' ? '抄录' : '已抄录'
}}</van-button>
</div>
<div v-else>
<van-button type="danger" size="small" :disabled="signVal == '1' ? true : isDisable" @click="sign('0')" v-no-more-click="1000">{{
appntSign.documentStatus == '2' ? '签名' : '已签名'
}}</van-button>
</div>
</div>
<div v-if="signVal == '1'">
<div v-if="isComment">
<van-button type="danger" size="small" :disabled="signVal == '1' ? true : isDisable" @click="chaolu('0')" v-no-more-click="1000" class="mr10">{{
appntSign.documentStatus == '2' ? '抄录' : '已抄录'
}}</van-button>
</div>
<div v-else>
<van-button type="danger" size="small" :disabled="signVal == '1' ? true : isDisable" @click="sign('0')" v-no-more-click="1000">{{
appntSign.documentStatus == '2' ? '签名' : '已签名'
}}</van-button>
</div>
</div>
</div>
<div class="pt25 pl30 flex align-items-c" v-if="relationToAppnt != '1'">
<span class="mr10">被保险人/监护人签名</span>
<div v-if="signVal == '0' || signVal == '2'">
<van-button type="danger" size="small" :disabled="signVal == '1' ? isDisableInsured : true" @click="sign('1')" v-no-more-click="1000">{{
insuredSign.documentStatus == '2' ? '未签名' : '已签名'
}}</van-button>
</div>
<div v-if="signVal == '1'" class="flex">
<van-button type="danger" size="small" :disabled="signVal == '1' ? isDisableInsured : true" @click="sign('1')" v-no-more-click="1000">{{
insuredSign.documentStatus == '2' ? '签名' : '已签名'
}}</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 class="bottom-btn bg-white" v-if="detailJump == '1'">
<van-button type="danger" size="large" @click="submit" :disabled="isSubmit" v-no-more-click="1000">提交</van-button>
</div>
<div class="bottom-btn bg-white" v-else>
<van-button type="danger" size="large" @click="next" :disabled="isDisabledComplite" v-no-more-click="1000">下一步</van-button>
</div>
</div>
</template>
<script>
import { RadioGroup, Radio, Dialog, NoticeBar, Cell, CellGroup, Button, Field } from 'vant'
import { getAuthCode, autchCodeCheck, getOrderDetail, saveInformation, submit } from '@/api/ebiz/sale/sale'
import { checkPhone } from '@/api/ebiz/customer/customer'
import config from '@/config'
export default {
data() {
let isWeixin = this.$utils.device().isWeixin //判断环境
return {
show: false, // 获取短信验证码
codeDisabled: false, // 获取验证码按钮是否禁用
timeId: null, // 计时器ID
countDown: 60, // 倒计时
authCode: '', // 验证码
pdfh5: null,
encyCustomerMobile:'',
pdfUrl: '',
// policyUrl: '',
src: location.origin + '/pdfjs/web/viewer.html?file=',
radio: '',
// 回执签收的radio
radioSure: '',
// 倒计时时间
number: '',
// // 定时器时间
time: '10',
// // 定时器名称
timer: null,
isOver: false,
// 判断验证码是否开始倒计时
Time: true,
// 按钮是否可以点击
isDisable: true,
// 被保险人是否可以点击
isDisableInsured: true,
// 投保人签名阅读信息
appntSign: {},
// 被保险人签名阅读信息
insuredSign: {},
// 是投保人还是被保险人 0 投保人 1被保险人 2 投被同人
signVal: '',
// CA签字位置
caOffset: '-150', // 投保人签名位置
// 图片路径
url: '',
// sign加密码
base64: '',
// 是否可以点击
isDisabledComplite: true,
// local带来的被保险人信息
saleInsuredPersonInfo: {},
// local带来的投保人信息
saleInsuredInfo: {},
// 投被保险人是否同人 1为投被同人其他为不是
relationToAppnt: '',
// 是否在微信
isWeixin,
// 是否可以点击提交
isSubmit: true,
// 是否签名了 回执流程
isSign: true,
// 是否从详情跳过来 如果为1 是
detailJump: '',
// 是否是万能险
isComment: false,
// 判断回执里面签名是否可以点击
isSure: true,
// 判断时间展示不同pdf勾选不同话术
// dayShow: false,
// // 产品编码
// chooseProductCodes: '',
// pdf名字
pdfName: '',
caSignEnteringGinseng: '', //ca签名入参
caSignExoticGinseng: '', //ca签名出参
isPersonalInformation:'' // -1不存在 其他值是下标
}
},
components: {
[RadioGroup.name]: RadioGroup,
[Radio.name]: Radio,
[Dialog.name]: Dialog,
[Cell.name]: Cell,
[CellGroup.name]: CellGroup,
[Button.name]: Button,
[Field.name]: Field,
[NoticeBar.name]: NoticeBar
},
methods: {
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 + `/#/sale/list`
},
routerInfo: {
path: `/sale/list`,
type: '1'
}
})
})
.catch(() => {
return
})
}
},
// 获取短信验证码
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)
}
})
},
// 验证码确认事件
async authConfirm() {
//清理计时器
this.clearTimer()
this.changeSubmit()
},
// 清理计时器
clearTimer() {
window.clearInterval(this.timeId)
this.timeId = null
this.countDown = 60
this.codeDisabled = false
},
//提交变更申请
async changeSubmit() {
if (null == this.sid) {
this.$toast('请先进行发送短信验证码')
return
}
let res = await autchCodeCheck({
smsId: this.sid,
code: this.authCode
})
if (res.result == 0) {
this.submit4detail()
} else {
this.$toast(res.resultMessage)
}
},
timeOut() {
let that = this
let time = that.time
that.Time = false
that.number = `${time}`
let timer = setInterval(() => {
time--
if (time <= 0) {
time = 0
clearInterval(timer)
that.Time = true
that.isOver = true
}
that.number = `${time}`
}, 1000)
},
// 获取签名状态
getOrderDetail() {
let that = this
let data = {
orderNo: that.$route.query.orderNo
}
return new Promise((resolve, reject) => {
getOrderDetail(data).then(res => {
if (res.result == '0') {
res.orderDTO.ebizSignDTOS.map(item => {
// if (item.documentCode == '12') {
// this.isPersonalInformation = 0 // 0代表有code12
// } else{
// this.isPersonalInformation = 1 // 1代表无code12
// }
if (item.documentCode == '2') {
this.pdfUrl = encodeURIComponent(config.imgDomain + `/returnDirectStream?imgPath=${item.policyUrl}`)
this.pdfName = item.documentName
if (item.signType == '0') {
that.appntSign = item
// this.policyUrl = item.policyUrl
} else if (item.signType == '1') {
that.insuredSign = item
} else {
that.appntSign = item
}
}
})
if (that.isWeixin) {
if (res.orderDTO.ebizSignDTOS.length > 1) {
if (that.appntSign.documentStatus == '3' && that.insuredSign.documentStatus == '3') {
that.isDisabledComplite = false
}
}
}
resolve('success')
}
})
})
},
// 单选框
click() {
let that = this
if (that.isOver == false) {
Dialog.confirm({
title: '提示',
message: '该内容涉及您的重大权益,请您仔细阅读',
showCancelButton: false
}).then(() => {
that.radio = ''
})
}
},
submit(){
if(this.detailJump == '1'){
this.submit4detailJump()
}else{
this.submit4detail()
}
},
submit4detailJump(){
// 如果是回执签收
// 则短信验证
this.customerMobile = this.saleInsuredInfo.mobile
this.encyCustomerMobile = this.customerMobile.replace(/^(\d{3})\d{4}(\d{4})$/, '$1****$2')
this.authCode = null
this.show = true
},
// 点击提交
submit4detail() {
this.$toast.loading({
duration: 0, // 持续展示 toast
forbidClick: true, // 禁用背景点击
loadingType: 'spinner',
message: '加载中……'
})
let data = {
contNo: window.localStorage.getItem('contNo'),
baseEncryp: this.base64,
caSignEnteringGinseng: this.caSignEnteringGinseng, //ca签名入参
caSignExoticGinseng: JSON.stringify(this.caSignExoticGinseng), //ca签名出参
pdfAddresss: window.localStorage.getItem('insurance-policyUrl'),
orderNo: this.$route.query.orderNo
}
submit(data).then(res => {
if (res.result == '0') {
this.$toast.clear()
window.localStorage.setItem('submitStatus', res.result)
this.$jump({
flag: 'h5',
extra: {
url: location.origin + '/#/serve/result?orderNo=' + this.$route.query.orderNo,
backToFirst: '1'
},
routerInfo: {
path: '/serve/result?orderNo=' + this.$route.query.orderNo
}
})
} else {
this.$toast(res.resultMessage)
/*window.localStorage.setItem('submitStatus', res.result)
this.$jump({
flag: 'h5',
extra: {
url: location.origin + '/#/serve/result',
backToFirst: '1'
},
routerInfo: {
path: '/serve/result'
}
})*/
}
})
},
// 点击完成
next() {
let that = this
this.$toast.loading({
duration: 0, // 持续展示 toast
forbidClick: true, // 禁用背景点击
loadingType: 'spinner',
message: '加载中……'
})
if (that.signVal == '0' || that.signVal == '2') {
let data = {
orderType: 'SIGN_ORDER',
orderDTO: {
orderInfoDTO: {
orderNo: that.$route.query.orderNo
},
ebizSignDTOS: [
{
signOrRead: 'sign',
signId: that.appntSign.signId,
orderNo: that.$route.query.orderNo,
documentStatus: '3',
signType: that.signVal,
baseEncryp: that.base64,
caSignEnteringGinseng: this.caSignEnteringGinseng, //ca签名入参
caSignExoticGinseng: JSON.stringify(this.caSignExoticGinseng), //ca签名出参
documentType: that.appntSign.documentType,
documentCode: that.appntSign.documentCode
}
]
}
}
saveInformation(data).then(res => {
if (res.result == '0') {
this.$toast.clear()
window.localStorage.setItem('jumpFromSign', '1')
let url
if(this.isPersonalInformation != '-1'){
url= '/sale/PersonalInformation'
}else{
url= '/sale/signatureConfirmation'
}
if (this.isWeixin) {
localStorage.removeItem('signInfo')
this.$jump({
flag: 'h5',
extra: {
url: location.origin + '/#'+ url + '?orderNo=' + that.$route.query.orderNo,
pullRefresh: '1',
backToFirst: '1'
},
routerInfo: {
path:
url +'?orderNo=' +
this.$route.query.orderNo +
'&token=' +
localStorage.token +
'&saleInsuredInfo=' +
this.$CacheUtils.getLocItem('saleInsuredInfo') +
'&saleInsuredPersonInfo=' +
this.$CacheUtils.getLocItem('saleInsuredPersonInfo') +
'&relationToAppnt=' +
JSON.parse(this.$CacheUtils.getLocItem('saleInsuredPersonInfo')).relationToAppnt +
'&attachmentShow=' +
window.localStorage.getItem('attachmentShow') +
'&signInvalid=' +
sessionStorage.getItem('signInvalid') +
'&airSign=1'
}
})
} else {
this.$jump({
flag: 'h5',
extra: {
url: location.origin + '/#' + url + '?orderNo=' + that.$route.query.orderNo,
pullRefresh: '1',
backToFirst: '1'
},
routerInfo: {
path: url + '?orderNo=' + that.$route.query.orderNo
}
})
}
} else {
that.$toast(res.resultMessage)
}
})
} else {
let data = {
orderType: 'SIGN_ORDER',
orderDTO: {
orderInfoDTO: {
orderNo: that.$route.query.orderNo
},
ebizSignDTOS: [
{
signOrRead: 'sign',
signId: that.insuredSign.signId,
orderNo: that.$route.query.orderNo,
documentStatus: '3',
signType: that.signVal,
baseEncryp: that.base64,
caSignEnteringGinseng: this.caSignEnteringGinseng, //ca签名入参
caSignExoticGinseng: JSON.stringify(this.caSignExoticGinseng), //ca签名出参
documentType: that.insuredSign.documentType,
documentCode: that.insuredSign.documentCode
}
]
}
}
saveInformation(data).then(res => {
if (res.result == '0') {
this.$toast.clear()
window.localStorage.setItem('jumpFromSign', '1')
let url
if(this.isPersonalInformation != '-1'){
url= '/sale/PersonalInformation'
}else{
url= '/sale/signatureConfirmation'
}
if (this.isWeixin) {
localStorage.removeItem('signInfo')
this.$jump({
flag: 'h5',
extra: {
url: location.origin + '/#'+ url + '?orderNo=' + that.$route.query.orderNo,
pullRefresh: '1',
backToFirst: '1'
},
routerInfo: {
path:
url +'?orderNo=' +
this.$route.query.orderNo +
'&token=' +
localStorage.token +
'&saleInsuredInfo=' +
this.$CacheUtils.getLocItem('saleInsuredInfo') +
'&saleInsuredPersonInfo=' +
this.$CacheUtils.getLocItem('saleInsuredPersonInfo') +
'&relationToAppnt=' +
JSON.parse(this.$CacheUtils.getLocItem('saleInsuredPersonInfo')).relationToAppnt +
'&attachmentShow=' +
window.localStorage.getItem('attachmentShow') +
'&signInvalid=' +
sessionStorage.getItem('signInvalid') +
'&airSign=1'
}
})
} else {
this.$jump({
flag: 'h5',
extra: {
url: location.origin + '/#'+ url + '?orderNo=' + that.$route.query.orderNo,
pullRefresh: '1',
backToFirst: '1'
},
routerInfo: {
path: url + '?orderNo=' + that.$route.query.orderNo
}
})
}
} else {
that.$toast(res.resultMessage)
}
})
}
},
// 点击签名
sign(val) {
console.log(val, 'val值')
let that = this
this.$toast.loading({
duration: 0, // 持续展示 toast
forbidClick: true, // 禁用背景点击
loadingType: 'spinner',
message: '加载中……'
})
// 投保人
if (val == '0') {
// 投保人且不是回执签收
if (this.detailJump != '1') {
// 投保人不是回执签收且投被同人
if (this.relationToAppnt == '1') {
// 投保人不是回执签收且投被同人且在微信
if (this.isWeixin) {
this.toAirSign('0', '申请日期', this.caOffset, '4')
} else {
// 投保人不是回执签收且投被同人且不在微信
EWebBridge.webCallAppInJs('ca_sign', {
//身份证号码
number: this.saleInsuredInfo.idNo,
//姓名
name: this.saleInsuredInfo.name,
type: this.saleInsuredInfo.idType,
keyword: '申请日期',
pageNo: '1',
index: '1',
offset: this.caOffset,
pos: '3', //设置偏移量 3表示右侧
signatureWidth: this.$utils.signParams().signatureWidth,
signatureHeight: this.$utils.signParams().signatureHeight
}).then(data => {
let temp = JSON.parse(data)
let caSignEnteringGinseng = {
//身份证号码
number: this.saleInsuredInfo.idNo,
//姓名
name: this.saleInsuredInfo.name,
type: this.saleInsuredInfo.idType,
keyword: '申请日期',
pageNo: '1',
index: '1',
offset: this.caOffset,
pos: '3', //设置偏移量 3表示右侧
signatureWidth: this.$utils.signParams().signatureWidth,
signatureHeight: this.$utils.signParams().signatureHeight
}
this.caSignEnteringGinseng = JSON.stringify(caSignEnteringGinseng)
this.caSignExoticGinseng = temp
// console.log(`--签名返回val:${val},this.detailJump:${this.detailJump},this.relationToAppnt:${this.relationToAppnt},CA_state:${temp.state}`)
this.$toast.clear()
if (JSON.parse(data).state == '1') {
this.base64 = decodeURI(JSON.parse(data).sign)
this.appntSign.documentStatus = '3'
this.isDisabledComplite = false
this.isSubmit = false
this.isSign = false
}
})
}
} else {
// 微信投保人不是回执签收且投被不同人
if (this.isWeixin) {
this.toAirSign('0', '法定监护人', this.caOffset, '4')
} else {
// 不在微信投保人不是回执签收且投被不同人
console.log('投保人签名')
EWebBridge.webCallAppInJs('ca_sign', {
//身份证号码
number: this.saleInsuredInfo.idNo,
//姓名
name: this.saleInsuredInfo.name,
type: this.saleInsuredInfo.idType,
keyword: '被保险人或法定监护人签名',
pageNo: '1',
index: '1',
offset: '-250',
pos: '3',
signatureWidth: this.$utils.signParams().signatureWidth,
signatureHeight: this.$utils.signParams().signatureHeight
}).then(data => {
let temp = JSON.parse(data)
let caSignEnteringGinseng = {
//身份证号码
number: this.saleInsuredInfo.idNo,
//姓名
name: this.saleInsuredInfo.name,
type: this.saleInsuredInfo.idType,
keyword: '被保险人或法定监护人签名',
pageNo: '1',
index: '1',
offset: '-250',
pos: '3',
signatureWidth: this.$utils.signParams().signatureWidth,
signatureHeight: this.$utils.signParams().signatureHeight
}
this.caSignEnteringGinseng = JSON.stringify(caSignEnteringGinseng)
this.caSignExoticGinseng = temp
// console.log(`--签名返回val:${val},this.detailJump:${this.detailJump},this.relationToAppnt:${this.relationToAppnt}`, JSON.stringify(data))
this.$toast.clear()
if (JSON.parse(data).state == '1') {
this.base64 = decodeURI(JSON.parse(data).sign)
this.appntSign.documentStatus = '3'
this.isDisabledComplite = false
this.isSubmit = false
this.isSign = false
}
})
}
}
} else {
switch (that.saleInsuredInfo.idType) {
case '居民身份证':
that.saleInsuredInfo.idType = '1'
break
case '户口本':
that.saleInsuredInfo.idType = '2'
break
case '出生证':
that.saleInsuredInfo.idType = '3'
break
case '外国人护照':
that.saleInsuredInfo.idType = '4'
break
case '港澳居民来往内地通行证':
that.saleInsuredInfo.idType = '5'
break
case '台湾居民来往大陆通行证':
that.saleInsuredInfo.idType = '6'
break
// case '其他':
// that.saleInsuredInfo.idType = '7'
// break
case '外国人永久居留身份证':
that.saleInsuredInfo.idType = '8'
break
case '港澳台居民居住证':
that.saleInsuredInfo.idType = '9'
break
}
// 微信投保人且是回执签收
if (this.isWeixin) {
this.toAirSign('0', '投保人签字', '0', '4')
} else {
// 不是微信投保人且是回执签收
EWebBridge.webCallAppInJs('ca_sign', {
//身份证号码
number: that.saleInsuredInfo.idNo,
//姓名
name: that.saleInsuredInfo.name,
type: that.saleInsuredInfo.idType,
keyword: '投保人签字',
pageNo: '1',
index: '1',
offset: '20',
pos: '3',
signatureWidth: this.$utils.signParams().signatureWidth,
signatureHeight: this.$utils.signParams().signatureHeight
}).then(data => {
let temp = JSON.parse(data)
let caSignEnteringGinseng = {
//身份证号码
number: that.saleInsuredInfo.idNo,
//姓名
name: that.saleInsuredInfo.name,
type: that.saleInsuredInfo.idType,
keyword: '投保人签字',
pageNo: '1',
index: '1',
offset: '20',
pos: '3',
signatureWidth: this.$utils.signParams().signatureWidth,
signatureHeight: this.$utils.signParams().signatureHeight
}
this.caSignEnteringGinseng = JSON.stringify(caSignEnteringGinseng)
this.caSignExoticGinseng = temp
// console.log(`--签名返回val:${val},this.detailJump:${this.detailJump},this.relationToAppnt:${this.relationToAppnt}`, JSON.stringify(data))
this.$toast.clear()
if (JSON.parse(data).state == '1') {
that.base64 = decodeURI(JSON.parse(data).sign)
that.appntSign.documentStatus = '3'
that.isDisabledComplite = false
that.isSubmit = false
that.isSign = false
}
})
}
}
} else {
// 在微信被保险人
if (this.isWeixin) {
this.toAirSign('1', '法定监护人', '10', '4')
} else {
// 不在微信被保险人
console.log('被保险人签名')
EWebBridge.webCallAppInJs('ca_sign', {
//身份证号码
number: that.saleInsuredPersonInfo.idNo,
//姓名
name: that.saleInsuredPersonInfo.name,
type: that.saleInsuredPersonInfo.idType,
keyword: '被保险人或法定监护人签名',
pageNo: '1',
index: '1',
offset: '50',
pos: '3',
signatureWidth: this.$utils.signParams().signatureWidth,
signatureHeight: this.$utils.signParams().signatureHeight
}).then(data => {
let temp = JSON.parse(data)
let caSignEnteringGinseng = {
//身份证号码
number: that.saleInsuredPersonInfo.idNo,
//姓名
name: that.saleInsuredPersonInfo.name,
type: that.saleInsuredPersonInfo.idType,
keyword: '被保险人或法定监护人签名',
pageNo: '1',
index: '1',
offset: '50',
pos: '3',
signatureWidth: this.$utils.signParams().signatureWidth,
signatureHeight: this.$utils.signParams().signatureHeight
}
this.caSignEnteringGinseng = JSON.stringify(caSignEnteringGinseng)
this.caSignExoticGinseng = temp
// console.log(`--签名返回val:${val},this.detailJump:${this.detailJump},this.relationToAppnt:${this.relationToAppnt}`, JSON.stringify(data))
this.$toast.clear()
if (JSON.parse(data).state == '1') {
that.base64 = decodeURI(JSON.parse(data).sign)
that.insuredSign.documentStatus = '3'
that.isDisabledComplite = false
}
})
}
}
},
toAirSign(status, keyword, offset, originStatus) {
localStorage.setItem(
'signInfo',
JSON.stringify({
originStatus: originStatus,
idNo: this.saleInsuredInfo.idNo,
name: this.saleInsuredInfo.name,
type: this.saleInsuredInfo.idType,
keyword: keyword,
status: status,
offset: offset,
originUrl: location.href
})
)
window.location.href = this.$mainUrl + '/sign/index.html'
},
// 抄录
chaolu() {
// 再微信
if (this.isWeixin) {
// 在微信且投被不同人
if (this.relationToAppnt != '1') {
localStorage.setItem(
'signInfo',
JSON.stringify({
idNo: this.saleInsuredInfo.idNo,
name: this.saleInsuredInfo.name,
type: this.saleInsuredInfo.idType,
originStatus: '4',
keyword: '投保人签名',
status: '0',
offset: '10',
originUrl: location.href,
commentKeyword: '认真', // 批注关键字
commentText: '本人已阅读保险条款、产品说明书和投保提示书,了解本产品的特点和保单利益的不确定性', // 批注文字
commentOffset: '30', // 批注偏移量
commentPos: '2', // 签字图片和关键字位置关系等于1时签字图片和关键字矩形重心重合
// * 等于2时签字图片位于关键字正下方中心线对齐等于3时签字图片位于关键字正右方中心线对齐
// * 等于4时签字图片左上角和关键字右下角重合可能额外附加偏移量详见构造函数的offset参数
caType: '1', // 是否是批注
pageNo: '1', // PDF起始页
KWIndex: '1' // 第几个关键字
})
)
window.location.href = this.$mainUrl + '/chaolu/index.html'
} else {
// 在微信且投被同人
localStorage.setItem(
'signInfo',
JSON.stringify({
idNo: this.saleInsuredInfo.idNo,
name: this.saleInsuredInfo.name,
type: this.saleInsuredInfo.idType,
originStatus: '4',
keyword: '申请日期',
status: '0',
offset: '-140',
originUrl: location.href,
commentKeyword: '认真', // 批注关键字
commentText: '本人已阅读保险条款、产品说明书和投保提示书,了解本产品的特点和保单利益的不确定性', // 批注文字
commentOffset: '30', // 批注偏移量
commentPos: '2', // 签字图片和关键字位置关系等于1时签字图片和关键字矩形重心重合
// * 等于2时签字图片位于关键字正下方中心线对齐等于3时签字图片位于关键字正右方中心线对齐
// * 等于4时签字图片左上角和关键字右下角重合可能额外附加偏移量详见构造函数的offset参数
caType: '1', // 是否是批注
pageNo: '1', // PDF起始页
KWIndex: '1' // 第几个关键字
})
)
window.location.href = this.$mainUrl + '/chaolu/index.html'
}
} else {
// 不在微信且投被不同人
if (this.relationToAppnt != '1') {
EWebBridge.webCallAppInJs('ca_sign', {
//身份证号码
number: this.saleInsuredInfo.idNo,
//姓名
name: this.saleInsuredInfo.name,
type: this.saleInsuredInfo.idType,
keyword: '投保人签名',
pageNo: '1',
index: '1',
offset: '10',
pos: '3', //设置偏移量 3表示右侧
commentKeyword: '认真',
commentText: '本人已阅读保险条款、产品说明书和投保提示书,了解本产品的特点和保单利益的不确定性',
commentOffset: '28',
commentPos: '2',
caType: '1',
signatureWidth: this.$utils.signParams().signatureWidth,
signatureHeight: this.$utils.signParams().signatureHeight
}).then(data => {
let temp = JSON.parse(data)
let caSignEnteringGinseng = {
//身份证号码
number: this.saleInsuredInfo.idNo,
//姓名
name: this.saleInsuredInfo.name,
type: this.saleInsuredInfo.idType,
keyword: '投保人签名',
pageNo: '1',
index: '1',
offset: '10',
pos: '3', //设置偏移量 3表示右侧
commentKeyword: '认真',
commentText: '本人已阅读保险条款、产品说明书和投保提示书,了解本产品的特点和保单利益的不确定性',
commentOffset: '28',
commentPos: '2',
caType: '1',
signatureWidth: this.$utils.signParams().signatureWidth,
signatureHeight: this.$utils.signParams().signatureHeight
}
this.caSignEnteringGinseng = JSON.stringify(caSignEnteringGinseng)
this.caSignExoticGinseng = temp
// console.log(`--签名返回val:${val},this.detailJump:${this.detailJump},this.relationToAppnt:${this.relationToAppnt},CA_state:${temp.state}`)
this.$toast.clear()
if (JSON.parse(data).state == '1') {
this.base64 = decodeURI(JSON.parse(data).sign)
this.appntSign.documentStatus = '3'
this.isDisabledComplite = false
this.isSubmit = false
this.isSign = false
}
})
} else {
// 不在微信且投被同人
EWebBridge.webCallAppInJs('ca_sign', {
//身份证号码
number: this.saleInsuredInfo.idNo,
//姓名
name: this.saleInsuredInfo.name,
type: this.saleInsuredInfo.idType,
keyword: '申请日期',
pageNo: '1',
index: '1',
offset: this.caOffset,
pos: '3', //设置偏移量 3表示右侧
commentKeyword: '认真',
commentText: '本人已阅读保险条款、产品说明书和投保提示书,了解本产品的特点和保单利益的不确定性',
commentOffset: '28',
commentPos: '2',
caType: '1',
signatureWidth: this.$utils.signParams().signatureWidth,
signatureHeight: this.$utils.signParams().signatureHeight
}).then(data => {
let temp = JSON.parse(data)
let caSignEnteringGinseng = {
//身份证号码
number: this.saleInsuredInfo.idNo,
//姓名
name: this.saleInsuredInfo.name,
type: this.saleInsuredInfo.idType,
keyword: '申请日期',
pageNo: '1',
index: '1',
offset: this.caOffset,
pos: '3', //设置偏移量 3表示右侧
commentKeyword: '认真',
commentText: '本人已阅读保险条款、产品说明书和投保提示书,了解本产品的特点和保单利益的不确定性',
commentOffset: '28',
commentPos: '2',
caType: '1',
signatureWidth: this.$utils.signParams().signatureWidth,
signatureHeight: this.$utils.signParams().signatureHeight
}
this.caSignEnteringGinseng = JSON.stringify(caSignEnteringGinseng)
this.caSignExoticGinseng = temp
// console.log(`--签名返回val:${val},this.detailJump:${this.detailJump},this.relationToAppnt:${this.relationToAppnt},CA_state:${temp.state}`)
this.$toast.clear()
if (JSON.parse(data).state == '1') {
this.base64 = decodeURI(JSON.parse(data).sign)
this.appntSign.documentStatus = '3'
this.isDisabledComplite = false
this.isSubmit = false
this.isSign = false
}
})
}
}
}
},
created() {
},
computed: {
listenChange() {
const { isOver, radio, appntSign, insuredSign, radioSure } = this
return { isOver, radio, appntSign, insuredSign, radioSure }
}
},
watch: {
listenChange(val) {
let that = this
if (!that.isWeixin) {
if (that.signVal == '0' || that.signVal == '2') {
if (val.isOver == true && val.radio != '' && val.appntSign.documentStatus !== '3') {
that.isDisable = false
} else {
that.isDisable = true
}
} else {
if (val.isOver == true && val.radio != '' && val.insuredSign.documentStatus !== '3') {
that.isDisableInsured = false
} else {
that.isDisableInsured = true
}
}
if (val.appntSign.documentStatus == '3' && val.insuredSign.documentStatus == '3') {
that.isDisabledComplite = false
} else {
that.isDisabledComplite = true
}
if (val.appntSign.documentStatus == '3') {
that.isDisable = true
}
if (val.insuredSign.documentStatus == '3') {
that.isDisableInsured = true
}
if (val.radioSure != '') {
this.isSure = false
}
} else {
if (that.signVal == '0' || that.signVal == '2') {
if (val.isOver == true && val.radio != '') {
that.isDisable = false
} else {
that.isDisable = true
}
} else {
if (val.isOver == true && val.radio != '') {
that.isDisableInsured = false
} else {
that.isDisableInsured = true
}
}
if (val.radioSure != '') {
this.isSure = false
}
}
}
},
async mounted() {
document.body.style.backgroundColor = '#fff'
let data = {
orderNo: this.$route.query.orderNo
}
getOrderDetail(data).then(res => {
if (res.result == '0') {
let array = []
res.orderDTO.ebizSignDTOS.map(item => {
array.push(item.documentCode)
})
this.isPersonalInformation = array.findIndex(item => item === '12')
}
})
if (!this.isWeixin) {
setTimeout(() => {
EWebBridge.webCallAppInJs('webview_left_button', {
img: this.$assetsUrl + 'images/del-close-btn@3x.png',
intercept: '1' //是否拦截原生返回事件 1是 其他否
})
}, 100)
window.appCallBack = this.appCallBack
}
let that = this
that.detailJump = window.localStorage.getItem('detailJump')
if (this.detailJump == '1') {
this.pdfUrl = encodeURIComponent(config.imgDomain + `/returnDirectStream?imgPath=${localStorage.getItem('insurance-policyUrl')}`)
}
that.signVal = window.localStorage.getItem('sign-val')
// 判断是不是万能险
let comment = window.localStorage.getItem('productCode')
if (comment == 'GFRS_M0003' || comment == 'GFRS_M0015' || comment == 'GFRS_M0017' || comment == 'GFRS_M0075' || comment == 'GFRS_M0080' || comment == 'GFRS_M0082' || comment == 'GFRS_M0083' || comment == 'GFRS_M0085') {
this.isComment = true
}
// 获取投保人信息
that.saleInsuredInfo = JSON.parse(this.$CacheUtils.getLocItem('saleInsuredInfo'))
// 在微信
if (this.isWeixin) {
// 在微信且不是回执签收
if (this.detailJump != '1') {
that.relationToAppnt = JSON.parse(this.$CacheUtils.getLocItem('saleInsuredPersonInfo')).relationToAppnt
let imgBase64Data = sessionStorage.getItem('imgBase64Data')
let wxSigned = sessionStorage.getItem('wxSigned')
let signInfo = JSON.parse(localStorage.getItem('signInfo'))
if (wxSigned) {
this.getOrderDetail().then(() => {
this.Time = true
this.isOver = true
this.radio = '1'
this.base64 = imgBase64Data
this.isDisabledComplite = false
if (signInfo.status == '0') {
this.$set(this.appntSign, 'documentStatus', '3')
this.isSign = false
this.isDisabledComplite = false
} else {
this.$set(this.insuredSign, 'documentStatus', '3')
this.isDisabledComplite = false
this.isSign = false
}
})
} else {
this.timeOut()
this.getOrderDetail()
}
} else {
// 在微信而且是回执签收
document.title = '保险合同签收回执电子确认书签名'
let imgBase64Data = sessionStorage.getItem('imgBase64Data')
let wxSigned = sessionStorage.getItem('wxSigned')
let signInfo = JSON.parse(localStorage.getItem('signInfo'))
if (wxSigned) {
this.Time = true
this.isOver = true
this.radioSure = '1'
this.base64 = imgBase64Data
this.isDisabledComplite = false
if (signInfo.status == '0') {
this.$set(this.appntSign, 'documentStatus', '3')
this.isSign = false
this.isDisabledComplite = false
this.isSubmit = false
} else {
this.$set(this.insuredSign, 'documentStatus', '3')
this.isDisabledComplite = false
this.isSign = false
}
}
}
} else {
// 不在微信且不是回执签收
if (this.detailJump != '1') {
// 投被保险人是否同人
that.relationToAppnt = JSON.parse(this.$CacheUtils.getLocItem('saleInsuredPersonInfo')).relationToAppnt
// 获取被保险人信息
that.saleInsuredPersonInfo = JSON.parse(this.$CacheUtils.getLocItem('saleInsuredPersonInfo'))
this.timeOut()
this.getOrderDetail()
} else {
// 不在微信但是在回执签收
document.title = '保险合同签收回执电子确认书签名'
}
}
},
beforeRouteLeave(to, from, next) {
document.body.style.backgroundColor = ''
next()
}
}
</script>
<style lang="scss" scoped>
img {
width: 100%;
height: 100%;
}
.notice {
width: 100%;
position: fixed;
top: 0;
z-index: 20;
}
.iframe {
width: 100vw;
height: 70vh;
}
</style>