Files
ebiz-h5/src/views/ebiz/sale/AttachmentManagement.vue
2023-09-27 14:50:21 +08:00

1324 lines
52 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">
<index-bar></index-bar>
<!-- 来源于支付失败后更换银行卡信息 -->
<div v-if="changeCard">
<div class="flex p10 align-items-c bg-white mt10">
<span>投保人附件</span>
</div>
<van-cell-group>
<van-field required label="银行卡账户" disabled />
</van-cell-group>
<div @click="test('fileListBank', '3', '0', saleInsuredInfo.appntId, saleInsuredInfo.idType)">
<van-uploader
name="fileListBank"
v-model="fileListBank"
:after-read="afterRead"
@delete="deleteImg"
:before-delete="beforeDelete"
class="mt10 ml20"
:max-count="1"
/>
</div>
</div>
<div v-else>
<!-- 投保人证件 -->
<div>
<div class="flex p10 align-items-c bg-white mt10">
<span>请点击+上传投保人身份证件</span>
</div>
<div class="m20 bg-white">
<div class="p10">
<div v-for="(item, index) in idType" :key="index">
<div v-if="item.id == saleInsuredInfo.idType">
<div v-if="item.id == '1' || item.id == '2' || item.id == '3' || item.id == '5' || item.id == '6' || item.id == '8' || item.id == '9'">
<van-cell-group>
<van-field required :label="item.id == '2' ? `${item.text}户主页` : `${item.text}正面`" disabled />
</van-cell-group>
<div @click="test('fileListIdFront', '1', '0', saleInsuredInfo.appntId, saleInsuredInfo.idType)" class="flex align-items-e">
<van-uploader
name="fileListIdFront"
v-model="fileListIdFront"
:after-read="afterRead"
:before-delete="beforeDelete"
class="mt10 ml20"
:max-count="1"
@delete="deleteImg"
/>
</div>
<van-cell-group>
<van-field required :label="item.id == '2' ? `${item.text}本人页` : `${item.text}反面`" disabled />
</van-cell-group>
<div @click="test('fileListIdBack', '2', '0', saleInsuredInfo.appntId, saleInsuredInfo.idType)">
<van-uploader
name="fileListIdBack"
v-model="fileListIdBack"
:after-read="afterRead"
@delete="deleteImg"
:before-delete="beforeDelete"
class="mt10 ml20"
:max-count="1"
/>
</div>
</div>
<div v-if="item.id == '4'">
<van-cell-group>
<van-field required :label="`${item.text}头像面`" disabled />
</van-cell-group>
<div @click="test('fileLIstImg', '8', '0', saleInsuredInfo.appntId, saleInsuredInfo.idType)">
<van-uploader
name="fileLIstImg"
v-model="fileLIstImg"
:after-read="afterRead"
@delete="deleteImg"
:before-delete="beforeDelete"
class="mt10 ml20"
:max-count="1"
/>
</div>
</div>
</div>
</div>
<van-cell-group>
<van-field required label="银行卡正面" disabled />
</van-cell-group>
<div @click="test('fileListBank', '3', '0', saleInsuredInfo.appntId, saleInsuredInfo.idType)">
<van-uploader
name="fileListBank"
v-model="fileListBank"
:after-read="afterRead"
@delete="deleteImg"
:before-delete="beforeDelete"
class="mt10 ml20"
:max-count="1"
/>
</div>
<van-cell-group v-if="isNotify">
<van-field label="健康告知异常类资料" disabled />
</van-cell-group>
<div v-if="isNotify" @click="test('fileListNotify', '24', '0', saleInsuredInfo.appntId, saleInsuredInfo.idType)">
<van-uploader
name="fileListNotify"
v-model="fileListNotify"
:after-read="afterRead"
@delete="deleteImg"
:before-delete="beforeDelete"
class="mt10 ml20"
:max-count="20"
/>
</div>
</div>
</div>
</div>
<!-- 被保险人证件 -->
<div v-if="relationToAppnt != '1'">
<div class="flex bg-white p10 align-items-c">
<span>请点击+上传被保险人身份证件</span>
</div>
<div class="m20 bg-white">
<div>
<div class=" ">
<div v-for="(item, index) in idType" :key="index">
<div v-if="item.id == saleInsuredPersonInfo.idType">
<div v-if="item.id == '1' || item.id == '2' || item.id == '3' || item.id == '5' || item.id == '6' || item.id == '8' || item.id == '9'">
<van-cell-group>
<van-field required :label="item.id == '2' ? `${item.text}户主页` : `${item.text}正面`" disabled />
</van-cell-group>
<div @click="test('fileListIdFrontInsured', '1', '1', saleInsuredPersonInfo.insuredId, saleInsuredPersonInfo.idType)">
<van-uploader
name="fileListIdFrontInsured"
v-model="fileListIdFrontInsured"
:after-read="afterRead"
:before-delete="beforeDelete"
@delete="deleteImg"
class="mt10 ml20"
:max-count="1"
/>
</div>
<van-cell-group>
<van-field required :label="item.id == '2' ? `${item.text}本人页` : `${item.text}反面`" disabled />
</van-cell-group>
<div @click="test('fileListIdBackInsured', '2', '1', saleInsuredPersonInfo.insuredId, saleInsuredPersonInfo.idType)">
<van-uploader
name="fileListIdBackInsured"
v-model="fileListIdBackInsured"
:after-read="afterRead"
:before-delete="beforeDelete"
@delete="deleteImg"
class="mt10 ml20"
:max-count="1"
/>
</div>
</div>
<div v-if="item.id == '4'">
<van-cell-group>
<van-field required :label="`${item.text}头像页`" disabled />
</van-cell-group>
<div @click="test('fileLIstImgInsured', '8', '1', saleInsuredPersonInfo.insuredId, saleInsuredPersonInfo.idType)">
<van-uploader
name="fileLIstImgInsured"
v-model="fileLIstImgInsured"
:after-read="afterRead"
:before-delete="beforeDelete"
@delete="deleteImg"
class="mt10 ml20"
:max-count="1"
/>
</div>
</div>
</div>
</div>
<van-cell-group v-if="isNotifyInsured">
<van-field label="健康告知异常类资料" disabled />
</van-cell-group>
<div v-if="isNotifyInsured" @click="test('fileListNotifyInsured', '24', '1', saleInsuredPersonInfo.insuredId, saleInsuredPersonInfo.idType)">
<van-uploader
name="fileListNotifyInsured"
v-model="fileListNotifyInsured"
:after-read="afterRead"
@delete="deleteImg"
:before-delete="beforeDelete"
class="mt10 ml20"
:max-count="20"
/>
</div>
</div>
</div>
</div>
</div>
<!-- 受益人类型 -->
<div v-if="saleBtnfPersonInfo">
<div class="flex bg-white p10 align-items-c">
<span>请点击+上传受益人身份证件</span>
</div>
<div class="m20 bg-white">
<div v-for="(item, index) in idType" :key="index">
<div v-for="(item01, index01) in saleBtnfPersonInfo" :key="index01">
<div v-if="item.id == item01.idType">
<div v-if="item.id == '1' || item.id == '2' || item.id == '3' || item.id == '5' || item.id == '6' || item.id == '8' || item.id == '9'">
<van-cell-group>
<van-field required :label="item.id == '2' ? `${item01.name}+${item.text}户主页` : `${item01.name}+${item.text}正面`" disabled />
</van-cell-group>
<div @click="test('fileListIdFrontBeneficiary', '1', '3', item01.bnfId, item01.idType, item01.bnfId)">
<van-uploader
:name="'fileListIdFrontBeneficiary'+index01"
v-model="bnfInfo[index01].fileListIdFrontBeneficiary"
:after-read="afterRead"
:before-delete="beforeDelete"
@delete="deleteImg"
class="mt10 ml20"
:max-count="1"
/>
</div>
<van-cell-group>
<van-field required :label="item.id == '2' ? `${item01.name}+${item.text}本人页` : `${item01.name}+${item.text}反面`" disabled />
</van-cell-group>
<div @click="test('fileListIdBackBeneficiary', '2', '3', item01.bnfId, item01.idType, item01.bnfId)">
<van-uploader
:name="'fileListIdBackBeneficiary'+index01"
v-model="bnfInfo[index01].fileListIdBackBeneficiary"
:after-read="afterRead"
:before-delete="beforeDelete"
@delete="deleteImg"
class="mt10 ml20"
:max-count="1"
/>
</div>
</div>
<div v-if="item.id == '4'">
<van-cell-group>
<van-field required :label="`${item01.name}+${item.text}头像页`" disabled />
</van-cell-group>
<div @click="test('fileLIstImgBeneficiary', '8', '3', item01.bnfId, item01.idType, item01.bnfId)">
<van-uploader
:name="'fileLIstImgBeneficiary'+index01"
v-model="bnfInfo[index01].fileLIstImgBeneficiary"
:after-read="afterRead"
:before-delete="beforeDelete"
@delete="deleteImg"
class="mt10 ml20"
:max-count="1"
/>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="ml30 mt30 mb80">
<van-radio-group v-model="radio">
<van-radio name="1">销售人员已见证各证件原件并拍照上传</van-radio>
</van-radio-group>
</div>
<div class="bg-white bottom-btn">
<van-button
type="danger"
class="attachmentManagement-next"
size="large"
:disabled="!(isDisabled == false && isDisabledBnf == false)"
@click="next"
@touchstart="beforeNext(isDisabled)"
v-no-more-click="1000"
>下一步</van-button
>
</div>
<van-dialog v-model="thisdialogshow" title="提示" confirmButtonText="返回修改">
<div style="padding: 20px;font-size: 14px;">
<div style="margin-bottom: 10px;letter-spacing: 1px;color: #E9332E;">校验失败原因</div>
<div v-for="(item,index) in thisdialogcontent" style="margin-bottom: 10px;letter-spacing: 1px;">{{index+1}}{{item}}</div>
</div>
</van-dialog>
</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, getOrderDetail, IDCardOCR } from '@/api/ebiz/sale/sale'
import config from '@/config'
import IndexBar from '@/components/ebiz/sale/IndexBar'
import utils from '../../../assets/js/business-common'
export default {
data() {
return {
thisdialogshow: false,
thisdialogcontent: '',
isNotify: false, //是否有异常的健康告知
isNotifyInsured: false,
// 订单号
orderNo: '',
// 被保人异常告知
fileListNotifyInsured: [],
// 投保人异常告知
fileListNotify: [],
// 投保人身份证正面
fileListIdFront: [
// { url: 'https://img.yzcdn.cn/vant/cat.jpeg' }
// Uploader 根据文件后缀来判断是否为图片文件
],
// 投保人身份证反面
fileListIdBack: [],
// 投保人其他类型页面
fileLIstImg: [],
// 投保人选择的必选其他
saleInsuredInfoOther: [],
// 被保险人选择的必选其他
saleInsuredPersonInfoOther: [],
// 银行卡正面
fileListBank: [],
// 被保险人身份证正面
fileListIdFrontInsured: [],
// 被保险人身份证反面
fileListIdBackInsured: [],
// 被保险人银行账户
fileListBankInsured: [],
// 被保险人其他类型页面
fileLIstImgInsured: [],
// 受益人身份证正面
fileListIdFrontBeneficiary: [],
// 受益人身份证反面
fileListIdBackBeneficiary: [],
// 受益人其他类型页面
fileLIstImgBeneficiary: [],
// 受益人
bnfInfo:[],
isDisabledBnf:true,
// 单选框
radio: '',
// 是否可以点击下一步
isDisabled: true,
// 数据字典证件类型
idType: [],
// 被保险人信息
saleInsuredPersonInfo: {},
// 投保人信息
saleInsuredInfo: {},
// 受益人信息
saleBtnfPersonInfo: {},
// 图片流
file: '',
// 图片名称
imgName: '',
// 图片返回数组
imgList: [],
type: '',
// 是投保人还是被保险人
isAppant: '',
// 传给后端的list
list: [],
// 是哪个证件类型
id: '',
//受益人id
bnfId:'',
// 投保人被保险人是否是一个人 1为同一个人
relationToAppnt: '',
changeCard: localStorage.changeCard,
salePageFlag: '9',
imageType: '',
subBusinessNo: '',
subBusinessType: '',
}
},
async created() {
//如果是从编辑进来的
let res= await getOrderDetail({ orderNo: this.$route.query.orderNo })
if (res.result == 0) {
if(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 = res.orderDTO.insuredDTOs[0].relationToAppnt
this.$utils.intLocalStorage(res)
//投保人信息
this.saleInsuredInfo = res.orderDTO.appntDTO
//被保险人信息
this.saleInsuredPersonInfo = res.orderDTO.insuredDTOs[0]
//收益人信息
this.saleBtnfPersonInfo = this.saleInsuredPersonInfo.bnfDTOs
//bnfInfo 受益人影像数据反显,护照属于其他类型,护照以外的证件区分正反面
console.log(this.saleBtnfPersonInfo,'this.saleBtnfPersonInfo')
if(this.saleBtnfPersonInfo){
this.saleBtnfPersonInfo.forEach((item, index, arr) => {
if(item.idType == '4'){
this.bnfInfo.push(
{
// 受益人其他类型页面
fileLIstImgBeneficiary: []
}
)
}else{
this.bnfInfo.push(
{
// 受益人身份证正面
fileListIdFrontBeneficiary: [],
// 受益人身份证反面
fileListIdBackBeneficiary: []
}
)
}
})
}else{
this.isDisabledBnf = false
}
// 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
})
}
}
}
} else {
this.$toast(res.resultMessage)
}
},
mounted() {
setTimeout(() => {
// eslint-disable-next-line no-undef
EWebBridge.webCallAppInJs('webview_left_button', {
img: this.$assetsUrl + 'images/del-close-btn@3x.png',
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
}
if (this.changeCard) {
document.body.style.backgroundColor = '#fff'
}
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')
// 数据字典获取
that.idType = DataDictionary.idType
// 获取投保人信息
// 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 = []
}
// 银行卡
if (window.localStorage.getItem('bankCardUrlPath') != null) {
let bankCardUrl = {
url: config.imgDomain + `/returnImageStream?a=b.jpg&imgPath=${window.localStorage.getItem('bankCardUrlPath')}`,
}
that.fileListBank.push(bankCardUrl)
let obj = {
businessNo: that.orderNo,
businessType: '',
imageInfoType: '3',
rgssUrl: window.localStorage.getItem('bankCardUrlPath'),
subBusinessType: '0',
subBusinessNo: that.saleInsuredInfo.insuredId,
}
that.list.push(obj)
} else {
that.fileListBank = []
}
// 被保险人银行卡
// if (window.localStorage.getItem('bankCardUrlInsuredPath') != null) {
// let bankCardUrlInsured = {
// url: config.imgDomain + `/returnImageStream?a=b.jpg&imgPath=${window.localStorage.getItem('bankCardUrlInsuredPath')}`
// }
// that.fileListBankInsured.push(bankCardUrlInsured)
// let obj = {
// businessNo: that.orderNo,
// businessType: '',
// imageInfoType: '3',
// rgssUrl: window.localStorage.getItem('bankCardUrlInsuredPath'),
// subBusinessType: '1',
// subBusinessNo: that.saleInsuredPersonInfo.insuredId
// }
// that.list.push(obj)
// } else {
// that.fileListBankInsured = []
// }
// 保费超过20万的提示
// Dialog.alert({ title: '提示', message: '趸交保费≥20万元或期交保费*总期数≥20万元时须上传指定受益人证件正反面' })
},
beforeRouteLeave(to, from, next) {
document.body.style.backgroundColor = ''
next()
},
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
})
}
},
// 删除图片前
beforeDelete(file, detail) {
let that = this
Dialog.confirm({
title: '提示',
message: '您确定要删除吗',
}).then(() => {
if (detail.name == 'fileListIdFront') {
this.fileListIdFront = []
this.deleteImg(file, 'fileListIdFront')
} else if (detail.name == 'fileListIdBack') {
this.fileListIdBack = []
this.deleteImg(file, 'fileListIdBack')
} else if (detail.name == 'fileLIstImg') {
this.fileLIstImg = []
this.deleteImg(file, 'fileLIstImg')
} else if (detail.name == 'fileListBank') {
this.fileListBank = []
this.deleteImg(file, 'fileListBank')
// } else if (detail.name == 'fileListBankBack') {
// this.fileListBankBack = []
} else if (detail.name == 'fileListIdFrontInsured') {
this.fileListIdFrontInsured = []
this.deleteImg(file, 'fileListIdFrontInsured')
} else if (detail.name == 'fileListIdBackInsured') {
this.fileListIdBackInsured = []
this.deleteImg(file, 'fileListIdBackInsured')
} else if (detail.name == 'fileListBankInsured') {
this.fileListBankInsured = []
this.deleteImg(file, 'fileListBankInsured')
} else if (detail.name == 'fileLIstImgInsured') {
this.fileLIstImgInsured = []
this.deleteImg(file, 'fileLIstImgInsured')
// } else if (detail.name == 'fileListOtherOne') {
// this.fileListOtherOne = []
// } else if (detail.name == 'fileListOtherTwo') {
// this.fileListOtherTwo = []
// } else if (detail.name == 'fileListOtherThree') {
// this.fileListOtherThree = []
} else if (detail.name == 'saleInsuredInfoOther') {
this.saleInsuredInfoOther = []
this.deleteImg(file, 'saleInsuredInfoOther')
} else if (detail.name == 'saleInsuredPersonInfoOther') {
this.saleInsuredPersonInfoOther = []
this.deleteImg(file, 'saleInsuredPersonInfoOther')
} else if (detail.name.indexOf('fileListIdFrontBeneficiary') != -1) {
//单独处理受益人影像删除通过name值查询到当前收益指的索引值下标操作data数据中定义的数据
let detailIndex = detail.name.substring(26,detail.name.length)
this.fileListIdFrontBeneficiary = []
this.bnfInfo.forEach((item, index) => {
if(index == detailIndex){
item.fileListIdFrontBeneficiary = []
}
})
this.deleteImg(file, 'fileListIdFrontBeneficiary')
} else if (detail.name.indexOf('fileListIdBackBeneficiary') != -1) {
let detailIndex = detail.name.substring(25,detail.name.length)
this.fileListIdBackBeneficiary = []
this.bnfInfo.forEach((item, index) => {
if(index == detailIndex){
item.fileListIdBackBeneficiary = []
}
})
this.deleteImg(file, 'fileListIdBackBeneficiary')
} else if (detail.name.indexOf('fileLIstImgBeneficiary') != -1) {
let detailIndex = detail.name.substring(22,detail.name.length)
this.fileLIstImgBeneficiary = []
this.bnfInfo.forEach((item, index) => {
if(index == detailIndex){
item.fileLIstImgBeneficiary = []
}
})
this.deleteImg(file, 'fileLIstImgBeneficiary')
} else if (detail.name == 'fileListNotify') {
this.fileListNotify.forEach((item, index, arr) => {
if (item.name == file.name) {
arr.splice(index,1)
}else{
return;
}
})
this.deleteImg(file, 'fileListNotify')
} else if (detail.name == 'fileListNotifyInsured') {
this.fileListNotifyInsured.forEach((item, index, arr) => {
if (item.name == file.name) {
arr.splice(index,1)
}else{
return;
}
})
this.deleteImg(file, 'fileListNotifyInsured')
}
})
},
test(name, type, subBusinessType, subBusinessNo, id, bnfId) {
this.imageType = type
this.subBusinessType = subBusinessType
this.bnfId = bnfId
this.id = id
this.type = name
this.subBusinessNo = subBusinessNo
this.$store.commit('updateUploadImgType', name)
this.$store.commit('updateUploadImgOrderNo', this.$route.query.orderNo)
},
// 删除图片
deleteImg(file, nameList) {
let that = this
that.list.map((item, index, array) => {
// if (item.fileName.indexOf(file.file.name) == -1) {
// return
// } else {
// array.splice(index, 1)
// }
if (item.fileName == file.name && nameList == item.name) {
array.splice(index, 1)
}
//单独处理受益人影像删除通过bnfId查询到删除某条数据
if(nameList == 'fileListIdFrontBeneficiary' || nameList == 'fileListIdBackBeneficiary' || nameList == 'fileLIstImgBeneficiary'){
if (item.fileName == file.name && item.subBusinessNo == that.bnfId) {
array.splice(index, 1)
}
}
})
},
afterRead(file) {
let that = this
// 此时可以自行将文件上传至服务器
that.file = file.content
that.imgName = Math.floor(Math.random() * 100).toString() + new Date().getTime() + file.file.name //为图片名加随机数 与时间戳
file.name = that.imgName
that.uploadImg()
},
//校验受益人影像是否完整上传
checkBtnInfo(item){
for(var key in item){
console.log(!item[key])
if(item[key].length == 0){
return false
}
}
return true
},
// 转化base64格式为文件格式
dataURLtoFile(dataurl, filename) {
//将base64转换为文件
var arr = dataurl.split(','),
mime = arr[0].match(/:(.*?);/)[1],
bstr = atob(arr[1]),
n = bstr.length,
u8arr = new Uint8Array(n)
while (n--) {
u8arr[n] = bstr.charCodeAt(n)
}
return new File([u8arr], filename, { type: mime })
},
// 上传图片
uploadImg() {
let that = this
this.$toast.loading({
duration: 0, // 持续展示 toast
forbidClick: true, // 禁用背景点击
loadingType: 'spinner',
message: '加载中……',
})
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 = {
name: name,
businessNo: that.orderNo,
businessType: '',
imageInfoType: that.imageType,
rgssUrl: encodeURI(res.path).replace(/\+/g, '%2B'),
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
}
},(error)=>{
if(that.bnfId){
that.saleBtnfPersonInfo.forEach((item,index)=>{
if(item.bnfId == that.bnfId){
that.bnfInfo[index][that.type]= []
}
})
} else {
that[that.type] = []
}
that.$toast('网络环境不佳,图片上传失败,请切换移动网络或稍后重试')
return false
})
},
beforeNext(isDis) {
if (isDis && this.fileListBank.length > 0 && 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]
console.log("res.content.validDate", res.content.validDate)
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
that.list.map((i) => {
delete i.name
})
let nowTime = new Date().getTime()
let localTime = window.localStorage.getItem('serrorTime')
if(nowTime - localTime < 20000){
this.$toast('您操作过于频繁请20S后再试')
return false
}
let data = {
orderDTO: {
orderInfoDTO: {
orderNo: this.$route.query.orderNo,
productCode: JSON.parse(localStorage.mainRiskCodes)[0],
},
appntDTO: {
relationToInsured: that.saleInsuredPersonInfo.relationToAppnt,
},
mediaDTOS: that.list,
},
orderType: that.changeCard ? 'MEDIANEW_ORDER' : 'MEDIA_ORDER',
}
saveInformation(data).then((res) => {
if (res.result == '0') {
this.$toast.clear()
if (!this.changeCard) {
window.localStorage.setItem('accountInfomation-bank', that.bank)
window.localStorage.setItem('accountInformationRadio', that.radio)
window.localStorage.setItem('accountInformation-isPaymentSelf', JSON.stringify(that.checked))
window.localStorage.setItem('jumpFromSign', '')
}
window.localStorage.removeItem('imgfront')
window.localStorage.removeItem('imgBackPath')
window.localStorage.removeItem('imgfrontPath')
window.localStorage.removeItem('imgfrontInsured')
window.localStorage.removeItem('imgfrontInsuredPath')
window.localStorage.removeItem('imgBackInsuredPath')
window.localStorage.removeItem('bankCardUrl')
window.localStorage.removeItem('bankCardUrlPath')
window.localStorage.removeItem('bankCardUrlInsured')
window.localStorage.removeItem('bankCardUrlInsuredPath')
that.$jump({
flag: 'h5',
extra: {
url: location.origin + '/#/sale/signatureConfirmation?orderNo=' + this.$route.query.orderNo,
pullRefresh: '1',
backToFirst: '1',
},
routerInfo: {
path: '/sale/signatureConfirmation?orderNo=' + this.$route.query.orderNo,
},
})
} else {
let thisTime = new Date().getTime()
window.localStorage.setItem('serrorTime',thisTime)
if (res.resultMessage.indexOf('Engine') != -1) {
this.thisdialogshow = true
// let thisdialogcontent = '【Engine】投保人电子邮箱已被其他投保人使用哦请确认并重新录入如有疑问请拨打4006946688进行咨询【Engine】被保人与投保人关系需为本人、配偶、子女、父母人工审核中请您耐心等待哦~'
this.thisdialogcontent = res.resultMessage.split('【Engine】')
this.thisdialogcontent.splice(0, 1)
} else {
Dialog.confirm({
title: '提示',
message: res.resultMessage,
confirmButtonColor: '#FF0000',
showCancelButton: false
})
}
}
})
},
},
computed: {
listenChange() {
const {
fileListIdFront,
fileListIdBack,
fileListBank,
// fileListBankBack,
radio,
fileLIstImg,
fileListIdFrontInsured,
fileListIdBackInsured,
fileListBankInsured,
fileLIstImgInsured,
saleInsuredPersonInfoOther,
saleInsuredInfoOther
} = this
return {
fileListIdFront,
fileListIdBack,
fileListBank,
// fileListBankBack,
radio,
fileListIdFrontInsured,
fileListIdBackInsured,
fileListBankInsured,
fileLIstImgInsured,
fileLIstImg,
saleInsuredPersonInfoOther,
saleInsuredInfoOther
}
},
},
watch: {
listenChange(val) {
let that = this
if (this.changeCard) {
//从转账不成功跳过来的
if (val.fileListBank.length != '0' && val.radio !== '') {
that.isDisabled = false
} else {
that.isDisabled = true
}
} else {
if (
(val.fileListIdFront.length != '0' &&
val.fileListIdBack.length != '0' &&
val.fileListBank.length != '0' &&
// val.fileListBankBack.length != '0' &&
val.fileListIdFrontInsured.length != '0' &&
val.fileListIdBackInsured.length != '0' &&
val.radio !== '') ||
(val.fileLIstImg.length != '0' &&
val.fileListBank.length != '0' &&
// val.fileListBankBack.length != '0' &&
val.fileListIdFrontInsured.length != '0' &&
val.fileListIdBackInsured.length != '0' &&
val.radio !== '') ||
(val.fileListIdFront.length != '0' &&
val.fileListIdBack.length != '0' &&
val.fileListIdFrontInsured.length != '0' &&
val.fileListIdBackInsured.length != '0' &&
val.fileListBankInsured.length != '0' &&
val.radio !== '') ||
(val.fileLIstImg.length != '0' &&
val.fileListIdFrontInsured.length != '0' &&
val.fileListIdBackInsured.length != '0' &&
val.fileListBankInsured.length != '0' &&
val.radio !== '') ||
(val.fileListIdFront.length != '0' &&
val.fileListIdBack.length != '0' &&
val.fileListBankInsured.length != '0' &&
val.fileLIstImgInsured.length != '0' &&
val.radio !== '') ||
(val.fileListIdFront.length != '0' &&
val.fileListIdBack.length != '0' &&
val.fileListBank.length != '0' &&
// val.fileListBankBack.length != '0' &&
val.fileLIstImgInsured.length != '0' &&
val.radio !== '') ||
(val.fileListBank.length != '0' &&
// val.fileListBankBack.length != '0' &&
val.fileLIstImg.length != '0' &&
val.fileLIstImgInsured.length != '0' &&
val.radio !== '') ||
(val.fileLIstImg.length != '0' && val.fileLIstImgInsured.length != '0' && val.fileListBankInsured.length != '0' && val.radio !== '') ||
(val.fileListIdFront.length != '0' &&
val.fileListIdBack.length != '0' &&
val.fileListBank.length != '0' &&
// val.fileListBankBack.length != '0' &&
val.radio !== '' &&
this.relationToAppnt == '1') ||
(val.fileLIstImg.length != '0' &&
val.fileListBank.length != '0' &&
// val.fileListBankBack.length != '0' &&
val.radio !== '' &&
this.relationToAppnt == '1') ||
(val.saleInsuredInfoOther.length != '0' &&
val.fileListBank.length != '0' &&
// val.fileListBankBack.length != '0' &&
val.fileListIdFrontInsured.length != '0' &&
val.fileListIdBackInsured.length != '0' &&
val.radio !== '') ||
(val.saleInsuredInfoOther.length != '0' &&
val.fileListBank.length != '0' &&
// val.fileListBankBack.length != '0' &&
val.fileLIstImgInsured.length != '0' &&
val.radio !== '') ||
(val.saleInsuredPersonInfoOther.length != '0' &&
val.fileListBankInsured.length != '0' &&
val.fileListIdFront.length != '0' &&
val.fileListIdBack.length != '0' &&
val.radio !== '') ||
(val.saleInsuredInfoOther.length != '0' &&
val.fileListBank.length != '0' &&
// val.fileListBankBack.length != '0' &&
val.fileLIstImg.length != '0' &&
val.radio !== '') ||
(val.saleInsuredInfoOther.length != '0' &&
val.fileListBankInsured.length != '0' &&
val.fileListIdFrontInsured.length != '0' &&
val.fileListIdBackInsured.length != '0' &&
val.radio !== '') ||
(val.saleInsuredInfoOther.length != '0' && val.fileListBankInsured.length != '0' && val.fileLIstImg.length != '0' && val.radio !== '') ||
(val.fileListBank.length != '0' &&
// val.fileListBankBack.length != '0' &&
val.fileListIdFront.length != '0' &&
val.fileListIdBack.length != '0' &&
val.saleInsuredPersonInfoOther.length != '0' &&
val.radio !== '') ||
(val.fileListBank.length != '0' &&
// val.fileListBankBack.length != '0' &&
val.fileLIstImg.length != '0' &&
val.saleInsuredPersonInfoOther.length != '0' &&
val.radio !== '') ||
(val.saleInsuredInfoOther.length != '0' &&
val.fileListBank.length != '0' &&
// val.fileListBankBack.length != '0' &&
val.saleInsuredPersonInfoOther.length != '0' &&
val.radio !== '') ||
(val.saleInsuredInfoOther.length != '0' &&
val.saleInsuredPersonInfoOther.length != '0' &&
val.fileListBankInsured.length != '0' &&
val.radio !== '') ||
(val.saleInsuredInfoOther.length != '0' &&
val.fileListBank.length != '0' &&
// val.fileListBankBack.length != '0' &&
val.radio !== '' &&
this.relationToAppnt == '1')
) {
//去掉收益人添加的,有收益人删掉该行显示下面影藏判断
that.isDisabled = false
} else {
that.isDisabled = true
}
}
},
//监听受益人影像list的变化控制下一步按钮是否可点击
bnfInfo: {
handler(val, oldval) {
console.log(val,'val监听到but')
console.log(oldval,'oldval监听到but')
let that = this
if (this.changeCard) {
document.body.style.backgroundColor = '#fff'
this.isDisabledBnf = false
}else{
if(val.length > 0){
for (let index = 0; index < val.length; index++) {
let item = val[index]
that.isDisabledBnf = !this.checkBtnInfo(item)
if(this.checkBtnInfo(item) == false){
return false
}
}
}else if (val.length == 0){
that.isDisabledBnf = false
}
}
},
deep: true
}
},
components: {
[Cell.name]: Cell,
[CellGroup.name]: CellGroup,
[Field.name]: Field,
[Uploader.name]: Uploader,
[RadioGroup.name]: RadioGroup,
[Radio.name]: Radio,
[Dialog.name]: Dialog,
[Picker.name]: Picker,
[Popup.name]: Popup,
[IndexBar.name]: IndexBar,
},
}
</script>
<style lang="scss" scoped>
@import '@/assets/sass/variables.scss';
.attachmentManagement-block {
width: 4px;
height: 15px;
background: #d6211a;
margin-right: 5px;
}
.attachmentManagement-next {
width: 100%;
}
/deep/ .van-hairline-unset--top-bottom::after {
border: none;
}
.redRadioCheckbox {
overflow: hidden;
}
/deep/ .van-field__label{
width: 50vw;
}
</style>