diff --git a/src/views/ebiz/questions/QuestionsDetail.vue b/src/views/ebiz/questions/QuestionsDetail.vue index 711d31e4e..37a551a90 100644 --- a/src/views/ebiz/questions/QuestionsDetail.vue +++ b/src/views/ebiz/questions/QuestionsDetail.vue @@ -132,6 +132,7 @@ export default { data() { let isWeixin = this.$utils.device().isWeixin return { + uploadIndex: 0, releationType: null, imageList: [], imageResultList: [], @@ -182,14 +183,30 @@ export default { }, methods: { // 补充资料问题件被保人上传身份证照片 - async uploadSupplementImg() { + async uploadSupplementImg(file) { + file.index = this.uploadIndex + this.uploadIndex++ + this.$toast.loading({ + duration: 0 + }) + const res = await this.afterRead(file) + let result = { + rgssUrl: res.path, + imageInfoType: 1, + subBusinessType: '0', + index: this.uploadIndex + } + this.imageResultList.push(result) if (this.isWeixin) { - localStorage.setItem('supplementImages', JSON.stringify(this.imageList)) + localStorage.setItem('imageResultList', JSON.stringify(this.imageResultList)) } }, - deleteSupplementImg() { + deleteSupplementImg(file) { + this.imageResultList = this.imageResultList.filter(result => { + return result.index !== file.index + }) if (this.isWeixin) { - localStorage.setItem('supplementImages', JSON.stringify(this.imageList)) + localStorage.setItem('imageResultList', JSON.stringify(this.imageResultList)) } return true }, @@ -226,6 +243,10 @@ export default { localStorage.setItem('agreementChecked', true) } + if (this.isWeixin && this.issueType === '828601') { + localStorage.setItem('imageResultList', JSON.stringify(this.imageResultList)) + } + // 新契约问题件签名前必须输入回复内容 if (this.issueType === 'TB89') { let reply = this.newContract.feedback.trim() @@ -401,47 +422,6 @@ export default { // 校验补充资料 if (this.issueType === '828601') { if (!this.checkSupplementData()) return this.$toast('请上传补充资料') - this.$toast.loading({ - duration: 0 - }) - this.imageResultList.splice(0) - /** - * 上传补充资料 - * 微信端特殊处理: - * 因为微信端签名会跳转页面, 为了签名回跳回显用户填过的信息, 用户填写过的信息都会被保存在localstorage中 - * 补充资料图片是以base64格式存储, 所以需要转换为file之后再上传 - */ - if (this.isWeixin) { - for (let image of this.imageList) { - let file = this.dataURLtoFile(image.content, '.png') - let res = await this.afterRead({ file: file }) - if (res.result === '0') { - let result = { - rgssUrl: res.path, - imageInfoType: 1, - subBusinessType: '0' - } - this.imageResultList.push(result) - } else { - return this.$toast(res.resultMessage) - } - } - } else { - for (let image of this.imageList) { - let res = await this.afterRead({ file: image.file }) - if (res.result === '0') { - let result = { - rgssUrl: res.path, - imageInfoType: 1, - subBusinessType: '0' - } - this.imageResultList.push(result) - } else { - return this.$toast(res.resultMessage) - } - } - } - this.$toast.clear() } // 转账不成功 if (this.issueType === '818901') { @@ -665,7 +645,7 @@ export default { localStorage.removeItem('problemCard') localStorage.removeItem('problemBankCode') // 补充资料问题件保存数据 - localStorage.removeItem('supplementImages') + localStorage.removeItem('imageResultList') } // localstorage存在投保人签名信息 @@ -721,9 +701,15 @@ export default { { // 微信签名后回显补充资料照片 - if (localStorage.getItem('supplementImages')) { - let images = JSON.parse(localStorage.getItem('supplementImages')) - this.imageList.push(...images) + if (localStorage.getItem('imageResultList')) { + let images = JSON.parse(localStorage.getItem('imageResultList')) + this.imageResultList = images + for (let image of images) { + this.imageList.push({ + url: config.imgDomain + `/returnImageStream?a=b.jpg&imgPath=${encodeURIComponent(image.rgssUrl)}`, + index: image.index + }) + } } } }