mirror of
http://112.124.100.131/GFRS/ebiz-h5.git
synced 2025-12-16 12:16:44 +08:00
553 lines
18 KiB
Vue
553 lines
18 KiB
Vue
<template>
|
||
<div class="insuranceInformation-container pb50 redRadioCheckbox">
|
||
<van-notice-bar :scrollable="false" v-if="!Time" class="notice">{{ `提示:阅读时长需在${this.Time ? this.time : this.number}秒以上` }}</van-notice-bar>
|
||
<iframe :src="src + appntSign.policyUrl" class="iframe"></iframe>
|
||
<van-radio-group v-model="radio" class="pb10 pt20 pl30 fs14">
|
||
<van-radio name="1" @click="click">
|
||
本人确认已阅读
|
||
<span>《{{ riskName }}产品说明书》</span>
|
||
</van-radio>
|
||
</van-radio-group>
|
||
<div class="pt10 pb10 pl30 flex align-items-c">
|
||
<span class="mr10">投保人签名 :</span>
|
||
<div v-if="signVal == '0' || signVal == '2'">
|
||
<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 class="bg-white bottom-btn">
|
||
<van-button type="danger" size="large" :disabled="isDisabledComplite" @click="goNext" v-no-more-click="1000">下一步</van-button>
|
||
</div>
|
||
</div>
|
||
</template>
|
||
<script>
|
||
import { RadioGroup, Radio, Dialog, NoticeBar } from 'vant'
|
||
import { saveInformation, getOrderDetail1 } from '@/api/ebiz/sale/sale'
|
||
import { openLoading, closeLoading } from '@/assets/js/utils/toastLoading.js'
|
||
import config from '@/config'
|
||
// import axios from 'axios'
|
||
export default {
|
||
data() {
|
||
let isWeixin = this.$utils.device().isWeixin //判断环境
|
||
return {
|
||
// 投保人还是被保险人信息
|
||
signVal: '',
|
||
// 投保人签名信息
|
||
appntSign: {},
|
||
radio: '',
|
||
// 倒计时时间
|
||
number: '',
|
||
// 定时器时间
|
||
time: '10',
|
||
// 定时器名称
|
||
timer: null,
|
||
isOver: false,
|
||
// 判断验证码是否开始倒计时
|
||
Time: true,
|
||
// 按钮是否可以点击
|
||
isDisable: true,
|
||
// 是否在微信
|
||
isWeixin,
|
||
// 是否签名了 回执流程
|
||
isSign: true,
|
||
// sign加密码
|
||
base64: '',
|
||
// 是否可以点击
|
||
isDisabledComplite: true,
|
||
// local带来的被保险人信息
|
||
saleInsuredPersonInfo: {},
|
||
// local带来的投保人信息
|
||
saleInsuredInfo: {},
|
||
// 是否从详情跳过来 如果为1 是
|
||
detailJump: '',
|
||
src: location.origin + '/pdfjs/web/viewer.html?file=',
|
||
//保险产品名称
|
||
riskName: localStorage.riskName
|
||
}
|
||
},
|
||
components: {
|
||
[RadioGroup.name]: RadioGroup,
|
||
[Radio.name]: Radio,
|
||
[Dialog.name]: Dialog,
|
||
[NoticeBar.name]: NoticeBar
|
||
},
|
||
mounted() {
|
||
let that = this
|
||
|
||
document.body.style.backgroundColor = '#fff'
|
||
setTimeout(function() {
|
||
closeLoading()
|
||
that.timeOut()
|
||
}, 5000)
|
||
},
|
||
async created() {
|
||
let that = this
|
||
|
||
that.detailJump = window.localStorage.getItem('detailJump')
|
||
that.signVal = window.localStorage.getItem('sign-val')
|
||
|
||
// 获取投保人信息
|
||
that.saleInsuredInfo = JSON.parse(window.localStorage.getItem('saleInsuredInfo'))
|
||
if (this.isWeixin) {
|
||
that.relationToAppnt = JSON.parse(window.localStorage.getItem('saleInsuredPersonInfo')).relationToAppnt
|
||
}
|
||
|
||
if (this.detailJump != '1') {
|
||
// 投被保险人是否同人
|
||
that.relationToAppnt = JSON.parse(window.localStorage.getItem('saleInsuredPersonInfo')).relationToAppnt
|
||
// 获取被保险人信息
|
||
that.saleInsuredPersonInfo = JSON.parse(window.localStorage.getItem('saleInsuredPersonInfo'))
|
||
}
|
||
// if (this.detailJump != '1') {
|
||
// this.getOrderDetail()
|
||
// }
|
||
|
||
if (this.isWeixin) {
|
||
let imgBase64Data = sessionStorage.getItem('oneimgBase64Data')
|
||
let wxSigned = sessionStorage.getItem('onewxSigned')
|
||
let signInfo = JSON.parse(localStorage.getItem('signInfo'))
|
||
console.log('`````````````````````````````````')
|
||
|
||
console.log('imgBase64Data: oneimgBase64Data:' + imgBase64Data)
|
||
console.log('wxSigned: ' + wxSigned)
|
||
if (wxSigned) {
|
||
console.log('第二次进入电子保单')
|
||
console.log('````````````````````````````````')
|
||
this.getOrderDetail().then(() => {
|
||
this.Time = true
|
||
this.isOver = true
|
||
this.radio = '1'
|
||
this.base64 = imgBase64Data
|
||
this.isDisabledComplite = false
|
||
console.log('signInfo.status:' + signInfo.status)
|
||
if (signInfo.status == '0') {
|
||
// this.appntSign.documentStatus = '3'
|
||
console.log('``````````````````')
|
||
this.$set(this.appntSign, 'documentStatus', '3')
|
||
console.log('appntSign.documentStatus: ' + this.appntSign.documentStatus)
|
||
this.isSign = false
|
||
this.isDisabledComplite = false
|
||
// this.isDisable = false
|
||
} else {
|
||
this.$set(this.insuredSign, 'documentStatus', '3')
|
||
// this.insuredSign.documentStatus = '3'
|
||
this.isDisabledComplite = false
|
||
this.isSign = false
|
||
}
|
||
})
|
||
} else {
|
||
console.log('````````````````````````')
|
||
console.log('第一次进入电子保单')
|
||
setTimeout(function() {
|
||
closeLoading()
|
||
this.timeOut()
|
||
}, 5000)
|
||
|
||
this.getOrderDetail()
|
||
}
|
||
} else {
|
||
this.timeOut()
|
||
if (this.detailJump != '1') {
|
||
this.getOrderDetail()
|
||
}
|
||
}
|
||
},
|
||
methods: {
|
||
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() {
|
||
openLoading()
|
||
let that = this
|
||
let data = {
|
||
orderNo: window.localStorage.getItem('orderNo')
|
||
}
|
||
return new Promise((resolve, reject) => {
|
||
getOrderDetail1(data).then(res => {
|
||
if (res.result == '0') {
|
||
res.orderDTO.ebizSignDTOS.map(item => {
|
||
if (item.signType == '0' || item.signType == '2') {
|
||
if (item.documentCode == '3') {
|
||
that.appntSign = item
|
||
console.log('that.appntSign', that.appntSign)
|
||
}
|
||
}
|
||
})
|
||
that.appntSign.policyUrl = encodeURIComponent(config.imgDomain + `/returnDirectStream?imgPath=${that.appntSign.policyUrl}`)
|
||
if (that.isWeixin) {
|
||
if (res.orderDTO.ebizSignDTOS.length > 1) {
|
||
if (that.appntSign.documentStatus == '3') {
|
||
that.isDisabledComplite = false
|
||
}
|
||
}
|
||
}
|
||
resolve('success')
|
||
}
|
||
})
|
||
})
|
||
},
|
||
// 点击阅读时
|
||
click() {
|
||
let that = this
|
||
if (that.isOver == false) {
|
||
Dialog.confirm({
|
||
title: '提示',
|
||
message: '该内容涉及您的重大权益,请您仔细阅读',
|
||
showCancelButton: false
|
||
}).then(() => {
|
||
that.radio = ''
|
||
})
|
||
}
|
||
},
|
||
// 点击签名
|
||
sign(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', '投保人签名', '5', '1')
|
||
} else {
|
||
EWebBridge.webCallAppInJs('ca_sign', {
|
||
//身份证号码
|
||
number: this.saleInsuredInfo.idNo,
|
||
//姓名
|
||
name: this.saleInsuredInfo.name,
|
||
type: this.saleInsuredInfo.idType,
|
||
keyword: '投保人签名',
|
||
pageNo: '1',
|
||
index: '1',
|
||
offset: '5',
|
||
pos: '3',
|
||
signatureWidth: this.$utils.signParams().signatureWidth,
|
||
signatureHeight: this.$utils.signParams().signatureHeight
|
||
}).then(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.isSign = false
|
||
}
|
||
})
|
||
}
|
||
} else {
|
||
if (this.isWeixin) {
|
||
this.toAirSign('0', '投保人签名', '5', '1')
|
||
} else {
|
||
EWebBridge.webCallAppInJs('ca_sign', {
|
||
//身份证号码
|
||
number: this.saleInsuredInfo.idNo,
|
||
//姓名
|
||
name: this.saleInsuredInfo.name,
|
||
type: this.saleInsuredInfo.idType,
|
||
keyword: '投保人签名',
|
||
pageNo: '1',
|
||
index: '1',
|
||
offset: '5',
|
||
pos: '3',
|
||
signatureWidth: this.$utils.signParams().signatureWidth,
|
||
signatureHeight: this.$utils.signParams().signatureHeight
|
||
}).then(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.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', '投保人签名', '5', '1')
|
||
} else {
|
||
EWebBridge.webCallAppInJs('ca_sign', {
|
||
//身份证号码
|
||
number: that.saleInsuredInfo.idNo,
|
||
//姓名
|
||
name: that.saleInsuredInfo.name,
|
||
type: that.saleInsuredInfo.idType,
|
||
keyword: '投保人签名',
|
||
pageNo: '1',
|
||
index: '1',
|
||
offset: '5',
|
||
pos: '3',
|
||
signatureWidth: this.$utils.signParams().signatureWidth,
|
||
signatureHeight: this.$utils.signParams().signatureHeight
|
||
}).then(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.isSign = false
|
||
}
|
||
})
|
||
}
|
||
}
|
||
}
|
||
},
|
||
// toAirSign(status, keyword, offset) {
|
||
// localStorage.setItem(
|
||
// 'signInfo',
|
||
// JSON.stringify({
|
||
// 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'
|
||
// },
|
||
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'
|
||
},
|
||
// 下一步
|
||
goNext() {
|
||
if (this.isWeixin) {
|
||
console.log('````````````````````')
|
||
console.log('进入微信')
|
||
this.$toast.loading({
|
||
duration: 0, // 持续展示 toast
|
||
|
||
forbidClick: true, // 禁用背景点击
|
||
|
||
loadingType: 'spinner',
|
||
|
||
message: '加载中……'
|
||
})
|
||
let that = this
|
||
if (that.signVal == '0' || that.signVal == '2') {
|
||
let data = {
|
||
orderType: 'SIGN_ORDER',
|
||
orderDTO: {
|
||
orderInfoDTO: {
|
||
orderNo: window.localStorage.getItem('orderNo')
|
||
},
|
||
ebizSignDTOS: [
|
||
{
|
||
signOrRead: 'sms',
|
||
signId: that.appntSign.signId,
|
||
orderNo: window.localStorage.getItem('orderNo'),
|
||
documentCode: that.appntSign.documentCode,
|
||
documentStatus: '3',
|
||
signType: that.appntSign.signType,
|
||
documentType: that.appntSign.documentType,
|
||
baseEncryp: that.base64,
|
||
policyUrl: that.appntSign.policyUrl
|
||
}
|
||
]
|
||
}
|
||
}
|
||
saveInformation(data).then(res => {
|
||
if (res.result == '0') {
|
||
this.$toast.clear()
|
||
window.localStorage.setItem('detailJump', '')
|
||
window.sessionStorage.onewxSigned = false
|
||
// window.sessionStorage.oneimgBase64Data = ''
|
||
this.$jump({
|
||
flag: 'h5',
|
||
extra: {
|
||
url: location.origin + '/#/sale/InsuranceTip'
|
||
},
|
||
routerInfo: {
|
||
path: '/sale/InsuranceTip'
|
||
}
|
||
})
|
||
} else {
|
||
that.$toast(res.resultMessage)
|
||
}
|
||
})
|
||
}
|
||
} else {
|
||
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: window.localStorage.getItem('orderNo')
|
||
},
|
||
ebizSignDTOS: [
|
||
{
|
||
signOrRead: 'sms',
|
||
signId: that.appntSign.signId,
|
||
orderNo: window.localStorage.getItem('orderNo'),
|
||
documentCode: that.appntSign.documentCode,
|
||
documentStatus: '3',
|
||
signType: that.appntSign.signType,
|
||
documentType: that.appntSign.documentType,
|
||
baseEncryp: that.base64,
|
||
policyUrl: that.appntSign.policyUrl
|
||
}
|
||
]
|
||
}
|
||
}
|
||
saveInformation(data).then(res => {
|
||
if (res.result == '0') {
|
||
this.$toast.clear()
|
||
window.localStorage.setItem('detailJump', '')
|
||
window.sessionStorage.onewxSigned = false
|
||
// window.sessionStorage.oneimgBase64Data = ''
|
||
this.$jump({
|
||
flag: 'h5',
|
||
extra: {
|
||
url: location.origin + '/#/sale/InsuranceTip',
|
||
forbidSwipeBack: '1'
|
||
},
|
||
routerInfo: {
|
||
path: '/sale/InsuranceTip'
|
||
}
|
||
})
|
||
} else {
|
||
that.$toast(res.resultMessage)
|
||
}
|
||
})
|
||
}
|
||
}
|
||
}
|
||
},
|
||
computed: {
|
||
listenChange() {
|
||
const { isOver, radio, appntSign } = this
|
||
return { isOver, radio, appntSign }
|
||
}
|
||
},
|
||
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
|
||
}
|
||
|
||
if (that.radio == '1' && val.appntSign.documentStatus == '3') {
|
||
that.isDisabledComplite = false
|
||
} else {
|
||
that.isDisabledComplite = true
|
||
}
|
||
}
|
||
if (val.appntSign.documentStatus == '3') {
|
||
that.isDisable = true
|
||
}
|
||
} else {
|
||
if (that.signVal == '0' || that.signVal == '2') {
|
||
if (val.isOver == true && val.radio != '') {
|
||
that.isDisable = false
|
||
} else {
|
||
that.isDisable = true
|
||
}
|
||
if (that.radio == '1' && val.appntSign.documentStatus == '3') {
|
||
that.isDisabledComplite = false
|
||
} else {
|
||
that.isDisabledComplite = true
|
||
}
|
||
}
|
||
}
|
||
}
|
||
},
|
||
|
||
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>
|