上传附件代码逻辑重新编写

This commit is contained in:
liu.xiaofeng@ebiz-digits.com
2023-08-09 10:01:17 +08:00
parent dfe5d8a0f0
commit 41892791f0

View File

@@ -9,7 +9,7 @@
<van-cell-group>
<van-field required label="银行卡账户" disabled />
</van-cell-group>
<div @click="test('fileListBank', saleInsuredInfo.idType)">
<div @click="test('fileListBank', '3', saleInsuredInfo.idType)">
<van-uploader
name="fileListBank"
v-model="fileListBank"
@@ -36,7 +36,7 @@
<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">
<div @click="test('fileListIdFront', '1', saleInsuredInfo.idType)" class="flex align-items-e">
<van-uploader
name="fileListIdFront"
v-model="fileListIdFront"
@@ -50,7 +50,7 @@
<van-cell-group>
<van-field required :label="item.id == '2' ? `${item.text}本人页` : `${item.text}反面`" disabled />
</van-cell-group>
<div @click="test('fileListIdBack', saleInsuredInfo.idType)">
<div @click="test('fileListIdBack', '2', saleInsuredInfo.idType)">
<van-uploader
name="fileListIdBack"
v-model="fileListIdBack"
@@ -66,7 +66,7 @@
<van-cell-group>
<van-field required :label="`${item.text}头像面`" disabled />
</van-cell-group>
<div @click="test('fileLIstImg', saleInsuredInfo.idType)">
<div @click="test('fileLIstImg', '8', saleInsuredInfo.idType)">
<van-uploader
name="fileLIstImg"
v-model="fileLIstImg"
@@ -83,7 +83,7 @@
<van-cell-group>
<van-field required label="银行卡正面" disabled />
</van-cell-group>
<div @click="test('fileListBank', saleInsuredInfo.idType)">
<div @click="test('fileListBank', '3', saleInsuredInfo.idType)">
<van-uploader
name="fileListBank"
v-model="fileListBank"
@@ -97,7 +97,7 @@
<van-cell-group v-if="isNotify">
<van-field label="健康告知异常类资料" disabled />
</van-cell-group>
<div v-if="isNotify" @click="test('fileListNotify', saleInsuredInfo.idType)">
<div v-if="isNotify" @click="test('fileListNotify', '24', saleInsuredInfo.idType)">
<van-uploader
name="fileListNotify"
v-model="fileListNotify"
@@ -125,7 +125,7 @@
<van-cell-group>
<van-field required :label="item.id == '2' ? `${item.text}户主页` : `${item.text}正面`" disabled />
</van-cell-group>
<div @click="test('fileListIdFrontInsured', saleInsuredPersonInfo.idType)">
<div @click="test('fileListIdFrontInsured', '1', saleInsuredPersonInfo.idType)">
<van-uploader
name="fileListIdFrontInsured"
v-model="fileListIdFrontInsured"
@@ -139,7 +139,7 @@
<van-cell-group>
<van-field required :label="item.id == '2' ? `${item.text}本人页` : `${item.text}反面`" disabled />
</van-cell-group>
<div @click="test('fileListIdBackInsured', saleInsuredPersonInfo.idType)">
<div @click="test('fileListIdBackInsured', '2', saleInsuredPersonInfo.idType)">
<van-uploader
name="fileListIdBackInsured"
v-model="fileListIdBackInsured"
@@ -155,7 +155,7 @@
<van-cell-group>
<van-field required :label="`${item.text}头像页`" disabled />
</van-cell-group>
<div @click="test('fileLIstImgInsured', saleInsuredPersonInfo.idType)">
<div @click="test('fileLIstImgInsured', '8', saleInsuredPersonInfo.idType)">
<van-uploader
name="fileLIstImgInsured"
v-model="fileLIstImgInsured"
@@ -172,7 +172,7 @@
<van-cell-group v-if="isNotifyInsured">
<van-field label="健康告知异常类资料" disabled />
</van-cell-group>
<div v-if="isNotifyInsured" @click="test('fileListNotifyInsured', saleInsuredInfo.idType)">
<div v-if="isNotifyInsured" @click="test('fileListNotifyInsured', '24', saleInsuredInfo.idType)">
<van-uploader
name="fileListNotifyInsured"
v-model="fileListNotifyInsured"
@@ -200,7 +200,7 @@
<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', item01.idType, item01.bnfId)">
<div @click="test('fileListIdFrontBeneficiary', '1', item01.idType, item01.bnfId)">
<van-uploader
:name="'fileListIdFrontBeneficiary'+index01"
v-model="bnfInfo[index01].fileListIdFrontBeneficiary"
@@ -214,7 +214,7 @@
<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', item01.idType, item01.bnfId)">
<div @click="test('fileListIdBackBeneficiary', '2', item01.idType, item01.bnfId)">
<van-uploader
:name="'fileListIdBackBeneficiary'+index01"
v-model="bnfInfo[index01].fileListIdBackBeneficiary"
@@ -230,7 +230,7 @@
<van-cell-group>
<van-field required :label="`${item01.name}+${item.text}头像页`" disabled />
</van-cell-group>
<div @click="test('fileLIstImgBeneficiary', item01.idType, item01.bnfId)">
<div @click="test('fileLIstImgBeneficiary', '8', item01.idType, item01.bnfId)">
<van-uploader
:name="'fileLIstImgBeneficiary'+index01"
v-model="bnfInfo[index01].fileLIstImgBeneficiary"
@@ -303,8 +303,6 @@ export default {
saleInsuredPersonInfoOther: [],
// 银行卡正面
fileListBank: [],
//银行卡反面
// fileListBankBack: [],
// 被保险人身份证正面
fileListIdFrontInsured: [],
// 被保险人身份证反面
@@ -751,59 +749,11 @@ export default {
}
})
},
test(type, id, bnfId) {
let that = this
that.bnfId = bnfId
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
case 'fileListIdFrontBeneficiary':
that.type = type
break
case 'fileListIdBackBeneficiary':
that.type = type
break
case 'fileLIstImgBeneficiary':
that.type = type
break
default:
that.type = type
}
test(name, type, id, bnfId) {
this.imageType = type
this.bnfId = bnfId
this.id = id
this.type = name
},
// 删除图片
deleteImg(file, nameList) {
@@ -869,683 +819,104 @@ export default {
formdata.append('imgPath', that.dataURLtoFile(that.file, that.imgName))
// formdata.append('imgType', that.type)
// formdata.append('orderNo', this.$route.query.orderNo)
uploadImg(formdata).then(
(res) => {
// console.log(res)
if (res.result == '0') {
this.$toast.clear()
if(res.path){
if (that.type == 'fileListIdFront' || that.type == 'fileListIdBack' || that.type == 'fileLIstImg' || that.type == 'fileListBank' || that.type == 'fileListNotify' || that.type == 'saleInsuredInfoOther') {
let imageInfoType = ''
let name = ''
if (that.type == 'fileListIdFront' && that.id == '1') {
//身份证正面
name = 'fileListIdFront'
imageInfoType = '1'
this.fileListIdFront = {
url: config.imgDomain + `/returnImageStream?a=b.jpg&imgPath=${res.path}`,
}
} else if (that.type == 'fileListIdBack' && that.id == '1') {
//身份证反面
name = 'fileListIdBack'
imageInfoType = '2'
this.fileListIdBack = {
url: config.imgDomain + `/returnImageStream?a=b.jpg&imgPath=${res.path}`,
}
} else if (that.type == 'fileListIdFront' && that.id == '2') {
//户口本正面
name = 'fileListIdFront'
imageInfoType = '5'
this.fileListIdFront = {
url: config.imgDomain + `/returnImageStream?a=b.jpg&imgPath=${res.path}`,
}
} else if (that.type == 'fileListIdBack' && that.id == '2') {
//户口本反面
name = 'fileListIdBack'
imageInfoType = '6'
this.fileListIdBack = {
url: config.imgDomain + `/returnImageStream?a=b.jpg&imgPath=${res.path}`,
}
} else if (that.type == 'fileListIdFront' && that.id == '3') {
//出生证正面
name = 'fileListIdFront'
imageInfoType = '7'
this.fileListIdFront = {
url: config.imgDomain + `/returnImageStream?a=b.jpg&imgPath=${res.path}`,
}
} else if (that.type == 'fileListIdBack' && that.id == '3') {
//出生证反面
name = 'fileListIdBack'
imageInfoType = '12'
this.fileListIdBack = {
url: config.imgDomain + `/returnImageStream?a=b.jpg&imgPath=${res.path}`,
}
} else if (that.type == 'fileLIstImg' && that.id == '4') {
//护照面
name = 'fileLIstImg'
imageInfoType = '8'
this.fileLIstImg = {
url: config.imgDomain + `/returnImageStream?a=b.jpg&imgPath=${res.path}`,
}
} else if (that.type == 'fileListIdFront' && that.id == '5') {
//港澳居民来往内地通行证正面
name = 'fileListIdFront'
imageInfoType = '9'
this.fileListIdFront = {
url: config.imgDomain + `/returnImageStream?a=b.jpg&imgPath=${res.path}`,
}
} else if (that.type == 'fileListIdBack' && that.id == '5') {
//港澳居民来往内地通行证反面
name = 'fileListIdBack'
imageInfoType = '13'
this.fileListIdBack = {
url: config.imgDomain + `/returnImageStream?a=b.jpg&imgPath=${res.path}`,
}
} else if (that.type == 'fileListIdFront' && that.id == '6') {
//台湾居民来往大陆通行证正面
name = 'fileListIdFront'
imageInfoType = '10'
this.fileListIdFront = {
url: config.imgDomain + `/returnImageStream?a=b.jpg&imgPath=${res.path}`,
}
} else if (that.type == 'fileListIdBack' && that.id == '6') {
//台湾居民来往大陆通行证反面
name = 'fileListIdBack'
imageInfoType = '14'
this.fileListIdBack = {
url: config.imgDomain + `/returnImageStream?a=b.jpg&imgPath=${res.path}`,
}
} else if (that.type == 'fileListIdFront' && that.id == '8') {
//外国人永久居留身份证正面
name = 'fileListIdFront'
imageInfoType = '15'
this.fileListIdFront = {
url: config.imgDomain + `/returnImageStream?a=b.jpg&imgPath=${res.path}`,
}
} else if (that.type == 'fileListIdBack' && that.id == '8') {
//外国人永久居留身份证反面
name = 'fileListIdBack'
imageInfoType = '16'
this.fileListIdBack = {
url: config.imgDomain + `/returnImageStream?a=b.jpg&imgPath=${res.path}`,
}
} else if (that.type == 'fileListIdFront' && that.id == '9') {
//港澳台居民居住证正面
name = 'fileListIdFront'
imageInfoType = '17'
this.fileListIdFront = {
url: config.imgDomain + `/returnImageStream?a=b.jpg&imgPath=${res.path}`,
}
} else if (that.type == 'fileListIdBack' && that.id == '9') {
//港澳台居民居住证反面
name = 'fileListIdBack'
imageInfoType = '18'
this.fileListIdBack = {
url: config.imgDomain + `/returnImageStream?a=b.jpg&imgPath=${res.path}`,
}
} else if (that.type == 'fileListBank') {
//银行卡正面
name = 'fileListBank'
imageInfoType = '3'
this.fileListBank = {
url: config.imgDomain + `/returnImageStream?a=b.jpg&imgPath=${res.path}`,
}
} else if (that.type == 'fileListNotify') {
name = 'fileListNotify'
imageInfoType = '24'
this.fileListNotify = {
url: config.imgDomain + `/returnImageStream?a=b.jpg&imgPath=${res.path}`,
}
}
let obj = {
name: name,
businessNo: that.orderNo,
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'
this.fileListIdFrontInsured = {
url: config.imgDomain + `/returnImageStream?a=b.jpg&imgPath=${res.path}`,
}
} else if (that.type == 'fileListIdBackInsured' && that.id == '1') {
name = 'fileListIdBackInsured'
imageInfoType = '2'
this.fileListIdBackInsured = {
url: config.imgDomain + `/returnImageStream?a=b.jpg&imgPath=${res.path}`,
}
} else if (that.type == 'fileListIdFrontInsured' && that.id == '2') {
name = 'fileListIdFrontInsured'
imageInfoType = '5'
this.fileListIdFrontInsured = {
url: config.imgDomain + `/returnImageStream?a=b.jpg&imgPath=${res.path}`,
}
} else if (that.type == 'fileListIdBackInsured' && that.id == '2') {
name = 'fileListIdBackInsured'
imageInfoType = '6'
this.fileListIdBackInsured = {
url: config.imgDomain + `/returnImageStream?a=b.jpg&imgPath=${res.path}`,
}
} else if (that.type == 'fileListIdFrontInsured' && that.id == '3') {
name = 'fileListIdFrontInsured'
imageInfoType = '7'
this.fileListIdFrontInsured = {
url: config.imgDomain + `/returnImageStream?a=b.jpg&imgPath=${res.path}`,
}
} else if (that.type == 'fileListIdBackInsured' && that.id == '3') {
name = 'fileListIdBackInsured'
imageInfoType = '12'
this.fileListIdBackInsured = {
url: config.imgDomain + `/returnImageStream?a=b.jpg&imgPath=${res.path}`,
}
} else if (that.type == 'fileLIstImgInsured' && that.id == '4') {
name = 'fileLIstImgInsured'
imageInfoType = '8'
this.fileLIstImgInsured = {
url: config.imgDomain + `/returnImageStream?a=b.jpg&imgPath=${res.path}`,
}
} else if (that.type == 'fileListIdFrontInsured' && that.id == '5') {
name = 'fileListIdFrontInsured'
imageInfoType = '9'
this.fileListIdFrontInsured = {
url: config.imgDomain + `/returnImageStream?a=b.jpg&imgPath=${res.path}`,
}
} else if (that.type == 'fileListIdBackInsured' && that.id == '5') {
name = 'fileListIdBackInsured'
imageInfoType = '13'
this.fileListIdBackInsured = {
url: config.imgDomain + `/returnImageStream?a=b.jpg&imgPath=${res.path}`,
}
} else if (that.type == 'fileListIdFrontInsured' && that.id == '6') {
name = 'fileListIdFrontInsured'
imageInfoType = '10'
this.fileListIdFrontInsured = {
url: config.imgDomain + `/returnImageStream?a=b.jpg&imgPath=${res.path}`,
}
} else if (that.type == 'fileListIdBackInsured' && that.id == '6') {
name = 'fileListIdBackInsured'
imageInfoType = '14'
this.fileListIdBackInsured = {
url: config.imgDomain + `/returnImageStream?a=b.jpg&imgPath=${res.path}`,
}
} else if (that.type == 'fileListIdFrontInsured' && that.id == '8') {
name = 'fileListIdFrontInsured'
imageInfoType = '15'
this.fileListIdFrontInsured = {
url: config.imgDomain + `/returnImageStream?a=b.jpg&imgPath=${res.path}`,
}
} else if (that.type == 'fileListIdBackInsured' && that.id == '8') {
name = 'fileListIdBackInsured'
imageInfoType = '16'
this.fileListIdBackInsured = {
url: config.imgDomain + `/returnImageStream?a=b.jpg&imgPath=${res.path}`,
}
} else if (that.type == 'fileListIdFrontInsured' && that.id == '9') {
name = 'fileListIdFrontInsured'
imageInfoType = '17'
this.fileListIdFrontInsured = {
url: config.imgDomain + `/returnImageStream?a=b.jpg&imgPath=${res.path}`,
}
} else if (that.type == 'fileListIdBackInsured' && that.id == '9') {
name = 'fileListIdBackInsured'
imageInfoType = '18'
this.fileListIdBackInsured = {
url: config.imgDomain + `/returnImageStream?a=b.jpg&imgPath=${res.path}`,
}
} else if (that.type == 'fileListNotifyInsured') {
name = 'fileListNotifyInsured'
imageInfoType = '24'
this.fileListNotifyInsured = {
url: config.imgDomain + `/returnImageStream?a=b.jpg&imgPath=${res.path}`,
}
}
let obj = {
name: name,
businessNo: that.orderNo,
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 == 'fileListIdFrontBeneficiary' || that.type == 'fileListIdBackBeneficiary' || that.type == 'fileLIstImgBeneficiary') {
// 是收益人
// 证件类型
let imageInfoType = ''
let name = ''
if (that.type == 'fileListIdFrontBeneficiary' && that.id == '1') {
name = 'fileListIdFrontBeneficiary'
imageInfoType = '1'
that.saleBtnfPersonInfo.forEach((item,index)=>{
if(item.bnfId == that.bnfId){
this.bnfInfo[index].fileListIdFrontBeneficiary = {
url: config.imgDomain + `/returnImageStream?a=b.jpg&imgPath=${res.path}`,
}
}
})
} else if (that.type == 'fileListIdBackBeneficiary' && that.id == '1') {
name = 'fileListIdBackBeneficiary'
imageInfoType = '2'
that.saleBtnfPersonInfo.forEach((item,index)=>{
if(item.bnfId == that.bnfId){
this.bnfInfo[index].fileListIdBackBeneficiary = {
url: config.imgDomain + `/returnImageStream?a=b.jpg&imgPath=${res.path}`,
}
}
})
} else if (that.type == 'fileListIdFrontBeneficiary' && that.id == '2') {
name = 'fileListIdFrontBeneficiary'
imageInfoType = '5'
that.saleBtnfPersonInfo.forEach((item,index)=>{
if(item.bnfId == that.bnfId){
this.bnfInfo[index].fileListIdFrontBeneficiary = {
url: config.imgDomain + `/returnImageStream?a=b.jpg&imgPath=${res.path}`,
}
}
})
} else if (that.type == 'fileListIdBackBeneficiary' && that.id == '2') {
name = 'fileListIdBackBeneficiary'
imageInfoType = '6'
that.saleBtnfPersonInfo.forEach((item,index)=>{
if(item.bnfId == that.bnfId){
this.bnfInfo[index].fileListIdBackBeneficiary = {
url: config.imgDomain + `/returnImageStream?a=b.jpg&imgPath=${res.path}`,
}
}
})
} else if (that.type == 'fileListIdFrontBeneficiary' && that.id == '3') {
name = 'fileListIdFrontBeneficiary'
imageInfoType = '7'
that.saleBtnfPersonInfo.forEach((item,index)=>{
if(item.bnfId == that.bnfId){
this.bnfInfo[index].fileListIdFrontBeneficiary = {
url: config.imgDomain + `/returnImageStream?a=b.jpg&imgPath=${res.path}`,
}
}
})
} else if (that.type == 'fileListIdBackBeneficiary' && that.id == '3') {
name = 'fileListIdBackBeneficiary'
imageInfoType = '12'
that.saleBtnfPersonInfo.forEach((item,index)=>{
if(item.bnfId == that.bnfId){
this.bnfInfo[index].fileListIdBackBeneficiary = {
url: config.imgDomain + `/returnImageStream?a=b.jpg&imgPath=${res.path}`,
}
}
})
} else if (that.type == 'fileLIstImgBeneficiary' && that.id == '4') {
name = 'fileLIstImgBeneficiary'
imageInfoType = '8'
that.saleBtnfPersonInfo.forEach((item,index)=>{
if(item.bnfId == that.bnfId){
this.bnfInfo[index].fileLIstImgBeneficiary = {
url: config.imgDomain + `/returnImageStream?a=b.jpg&imgPath=${res.path}`,
}
}
})
} else if (that.type == 'fileListIdFrontBeneficiary' && that.id == '5') {
name = 'fileListIdFrontBeneficiary'
imageInfoType = '9'
that.saleBtnfPersonInfo.forEach((item,index)=>{
if(item.bnfId == that.bnfId){
this.bnfInfo[index].fileListIdFrontBeneficiary = {
url: config.imgDomain + `/returnImageStream?a=b.jpg&imgPath=${res.path}`,
}
}
})
} else if (that.type == 'fileListIdBackBeneficiary' && that.id == '5') {
name = 'fileListIdBackBeneficiary'
imageInfoType = '13'
that.saleBtnfPersonInfo.forEach((item,index)=>{
if(item.bnfId == that.bnfId){
this.bnfInfo[index].fileListIdBackBeneficiary = {
url: config.imgDomain + `/returnImageStream?a=b.jpg&imgPath=${res.path}`,
}
}
})
} else if (that.type == 'fileListIdFrontBeneficiary' && that.id == '6') {
name = 'fileListIdFrontBeneficiary'
imageInfoType = '10'
that.saleBtnfPersonInfo.forEach((item,index)=>{
if(item.bnfId == that.bnfId){
this.bnfInfo[index].fileListIdFrontBeneficiary = {
url: config.imgDomain + `/returnImageStream?a=b.jpg&imgPath=${res.path}`,
}
}
})
} else if (that.type == 'fileListIdBackBeneficiary' && that.id == '6') {
name = 'fileListIdBackBeneficiary'
imageInfoType = '14'
that.saleBtnfPersonInfo.forEach((item,index)=>{
if(item.bnfId == that.bnfId){
this.bnfInfo[index].fileListIdBackBeneficiary = {
url: config.imgDomain + `/returnImageStream?a=b.jpg&imgPath=${res.path}`,
}
}
})
} else if (that.type == 'fileListIdFrontBeneficiary' && that.id == '8') {
name = 'fileListIdFrontBeneficiary'
imageInfoType = '15'
that.saleBtnfPersonInfo.forEach((item,index)=>{
if(item.bnfId == that.bnfId){
this.bnfInfo[index].fileListIdFrontBeneficiary = {
url: config.imgDomain + `/returnImageStream?a=b.jpg&imgPath=${res.path}`,
}
}
})
} else if (that.type == 'fileListIdBackBeneficiary' && that.id == '8') {
name = 'fileListIdBackBeneficiary'
imageInfoType = '16'
that.saleBtnfPersonInfo.forEach((item,index)=>{
if(item.bnfId == that.bnfId){
this.bnfInfo[index].fileListIdBackBeneficiary = {
url: config.imgDomain + `/returnImageStream?a=b.jpg&imgPath=${res.path}`,
}
}
})
} else if (that.type == 'fileListIdFrontBeneficiary' && that.id == '9') {
name = 'fileListIdFrontBeneficiary'
imageInfoType = '17'
that.saleBtnfPersonInfo.forEach((item,index)=>{
if(item.bnfId == that.bnfId){
this.bnfInfo[index].fileListIdFrontBeneficiary = {
url: config.imgDomain + `/returnImageStream?a=b.jpg&imgPath=${res.path}`,
}
}
})
} else if (that.type == 'fileListIdBackBeneficiary' && that.id == '9') {
name = 'fileListIdBackBeneficiary'
imageInfoType = '18'
that.saleBtnfPersonInfo.forEach((item,index)=>{
if(item.bnfId == that.bnfId){
this.bnfInfo[index].fileListIdBackBeneficiary = {
url: config.imgDomain + `/returnImageStream?a=b.jpg&imgPath=${res.path}`,
}
}
})
}
let obj = {
name: name,
businessNo: that.orderNo,
businessType: '',
imageInfoType: imageInfoType,
rgssUrl: encodeURI(res.path).replace(/\+/g, '%2B'),
subBusinessType: '3',
subBusinessNo: that.bnfId,
fileName: that.imgName,
}
this.imageType = imageInfoType
that.list.push(obj)
}
else if (that.type == 'fileListOther') {
// 是其他
let type = '2'
let name = 'fileListOther'
this.fileListOther = {
url: config.imgDomain + `/returnImageStream?a=b.jpg&imgPath=${res.path}`,
}
let obj = {
name: name,
businessNo: that.orderNo,
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 == 'fileListNotify') {
uploadImg(formdata).then(res=>{
if(res.result == 0 && res.path){
let subBusinessNo = ''
if (
that.type == 'fileListIdFront' ||
that.type == 'fileListIdBack' ||
that.type == 'fileLIstImg' ||
that.type == 'fileListBank' ||
that.type == 'fileListNotify' ||
that.type == 'saleInsuredInfoOther'
){
subBusinessNo = that.saleInsuredInfo.appntId
}
else if (
that.type == 'fileListIdFrontInsured' ||
that.type == 'fileListIdBackInsured' ||
that.type == 'fileListBankInsured' ||
that.type == 'fileLIstImgInsured' ||
that.type == 'fileListNotifyInsured' ||
that.type == 'saleInsuredPersonInfoOther'
){
subBusinessNo = that.saleInsuredPersonInfo.insuredId
} else if (
that.type == 'fileListIdFrontBeneficiary' ||
that.type == 'fileListIdBackBeneficiary' ||
that.type == 'fileLIstImgBeneficiary'
){
subBusinessNo = that.bnfId
} else if (that.type == 'fileListOther'){
subBusinessNo = ''
}
}
let obj = {
name: name,
businessNo: that.orderNo,
businessType: '',
imageInfoType: that.imageType,
rgssUrl: encodeURI(res.path).replace(/\+/g, '%2B'),
subBusinessType: '0',
subBusinessNo: 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' || that.type == 'fileListIdFrontBeneficiary'|| that.type == 'fileListIdBackBeneficiary'){
if(that.id == '1' && this.imageType == '1' && that.type == 'fileListIdFront'){
//投保人身份证正面
this.IDCardOCRValite(that.id, this.orderNo, imgPath, 'FRONT', 'appentFront')
}else if(that.id == '1' && this.imageType == '2' && that.type == 'fileListIdBack'){
//投保人身份证反面
this.IDCardOCRValite(that.id, this.orderNo, imgPath, 'BACK', 'appentBack')
}else if(that.id == '1' && this.imageType == '1' && that.type == 'fileListIdFrontInsured'){
//被保人身份证正面
this.IDCardOCRValite(that.id, this.orderNo, imgPath, 'FRONT', 'insuredFront')
}else if(that.id == '1' && this.imageType == '2' && that.type == 'fileListIdBackInsured'){
//被保人身份证反面
this.IDCardOCRValite(that.id, this.orderNo, imgPath, 'BACK', 'insuredBack')
}else if(that.id == '1' && this.imageType == '1' && that.type == 'fileListIdFrontBeneficiary'){
//受益人身份证正面
this.IDCardOCRValite(that.id, this.orderNo, imgPath, 'FRONT', 'beneficiaryFront')
}else if(that.id == '1' && this.imageType == '2' && that.type == 'fileListIdBackBeneficiary'){
//受益人身份证反面
this.IDCardOCRValite(that.id, this.orderNo, imgPath, 'BACK', 'beneficiaryBack')
}else {
//其他素材(护照,户口本,港澳身份证等)
this.IDCardOCRValite(that.id, this.orderNo, 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
}
if(that.type == 'fileListIdFrontBeneficiary'){
that.saleBtnfPersonInfo.forEach((item,index)=>{
if(item.bnfId == that.bnfId){
that.bnfInfo[index].fileListIdFrontBeneficiary = []
}
})
}
if(that.type == 'fileListIdBackBeneficiary'){
that.saleBtnfPersonInfo.forEach((item,index)=>{
if(item.bnfId == that.bnfId){
that.bnfInfo[index].fileListIdBackBeneficiary = []
}
})
}
if(that.type == 'fileLIstImgBeneficiary'){
that.saleBtnfPersonInfo.forEach((item,index)=>{
if(item.bnfId == that.bnfId){
that.bnfInfo[index].fileLIstImgBeneficiary = []
}
})
}
this.$toast.clear()
//只有身份证件才进行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 {
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
}
if(that.type == 'fileListIdFrontBeneficiary'){
that.saleBtnfPersonInfo.forEach((item,index)=>{
if(item.bnfId == that.bnfId){
that.bnfInfo[index].fileListIdFrontBeneficiary = []
}
})
}
if(that.type == 'fileListIdBackBeneficiary'){
that.saleBtnfPersonInfo.forEach((item,index)=>{
if(item.bnfId == that.bnfId){
that.bnfInfo[index].fileListIdBackBeneficiary = []
}
})
}
if(that.type == 'fileLIstImgBeneficiary'){
that.saleBtnfPersonInfo.forEach((item,index)=>{
if(item.bnfId == that.bnfId){
that.bnfInfo[index].fileLIstImgBeneficiary = []
}
})
}
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
}
if(that.type == 'fileListIdFrontBeneficiary'){
}else{
if(that.bnfId){
that.saleBtnfPersonInfo.forEach((item,index)=>{
if(item.bnfId == that.bnfId){
that.bnfInfo[index].fileListIdFrontBeneficiary = []
that.bnfInfo[index][that.type]= []
}
})
} else {
that[that.type] = []
}
if(that.type == 'fileListIdBackBeneficiary'){
that.saleBtnfPersonInfo.forEach((item,index)=>{
if(item.bnfId == that.bnfId){
that.bnfInfo[index].fileListIdBackBeneficiary = []
}
})
}
if(that.type == 'fileLIstImgBeneficiary'){
that.saleBtnfPersonInfo.forEach((item,index)=>{
if(item.bnfId == that.bnfId){
that.bnfInfo[index].fileLIstImgBeneficiary = []
}
})
}
if(that.type == 'fileListIdFrontBeneficiary'){
that.saleBtnfPersonInfo.forEach((item,index)=>{
if(item.bnfId == that.bnfId){
that.bnfInfo[index].fileListIdFrontBeneficiary = []
}
})
}
if(that.type == 'fileListIdBackBeneficiary'){
that.saleBtnfPersonInfo.forEach((item,index)=>{
if(item.bnfId == that.bnfId){
that.bnfInfo[index].fileListIdBackBeneficiary = []
}
})
}
if(that.type == 'fileLIstImgBeneficiary'){
that.saleBtnfPersonInfo.forEach((item,index)=>{
if(item.bnfId == that.bnfId){
that.bnfInfo[index].fileLIstImgBeneficiary = []
}
})
}
this.$toast('网络环境不佳,图片上传失败,请切换移动网络或稍后重试')
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) {
@@ -1554,6 +925,12 @@ export default {
},
IDCardOCRValite(idType, orderNo, imgPath, cardSide, flag){
this.$toast.loading({
duration: 0, // 持续展示 toast
forbidClick: true, // 禁用背景点击
loadingType: 'spinner',
message: '加载中……',
})
let param = {
idType : idType,
orderNo : orderNo,
@@ -1562,6 +939,7 @@ export default {
}
//调用身份证OCR识别
IDCardOCR(param).then((res) => {
this.$toast.clear()
if(res.result == '0'){
//不校验OCR直接返回
if(res.content == '' || res.content == null){