上传附件页面关于图片删除逻辑代码修改

This commit is contained in:
liu.xiaofeng@ebiz-digits.com
2023-07-20 10:36:04 +08:00
parent 1040189bd4
commit 55f430d9d2

View File

@@ -9,15 +9,7 @@
<van-field required label="银行卡账户" disabled /> <van-field required label="银行卡账户" disabled />
</van-cell-group> </van-cell-group>
<div @click="test('fileListBank', saleInsuredInfo.idType)"> <div @click="test('fileListBank', saleInsuredInfo.idType)">
<van-uploader <van-uploader name="fileListBank" v-model="fileListBank" :after-read="afterRead" @delete="deleteImg" :before-delete="beforeDelete" class="mt10 ml20" :max-count="1"/>
name="fileListBank"
v-model="fileListBank"
:after-read="afterRead"
@delete="deleteImg"
:before-delete="beforeDelete"
class="mt10 ml20"
:max-count="1"
/>
</div> </div>
</div> </div>
<div v-else> <div v-else>
@@ -35,29 +27,13 @@
<van-field required :label="item.id == '2' ? `${item.text}户主页` : `${item.text}正面`" disabled /> <van-field required :label="item.id == '2' ? `${item.text}户主页` : `${item.text}正面`" disabled />
</van-cell-group> </van-cell-group>
<div @click="test('fileListIdFront', saleInsuredInfo.idType)" class="flex align-items-e"> <div @click="test('fileListIdFront', saleInsuredInfo.idType)" class="flex align-items-e">
<van-uploader <van-uploader name="fileListIdFront" v-model="fileListIdFront" :after-read="afterRead" :before-delete="beforeDelete" class="mt10 ml20" :max-count="1" @delete="deleteImg"/>
name="fileListIdFront"
v-model="fileListIdFront"
:after-read="afterRead"
:before-delete="beforeDelete"
class="mt10 ml20"
:max-count="1"
@delete="deleteImg"
/>
</div> </div>
<van-cell-group> <van-cell-group>
<van-field required :label="item.id == '2' ? `${item.text}本人页` : `${item.text}反面`" disabled /> <van-field required :label="item.id == '2' ? `${item.text}本人页` : `${item.text}反面`" disabled />
</van-cell-group> </van-cell-group>
<div @click="test('fileListIdBack', saleInsuredInfo.idType)"> <div @click="test('fileListIdBack', saleInsuredInfo.idType)">
<van-uploader <van-uploader name="fileListIdBack" v-model="fileListIdBack" :after-read="afterRead" @delete="deleteImg" :before-delete="beforeDelete" class="mt10 ml20" :max-count="1"/>
name="fileListIdBack"
v-model="fileListIdBack"
:after-read="afterRead"
@delete="deleteImg"
:before-delete="beforeDelete"
class="mt10 ml20"
:max-count="1"
/>
</div> </div>
</div> </div>
<div v-if="item.id == '4'"> <div v-if="item.id == '4'">
@@ -65,15 +41,7 @@
<van-field required :label="`${item.text}头像面`" disabled /> <van-field required :label="`${item.text}头像面`" disabled />
</van-cell-group> </van-cell-group>
<div @click="test('fileLIstImg', saleInsuredInfo.idType)"> <div @click="test('fileLIstImg', saleInsuredInfo.idType)">
<van-uploader <van-uploader name="fileLIstImg" v-model="fileLIstImg" :after-read="afterRead" @delete="deleteImg" :before-delete="beforeDelete" class="mt10 ml20" :max-count="1"/>
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>
@@ -82,29 +50,13 @@
<van-field required label="银行卡正面" disabled /> <van-field required label="银行卡正面" disabled />
</van-cell-group> </van-cell-group>
<div @click="test('fileListBank', saleInsuredInfo.idType)"> <div @click="test('fileListBank', saleInsuredInfo.idType)">
<van-uploader <van-uploader name="fileListBank" v-model="fileListBank" :after-read="afterRead" @delete="deleteImg" :before-delete="beforeDelete" class="mt10 ml20" :max-count="1"/>
name="fileListBank"
v-model="fileListBank"
:after-read="afterRead"
@delete="deleteImg"
:before-delete="beforeDelete"
class="mt10 ml20"
:max-count="1"
/>
</div> </div>
<van-cell-group v-if="isNotify"> <van-cell-group v-if="isNotify">
<van-field label="健康告知异常类资料" disabled /> <van-field label="健康告知异常类资料" disabled />
</van-cell-group> </van-cell-group>
<div v-if="isNotify" @click="test('fileListNotify', saleInsuredInfo.idType)"> <div v-if="isNotify" @click="test('fileListNotify', saleInsuredInfo.idType)">
<van-uploader <van-uploader name="fileListNotify" v-model="fileListNotify" :after-read="afterRead" @delete="deleteImg" :before-delete="beforeDelete" class="mt10 ml20" :max-count="20"/>
name="fileListNotify"
v-model="fileListNotify"
:after-read="afterRead"
@delete="deleteImg"
:before-delete="beforeDelete"
class="mt10 ml20"
:max-count="20"
/>
</div> </div>
</div> </div>
</div> </div>
@@ -123,29 +75,13 @@
<van-field required :label="item.id == '2' ? `${item.text}户主页` : `${item.text}正面`" disabled /> <van-field required :label="item.id == '2' ? `${item.text}户主页` : `${item.text}正面`" disabled />
</van-cell-group> </van-cell-group>
<div @click="test('fileListIdFrontInsured', saleInsuredPersonInfo.idType)"> <div @click="test('fileListIdFrontInsured', saleInsuredPersonInfo.idType)">
<van-uploader <van-uploader name="fileListIdFrontInsured" v-model="fileListIdFrontInsured" :after-read="afterRead" :before-delete="beforeDelete" @delete="deleteImg" class="mt10 ml20" :max-count="1"/>
name="fileListIdFrontInsured"
v-model="fileListIdFrontInsured"
:after-read="afterRead"
:before-delete="beforeDelete"
@delete="deleteImg"
class="mt10 ml20"
:max-count="1"
/>
</div> </div>
<van-cell-group> <van-cell-group>
<van-field required :label="item.id == '2' ? `${item.text}本人页` : `${item.text}反面`" disabled /> <van-field required :label="item.id == '2' ? `${item.text}本人页` : `${item.text}反面`" disabled />
</van-cell-group> </van-cell-group>
<div @click="test('fileListIdBackInsured', saleInsuredPersonInfo.idType)"> <div @click="test('fileListIdBackInsured', saleInsuredPersonInfo.idType)">
<van-uploader <van-uploader name="fileListIdBackInsured" v-model="fileListIdBackInsured" :after-read="afterRead" :before-delete="beforeDelete" @delete="deleteImg" class="mt10 ml20" :max-count="1"/>
name="fileListIdBackInsured"
v-model="fileListIdBackInsured"
:after-read="afterRead"
:before-delete="beforeDelete"
@delete="deleteImg"
class="mt10 ml20"
:max-count="1"
/>
</div> </div>
</div> </div>
<div v-if="item.id == '4'"> <div v-if="item.id == '4'">
@@ -153,15 +89,7 @@
<van-field required :label="`${item.text}头像页`" disabled /> <van-field required :label="`${item.text}头像页`" disabled />
</van-cell-group> </van-cell-group>
<div @click="test('fileLIstImgInsured', saleInsuredPersonInfo.idType)"> <div @click="test('fileLIstImgInsured', saleInsuredPersonInfo.idType)">
<van-uploader <van-uploader name="fileLIstImgInsured" v-model="fileLIstImgInsured" :after-read="afterRead" :before-delete="beforeDelete" @delete="deleteImg" class="mt10 ml20" :max-count="1"/>
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>
@@ -170,15 +98,7 @@
<van-field label="健康告知异常类资料" disabled /> <van-field label="健康告知异常类资料" disabled />
</van-cell-group> </van-cell-group>
<div v-if="isNotifyInsured" @click="test('fileListNotifyInsured', saleInsuredInfo.idType)"> <div v-if="isNotifyInsured" @click="test('fileListNotifyInsured', saleInsuredInfo.idType)">
<van-uploader <van-uploader name="fileListNotifyInsured" v-model="fileListNotifyInsured" :after-read="afterRead" @delete="deleteImg" :before-delete="beforeDelete" class="mt10 ml20" :max-count="20"/>
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>
@@ -198,29 +118,13 @@
<van-field required :label="item.id == '2' ? `${item01.name}+${item.text}户主页` : `${item01.name}+${item.text}正面`" disabled /> <van-field required :label="item.id == '2' ? `${item01.name}+${item.text}户主页` : `${item01.name}+${item.text}正面`" disabled />
</van-cell-group> </van-cell-group>
<div @click="test('fileListIdFrontBeneficiary', item01.idType, item01.bnfId)"> <div @click="test('fileListIdFrontBeneficiary', item01.idType, item01.bnfId)">
<van-uploader <van-uploader :name="'fileListIdFrontBeneficiary'+index01" v-model="bnfInfo[index01].fileListIdFrontBeneficiary" :after-read="afterRead" :before-delete="beforeDelete" @delete="deleteImg" class="mt10 ml20" :max-count="1"/>
:name="'fileListIdFrontBeneficiary'+index01"
v-model="bnfInfo[index01].fileListIdFrontBeneficiary"
:after-read="afterRead"
:before-delete="beforeDelete"
@delete="deleteImg"
class="mt10 ml20"
:max-count="1"
/>
</div> </div>
<van-cell-group> <van-cell-group>
<van-field required :label="item.id == '2' ? `${item01.name}+${item.text}本人页` : `${item01.name}+${item.text}反面`" disabled /> <van-field required :label="item.id == '2' ? `${item01.name}+${item.text}本人页` : `${item01.name}+${item.text}反面`" disabled />
</van-cell-group> </van-cell-group>
<div @click="test('fileListIdBackBeneficiary', item01.idType, item01.bnfId)"> <div @click="test('fileListIdBackBeneficiary', item01.idType, item01.bnfId)">
<van-uploader <van-uploader :name="'fileListIdBackBeneficiary'+index01" v-model="bnfInfo[index01].fileListIdBackBeneficiary" :after-read="afterRead" :before-delete="beforeDelete" @delete="deleteImg" class="mt10 ml20" :max-count="1"/>
: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> </div>
<div v-if="item.id == '4'"> <div v-if="item.id == '4'">
@@ -228,15 +132,7 @@
<van-field required :label="`${item01.name}+${item.text}头像页`" disabled /> <van-field required :label="`${item01.name}+${item.text}头像页`" disabled />
</van-cell-group> </van-cell-group>
<div @click="test('fileLIstImgBeneficiary', item01.idType, item01.bnfId)"> <div @click="test('fileLIstImgBeneficiary', item01.idType, item01.bnfId)">
<van-uploader <van-uploader :name="'fileLIstImgBeneficiary'+index01" v-model="bnfInfo[index01].fileLIstImgBeneficiary" :after-read="afterRead" :before-delete="beforeDelete" @delete="deleteImg" class="mt10 ml20" :max-count="1"/>
: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>
@@ -251,16 +147,9 @@
</van-radio-group> </van-radio-group>
</div> </div>
<div class="bg-white bottom-btn"> <div class="bg-white bottom-btn">
<van-button <van-button type="danger" class="attachmentManagement-next" size="large" :disabled="!(isDisabled == false && isDisabledBnf == false)" @click="next" @touchstart="beforeNext(isDisabled)" v-no-more-click="1000">
type="danger" 下一步
class="attachmentManagement-next" </van-button>
size="large"
:disabled="!(isDisabled == false && isDisabledBnf == false)"
@click="next"
@touchstart="beforeNext(isDisabled)"
v-no-more-click="1000"
>下一步</van-button
>
</div> </div>
</div> </div>
</template> </template>
@@ -662,7 +551,6 @@ export default {
}, },
// 删除图片前 // 删除图片前
beforeDelete(file, detail) { beforeDelete(file, detail) {
let that = this
Dialog.confirm({ Dialog.confirm({
title: '提示', title: '提示',
message: '您确定要删除吗', message: '您确定要删除吗',
@@ -679,8 +567,6 @@ export default {
} else if (detail.name == 'fileListBank') { } else if (detail.name == 'fileListBank') {
this.fileListBank = [] this.fileListBank = []
this.deleteImg(file, 'fileListBank') this.deleteImg(file, 'fileListBank')
// } else if (detail.name == 'fileListBankBack') {
// this.fileListBankBack = []
} else if (detail.name == 'fileListIdFrontInsured') { } else if (detail.name == 'fileListIdFrontInsured') {
this.fileListIdFrontInsured = [] this.fileListIdFrontInsured = []
this.deleteImg(file, 'fileListIdFrontInsured') this.deleteImg(file, 'fileListIdFrontInsured')
@@ -693,26 +579,12 @@ export default {
} else if (detail.name == 'fileLIstImgInsured') { } else if (detail.name == 'fileLIstImgInsured') {
this.fileLIstImgInsured = [] this.fileLIstImgInsured = []
this.deleteImg(file, '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') { } else if (detail.name == 'saleInsuredInfoOther') {
this.saleInsuredInfoOther = [] this.saleInsuredInfoOther = []
this.deleteImg(file, 'saleInsuredInfoOther') this.deleteImg(file, 'saleInsuredInfoOther')
} else if (detail.name == 'saleInsuredPersonInfoOther') { } else if (detail.name == 'saleInsuredPersonInfoOther') {
this.saleInsuredPersonInfoOther = [] this.saleInsuredPersonInfoOther = []
this.deleteImg(file, '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.indexOf('fileListIdFrontBeneficiary') != -1) { } else if (detail.name.indexOf('fileListIdFrontBeneficiary') != -1) {
//单独处理受益人影像删除通过name值查询到当前收益指的索引值下标操作data数据中定义的数据 //单独处理受益人影像删除通过name值查询到当前收益指的索引值下标操作data数据中定义的数据
let detailIndex = detail.name.substring(26,detail.name.length) let detailIndex = detail.name.substring(26,detail.name.length)
@@ -819,22 +691,19 @@ export default {
// 删除图片 // 删除图片
deleteImg(file, nameList) { deleteImg(file, nameList) {
let that = this let that = this
that.list.map((item, index, array) => { debugger
// if (item.fileName.indexOf(file.file.name) == -1) { that.list.forEach((item, index) => {
// return
// } else {
// array.splice(index, 1)
// }
if (item.fileName == file.name && nameList == item.name) { if (item.fileName == file.name && nameList == item.name) {
array.splice(index, 1) that.list.splice(index, 1)
} }
//单独处理受益人影像删除通过bnfId查询到删除某条数据 //单独处理受益人影像删除通过bnfId查询到删除某条数据
if(nameList == 'fileListIdFrontBeneficiary' || nameList == 'fileListIdBackBeneficiary' || nameList == 'fileLIstImgBeneficiary'){ if(nameList == 'fileListIdFrontBeneficiary' || nameList == 'fileListIdBackBeneficiary' || nameList == 'fileLIstImgBeneficiary'){
if (item.fileName == file.name && item.subBusinessNo == that.bnfId) { if (item.fileName == file.name && item.subBusinessNo == that.bnfId) {
array.splice(index, 1) that.list.splice(index, 1)
} }
} }
}) })
debugger
}, },
afterRead(file) { afterRead(file) {
let that = this let that = this
@@ -883,40 +752,18 @@ export default {
if (res.result == '0') { if (res.result == '0') {
this.$toast.clear() this.$toast.clear()
if(res.result == 0 && res.path){ if(res.result == 0 && res.path){
if (that.type == 'fileListIdFront' || that.type == 'fileListIdBack' || that.type == 'fileLIstImg' || that.type == 'fileListBank' || that.type == 'fileListNotify' || that.type == 'saleInsuredInfoOther') {
let imgPath = res.path
//只有身份证件才进行ocr校验
if(that.type == 'fileListIdFront' ||
that.type == 'fileListIdBack' ||
that.type == 'fileListIdFrontInsured' ||
that.type == 'fileListIdBackInsured' ||
that.type == 'fileListIdFrontBeneficiary'||
that.type == 'fileListIdBackBeneficiary'){
if(that.id == '1' && that.type == 'fileListIdFront'){
//投保人身份证正面
this.IDCardOCRValite(that.id, this.orderNo, imgPath, 'FRONT', 'fileListIdFront')
}else if(that.id == '1' && that.type == 'fileListIdBack'){
//投保人身份证反面
this.IDCardOCRValite(that.id, this.orderNo, imgPath, 'BACK', 'fileListIdBack')
}else if(that.id == '1' && that.type == 'fileListIdFrontInsured'){
//被保人身份证正面
this.IDCardOCRValite(that.id, this.orderNo, imgPath, 'FRONT', 'fileListIdFrontInsured')
}else if(that.id == '1' && that.type == 'fileListIdBackInsured'){
//被保人身份证反面
this.IDCardOCRValite(that.id, this.orderNo, imgPath, 'BACK', 'fileListIdBackInsured')
}else if(that.id == '1' && that.type == 'fileListIdFrontBeneficiary'){
//受益人身份证正面
this.IDCardOCRValite(that.id, this.orderNo, imgPath, 'FRONT', 'fileListIdFrontBeneficiary')
}else if(that.id == '1' && that.type == 'fileListIdBackBeneficiary'){
//受益人身份证反面
this.IDCardOCRValite(that.id, this.orderNo, imgPath, 'BACK', 'fileListIdBackBeneficiary')
}
}
if (that.type == 'fileLIstImg' || that.type == 'fileListBank' || that.type == 'fileListNotify' || that.type == 'saleInsuredInfoOther') {
let imageInfoType = '' let imageInfoType = ''
let name = '' let name = ''
if (that.type == 'fileListIdFront' && that.id == '2') { 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' name = 'fileListIdFront'
imageInfoType = '5' imageInfoType = '5'
@@ -976,6 +823,7 @@ export default {
name = 'fileListNotify' name = 'fileListNotify'
imageInfoType = '24' imageInfoType = '24'
} }
this.imageType = imageInfoType
let obj = { let obj = {
name: name, name: name,
businessNo: that.orderNo, businessNo: that.orderNo,
@@ -986,27 +834,20 @@ export default {
subBusinessNo: that.saleInsuredInfo.appntId, subBusinessNo: that.saleInsuredInfo.appntId,
fileName: that.imgName, fileName: that.imgName,
} }
if(that.list && that.list.length != 0){
let thisIndex = ''
let thisFlag = false
that.list.forEach((item,index)=>{
if(item.imageInfoType == imageInfoType){
thisFlag = true
thisIndex = index
}
})
if(thisFlag){
that.list.slice(thisIndex,1)
}
}
that.list.push(obj) that.list.push(obj)
} }
else if (that.type == 'fileListBankInsured' || that.type == 'fileLIstImgInsured' || that.type == 'fileListNotifyInsured' || that.type == 'saleInsuredPersonInfoOther') { else if (that.type == 'fileListIdFrontInsured' || that.type == 'fileListIdBackInsured' || that.type == 'fileListBankInsured' || that.type == 'fileLIstImgInsured' || that.type == 'fileListNotifyInsured' || that.type == 'saleInsuredPersonInfoOther') {
// 是被保险人 // 是被保险人
// 证件类型 // 证件类型
let imageInfoType = '' let imageInfoType = ''
let name = '' let name = ''
if (that.type == 'fileListIdFrontInsured' && that.id == '2') { 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' name = 'fileListIdFrontInsured'
imageInfoType = '5' imageInfoType = '5'
} else if (that.type == 'fileListIdBackInsured' && that.id == '2') { } else if (that.type == 'fileListIdBackInsured' && that.id == '2') {
@@ -1049,7 +890,7 @@ export default {
name = 'fileListNotifyInsured' name = 'fileListNotifyInsured'
imageInfoType = '24' imageInfoType = '24'
} }
this.imageType = imageInfoType
let obj = { let obj = {
name: name, name: name,
businessNo: that.orderNo, businessNo: that.orderNo,
@@ -1060,29 +901,21 @@ export default {
subBusinessNo: that.saleInsuredPersonInfo.insuredId, subBusinessNo: that.saleInsuredPersonInfo.insuredId,
fileName: that.imgName, fileName: that.imgName,
} }
this.imageType = imageInfoType
if(that.list && that.list.length != 0){
let thisIndex = ''
let thisFlag = false
that.list.forEach((item,index)=>{
if(item.imageInfoType == imageInfoType){
thisFlag = true
thisIndex = index
}
})
if(thisFlag){
that.list.slice(thisIndex,1)
}
}
that.list.push(obj) that.list.push(obj)
} }
else if (that.type == 'fileLIstImgBeneficiary') { else if (that.type == 'fileListIdFrontBeneficiary' || that.type == 'fileListIdBackBeneficiary' || that.type == 'fileLIstImgBeneficiary') {
// 是收益人 // 是收益人
// 证件类型 // 证件类型
let imageInfoType = '' let imageInfoType = ''
let name = '' let name = ''
if (that.type == 'fileListIdFrontBeneficiary' && that.id == '2') { if (that.type == 'fileListIdFrontBeneficiary' && that.id == '1') {
name = 'fileListIdFrontBeneficiary'
imageInfoType = '1'
} else if (that.type == 'fileListIdBackBeneficiary' && that.id == '1') {
name = 'fileListIdBackBeneficiary'
imageInfoType = '2'
} else if (that.type == 'fileListIdFrontBeneficiary' && that.id == '2') {
name = 'fileListIdFrontBeneficiary' name = 'fileListIdFrontBeneficiary'
imageInfoType = '5' imageInfoType = '5'
} else if (that.type == 'fileListIdBackBeneficiary' && that.id == '2') { } else if (that.type == 'fileListIdBackBeneficiary' && that.id == '2') {
@@ -1122,7 +955,7 @@ export default {
name = 'fileListIdBackBeneficiary' name = 'fileListIdBackBeneficiary'
imageInfoType = '18' imageInfoType = '18'
} }
this.imageType = imageInfoType
let obj = { let obj = {
name: name, name: name,
businessNo: that.orderNo, businessNo: that.orderNo,
@@ -1133,20 +966,6 @@ export default {
subBusinessNo: that.bnfId, subBusinessNo: that.bnfId,
fileName: that.imgName, fileName: that.imgName,
} }
this.imageType = imageInfoType
if(that.list && that.list.length != 0){
let thisIndex = ''
let thisFlag = false
that.list.forEach((item,index)=>{
if(item.imageInfoType == imageInfoType){
thisFlag = true
thisIndex = index
}
})
if(thisFlag){
that.list.slice(thisIndex,1)
}
}
that.list.push(obj) that.list.push(obj)
} }
else if (that.type == 'fileListOther') { else if (that.type == 'fileListOther') {
@@ -1163,25 +982,155 @@ export default {
subBusinessNo: '', subBusinessNo: '',
fileName: that.imgName, fileName: that.imgName,
} }
if(that.list && that.list.length != 0){
let thisIndex = ''
let thisFlag = false
that.list.forEach((item,index)=>{
if(item.imageInfoType == imageInfoType){
thisFlag = true
thisIndex = index
}
})
if(thisFlag){
that.list.slice(thisIndex,1)
}
}
that.list.push(obj) 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{ 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()
}
}
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.clear()
this.$toast(res.resultMessage) this.$toast(res.resultMessage)
} }
@@ -1283,78 +1232,21 @@ export default {
//调用身份证OCR识别 //调用身份证OCR识别
IDCardOCR(param).then((res) => { IDCardOCR(param).then((res) => {
if(res.result == '0'){ if(res.result == '0'){
//如果识别的身份证信息与填写的不一致,进行提示
let isFlag = true;
let imageInfoType = ''
let subBusinessNo = ''
//不校验OCR直接返回 //不校验OCR直接返回
if(res.content == '' || res.content == null){ if(res.content == '' || res.content == null){
if(flag == 'fileListIdFront'){
imageInfoType = '1'
subBusinessNo = this.saleInsuredInfo.appntId
}
else if(flag == 'fileListIdBack'){
imageInfoType = '2'
subBusinessNo = this.saleInsuredInfo.appntId
}
else if(flag == 'fileListIdFrontInsured'){
imageInfoType = '1'
subBusinessNo = this.saleInsuredPersonInfo.insuredId
}
else if(flag == 'fileListIdBackInsured'){
imageInfoType = '2'
subBusinessNo = this.saleInsuredPersonInfo.insuredId
}
else if(flag == 'fileListIdFrontBeneficiary'){
imageInfoType = '1'
subBusinessNo = this.bnfId
}
else if(flag == 'fileListIdBackBeneficiary'){
imageInfoType = '2'
subBusinessNo = this.bnfId
}
let obj = {
name: flag,
businessNo: this.orderNo,
businessType: '',
imageInfoType: imageInfoType,
rgssUrl: encodeURI(imgPath).replace(/\+/g, '%2B'),
subBusinessType: '0',
subBusinessNo: subBusinessNo,
fileName: this.imgName,
}
this.imageType = imageInfoType
if(this.list && this.list.length != 0){
let thisIndex = ''
let thisFlag = false
this.list.forEach((item,index)=>{
if(item.imageInfoType == imageInfoType){
thisFlag = true
thisIndex = index
}
})
if(thisFlag){
this.list.slice(thisIndex,1)
}
}
this.list.push(obj)
return return
} }
//如果识别的身份证信息与填写的不一致,进行提示
let isFlag = true;
//投保人身份证正面 //投保人身份证正面
if(flag == 'fileListIdFront'){ if('appentFront' == flag){
imageInfoType = '1'
subBusinessNo = this.saleInsuredInfo.appntId
this.saleInsuredInfo.sex = this.saleInsuredInfo.sex == '0'? '男' :'女' this.saleInsuredInfo.sex = this.saleInsuredInfo.sex == '0'? '男' :'女'
res.content.birth = utils.formatDate(Date.parse(res.content.birth), 'yyyy-MM-dd') 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){ 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; isFlag = false;
this.fileListIdFront = []
} }
} }
else if(flag == 'fileListIdBack'){ else if('appentBack' == flag){
imageInfoType = '2'
subBusinessNo = this.saleInsuredInfo.appntId
//投保人身份证反面 //投保人身份证反面
//"ValidDate": "2010.07.21-2020.07.21" //"ValidDate": "2010.07.21-2020.07.21"
//"ValidDate": "2010.07.21-长期" //"ValidDate": "2010.07.21-长期"
@@ -1363,31 +1255,22 @@ export default {
res.content.validDate = '9999-12-31' res.content.validDate = '9999-12-31'
if(this.saleInsuredInfo.certiexpiredate != res.content.validDate){ if(this.saleInsuredInfo.certiexpiredate != res.content.validDate){
isFlag = false; isFlag = false;
this.fileListIdBack = []
} }
}else{ }else{
res.content.validDate = res.content.validDate.split('-')[1].replace(/\./g,'-') res.content.validDate = res.content.validDate.split('-')[1].replace(/\./g,'-')
if(this.saleInsuredInfo.certiexpiredate != res.content.validDate){ if(this.saleInsuredInfo.certiexpiredate != res.content.validDate){
isFlag = false; isFlag = false;
this.fileListIdBack = []
} }
} }
} }else if('insuredFront' == flag){
else if(flag == 'fileListIdFrontInsured'){
imageInfoType = '1'
subBusinessNo = this.saleInsuredPersonInfo.insuredId
this.saleInsuredPersonInfo.sex = this.saleInsuredPersonInfo.sex == '0'? '男' :'女' this.saleInsuredPersonInfo.sex = this.saleInsuredPersonInfo.sex == '0'? '男' :'女'
res.content.birth = utils.formatDate(Date.parse(res.content.birth), 'yyyy-MM-dd') 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){ 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; isFlag = false;
this.fileListIdFrontInsured = []
} }
} }else if('insuredBack' == flag){
else if(flag == 'fileListIdBackInsured'){
imageInfoType = '2'
subBusinessNo = this.saleInsuredPersonInfo.insuredId
//被保人身份证反面 //被保人身份证反面
//"ValidDate": "2010.07.21-2020.07.21" //"ValidDate": "2010.07.21-2020.07.21"
//"ValidDate": "2010.07.21-长期" //"ValidDate": "2010.07.21-长期"
@@ -1397,30 +1280,21 @@ export default {
res.content.validDate = '9999-12-31' res.content.validDate = '9999-12-31'
if(this.saleInsuredPersonInfo.certiexpiredate != res.content.validDate){ if(this.saleInsuredPersonInfo.certiexpiredate != res.content.validDate){
isFlag = false; isFlag = false;
this.fileListIdBackInsured = []
} }
}else{ }else{
res.content.validDate = res.content.validDate.split('-')[1].replace(/\./g,'-') res.content.validDate = res.content.validDate.split('-')[1].replace(/\./g,'-')
if(this.saleInsuredPersonInfo.certiexpiredate != res.content.validDate){ if(this.saleInsuredPersonInfo.certiexpiredate != res.content.validDate){
isFlag = false; isFlag = false;
this.fileListIdBackInsured = []
} }
} }
} }else if('beneficiaryFront' == flag){
else if(flag == 'fileListIdFrontBeneficiary'){
imageInfoType = '1'
subBusinessNo = this.bnfId
this.saleBtnfPersonInfo.sex = this.saleBtnfPersonInfo.sex == '0'? '男' :'女' this.saleBtnfPersonInfo.sex = this.saleBtnfPersonInfo.sex == '0'? '男' :'女'
res.content.birth = utils.formatDate(Date.parse(res.content.birth), 'yyyy-MM-dd') 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){ 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; isFlag = false;
this.fileListIdFrontBeneficiary = []
} }
} }else if('beneficiaryBack' == flag){
else if(flag == 'fileListIdBackBeneficiary'){
imageInfoType = '2'
subBusinessNo = this.bnfId
//受益人身份证反面 //受益人身份证反面
//"ValidDate": "2010.07.21-2020.07.21" //"ValidDate": "2010.07.21-2020.07.21"
//"ValidDate": "2010.07.21-长期" //"ValidDate": "2010.07.21-长期"
@@ -1430,45 +1304,17 @@ export default {
res.content.validDate = '9999-12-31' res.content.validDate = '9999-12-31'
if(this.saleBtnfPersonInfo.certiexpiredate != res.content.validDate){ if(this.saleBtnfPersonInfo.certiexpiredate != res.content.validDate){
isFlag = false; isFlag = false;
this.fileListIdBackBeneficiary = []
} }
}else{ }else{
res.content.validDate = res.content.validDate.split('-')[1].replace(/\./g,'-') res.content.validDate = res.content.validDate.split('-')[1].replace(/\./g,'-')
if(this.saleBtnfPersonInfo.certiexpiredate != res.content.validDate){ if(this.saleBtnfPersonInfo.certiexpiredate != res.content.validDate){
isFlag = false; isFlag = false;
this.fileListIdBackBeneficiary = []
} }
} }
} }
if(!isFlag){ if(!isFlag){
this.$toast.clear() this.$toast.clear()
this.$toast("上传的证件信息与录入的证件信息不一致,请核对修改并重新上传。") this.$toast("上传的证件信息与录入的证件信息不一致,请核对修改并重新上传。")
}else{
let obj = {
name: flag,
businessNo: this.orderNo,
businessType: '',
imageInfoType: imageInfoType,
rgssUrl: encodeURI(imgPath).replace(/\+/g, '%2B'),
subBusinessType: '0',
subBusinessNo: subBusinessNo,
fileName: this.imgName,
}
this.imageType = imageInfoType
if(this.list && this.list.length != 0){
let thisIndex = ''
let thisFlag = false
this.list.forEach((item,index)=>{
if(item.imageInfoType == imageInfoType){
thisFlag = true
thisIndex = index
}
})
if(thisFlag){
this.list.slice(thisIndex,1)
}
}
this.list.push(obj)
} }
}else{ }else{
this.$toast.clear() this.$toast.clear()
@@ -1495,6 +1341,8 @@ export default {
}, },
orderType: that.changeCard ? 'MEDIANEW_ORDER' : 'MEDIA_ORDER', orderType: that.changeCard ? 'MEDIANEW_ORDER' : 'MEDIA_ORDER',
} }
console.log(data)
return
saveInformation(data).then((res) => { saveInformation(data).then((res) => {
if (res.result == '0') { if (res.result == '0') {
this.$toast.clear() this.$toast.clear()