feat(ebiz/saleFlowProImprove): 优化受益人信息添加功能

- 重构身份证扫描组件动态加载逻辑
- 统一照片扫描组件处理流程
- 修复受益人数据更新方法命名错误
- 调整受益人唯一标识字段bid替代id
- 完善组件销毁前任务清理机制
- 优化证件类型判断与图片上传验证
- 移除冗余的本地存储操作
- 规范代码结构与导入顺序
This commit is contained in:
hz
2025-11-26 16:36:03 +08:00
parent 6f788edd0f
commit 5d8aa02db8
6 changed files with 213 additions and 583 deletions

View File

@@ -1,8 +1,10 @@
<template>
<div class="add-beneficiary-container redRadioCheckbox">
<!-- 身份证扫描 -->
<IdentityCardScan :options="{ showIDInfo: false }" @getScanInfo="$emit('scaned', $event)" />
<!-- <IdentityCardScan :role="user.beneficiary" :subTask="`${subTask}-uploadPhoto`" :user-info="beneficiary" @getScanInfo="$emit('scaned', $event)" />-->
<template v-if="uploadComponentInfo">
<Component :is="uploadComponentInfo.component" v-bind="uploadComponentInfo.props" v-on="uploadComponentInfo.event" />
</template>
<!-- 基本信息 -->
<van-cell-group>
<van-field
@@ -365,9 +367,7 @@ export default {
props: ['beneficiary', 'task', 'disableSyncApplicant'],
inject: ['nextStepProcesserContainer'],
computed: {
user() {
return user
},
user: () => user,
applicant: () => applicant,
relationToAppnt: {
get() {
@@ -381,6 +381,24 @@ export default {
set(value) {
this.userInfo.relationToInsured = value
}
},
uploadComponentInfo() {
const idType = this.userInfo.idType
const subTask = `${this.subTask}-uploadPhoto`
const IdentityCardScan = {
component: 'IdentityCardScan',
props: { subTask, role: user.beneficiary, userInfo: this.beneficiary },
event: { getScanInfo: event => this.$emit('scaned', event) }
}
if (this.idImage) IdentityCardScan.props.idImage = this.idImage
const PhotoScan = {
component: () => import('./components/PhotoScanner.vue'),
props: { userInfo: this.beneficiary, role: user.beneficiary, subTask },
event: { getScanInfo: event => this.$emit('scaned', event) }
}
return !idType ? IdentityCardScan : Number(idType) === 1 ? IdentityCardScan : PhotoScan
}
},
mounted() {
@@ -390,7 +408,7 @@ export default {
this.branchType = window.localStorage.getItem('branchType')
}
this.updateDate()
this.updateData()
this.registerSubTask()
},
destroyed() {
@@ -407,7 +425,7 @@ export default {
this.$emit('taskRemove', this.subTask)
this.nextStepProcesserContainer.removeTask(this.subTask)
},
updateDate() {
updateData() {
const { marriage } = DataDictionary
const marriageStatus = marriage.find(item => Number(item.id) === Number(this.beneficiary.marriage))
// 合并参数
@@ -1219,7 +1237,7 @@ export default {
if (res.result == '0') {
beneficiaries.push(this.userInfo)
// 保存 新增的受益人信息 以及页面跳转字段
localStorage.beneficiaryInfo = JSON.stringify(beneficiaries)
// localStorage.beneficiaryInfo = JSON.stringify(beneficiaries)
localStorage.fromAddBeneficiaryInfo = true
if (this.userInfo.asAppntAddress == true) {
localStorage.applicant = '1'

View File

@@ -24,7 +24,7 @@
ref="beneficiaryRef"
:beneficiary.sync="beneficiary"
:disableSyncApplicant="index < 1"
:task="`saveBeneficiary_saveOtherBeneficiary-${generateRandomId()}`"
:task="`saveBeneficiary-${beneficiary.bid}`"
@scaned="getIdentityInfo($event, index)"
@syncBeneficiary="handleSyncBeneficiary($event, index)"
@taskAdd="task => preTasks.push(task)"
@@ -38,9 +38,9 @@
</template>
<script>
import { RadioGroup, Radio, Icon, Dialog } from 'vant'
import { Dialog, Icon, Radio, RadioGroup } from 'vant'
import dataDictionary from '@/assets/js/utils/data-dictionary'
import { saveOrUpdateOrderInfo, getOrderDetail } from '@/api/ebiz/sale/sale'
import { getOrderDetail, saveOrUpdateOrderInfo } from '@/api/ebiz/sale/sale'
import IndexBar from '@/components/ebiz/sale/IndexBar'
import { beneficiaryType } from '@/views/ebiz/saleFlowProImprove/js/enum'
import { beneficiaries } from '@/views/ebiz/saleFlowProImprove/js/state'
@@ -152,7 +152,7 @@ export default {
} else {
;[beneficiary.certificateValidate, beneficiary.certiexpiredate] = [formatDate(startDate), formatDate(endDate)]
}
el.updateDate()
el.updateData()
function formatDate(date) {
if (!date) return
@@ -185,7 +185,7 @@ export default {
insuredDTOs: [
{
insuredId: JSON.parse(this.$CacheUtils.getLocItem('saleInsuredPersonInfo')).insuredId,
bnfDTOs: this.type === beneficiaryType.legalPerson ? [] : this.beneficiaries.map(beneficiary => delete beneficiary.id)
bnfDTOs: this.type === beneficiaryType.legalPerson ? [] : this.beneficiaries.map(beneficiary => delete beneficiary.bid)
}
],
paymentDTO: {},
@@ -217,7 +217,7 @@ export default {
if (!validateBnfLot(this.beneficiaries)) return
this.beneficiaries.push({
id: (Math.random() * 100).toFixed().toString(16) + Date.now(),
bid: this.generateRandomId(),
relationToInsured: ''
})
@@ -287,7 +287,8 @@ export default {
async () => {
return await this.nextStep()
},
this.preTasks
this.preTasks,
this.postTasks
)
},
/**
@@ -308,8 +309,11 @@ export default {
}
},
computed: {
beneficiaryType() {
return beneficiaryType
beneficiaryType: () => beneficiaryType,
postTasks() {
return this.beneficiaries.map(beneficiary => {
return `saveBeneficiary-${beneficiary.bid}-uploadPhoto`
})
}
},
inject: ['nextStepProcesserContainer'],

View File

@@ -1969,14 +1969,14 @@ export default {
const subTask = 'saveApplicant_uploadImage'
const IdentityCardScan = {
component: 'IdentityCardScan',
props: { options: { showIDInfo: false }, subTask, role: user.applicant },
props: { subTask, role: user.applicant },
event: { getScanInfo: this.getIdentityInfo }
}
if (this.idImage) IdentityCardScan.props.idImage = this.idImage
const PhotoScan = {
component: PhotoScanner,
props: { type: 'HouseholdRegister', role: user.applicant, subTask },
props: { role: user.applicant, subTask },
event: { getScanInfo: this.getIdentityInfo }
}

View File

@@ -2108,13 +2108,13 @@ export default {
},
computed: {
isReadonly() {
// return this.isAppnt && this.source !== 'trial'
return this.isAppnt
},
isShowOthenSalarySource() {
if (this.userInfo.salarySource == '4') {
if (String(this.userInfo.salarySource) === '4') {
return true
} else {
// eslint-disable-next-line vue/no-side-effects-in-computed-properties
this.userInfo.otherSalarySource = ''
return false
}
@@ -2126,7 +2126,7 @@ export default {
}
return ''
},
set(value) {
set() {
// 当需要设置 homeName 时,可以在这里处理
// 但由于 homeName 是由省市区代码计算得出的,通常不需要 setter
// 保留空的 setter 以避免错误
@@ -2138,13 +2138,13 @@ export default {
const subTask = 'saveInsured_uploadImage'
const IdentityCardScan = {
component: 'IdentityCardScan',
props: { options: { showIDInfo: false }, subTask, role: user.insured },
props: { subTask, role: user.insured },
event: { getScanInfo: this.getIdentityInfo }
}
if (this.idImage) IdentityCardScan.props.idImage = this.idImage
const PhotoScan = {
component: PhotoScanner,
props: { type: 'HouseholdRegister', role: user.insured, subTask },
props: { role: user.insured, subTask },
event: { getScanInfo: this.getIdentityInfo }
}

View File

@@ -29,7 +29,7 @@
<script>
import { Row, Col } from 'vant'
import { saveInformation } from '@/api/ebiz/sale/sale'
import { getOrderDetail, saveInformation } from '@/api/ebiz/sale/sale'
import { applicant, insured } from '@/views/ebiz/saleFlowProImprove/js/state'
import { imageType, user } from '@/views/ebiz/saleFlowProImprove/js/enum'
@@ -54,11 +54,12 @@ export default {
},
options: {
default: () => ({
showIDInfo: true
showIDInfo: false
})
},
subTask: { type: String, default: '' },
role: { type: String, default: user.applicant },
userInfo: { type: Object, default: () => ({}) },
// 上级组件传过来的图片
idImage: {
type: Object,
@@ -101,6 +102,7 @@ export default {
},
computed: {
user: () => user,
// 信息显示列表
infoItems() {
return [
@@ -134,6 +136,9 @@ export default {
this.initComponent()
this.registerSubTask()
},
beforeDestroy() {
this.nextStepProcesserContainer.removeTask(this.subTask)
},
inject: ['nextStepProcesserContainer'],
methods: {
registerSubTask() {
@@ -143,6 +148,19 @@ export default {
this.$toast('请补充完整影像信息')
return false
}
// 针对 受益人进行特殊的处理, 下一步前的前置处理
if (this.role === this.user.beneficiary) {
const result = getOrderDetail({ orderNo: this.$route.query.orderNo })
if (result.result !== '0') return
const idNo = this.userInfo['idNo']
const beneficiaries = result.orderDTO.insuredDTOs[0].bnfDTOs
if (!Array.isArray(beneficiaries)) return
const beneficiary = beneficiaries.find(beneficiary => beneficiary.idNo === idNo)
this.list.forEach(item => {
item.subBusinessNo = beneficiary.bnfId
})
}
return await this.nextStep()
})
},

View File

@@ -1,126 +1,118 @@
<template>
<div class="photo-scanner-container">
<div>
<!-- 投保人证件 -->
<div>
<div class="bg-white">
<div class="">
<div v-for="(item, index) in idType" :key="index">
<div v-if="item.id === Number(saleInsuredInfo.idType)">
<div v-if="[1, 2, 3, 5, 6, 8, 9, 11, 12].includes(item.id)" class="flex" style="justify-content: space-evenly">
<div @click="test('fileListIdFront', '1', '0', saleInsuredInfo.appntId, saleInsuredInfo.idType)">
<div class="flex align-items-e">
<van-uploader
v-model="fileListIdFront"
:after-read="afterRead"
:before-delete="beforeDelete"
:max-count="1"
class="mt10 ml20"
name="fileListIdFront"
@delete="deleteImg"
/>
</div>
<van-field disabled>
<template #label>
<span class="fs12">{{ item.id === 2 ? `${item.text}户主页` : `${item.text}正面` }}</span>
</template>
<template #input>
<div v-show="false"></div>
</template>
</van-field>
</div>
<div @click="test('fileListIdBack', '2', '0', saleInsuredInfo.appntId, saleInsuredInfo.idType)">
<div>
<van-uploader
v-model="fileListIdBack"
:after-read="afterRead"
:before-delete="beforeDelete"
:max-count="1"
class="mt10 ml20"
name="fileListIdBack"
@delete="deleteImg"
/>
</div>
<van-field disabled>
<template #label>
<span class="fs12">{{ item.id === 2 ? `${item.text}本人页` : `${item.text}反面` }}</span>
</template>
<template #input>
<div v-show="false"></div>
</template>
</van-field>
</div>
</div>
<div v-if="item.id === 4">
<div @click="test('fileLIstImg', '8', '0', saleInsuredInfo.appntId, saleInsuredInfo.idType)">
<van-uploader
v-model="fileLIstImg"
:after-read="afterRead"
:before-delete="beforeDelete"
:max-count="1"
class="mt10 ml20"
name="fileLIstImg"
@delete="deleteImg"
/>
</div>
<van-field disabled>
<template #label>
<span class="fs12">{{ `${item.text}头像面` }}</span>
</template>
</van-field>
</div>
<div class="bg-white">
<div v-for="(item, index) in idType" :key="index">
<div v-if="item.id === Number(currentUser.idType)">
<div v-if="[1, 2, 3, 5, 6, 8, 9, 11, 12].includes(item.id)" class="flex" style="justify-content: space-evenly">
<div @click="test('fileListIdFront', '1', '0', currentUserID, currentUser.idType)">
<div class="flex align-items-e">
<van-uploader
v-model="fileListIdFront"
:after-read="afterRead"
:before-delete="beforeDelete"
:max-count="1"
class="mt10 ml20"
name="fileListIdFront"
@delete="deleteImg"
/>
</div>
<van-field disabled>
<template #label>
<span class="fs12">{{ item.id === 2 ? `${item.text}户主页` : `${item.text}正面` }}</span>
</template>
<template #input>
<div v-show="false"></div>
</template>
</van-field>
</div>
<van-cell-group v-if="isNotify">
<van-field disabled label="健康告知异常类资料" />
</van-cell-group>
<div v-if="isNotify" @click="test('fileListNotify', '24', '0', saleInsuredInfo.appntId, saleInsuredInfo.idType)">
<van-uploader
v-model="fileListNotify"
:after-read="afterRead"
:before-delete="beforeDelete"
:max-count="20"
class="mt10 ml20"
name="fileListNotify"
@delete="deleteImg"
/>
</div>
<van-cell-group v-if="isEvalateNeed">
<van-field class="evalate-need" disabled label="投保人适当性评估文件及投保人声明附件上传" />
</van-cell-group>
<div v-if="isEvalateNeed" @click="test('fileListEvalte', '30', '0', saleInsuredInfo.appntId, saleInsuredInfo.idType)">
<van-uploader
v-model="fileListEvalte"
:after-read="afterRead"
:before-delete="beforeDelete"
:max-count="20"
class="mt10 ml20"
name="fileListEvalte"
@delete="deleteImg"
/>
<div @click="test('fileListIdBack', '2', '0', currentUserID, currentUser.idType)">
<div>
<van-uploader
v-model="fileListIdBack"
:after-read="afterRead"
:before-delete="beforeDelete"
:max-count="1"
class="mt10 ml20"
name="fileListIdBack"
@delete="deleteImg"
/>
</div>
<van-field disabled>
<template #label>
<span class="fs12">{{ item.id === 2 ? `${item.text}本人页` : `${item.text}反面` }}</span>
</template>
<template #input>
<div v-show="false"></div>
</template>
</van-field>
</div>
</div>
<div v-if="item.id === 4">
<div @click="test('fileLIstImg', '8', '0', currentUserID, currentUser.idType)">
<van-uploader
v-model="fileLIstImg"
:after-read="afterRead"
:before-delete="beforeDelete"
:max-count="1"
class="mt10 ml20"
name="fileLIstImg"
@delete="deleteImg"
/>
</div>
<van-field disabled>
<template #label>
<span class="fs12">{{ `${item.text}头像面` }}</span>
</template>
</van-field>
</div>
</div>
</div>
<van-cell-group v-if="isNotify">
<van-field disabled label="健康告知异常类资料" />
</van-cell-group>
<div v-if="isNotify" @click="test('fileListNotify', '24', '0', currentUserID, currentUser.idType)">
<van-uploader
v-model="fileListNotify"
:after-read="afterRead"
:before-delete="beforeDelete"
:max-count="20"
class="mt10 ml20"
name="fileListNotify"
@delete="deleteImg"
/>
</div>
<van-cell-group v-if="isEvalateNeed">
<van-field class="evalate-need" disabled label="投保人适当性评估文件及投保人声明附件上传" />
</van-cell-group>
<div v-if="isEvalateNeed" @click="test('fileListEvalte', '30', '0', currentUserID, currentUser.idType)">
<van-uploader
v-model="fileListEvalte"
:after-read="afterRead"
:before-delete="beforeDelete"
:max-count="20"
class="mt10 ml20"
name="fileListEvalte"
@delete="deleteImg"
/>
</div>
</div>
</div>
</template>
<script>
import DataDictionary from '@/assets/js/utils/data-dictionary'
import { Cell, CellGroup, Field, Uploader, RadioGroup, Radio, Dialog, Picker, Popup } from 'vant'
import { uploadImg2, saveInformation, IDCardOCR } from '@/api/ebiz/sale/sale'
import config from '@/config'
import { Cell, CellGroup, Dialog, Field, Picker, Popup, Radio, RadioGroup, Uploader } from 'vant'
import { saveInformation, uploadImg2 } from '@/api/ebiz/sale/sale'
import IndexBar from '@/components/ebiz/sale/IndexBar'
import utils from '@/assets/js/business-common'
import { applicant, beneficiaries, insured } from '@/views/ebiz/saleFlowProImprove/js/state'
import { subBusinessType as user } from '@/views/ebiz/saleFlowProImprove/js/enum'
export default {
props: {
role: { type: String, default: user.applicant },
subTask: { type: String, default: '' }
subTask: { type: String, default: '' },
userInfo: { type: Object, default: () => ({}) }
},
inject: ['nextStepProcesserContainer'],
data() {
@@ -160,7 +152,6 @@ export default {
id: '', // 是哪个证件类型
bnfId: '', //受益人id
relationToAppnt: '',
salePageFlag: '9',
imageType: '',
subBusinessNo: '',
subBusinessType: '',
@@ -168,53 +159,43 @@ export default {
isEvalateNeed: false
}
},
async created() {
// this.initialize()
// // localStorage.saleInsuredPersonInfo = JSON.stringify(res.orderDTO.insuredDTOs[0])
// // 核保老师确认只有财务告知第8项社保问题选【是】不用展示上传资料按钮其他健康告知或财务告知选【是】都可以展示上传资料按钮
// if (this.saleInsuredInfo.impartDTO.impartItemDTOS && this.saleInsuredInfo.impartDTO.impartItemDTOS.length > 0) {
// this.isNotify = this.saleInsuredInfo.impartDTO.impartItemDTOS.some(item => {
// return item.impartAnswer != 1
// })
// }
// if (!this.isNotify) {
// if (this.saleInsuredInfo.financeImpartDTO.impartItemDTOS && this.saleInsuredInfo.financeImpartDTO.impartItemDTOS.length > 0) {
// this.isNotify = this.saleInsuredInfo.financeImpartDTO.impartItemDTOS.some(item => {
// return item.impartAnswer != 1 && item.impartCode != 8
// })
// }
// }
//
// if (this.saleInsuredPersonInfo.impartDTO.impartItemDTOS && this.saleInsuredPersonInfo.impartDTO.impartItemDTOS.length > 0) {
// if (this.saleInsuredPersonInfo.relationToAppnt == 1) {
// this.isNotify = this.saleInsuredPersonInfo.impartDTO.impartItemDTOS.some(item => {
// return item.impartAnswer != 1
// })
// } else {
// this.isNotifyInsured = this.saleInsuredPersonInfo.impartDTO.impartItemDTOS.some(item => {
// return item.impartAnswer != 1
// })
// }
// }
//
// if (this.saleInsuredPersonInfo.relationToAppnt == 1) {
// if (!this.isNotify) {
// if (this.saleInsuredPersonInfo.financeImpartDTO.impartItemDTOS && this.saleInsuredPersonInfo.financeImpartDTO.impartItemDTOS.length > 0) {
// this.isNotify = this.saleInsuredPersonInfo.financeImpartDTO.impartItemDTOS.some(item => {
// return item.impartAnswer != 1 && item.impartCode != 8
// })
// }
// }
// } else {
// if (!this.isNotifyInsured) {
// if (this.saleInsuredPersonInfo.financeImpartDTO.impartItemDTOS && this.saleInsuredPersonInfo.financeImpartDTO.impartItemDTOS.length > 0) {
// this.isNotifyInsured = this.saleInsuredPersonInfo.financeImpartDTO.impartItemDTOS.some(item => {
// return item.impartAnswer != 1 && item.impartCode != 8
// })
// }
// }
// // }
// }
computed: {
user: () => user,
listenChange() {
const {
fileListIdFront,
fileListIdBack,
radio,
fileLIstImg,
fileListIdFrontInsured,
fileListIdBackInsured,
fileLIstImgInsured,
saleInsuredPersonInfoOther,
saleInsuredInfoOther
} = this
return {
fileListIdFront,
fileListIdBack,
radio,
fileListIdFrontInsured,
fileListIdBackInsured,
fileLIstImgInsured,
fileLIstImg,
saleInsuredPersonInfoOther,
saleInsuredInfoOther
}
},
currentUser() {
return this.role === user.applicant ? this.saleInsuredInfo : this.role === user.insured ? this.saleInsuredPersonInfo : this.userInfo
},
currentUserID() {
return this.role === user.applicant
? this.saleInsuredInfo.appntId
: this.role === user.insured
? this.saleInsuredPersonInfo.insuredId
: this.userInfo.bnfId
}
},
mounted() {
setTimeout(() => {
@@ -224,114 +205,6 @@ export default {
intercept: '1' //是否拦截原生返回事件 1是 其他否
})
}, 100)
window.appCallBack = this.appCallBack
if (!this.$route.query.edit) {
//如果不是编辑/导航条跳转进来的
localStorage.setItem('salePageFlag', this.salePageFlag)
} else if (this.$route.query.edit && !this.$route.query.salePageFlag) {
//如果从保单列表点击编辑按钮进入
this.salePageFlag = '9'
localStorage.setItem('salePageFlag', this.salePageFlag)
} else if (this.$route.query.salePageFlag) {
//如果是从导航栏点击进入
this.salePageFlag = localStorage.salePageFlag
}
let that = this
// 投被保险人是否同人
// if (this.$CacheUtils.getLocItem('saleInsuredPersonInfo')) {
// that.relationToAppnt = JSON.parse(this.$CacheUtils.getLocItem('saleInsuredPersonInfo')).relationToAppnt
// // 获取被保险人信息
// that.saleInsuredPersonInfo = JSON.parse(this.$CacheUtils.getLocItem('saleInsuredPersonInfo'))
// }
// 获取订单号
that.orderNo = this.$route.query.orderNo
// 获取是投保人还是被保险人
that.isAppant = window.localStorage.getItem('accountInformationRadio')
// 获取投保人信息
// if (this.$CacheUtils.getLocItem('saleInsuredInfo')) {
// that.saleInsuredInfo = JSON.parse(this.$CacheUtils.getLocItem('saleInsuredInfo'))
// }
// if (!this.isNotify) {
// this.isNotify = this.saleInsuredPersonInfo.impartDTO.impartItemDTOS.some((item) => {
// return item.impartAnswer != 1
// })
// }
// document.body.style.backgroundColor = '#fff'
// 身份证正面
if (window.localStorage.getItem('imgfrontPath') != null) {
let imgfront = {
url: config.imgDomain + `/returnImageStream?a=b.jpg&imgPath=${window.localStorage.getItem('imgfrontPath')}`
}
that.fileListIdFront.push(imgfront)
let obj = {
businessNo: that.orderNo,
businessType: '',
imageInfoType: '1',
rgssUrl: window.localStorage.getItem('imgfrontPath'),
subBusinessType: '0',
subBusinessNo: that.saleInsuredInfo.insuredId
}
that.list.push(obj)
} else {
that.fileListIdFront = []
}
// 被保险人身份证正面
if (window.localStorage.getItem('imgfrontInsuredPath') != null) {
let imgfront = {
url: config.imgDomain + `/returnImageStream?a=b.jpg&imgPath=${window.localStorage.getItem('imgfrontInsuredPath')}`
}
that.fileListIdFrontInsured.push(imgfront)
let obj = {
businessNo: that.orderNo,
businessType: '',
imageInfoType: '1',
rgssUrl: window.localStorage.getItem('imgfrontInsuredPath'),
subBusinessType: '1',
subBusinessNo: that.saleInsuredPersonInfo.insuredId
}
that.list.push(obj)
} else {
that.fileListIdFrontInsured = []
}
// 身份证背面
if (window.localStorage.getItem('imgBackPath') != null) {
let imgback = {
url: config.imgDomain + `/returnImageStream?a=b.jpg&imgPath=${window.localStorage.getItem('imgBackPath')}`
}
that.fileListIdBack.push(imgback)
let obj = {
businessNo: that.orderNo,
businessType: '',
imageInfoType: '2',
rgssUrl: window.localStorage.getItem('imgBackPath'),
subBusinessType: '0',
subBusinessNo: that.saleInsuredInfo.insuredId
}
that.list.push(obj)
} else {
that.fileListIdBack = []
}
// 被保险人身份证背面
if (window.localStorage.getItem('imgBackInsuredPath') != null) {
let imgback = {
url: config.imgDomain + `/returnImageStream?a=b.jpg&imgPath=${window.localStorage.getItem('imgBackInsuredPath')}`
}
that.fileListIdBackInsured.push(imgback)
let obj = {
businessNo: that.orderNo,
businessType: '',
imageInfoType: '2',
rgssUrl: window.localStorage.getItem('imgBackInsuredPath'),
subBusinessType: '1',
subBusinessNo: that.saleInsuredPersonInfo.insuredId
}
that.list.push(obj)
} else {
that.fileListIdBackInsured = []
}
this.registerSubTask()
},
destroyed() {
@@ -346,13 +219,12 @@ export default {
if (!this.subTask) return
this.nextStepProcesserContainer.registerPreTask(this.subTask, () => {
let idType
if (this.role === user.applicant) idType = this.saleInsuredInfo.userInfo.idType
else if (this.role === user.insured) idType = this.saleInsuredPersonInfo.userInfo.idType
if (this.role === user.applicant) idType = this.saleInsuredInfo.idType
else if (this.role === user.insured) idType = this.saleInsuredPersonInfo.idType
let result = Number(idType) === 4 ? this.list.length === 1 : this.list.length === 2
if (!result) {
const cuser = this.role === user.applicant ? '投保人' : this.role === user.insured ? '被保人' : '受益人'
this.$toast.clear()
this.$toast(`请补充完整 ${cuser} 图片信息`)
return false
}
@@ -362,87 +234,6 @@ export default {
removeSubTask() {
this.nextStepProcesserContainer.removeTask(this.subTask)
},
async initialize() {
//如果是从编辑进来的
// let res = await getOrderDetail({ orderNo: this.$route.query.orderNo /* userAssessLogic: true */ })
// this.isEvalateNeed = res.orderDTO.orderInfoDTO.assessFlag === '1'
// if (res.result == 0) {
// if(res.orderDTO.riskEvaluationDTO && res.orderDTO.riskEvaluationDTO.isShowEvaluationPoint == '1'&&res.orderDTO.riskEvaluationDTO.totalScore == null){
// Dialog.alert({
// title: '提示',
// message: '您当前未完成测评,请完成后再进行后续操作',
// theme: 'round-button',
// }).then(() => {
// this.$jump({
// flag: 'h5',
// extra: {
// url: location.origin + '/#/sale/answerPage',
// },
// routerInfo: {
// path: '/sale/answerPage'
// }
// })
// // on close
// })
// }
//是投保人还是被保险人
// localStorage.accountInformationRadio = res.orderDTO.orderAccountDTO.accountType
//投被保险人关系
this.relationToAppnt = insured.relationToAppnt
//投保人信息
// this.saleInsuredInfo = res.orderDTO.appntDTO
//被保险人信息
// this.saleInsuredPersonInfo = res.orderDTO.insuredDTOs[0]
//收益人信息
// this.saleBtnfPersonInfo = this.saleInsuredPersonInfo.bnfDTOs
//bnfInfo 受益人影像数据反显,护照属于其他类型,护照以外的证件区分正反面
if (Array.isArray(this.saleBtnfPersonInfo) && this.saleBtnfPersonInfo.length > 0) {
this.saleBtnfPersonInfo.forEach(item => {
if (String(item.idType) === '4') {
this.bnfInfo.push({
// 受益人其他类型页面
fileLIstImgBeneficiary: []
})
} else {
this.bnfInfo.push({
// 受益人身份证正面
fileListIdFrontBeneficiary: [],
// 受益人身份证反面
fileListIdBackBeneficiary: []
})
}
})
} else {
this.isDisabledBnf = false
}
},
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(() => {})
}
},
// 删除图片前
beforeDelete(file, detail) {
@@ -605,69 +396,19 @@ export default {
})
let formdata = new FormData()
formdata.append('imgPath', that.dataURLtoFile(that.file, that.imgName))
uploadImg2(formdata).then(
res => {
if (res.result === '0' && res.path) {
let obj = {
businessNo: that.orderNo,
businessType: '',
imageInfoType: that.imageType,
rgssUrl: encodeURIComponent(res.path),
subBusinessType: that.subBusinessType,
subBusinessNo: that.subBusinessNo,
fileName: that.imgName
}
that.list.push(obj)
//只有身份证件才进行ocr校验
if (
that.type === 'fileListIdFront' ||
that.type === 'fileListIdBack' ||
that.type === 'fileLIstImg' ||
that.type === 'fileListIdFrontInsured' ||
that.type === 'fileListIdBackInsured' ||
that.type === 'fileLIstImgInsured' ||
that.type === 'fileListIdFrontBeneficiary' ||
that.type === 'fileListIdBackBeneficiary'
) {
if (that.id == '1' && this.imageType == '1' && that.type === 'fileListIdFront') {
//投保人身份证正面
that.IDCardOCRValite(that.id, that.orderNo, res.path, 'FRONT', 'appentFront')
} else if (that.id == '1' && that.imageType == '2' && that.type === 'fileListIdBack') {
//投保人身份证反面
that.IDCardOCRValite(that.id, that.orderNo, res.path, 'BACK', 'appentBack')
} else if (that.id == '1' && that.imageType == '1' && that.type === 'fileListIdFrontInsured') {
//被保人身份证正面
that.IDCardOCRValite(that.id, that.orderNo, res.path, 'FRONT', 'insuredFront')
} else if (that.id == '1' && that.imageType == '2' && that.type === 'fileListIdBackInsured') {
//被保人身份证反面
that.IDCardOCRValite(that.id, that.orderNo, res.path, 'BACK', 'insuredBack')
} else if (that.id == '1' && that.imageType == '1' && that.type === 'fileListIdFrontBeneficiary') {
//受益人身份证正面
that.IDCardOCRValite(that.id, that.orderNo, res.path, 'FRONT', 'beneficiaryFront')
} else if (that.id == '1' && that.imageType == '2' && that.type === 'fileListIdBackBeneficiary') {
//受益人身份证反面
that.IDCardOCRValite(that.id, that.orderNo, res.path, 'BACK', 'beneficiaryBack')
} else {
//其他素材(护照,户口本,港澳身份证等)
that.IDCardOCRValite(that.id, that.orderNo, res.path, 'OTHER', '')
}
}
} else {
if (that.bnfId) {
that.saleBtnfPersonInfo.forEach((item, index) => {
if (item.bnfId == that.bnfId) {
that.bnfInfo[index][that.type] = []
}
})
} else {
that[that.type] = []
}
that.$toast(res.resultMessage)
return false
uploadImg2(formdata).then(res => {
if (res.result === '0' && res.path) {
let obj = {
businessNo: that.orderNo,
businessType: '',
imageInfoType: that.imageType,
rgssUrl: encodeURIComponent(res.path),
subBusinessType: that.subBusinessType,
subBusinessNo: that.subBusinessNo,
fileName: that.imgName
}
},
error => {
that.list.push(obj)
} else {
if (that.bnfId) {
that.saleBtnfPersonInfo.forEach((item, index) => {
if (item.bnfId == that.bnfId) {
@@ -677,136 +418,16 @@ export default {
} else {
that[that.type] = []
}
that.$toast('网络环境不佳,图片上传失败,请切换移动网络或稍后重试')
that.$toast(res.resultMessage)
return false
}
)
})
},
beforeNext(isDis) {
if (isDis && this.fileListIdBack.length > 0 && this.fileListIdFront.length > 0) {
this.$toast('请勾选确认销售人员已见证各证件原件并拍照上传')
}
},
IDCardOCRValite(idType, orderNo, imgPath, cardSide, flag) {
this.$toast.loading({
duration: 0, // 持续展示 toast
forbidClick: true, // 禁用背景点击
loadingType: 'spinner',
message: '加载中……'
})
let param = {
idType: idType,
orderNo: orderNo,
imgPath: imgPath,
cardSide: cardSide
}
//调用身份证OCR识别
IDCardOCR(param).then(res => {
this.$toast.clear()
if (res.result === '0') {
//不校验OCR直接返回
if (res.content == '' || res.content == null) {
return
}
//如果识别的身份证信息与填写的不一致,进行提示
let isFlag = true
//投保人身份证正面
if ('appentFront' === flag) {
this.saleInsuredInfo.sex = this.saleInsuredInfo.sex == '0' ? '男' : '女'
res.content.birth = utils.formatDate(Date.parse(res.content.birth), 'yyyy-MM-dd')
if (
this.saleInsuredInfo.name != res.content.name ||
this.saleInsuredInfo.sex != res.content.sex ||
this.saleInsuredInfo.birthday != res.content.birth ||
this.saleInsuredInfo.idNo != res.content.idNum
) {
isFlag = false
}
} else if ('appentBack' === flag) {
//投保人身份证反面
//"ValidDate": "2010.07.21-2020.07.21"
//"ValidDate": "2010.07.21-长期"
let certiexpireDate = res.content.validDate.split('-')[1]
if ('长期' === certiexpireDate) {
res.content.validDate = '9999-12-31'
if (this.saleInsuredInfo.certiexpiredate != res.content.validDate) {
isFlag = false
}
} else {
res.content.validDate = res.content.validDate.split('-')[1].replace(/\./g, '-')
if (this.saleInsuredInfo.certiexpiredate != res.content.validDate) {
isFlag = false
}
}
} else if ('insuredFront' === flag) {
this.saleInsuredPersonInfo.sex = this.saleInsuredPersonInfo.sex == '0' ? '男' : '女'
res.content.birth = utils.formatDate(Date.parse(res.content.birth), 'yyyy-MM-dd')
//被保人身份证正面
if (
this.saleInsuredPersonInfo.name != res.content.name ||
this.saleInsuredPersonInfo.sex != res.content.sex ||
this.saleInsuredPersonInfo.birthday != res.content.birth ||
this.saleInsuredPersonInfo.idNo != res.content.idNum
) {
isFlag = false
}
} else if ('insuredBack' === flag) {
//被保人身份证反面
//"ValidDate": "2010.07.21-2020.07.21"
//"ValidDate": "2010.07.21-长期"
let certiexpireDate = res.content.validDate.split('-')[1]
if ('长期' === certiexpireDate) {
res.content.validDate = '9999-12-31'
if (this.saleInsuredPersonInfo.certiexpiredate != res.content.validDate) {
isFlag = false
}
} else {
res.content.validDate = res.content.validDate.split('-')[1].replace(/\./g, '-')
if (this.saleInsuredPersonInfo.certiexpiredate != res.content.validDate) {
isFlag = false
}
}
} else if ('beneficiaryFront' === flag) {
this.saleBtnfPersonInfo.sex = this.saleBtnfPersonInfo.sex == '0' ? '男' : '女'
res.content.birth = utils.formatDate(Date.parse(res.content.birth), 'yyyy-MM-dd')
//受益人身份证正面
if (
this.saleBtnfPersonInfo.name != res.content.name ||
this.saleBtnfPersonInfo.sex != res.content.sex ||
this.saleBtnfPersonInfo.birthday != res.content.birth ||
this.saleBtnfPersonInfo.idNo != res.content.idNum
) {
isFlag = false
}
} else if ('beneficiaryBack' === flag) {
//受益人身份证反面
//"ValidDate": "2010.07.21-2020.07.21"
//"ValidDate": "2010.07.21-长期"
let certiexpireDate = res.content.validDate.split('-')[1]
console.log('res.content.validDate', res.content.validDate)
if ('长期' === certiexpireDate) {
res.content.validDate = '9999-12-31'
if (this.saleBtnfPersonInfo.certiexpiredate != res.content.validDate) {
isFlag = false
}
} else {
res.content.validDate = res.content.validDate.split('-')[1].replace(/\./g, '-')
if (this.saleBtnfPersonInfo.certiexpiredate != res.content.validDate) {
isFlag = false
}
}
}
if (!isFlag) {
this.$toast.clear()
this.$toast('上传的证件信息与录入的证件信息不一致,请核对修改并重新上传。')
}
} else {
this.$toast.clear()
this.$toast(res.resultMessage)
}
})
},
// 点击下一步
next() {
let that = this
@@ -831,7 +452,6 @@ export default {
}
saveInformation(data).then(res => {
if (res.result === '0') {
this.$toast.clear()
window.localStorage.setItem('accountInformationRadio', that.radio)
window.localStorage.setItem('accountInformation-isPaymentSelf', JSON.stringify(that.checked))
window.localStorage.setItem('jumpFromSign', '')
@@ -861,36 +481,6 @@ export default {
})
}
},
computed: {
user() {
return user
},
listenChange() {
const {
fileListIdFront,
fileListIdBack,
radio,
fileLIstImg,
fileListIdFrontInsured,
fileListIdBackInsured,
fileLIstImgInsured,
saleInsuredPersonInfoOther,
saleInsuredInfoOther
} = this
return {
fileListIdFront,
fileListIdBack,
radio,
fileListIdFrontInsured,
fileListIdBackInsured,
fileLIstImgInsured,
fileLIstImg,
saleInsuredPersonInfoOther,
saleInsuredInfoOther
}
}
},
watch: {
listenChange(val) {
let that = this