Files
ebiz-h5/src/views/ebiz/cardList/GroupAttachmentManagement.vue
2024-01-05 21:23:32 +08:00

1412 lines
53 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>
<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', 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', 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', 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>
</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', 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', 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', 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>
</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"
@click="appntIsAgent"
@touchstart="beforeNext(isDisabled)"
v-no-more-click="1000"
>立即投保</van-button
>
</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 { cardOrderDetail,saveOrUpdateGroupCard } from '@/api/ebiz/cardList/cardList.js'
import config from '@/config'
import utils from '../../../assets/js/business-common'
import { underWrite, appntIsAgent } from '@/api/ebiz/sale/sale'
import { uploadImg, IDCardOCR } from '@/api/ebiz/sale/sale'
export default {
data() {
return {
// 订单号
cardOrderNo: '',
// 被保人异常告知
fileListNotifyInsured: [],
// 投保人异常告知
fileListNotify: [],
// 身份证正面
fileListIdFront: [
// { url: 'https://img.yzcdn.cn/vant/cat.jpeg' }
// Uploader 根据文件后缀来判断是否为图片文件
],
// 身份证反面
fileListIdBack: [],
// 其他类型页面
fileLIstImg: [],
// 投保人选择的必选其他
saleInsuredInfoOther: [],
// 被保险人选择的必选其他
saleInsuredPersonInfoOther: [],
// 银行卡正面
fileListBank: [],
//银行卡反面
// fileListBankBack: [],
// 被保险人身份证正面
fileListIdFrontInsured: [],
// 被保险人身份证反面
fileListIdBackInsured: [],
// 被保险人银行账户
fileListBankInsured: [],
// 被保险人其他类型页面
fileLIstImgInsured: [],
// 受益人
// fileListtypebeneficiary: [],
// fileLIstImgInsrued
// 其他
// fileListOtherOne: [],
// fileListOtherTwo: [],
// fileListOtherThree: [],
// 单选框
// radio: '',
// 是否可以点击下一步
isDisabled: true,
// 数据字典证件类型
idType: [],
// 被保险人信息
saleInsuredPersonInfo: {},
// 投保人信息
saleInsuredInfo: {},
// 图片流
file: '',
// 图片名称
imgName: '',
// 图片返回数组
imgList: [],
type: '',
// 是投保人还是被保险人
isAppant: '',
// 传给后端的list
list: [],
// 是哪个证件类型
id: '',
// 投保人被保险人是否是一个人 1为同一个人
relationToAppnt: '',
salePageFlag: '9',
imageType: ''
}
},
created() {
if (this.$route.query.cardOrderNo) {
this.cardOrderNo = this.$route.query.cardOrderNo
}
//如果是从编辑进来的
// if (this.$route.query.edit) {
cardOrderDetail({ orderNo: this.cardOrderNo }).then((res) => {
// console.log(res)
if (res.result == 0) {
//投被保险人关系
this.relationToAppnt = res.orderDTO.insuredDTOs[0].relationToAppnt
this.$utils.intLocalStorage(res)
//投保人信息
this.saleInsuredInfo = res.orderDTO.appntDTO
//被保险人信息
this.saleInsuredPersonInfo = res.orderDTO.insuredDTOs[0]
// localStorage.saleInsuredPersonInfo = JSON.stringify(res.orderDTO.insuredDTOs[0])
} 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
}
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.idType = DataDictionary.idType
// 获取投保人信息
// if (this.$CacheUtils.getLocItem('saleInsuredInfo')) {
// that.saleInsuredInfo = JSON.parse(this.$CacheUtils.getLocItem('saleInsuredInfo'))
// }
// 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.cardOrderNo,
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.cardOrderNo,
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.cardOrderNo,
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.cardOrderNo,
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.cardOrderNo,
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.cardOrderNo,
// 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 == 'fileListtypebeneficiary') {
// that.fileListtypebeneficiary.map((item, index, array) => {
// if (item.content == file.content) {
// array.splice(index, 1)
// } else {
// return
// }
// })
} 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(type, id) {
let that = this
that.id = id
switch (type) {
case 'fileListIdFront':
that.type = type
break
case 'fileListIdBack':
that.type = type
break
case 'fileLIstImg':
that.type = type
break
case 'fileListBank':
that.type = type
break
// case 'fileListBankBack':
// that.type = type
// break
case 'fileListOther':
that.type = type
break
case 'fileListIdFrontInsured':
that.type = type
break
case 'fileListIdBackInsured':
that.type = type
break
case 'fileListBankInsured':
that.type = type
break
case 'fileLIstImgInsured':
that.type = type
break
case 'saleInsuredPersonInfoOther':
that.type = type
break
case 'saleInsuredInfoOther':
that.type = type
break
default:
that.type = type
}
},
// 删除图片
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)
}
})
},
afterRead(file) {
let that = this
// console.log(type)
// 此时可以自行将文件上传至服务器
that.file = file.content
that.imgName = Math.floor(Math.random() * 100).toString() + new Date().getTime() + file.file.name //为图片名加随机数 与时间戳
file.name = that.imgName
that.uploadImg()
},
// 转化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))
uploadImg(formdata).then(
(res) => {
// console.log(res)
if (res.result == '0') {
this.$toast.clear()
// res.responseObject.imgList.map(item => {
if (
that.type == 'fileListIdFront' ||
that.type == 'fileListIdBack' ||
that.type == 'fileLIstImg' ||
that.type == 'fileListBank' ||
// that.type == 'fileListBankBack' ||
that.type == 'fileListNotify' ||
that.type == 'saleInsuredInfoOther'
) {
// 是投保人
// console.log(that.file)
// 证件类型
let imageInfoType = ''
let name = ''
// if (that.type == 'fileListIdFront' && that.id == '1') {
// imageInfoType = '1'
// } else if (that.type == 'fileListIdBack' && that.id == '1') {
// imageInfoType = '2'
// } else if (that.type == 'fileListBank') {
// imageInfoType = '3'
// } else if (that.type == 'fileListIdFront' && that.id == '2') {
// imageInfoType = '5'
// } else if (that.type == 'fileListIdBack' && that.id == '2') {
// imageInfoType = '6'
// } else if (that.type == 'fileLIstImg' && that.id == '3') {
// imageInfoType = '7'
// } else if (that.type == 'fileLIstImg' && that.id == '4') {
// imageInfoType = '8'
// } else if (that.type == 'fileLIstImg' && that.id == '5') {
// imageInfoType = '9'
// } else if (that.type == 'fileLIstImg' && that.id == '6') {
// imageInfoType = '10'
// } else if (that.type == 'saleInsuredInfoOther' && that.id == '7') {
// imageInfoType = '11'
// }
if (that.type == 'fileListIdFront' && that.id == '1') {
//身份证正面
name = 'fileListIdFront'
imageInfoType = '1'
} else if (that.type == 'fileListIdBack' && that.id == '1') {
//身份证反面
name = 'fileListIdBack'
imageInfoType = '2'
} else if (that.type == 'fileListIdFront' && that.id == '2') {
//户口本正面
name = 'fileListIdFront'
imageInfoType = '5'
} else if (that.type == 'fileListIdBack' && that.id == '2') {
//户口本反面
name = 'fileListIdBack'
imageInfoType = '6'
} else if (that.type == 'fileListIdFront' && that.id == '3') {
//出生证正面
name = 'fileListIdFront'
imageInfoType = '7'
} else if (that.type == 'fileListIdBack' && that.id == '3') {
//出生证反面
name = 'fileListIdBack'
imageInfoType = '12'
} else if (that.type == 'fileLIstImg' && that.id == '4') {
//护照面
name = 'fileLIstImg'
imageInfoType = '8'
} else if (that.type == 'fileListIdFront' && that.id == '5') {
//港澳居民来往内地通行证正面
name = 'fileListIdFront'
imageInfoType = '9'
} else if (that.type == 'fileListIdBack' && that.id == '5') {
//港澳居民来往内地通行证反面
name = 'fileListIdBack'
imageInfoType = '13'
} else if (that.type == 'fileListIdFront' && that.id == '6') {
//台湾居民来往大陆通行证正面
name = 'fileListIdFront'
imageInfoType = '10'
} else if (that.type == 'fileListIdBack' && that.id == '6') {
//台湾居民来往大陆通行证反面
name = 'fileListIdBack'
imageInfoType = '14'
} else if (that.type == 'fileListIdFront' && that.id == '8') {
//外国人永久居留身份证正面
name = 'fileListIdFront'
imageInfoType = '15'
} else if (that.type == 'fileListIdBack' && that.id == '8') {
//外国人永久居留身份证反面
name = 'fileListIdBack'
imageInfoType = '16'
} else if (that.type == 'fileListIdFront' && that.id == '9') {
//港澳台居民居住证正面
name = 'fileListIdFront'
imageInfoType = '17'
} else if (that.type == 'fileListIdBack' && that.id == '9') {
//港澳台居民居住证反面
name = 'fileListIdBack'
imageInfoType = '18'
} else if (that.type == 'fileListBank') {
//银行卡正面
name = 'fileListBank'
imageInfoType = '3'
// } else if (that.type == 'fileListBankBack') {
// //银行卡反面
// imageInfoType = '19'
} else if (that.type == 'fileListNotify') {
name = 'fileListNotify'
imageInfoType = '24'
}
let obj = {
name: name,
businessNo: that.cardOrderNo,
businessType: '',
imageInfoType: imageInfoType,
// window.localStorage.setItem('bankCardUrlInsuredPath', encodeURI(JSON.parse(data).path).replace(/\+/g, '%2B'))
rgssUrl: encodeURI(res.path).replace(/\+/g, '%2B'),
subBusinessType: '0',
subBusinessNo: that.saleInsuredInfo.appntId,
fileName: that.imgName,
}
this.imageType = imageInfoType
that.list.push(obj)
} else if (
that.type == 'fileListIdFrontInsured' ||
that.type == 'fileListIdBackInsured' ||
that.type == 'fileListBankInsured' ||
that.type == 'fileLIstImgInsured' ||
that.type == 'fileListNotifyInsured' ||
that.type == 'saleInsuredPersonInfoOther'
) {
// 是被保险人
// 证件类型
let imageInfoType = ''
let name = ''
if (that.type == 'fileListIdFrontInsured' && that.id == '1') {
name = 'fileListIdFrontInsured'
imageInfoType = '1'
} else if (that.type == 'fileListIdBackInsured' && that.id == '1') {
name = 'fileListIdBackInsured'
imageInfoType = '2'
} else if (that.type == 'fileListIdFrontInsured' && that.id == '2') {
name = 'fileListIdFrontInsured'
imageInfoType = '5'
} else if (that.type == 'fileListIdBackInsured' && that.id == '2') {
name = 'fileListIdBackInsured'
imageInfoType = '6'
} else if (that.type == 'fileListIdFrontInsured' && that.id == '3') {
name = 'fileListIdFrontInsured'
imageInfoType = '7'
} else if (that.type == 'fileListIdBackInsured' && that.id == '3') {
name = 'fileListIdBackInsured'
imageInfoType = '12'
} else if (that.type == 'fileLIstImgInsured' && that.id == '4') {
name = 'fileLIstImgInsured'
imageInfoType = '8'
} else if (that.type == 'fileListIdFrontInsured' && that.id == '5') {
name = 'fileListIdFrontInsured'
imageInfoType = '9'
} else if (that.type == 'fileListIdBackInsured' && that.id == '5') {
name = 'fileListIdBackInsured'
imageInfoType = '13'
} else if (that.type == 'fileListIdFrontInsured' && that.id == '6') {
name = 'fileListIdFrontInsured'
imageInfoType = '10'
} else if (that.type == 'fileListIdBackInsured' && that.id == '6') {
name = 'fileListIdBackInsured'
imageInfoType = '14'
} else if (that.type == 'fileListIdFrontInsured' && that.id == '8') {
name = 'fileListIdFrontInsured'
imageInfoType = '15'
} else if (that.type == 'fileListIdBackInsured' && that.id == '8') {
name = 'fileListIdBackInsured'
imageInfoType = '16'
} else if (that.type == 'fileListIdFrontInsured' && that.id == '9') {
name = 'fileListIdFrontInsured'
imageInfoType = '17'
} else if (that.type == 'fileListIdBackInsured' && that.id == '9') {
name = 'fileListIdBackInsured'
imageInfoType = '18'
} else if (that.type == 'fileListNotifyInsured') {
name = 'fileListNotifyInsured'
imageInfoType = '24'
}
let obj = {
name: name,
businessNo: that.cardOrderNo,
businessType: '',
imageInfoType: imageInfoType,
rgssUrl: encodeURI(res.path).replace(/\+/g, '%2B'),
subBusinessType: '1',
subBusinessNo: that.saleInsuredPersonInfo.insuredId,
fileName: that.imgName,
}
this.imageType = imageInfoType
that.list.push(obj)
} else if (that.type == 'fileListOther') {
// 是其他
let type = '2'
let name = 'fileListOther'
let obj = {
name: name,
businessNo: that.cardOrderNo,
businessType: name,
imageInfoType: '11',
rgssUrl: encodeURI(res.path).replace(/\+/g, '%2B'),
subBusinessType: type,
subBusinessNo: '',
fileName: that.imgName,
}
that.list.push(obj)
// } else if (that.type == 'fileListtypebeneficiary') {
// // 是受益人
// let type = '3'
// let obj = {
// businessNo: that.cardOrderNo,
// businessType: '',
// imageInfoType: '21',
// rgssUrl: encodeURI(res.path).replace(/\+/g, '%2B'),
// subBusinessType: type,
// subBusinessNo: '',
// fileName: that.imgName
// }
// that.list.push(obj)
} else if (that.type == 'fileListNotify') {
// 健康告知异常类资料
// let obj = {
// name: 'fileListNotify',
// businessNo: that.cardOrderNo,
// businessType: '',
// imageInfoType: '24',
// rgssUrl: encodeURI(res.path).replace(/\+/g, '%2B'),
// subBusinessType: '0',
// subBusinessNo: '',
// fileName: that.imgName,
// }
// that.list.push(obj)
}
let imgPath = res.path
//只有身份证件才进行ocr校验
if(that.type == 'fileListIdFront' || that.type == 'fileListIdBack' || that.type == 'fileLIstImg' ||
that.type == 'fileListIdFrontInsured' || that.type == 'fileListIdBackInsured' || that.type == 'fileLIstImgInsured'){
if(that.id == '1' && this.imageType == '1' && that.type == 'fileListIdFront'){
//投保人身份证正面
this.IDCardOCRValite(that.id, this.cardOrderNo, imgPath, 'FRONT', 'appentFront')
}else if(that.id == '1' && this.imageType == '2' && that.type == 'fileListIdBack'){
//投保人身份证反面
this.IDCardOCRValite(that.id, this.cardOrderNo, imgPath, 'BACK', 'appentBack')
}else if(that.id == '1' && this.imageType == '1' && that.type == 'fileListIdFrontInsured'){
//被保人身份证正面
this.IDCardOCRValite(that.id, this.cardOrderNo, imgPath, 'FRONT', 'insuredFront')
}else if(that.id == '1' && this.imageType == '2' && that.type == 'fileListIdBackInsured'){
//被保人身份证反面
this.IDCardOCRValite(that.id, this.cardOrderNo, imgPath, 'BACK', 'insuredBack')
}else {
//其他素材(护照,户口本,港澳身份证等)
this.IDCardOCRValite(that.id, this.cardOrderNo, imgPath, "OTHER", '')
}
}
} else {
switch (that.type) {
case 'fileListIdFront':
that.fileListIdFront = []
break
case 'fileListIdBack':
that.fileListIdBack = []
break
case 'fileLIstImg':
that.fileLIstImg = []
break
case 'fileListBank':
that.fileListBank = []
break
case 'fileListOther':
that.fileListOther = []
break
case 'fileListIdFrontInsured':
that.fileListIdFrontInsured = []
break
case 'fileListIdBackInsured':
that.fileListIdBackInsured = []
break
case 'fileListBankInsured':
that.fileListBankInsured = []
break
case 'fileLIstImgInsured':
that.fileLIstImgInsured = []
break
case 'saleInsuredInfoOther':
that.saleInsuredInfoOther = []
break
case 'saleInsuredPersonInfoOther':
that.saleInsuredPersonInfoOther = []
break
}
this.$toast.clear()
this.$toast(res.resultMessage)
}
},
(error) => {
switch (that.type) {
case 'fileListIdFront':
that.fileListIdFront = []
break
case 'fileListIdBack':
that.fileListIdBack = []
break
case 'fileLIstImg':
that.fileLIstImg = []
break
case 'fileListBank':
that.fileListBank = []
break
case 'fileListOther':
that.fileListOther = []
break
case 'fileListIdFrontInsured':
that.fileListIdFrontInsured = []
break
case 'fileListIdBackInsured':
that.fileListIdBackInsured = []
break
case 'fileListBankInsured':
that.fileListBankInsured = []
break
case 'fileLIstImgInsured':
that.fileLIstImgInsured = []
break
case 'saleInsuredInfoOther':
that.saleInsuredInfoOther = []
break
case 'saleInsuredPersonInfoOther':
that.saleInsuredPersonInfoOther = []
break
}
this.$toast('网络环境不佳,图片上传失败,请切换移动网络或稍后重试')
}
)
},
beforeNext(isDis) {
if (isDis && this.fileListBank.length > 0 && this.fileListIdBack.length > 0 && this.fileListIdFront.length > 0) {
this.$toast('请勾选确认销售人员已见证各证件原件并拍照上传')
}
},
IDCardOCRValite(idType, orderNo, imgPath, cardSide, flag){
let param = {
idType : idType,
orderNo : orderNo,
imgPath : imgPath,
cardSide : cardSide,
}
//调用身份证OCR识别
IDCardOCR(param).then((res) => {
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.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;
}
}
}
if(!isFlag){
this.$toast.clear()
this.$toast("上传的证件信息与录入的证件信息不一致,请核对修改并重新上传。")
}
}else{
this.$toast.clear()
this.$toast(res.resultMessage)
}
});
},
appntIsAgent(){
let params = {
orderNo: this.cardOrderNo
}
appntIsAgent(params).then(res=>{
if(res.result == '0') {
if(res.content.isAgengFlag == '0') {
this.$dialog.confirm({
className: 'dialog-delete',
title: '提示',
message: '投保人/法人同时为代理人此代理人费用为0。虚拟账号的提示虚拟代理人费用为0。请确认提交审核或者退回修改',
cancelButtonColor: '#E9332E',
confirmButtonColor: '#FFFFFF',
cancelButtonText: '退回'
})
.then(() => {
this.next()
})
.catch(() => {
return
})
} else {
this.next()
}
} else {
this.$toast(res.resultMessage)
}
})
},
// 点击下一步
next() {
console.log(888)
let that = this
localStorage.setItem('orderNo', JSON.stringify(parseInt(this.cardOrderNo)))
// this.$toast.loading({
// duration: 0, // 持续展示 toast
// forbidClick: true, // 禁用背景点击
// loadingType: 'spinner',
// message: '加载中……'
// })
//注释双录提示
// let request = {
// productList: JSON.parse(localStorage.chooseProductCodes),
// // productList: ["DCRS_A0009"],
// birthday: this.saleInsuredInfo.birthday
// }
// check(request).then(res => {
// if (res.result == '0') {
// if (res.status == '0') {
// // 弹
// window.localStorage.setItem('attachmentShow', '0')
// } else {
// // 不弹
// window.localStorage.setItem('attachmentShow', '1')
// }
// } else {
// // 不弹
// window.localStorage.setItem('attachmentShow', '1')
// }
// })
// delete that.list.fileName
that.list.map((i) => {
delete i.name
})
let data = {
orderDTO: {
orderInfoDTO: {
orderNo: this.cardOrderNo,
productCode: that.saleInsuredPersonInfo.riskDTOLst[0].mainRiskCode,
},
appntDTO: {
relationToInsured: that.saleInsuredPersonInfo.relationToAppnt,
},
mediaDTOS: that.list,
},
orderType: 'CARDGROUP_MEDIA_ORDER',
}
saveOrUpdateGroupCard(data).then((res) => {
if (res.result == '0') {
this.$toast.clear()
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')
let data = {
platform: 'app',
type: '1',
orderDTO: {
orderInfoDTO: {
orderNo: this.cardOrderNo
}
}
}
//核保
underWrite(data).then(res => {
if (res.result == '0') {
this.$toast.clear()
window.localStorage.setItem('underWriteData', JSON.stringify(res))
if (res.uwResult == '33') {
window.localStorage.setItem('uwResult', res.uwResult)
window.localStorage.setItem('resultMessage', res.message)
} else {
window.localStorage.setItem('uwResult', res.uwResult)
}
if (res.uwResult == '02') {
this.underWriteData = res
window.localStorage.setItem('underWriteData', JSON.stringify(res))
this.$jump({
flag: 'h5',
extra: {
url: location.origin + `/#/cardList/pay`,
forbidSwipeBack: 1
},
routerInfo: {
path: `/cardList/pay`
}
})
} else {
window.localStorage.setItem('uwResult', res.uwResult)
window.localStorage.setItem('resultMessage', res.message)
this.$jump({
flag: 'h5',
extra: {
url: location.origin + '/#/cardList/result',
backToFirst: '1'
},
routerInfo: {
path: '/cardList/result'
}
})
}
return true
} else {
this.$toast(res.resultMessage)
return false
}
})
} else {
Dialog.confirm({
title: '提示',
message: res.resultMessage,
confirmButtonColor:'#FF0000',
showCancelButton:false
})
//that.$toast(res.resultMessage)
}
})
},
},
computed: {
// eslint-disable-next-line vue/return-in-computed-property
typebeneficiary() {
// 1.趸交保费≥20万元或期交保费*总期数≥20万元时
// 2.指定受益人
// 3.受益人与被保险人关系为其他
if (!window.localStorage.getItem('trialList') == true || !window.localStorage.getItem('beneficiaryInfo') == true) {
return false
} else {
let beneficiaryInfoList = JSON.parse(window.localStorage.getItem('beneficiaryInfo'))
if (JSON.parse(window.localStorage.getItem('trialList'))[0].prem >= 200000) {
for (let index = 0; index < beneficiaryInfoList.length; index++) {
if (beneficiaryInfoList[index].relationToInsured == 5) {
return true
}
}
// return false
} else {
return false
}
}
},
listenChange() {
const {
fileListIdFront,
fileListIdBack,
fileListBank,
// fileListBankBack,
// radio,
fileLIstImg,
fileListIdFrontInsured,
fileListIdBackInsured,
fileListBankInsured,
fileLIstImgInsured,
saleInsuredPersonInfoOther,
saleInsuredInfoOther,
// fileListtypebeneficiary
} = this
console.log(this)
return {
fileListIdFront,
fileListIdBack,
fileListBank,
// fileListBankBack,
// radio,
fileListIdFrontInsured,
fileListIdBackInsured,
fileListBankInsured,
fileLIstImgInsured,
fileLIstImg,
saleInsuredPersonInfoOther,
saleInsuredInfoOther,
// fileListtypebeneficiary
}
},
},
watch: {
listenChange(val) {
let that = this
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
// if ((that.typebeneficiary && val.fileListtypebeneficiary.length != '0') || (!that.typebeneficiary && val.fileListtypebeneficiary.length == '0')) {
// that.isDisabled = false
// } else {
// that.isDisabled = true
// }
} else {
that.isDisabled = 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
},
}
</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;
}
</style>