增加删除图片后续处理

This commit is contained in:
mengxiaolong
2020-08-10 15:02:41 +08:00
parent 91b6cc1936
commit 1d0ebb5d14

View File

@@ -15,9 +15,21 @@
</p> </p>
</div> </div>
<p class="uploadTitle">身份证头像面照片</p> <p class="uploadTitle">身份证头像面照片</p>
<van-uploader :max-count="1" :after-read="insurantUpload" name="insurantIdCardA" v-model="supplement.insurantIdCardA" /> <van-uploader
:max-count="1"
:after-read="insurantUpload"
:before-delete="insurantDelete"
name="insurantIdCardA"
v-model="supplement.insurantIdCardA"
/>
<p class="uploadTitle">身份证国徽面照片</p> <p class="uploadTitle">身份证国徽面照片</p>
<van-uploader :max-count="1" :after-read="insurantUpload" name="insurantIdCardB" v-model="supplement.insurantIdCardB" /> <van-uploader
:max-count="1"
:after-read="insurantUpload"
:before-delete="insurantDelete"
name="insurantIdCardB"
v-model="supplement.insurantIdCardB"
/>
</div> </div>
</div> </div>
<div class="updateInfo"> <div class="updateInfo">
@@ -30,11 +42,29 @@
</p> </p>
</div> </div>
<p class="uploadTitle">身份证头像面照片</p> <p class="uploadTitle">身份证头像面照片</p>
<van-uploader :max-count="1" :after-read="policyHolderUpload" name="policyholderIdCardA" v-model="supplement.policyholderIdCardA" /> <van-uploader
:max-count="1"
:after-read="policyHolderUpload"
:before-delete="policyHolderDelete"
name="policyholderIdCardA"
v-model="supplement.policyholderIdCardA"
/>
<p class="uploadTitle">身份证国徽面照片</p> <p class="uploadTitle">身份证国徽面照片</p>
<van-uploader :max-count="1" :after-read="policyHolderUpload" name="policyholderIdCardB" v-model="supplement.policyholderIdCardB" /> <van-uploader
:max-count="1"
:after-read="policyHolderUpload"
:before-delete="policyHolderDelete"
name="policyholderIdCardB"
v-model="supplement.policyholderIdCardB"
/>
<p class="uploadTitle">银行卡照片</p> <p class="uploadTitle">银行卡照片</p>
<van-uploader :max-count="1" :after-read="policyHolderUpload" name="policyholderBankCardA" v-model="supplement.policyholderBankCardA" /> <van-uploader
:max-count="1"
:after-read="policyHolderUpload"
@delete="policyHolderDelete"
name="policyholderBankCardA"
v-model="supplement.policyholderBankCardA"
/>
</div> </div>
</div> </div>
</div> </div>
@@ -75,7 +105,7 @@
<div class="item"> <div class="item">
<van-field label-class="labels" readonly label="银行卡照片"></van-field> <van-field label-class="labels" readonly label="银行卡照片"></van-field>
<div class="cardList"> <div class="cardList">
<van-uploader :max-count="1" :after-read="cardUpload" name="card" v-model="transfer.cardPhoto" /> <van-uploader :max-count="1" :after-read="cardUpload" @delete="transferBankCardDelete" name="card" v-model="transfer.cardPhoto" />
</div> </div>
</div> </div>
</div> </div>
@@ -155,13 +185,16 @@ export default {
descriptionPolicyholder: '', descriptionPolicyholder: '',
// 被保人身份证明 // 被保人身份证明
insurantIdCardA: [], insurantIdCardA: [],
insurantIdCardAUploadResult: null,
insurantIdCardB: [], insurantIdCardB: [],
insurantUploadResult: [], insurantIdCardBUploadResult: null,
// 投保人身份证明等资料 // 投保人身份证明等资料
policyholderIdCardA: [], policyholderIdCardA: [],
policyholderIdCardAUploadResult: null,
policyholderIdCardB: [], policyholderIdCardB: [],
policyholderIdCardBUploadResult: null,
policyholderBankCardA: [], policyholderBankCardA: [],
policyholderUploadResult: [] policyholderBankCardAUploadResult: null
}, },
newContract: { newContract: {
// 新契约 // 新契约
@@ -206,6 +239,7 @@ export default {
} }
}, },
methods: { methods: {
// 补充资料问题件投保人上传身份证照片,银行卡照片
async policyHolderUpload(file, detail) { async policyHolderUpload(file, detail) {
// 微信端将上传的图片保存到localstorage中供签名回调使用 // 微信端将上传的图片保存到localstorage中供签名回调使用
if (this.isWeixin) { if (this.isWeixin) {
@@ -213,23 +247,76 @@ export default {
} }
let res = await this.afterRead(file) let res = await this.afterRead(file)
let imageType = detail.name === 'policyholderIdCardA' ? 1 : detail.name === 'policyholderIdCardB' ? 2 : 3 let imageType = detail.name === 'policyholderIdCardA' ? 1 : detail.name === 'policyholderIdCardB' ? 2 : 3
this.supplement.policyholderUploadResult.push({ let result = {
rgssUrl: res.path, rgssUrl: res.path,
imageInfoType: imageType, imageInfoType: imageType,
subBusinessType: 0 subBusinessType: 0
}) }
switch (detail.name) {
case 'policyholderIdCardA':
this.supplement.policyholderIdCardAUploadResult = result
break
case 'policyholderIdCardB':
this.supplement.policyholderIdCardBUploadResult = result
break
case 'policyholderBankCardA':
this.supplement.policyholderBankCardAUploadResult = result
break
}
}, },
// 投保人删除资料回调方法
policyHolderDelete(file, detail) {
switch (detail.name) {
case 'policyholderIdCardA':
this.supplement.policyholderIdCardAUploadResult = null
return true
case 'policyholderIdCardB':
this.supplement.policyholderIdCardBUploadResult = null
return true
case 'policyholderBankCardA':
this.supplement.policyholderBankCardAUploadResult = null
return true
}
},
checkPolicyholderUpload() {
return (
this.supplement.policyholderIdCardAUploadResult && this.supplement.policyholderIdCardBUploadResult && this.supplement.policyholderBankCardAUploadResult
)
},
// 补充资料问题件被保人上传身份证照片
async insurantUpload(file, detail) { async insurantUpload(file, detail) {
if (this.isWeixin) { if (this.isWeixin) {
localStorage.setItem(detail.name, file.content) localStorage.setItem(detail.name, file.content)
} }
let res = await this.afterRead(file) let res = await this.afterRead(file)
this.supplement.insurantUploadResult.push({ let result = {
rgssUrl: res.path, rgssUrl: res.path,
imageInfoType: detail.name === 'insurantIdCardA' ? 1 : 2, imageInfoType: detail.name === 'insurantIdCardA' ? 1 : 2,
subBusinessType: 1 subBusinessType: 1
}) }
switch (detail.name) {
case 'insurantIdCardA':
this.supplement.insurantIdCardAUploadResult = result
break
case 'insurantIdCardB':
this.supplement.insurantIdCardBUploadResult = result
break
}
}, },
insurantDelete(file, detail) {
switch (detail.name) {
case 'insurantIdCardA':
this.supplement.insurantIdCardAUploadResult = null
return true
case 'insurantIdCardB':
this.supplement.insurantIdCardBUploadResult = null
return true
}
},
checkInsurantUpload() {
return this.supplement.insurantIdCardAUploadResult && this.supplement.insurantIdCardBUploadResult
},
// 转账不成功问题件添加银行卡照片
async cardUpload(file, detail) { async cardUpload(file, detail) {
if (this.isWeixin) { if (this.isWeixin) {
localStorage.setItem(detail.name, file.content) localStorage.setItem(detail.name, file.content)
@@ -239,6 +326,10 @@ export default {
rgssUrl: res.path rgssUrl: res.path
}) })
}, },
// 转账不成功问题件删除银行卡照片
transferBankCardDelete() {
this.transfer.cardUploadResult.splice(0)
},
// 签名 // 签名
async autograph(personType) { async autograph(personType) {
// 新契约问题件签名前必须输入回复内容 // 新契约问题件签名前必须输入回复内容
@@ -369,6 +460,8 @@ export default {
this.transfer.bankCode = '' this.transfer.bankCode = ''
this.transfer.bank = '' this.transfer.bank = ''
this.transfer.card = '' this.transfer.card = ''
this.transfer.cardPhoto.splice(0)
this.transfer.cardUploadResult.splice(0)
}, },
async afterRead(file) { async afterRead(file) {
let data = new FormData() let data = new FormData()
@@ -381,9 +474,8 @@ export default {
if (this.issueType === 'TB89' && this.newContract.feedback.trim() === '') return this.$toast('请填写回复内容') if (this.issueType === 'TB89' && this.newContract.feedback.trim() === '') return this.$toast('请填写回复内容')
// 校验补充资料 // 校验补充资料
if (this.issueType === '828601') { if (this.issueType === '828601') {
if (this.supplement.insurantUploadResult.length < 2 || this.supplement.policyholderUploadResult.length < 3) { if (!this.checkInsurantUpload()) return this.$toast('请上传被保人补充资料')
return this.$toast('请上传补充资料') if (!this.checkPolicyholderUpload()) return this.$toast('请上传投保人补充资料')
}
} }
// 转账不成功 // 转账不成功
if (this.issueType === '818901') { if (this.issueType === '818901') {
@@ -438,7 +530,6 @@ export default {
bankName: '', bankName: '',
bankNo: '', bankNo: '',
list: [], list: [],
pdfUrl: '/opt/ebiz/webapps/ebiz-epolicy/pdf/2020/08/09/1000000891076891/1000000891076891.pdf',
signInfo: signInfo signInfo: signInfo
} }
// 验证码验证成功 // 验证码验证成功
@@ -452,9 +543,12 @@ export default {
// 补充资料类问题件 // 补充资料类问题件
else if (this.issueType === '828601') { else if (this.issueType === '828601') {
// 被保人资料 // 被保人资料
problemData.list.push(...this.supplement.insurantUploadResult) problemData.list.push(this.supplement.insurantIdCardAUploadResult)
problemData.list.push(this.supplement.insurantIdCardBUploadResult)
// 投保人资料 // 投保人资料
problemData.list.push(...this.supplement.policyholderUploadResult) problemData.list.push(this.supplement.policyholderIdCardAUploadResult)
problemData.list.push(this.supplement.policyholderIdCardBUploadResult)
problemData.list.push(this.supplement.policyholderBankCardAUploadResult)
} }
// 转账不成功问题件 // 转账不成功问题件
else { else {
@@ -466,8 +560,11 @@ export default {
item.imageInfoType = '3' item.imageInfoType = '3'
item.subBusinessType = '0' item.subBusinessType = '0'
} }
// 选择非终止转账时上传银行卡照片
if (this.transfer.mode !== 2) {
problemData.list = this.transfer.cardUploadResult problemData.list = this.transfer.cardUploadResult
} }
}
// 更新问题件数据 // 更新问题件数据
let res = await updateQuestionDetail(problemData) let res = await updateQuestionDetail(problemData)
console.dir(res) console.dir(res)
@@ -623,7 +720,7 @@ export default {
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.iframe { .iframe {
width: 100vw; width: 99%;
height: 70vh; height: 70vh;
} }
@@ -698,8 +795,7 @@ export default {
} }
} }
.pdf { .pdf {
width: 100%; width: 100vw;
border-bottom: 1px solid #eee;
} }
.checkedBox { .checkedBox {
padding: 10px; padding: 10px;