mirror of
http://112.124.100.131/GFRS/ebiz-h5.git
synced 2025-12-11 19:06:43 +08:00
fix(beneficiary): 修复受益人提交异常的问题
- 删除重复的份额累加逻辑 - 优化重复添加校验方式并增强判断条件 - 移除无用参数并调整方法调用 - 注入被保人信息并优化数据获取逻辑 - 增强受益份额校验函数支持下一步验证 - 完善婚姻状态过滤器容错处理 - 调整法定受益人数据结构传递方式
This commit is contained in:
@@ -1185,7 +1185,6 @@ export default {
|
|||||||
beneficiaries.forEach(item => {
|
beneficiaries.forEach(item => {
|
||||||
ratio += parseInt(item.bnfLot)
|
ratio += parseInt(item.bnfLot)
|
||||||
})
|
})
|
||||||
ratio += parseInt(this.userInfo.bnfLot)
|
|
||||||
if (ratio > 100) {
|
if (ratio > 100) {
|
||||||
this.$toast('受益份额有误,请重新输入~')
|
this.$toast('受益份额有误,请重新输入~')
|
||||||
return false
|
return false
|
||||||
@@ -1193,10 +1192,10 @@ export default {
|
|||||||
|
|
||||||
if (this.userInfo.idNo != '') {
|
if (this.userInfo.idNo != '') {
|
||||||
// 受益人不能重复添加 (证件号码为基准)
|
// 受益人不能重复添加 (证件号码为基准)
|
||||||
let isDbAdd = beneficiaries.some(item => {
|
let isDbAdd = beneficiaries.filter(item => {
|
||||||
return item.idNo == this.userInfo.idNo
|
return item.idNo == this.userInfo.idNo
|
||||||
})
|
})
|
||||||
if (isDbAdd) {
|
if (isDbAdd && isDbAdd.length > 1) {
|
||||||
this.$toast('受益人不支持重复添加')
|
this.$toast('受益人不支持重复添加')
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
@@ -1381,7 +1380,7 @@ export default {
|
|||||||
day = day.toString().padStart(2, '0')
|
day = day.toString().padStart(2, '0')
|
||||||
return `${year}-${month}-${day}`
|
return `${year}-${month}-${day}`
|
||||||
},
|
},
|
||||||
getRelatedData(val, from) {
|
getRelatedData(val) {
|
||||||
if (this.userInfo.idType != '1' && this.userInfo.idType != '2') {
|
if (this.userInfo.idType != '1' && this.userInfo.idType != '2') {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,11 +39,10 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { Dialog, Icon, Radio, RadioGroup } from 'vant'
|
import { Dialog, Icon, Radio, RadioGroup } from 'vant'
|
||||||
import dataDictionary from '@/assets/js/utils/data-dictionary'
|
|
||||||
import { getOrderDetail, saveOrUpdateOrderInfo } from '@/api/ebiz/sale/sale'
|
import { getOrderDetail, saveOrUpdateOrderInfo } from '@/api/ebiz/sale/sale'
|
||||||
import IndexBar from '@/components/ebiz/sale/IndexBar'
|
import IndexBar from '@/components/ebiz/sale/IndexBar'
|
||||||
import { beneficiaryType } from '@/views/ebiz/saleFlowProImprove/js/enum'
|
import { beneficiaryType } from '@/views/ebiz/saleFlowProImprove/js/enum'
|
||||||
import { beneficiaries } from '@/views/ebiz/saleFlowProImprove/js/state'
|
import { beneficiaries, insured } from '@/views/ebiz/saleFlowProImprove/js/state'
|
||||||
import { vm } from '@/main'
|
import { vm } from '@/main'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
@@ -184,8 +183,8 @@ export default {
|
|||||||
appntDTO: {},
|
appntDTO: {},
|
||||||
insuredDTOs: [
|
insuredDTOs: [
|
||||||
{
|
{
|
||||||
insuredId: JSON.parse(this.$CacheUtils.getLocItem('saleInsuredPersonInfo')).insuredId,
|
insuredId: this.insured.insuredId,
|
||||||
bnfDTOs: this.type === beneficiaryType.legalPerson ? [] : this.beneficiaries.map(beneficiary => delete beneficiary.bid)
|
bnfDTOs: this.type === beneficiaryType.legalPerson ? [] : this.beneficiaries
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
paymentDTO: {},
|
paymentDTO: {},
|
||||||
@@ -214,29 +213,32 @@ export default {
|
|||||||
},
|
},
|
||||||
//添加受益人
|
//添加受益人
|
||||||
add() {
|
add() {
|
||||||
if (!validateBnfLot(this.beneficiaries)) return
|
if (!this.validateBnfLot(this.beneficiaries)) return
|
||||||
|
|
||||||
this.beneficiaries.push({
|
this.beneficiaries.push({
|
||||||
bid: this.generateRandomId(),
|
bid: this.generateRandomId(),
|
||||||
relationToInsured: ''
|
relationToInsured: ''
|
||||||
})
|
})
|
||||||
|
},
|
||||||
function validateBnfLot(beneficiaries) {
|
validateBnfLot: function(beneficiaries, validateNext = false) {
|
||||||
if (beneficiaries.length === 0) return true
|
if (beneficiaries.length === 0) return true
|
||||||
let beneRatio = beneficiaries.reduce((acc, cur) => {
|
let beneRatio = beneficiaries.reduce((acc, cur) => {
|
||||||
if (cur.bnfLot === '' && isNaN(Number(cur.bnfLot))) return NaN
|
if (cur.bnfLot === '' && isNaN(Number(cur.bnfLot))) return NaN
|
||||||
return acc + parseInt(cur.bnfLot)
|
return acc + parseInt(cur.bnfLot)
|
||||||
}, 0)
|
}, 0)
|
||||||
if (isNaN(beneRatio)) {
|
if (isNaN(beneRatio)) {
|
||||||
vm.$toast('请输入正确的受益比例')
|
vm.$toast('请输入正确的受益比例')
|
||||||
return false
|
return false
|
||||||
}
|
|
||||||
if (beneRatio >= 100) {
|
|
||||||
vm.$toast('受益份额已满~')
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
return true
|
|
||||||
}
|
}
|
||||||
|
if (beneRatio > 100) {
|
||||||
|
vm.$toast('受益份额已满~')
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
if (validateNext && beneRatio < 100) {
|
||||||
|
vm.$toast('受益人受益比例不合法')
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
return true
|
||||||
},
|
},
|
||||||
// 单选按钮切换
|
// 单选按钮切换
|
||||||
radioChange(val) {
|
radioChange(val) {
|
||||||
@@ -285,6 +287,7 @@ export default {
|
|||||||
this.nextStepProcesserContainer.registerMainTask(
|
this.nextStepProcesserContainer.registerMainTask(
|
||||||
taskID,
|
taskID,
|
||||||
async () => {
|
async () => {
|
||||||
|
if (!this.validateBnfLot(this.beneficiaries, true) && this.type === beneficiaryType.designateBeneficiary) return
|
||||||
return await this.nextStep()
|
return await this.nextStep()
|
||||||
},
|
},
|
||||||
this.preTasks,
|
this.preTasks,
|
||||||
@@ -309,6 +312,7 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
insured: () => insured,
|
||||||
beneficiaryType: () => beneficiaryType,
|
beneficiaryType: () => beneficiaryType,
|
||||||
postTasks() {
|
postTasks() {
|
||||||
return this.beneficiaries.map(beneficiary => {
|
return this.beneficiaries.map(beneficiary => {
|
||||||
@@ -316,18 +320,7 @@ export default {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
inject: ['nextStepProcesserContainer'],
|
inject: ['nextStepProcesserContainer']
|
||||||
filters: {
|
|
||||||
relationTransfer(relationIdx) {
|
|
||||||
let relationText = ''
|
|
||||||
dataDictionary.relationToAppnt.some(item => {
|
|
||||||
if (item.id == relationIdx) {
|
|
||||||
relationText = item.text
|
|
||||||
}
|
|
||||||
})
|
|
||||||
return relationText
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
|||||||
@@ -2108,7 +2108,9 @@ export default {
|
|||||||
marriageStatus() {
|
marriageStatus() {
|
||||||
if (this.userInfo.marriageStatus) return this.userInfo.marriageStatus
|
if (this.userInfo.marriageStatus) return this.userInfo.marriageStatus
|
||||||
|
|
||||||
return DataDictionary.marriage.find(item => item.id === Number(this.userInfo.marriage)).text || ''
|
const res = DataDictionary.marriage.find(item => item.id === Number(this.userInfo.marriage))
|
||||||
|
if (res) return res.text
|
||||||
|
else return ''
|
||||||
},
|
},
|
||||||
isReadonly() {
|
isReadonly() {
|
||||||
return this.isAppnt
|
return this.isAppnt
|
||||||
|
|||||||
Reference in New Issue
Block a user