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