feat(ebiz): 优化受益人信息添加流程

- 调整 AddBeneficiaryInfo.vue 中的 van-checkbox 和 van-field 组件格式,提升代码可读性- 移除未使用的 IdentityCardScan 组件导入和相关代码
-重构 relationToAppnt 的计算属性,支持通过 props 传入 beneficiary 数据-优化日期选择器逻辑,增强证件有效期和出生日期的校验规则
- 清理 Beneficiary.vue 中的冗余代码和注释,简化组件结构- 更新 InsuranceApplicationFlowBeneficiary.vue 的插槽用法,实现 beneficiary 数据同步-修复多处语法格式问题,包括括号、缩进和换行符
- 移除大量调试用的 console.log 输出语句
- 优化 getOrderDetail 接口调用逻辑,提高数据初始化准确性
- 统一条件判断中的严格相等运算符使用
This commit is contained in:
hz
2025-11-03 16:08:16 +08:00
parent a46579db91
commit 23542d36cb
3 changed files with 186 additions and 160 deletions

View File

@@ -14,7 +14,9 @@
@click="toSelect('7')"
/>
<div class="relative border-bt fs14 p10 flex align-center">
<van-checkbox v-model="userInfo.asAppntAddress" @change="asAppntAddress" :disabled="Insured">同投保人</van-checkbox>
<van-checkbox v-model="userInfo.asAppntAddress" @change="asAppntAddress" :disabled="Insured">
同投保人
</van-checkbox>
</div>
<customer-picker
@on-choose="chooseCustomer"
@@ -91,7 +93,9 @@
:readonly="isInsured"
></FieldDatePicter>
<div class="border-bt relative fs14 p10 flex align-center">
<van-checkbox v-model="userInfo.effectiveDateType" class="fr" :disabled="effectiveDateTypeAble" @change="effectiveDataTypeChange">长期</van-checkbox>
<van-checkbox v-model="userInfo.effectiveDateType" class="fr" :disabled="effectiveDateTypeAble"
@change="effectiveDataTypeChange">长期
</van-checkbox>
</div>
<select-radio
:radios="sexRadio"
@@ -135,7 +139,8 @@
v-validate="'required|contactAdderss'"
data-vv-name="联系地址"
/>
<van-field v-model="userInfo.village" label="" name="详细地址" placeholder="请输入详细地址" v-validate="'required'" clearable maxlength="30" />
<van-field v-model="userInfo.village" label="" name="详细地址" placeholder="请输入详细地址"
v-validate="'required'" clearable maxlength="30" />
<div class="pl10 pt10 pb10 pr10 address fs14">
<van-checkbox v-model="withRootUser.value">同投保人地址</van-checkbox>
</div>
@@ -219,7 +224,7 @@
<!-- 家庭信息 -->
<!-- <van-cell-group>
</van-cell-group>-->
<!-- <van-button type="danger" class="bottom-btn" @click="nextStep" v-no-more-click="1000">添加</van-button>-->
<!-- <van-button type="danger" class="bottom-btn" @click="nextStep" v-no-more-click="1000">添加</van-button>-->
<!-- 字段选择 -->
<van-popup v-model="popupShow" position="bottom">
@@ -227,7 +232,8 @@
</van-popup>
<!-- 地区选择 -->
<van-popup position="bottom" v-model="isAreaListShow">
<van-area title="省市区" :visible-item-count="4" :area-list="areaList" @confirm="setBankArea" @cancel="isAreaListShow = false" />
<van-area title="省市区" :visible-item-count="4" :area-list="areaList" @confirm="setBankArea"
@cancel="isAreaListShow = false" />
</van-popup>
<van-popup v-model="isMarriageStatusShow" position="bottom">
<van-picker show-toolbar :columns="columns" @confirm="onMarriageConfirm" @cancel="isMarriageStatusShow = false" />
@@ -245,7 +251,6 @@ import areaList from '@/assets/js/utils/areaForSale'
import countCredentialValidity from '@/assets/js/utils/countCredentialValidity'
import filter from '@/filters/index'
import utilsAge from '@/assets/js/utils/age'
import IdentityCardScan from '@/components/ebiz/sale/IdentityCardScan'
import CustomerPicker from '@/components/ebiz/customer/CustomerPicker'
import idNoCheck from '@/assets/js/utils/idNoCheck'
import { idToData } from './js/verification'
@@ -271,14 +276,13 @@ export default {
[Popup.name]: Popup,
[Picker.name]: Picker,
[Area.name]: Area,
[IdentityCardScan.name]: IdentityCardScan,
[CustomerPicker.name]: CustomerPicker
},
data() {
return {
withRootUser: {
load: false, //防止重复请求
value: false,
value: false
},
nameLimit: false,
idNoLimit: false,
@@ -304,7 +308,6 @@ export default {
}
],
currentPopupIndex: '',
relationToAppnt: '',
popupShow: false,
areaShow: false,
pickerType: undefined,
@@ -358,7 +361,19 @@ export default {
Insured: false, //投保人本人按钮是否置灰
idLimit: false, //证件起止日期是否只读
saleInsuredPersonInfo: JSON.parse(this.$CacheUtils.getLocItem('saleInsuredPersonInfo')), //被保人信息
branchType:''
branchType: ''
}
},
props: ['beneficiary'],
computed: {
relationToAppnt: {
get() {
const { relationToAppnt } = DataDictionary
return relationToAppnt.find(item => Number(item.id) === Number(this.beneficiary.relationToInsured))['text']
},
set(value) {
this.userInfo.relationToInsured = value
}
}
},
mounted() {
@@ -368,9 +383,20 @@ export default {
} else {
this.Insured = false
}
if(window.localStorage.getItem('branchType') || this.$route.query.branchType) {
if (window.localStorage.getItem('branchType') || this.$route.query.branchType) {
this.branchType = window.localStorage.getItem('branchType')
}
// this.initDate()
const { marriage } = DataDictionary
// 合并参数
this.userInfo = {
...this.userInfo, ...this.beneficiary,
// 婚姻状况
...{ marriageStatus: marriage.find(item => Number(item.id) === Number(this.beneficiary.marriage))['text'] }
}
const { province: provinceCode, city: cityCode, area: areaCode } = this.beneficiary
this.areaStr = getAreaName([{ code: provinceCode }, { code: cityCode }, { code: areaCode }])
},
methods: {
setCustomerMarriage(marriageCode) {
@@ -424,7 +450,6 @@ export default {
county.code = '500243'
break
}
console.log(areaInfo[2])
this.userInfo.province = province.code
this.userInfo.city = city.code
this.userInfo.area = county.code
@@ -543,20 +568,18 @@ export default {
this.userInfo.idNo = this.userInfo.certiexpiredate = this.userInfo.birthday = ''
this.userInfo.sex = '0'
this.effectiveDateTypeAble = false
console.log(value.id)
//身份证以外的证件类型可以使用长期
if (value.id == '1') {
console.log('123')
let age = utilsAge.getAge(this.userInfo.birthday, new Date())
this.effectiveDateTypeAble = age <= 45
}else if (value.id == '2') {
} else if (value.id == '2') {
//证件类型户口本时,证件截止日期和是否长期不可选择
this.idLimit = true
this.effectiveDateTypeAble = true
this.userInfo.effectiveDateType = false
}
// else if (value.id == 2 || value.id == 3) {
// this.effectiveDateTypeAble = true
// else if (value.id == 2 || value.id == 3) {
// this.effectiveDateTypeAble = true
// }
else {
this.effectiveDateTypeAble = false
@@ -631,88 +654,85 @@ export default {
//证件起始截止日期
onDateConfirm(val, type) {
switch (type) {
case '0':
{
//证件起始日期
//如果录入日期早于出生日期或晚于当前日期
if (Date.parse(val) > Date.parse(new Date()) || Date.parse(val) < Date.parse(this.userInfo.birthday)) {
this.userInfo.certificateValidate = ''
this.$refs.certificateValidate.date = ''
return this.$toast('证件起始日期填写错误')
}
case '0': {
//证件起始日期
//如果录入日期早于出生日期或晚于当前日期
if (Date.parse(val) > Date.parse(new Date()) || Date.parse(val) < Date.parse(this.userInfo.birthday)) {
this.userInfo.certificateValidate = ''
this.$refs.certificateValidate.date = ''
return this.$toast('证件起始日期填写错误')
}
// 计算年龄
// 长期按钮是否禁用
if (this.userInfo.idType == '1') {
let age = utilsAge.getAge(this.userInfo.birthday, new Date())
this.effectiveDateTypeAble = age <= 45
if(this.userInfo.birthday){
this.userInfo.certiexpiredate = countCredentialValidity.getEndDate(age,val)
if(this.userInfo.certiexpiredate) {
this.effectiveDateTypeAble = true
this.userInfo.effectiveDateType = false
}
// 计算年龄
// 长期按钮是否禁用
if (this.userInfo.idType == '1') {
let age = utilsAge.getAge(this.userInfo.birthday, new Date())
this.effectiveDateTypeAble = age <= 45
if (this.userInfo.birthday) {
this.userInfo.certiexpiredate = countCredentialValidity.getEndDate(age, val)
if (this.userInfo.certiexpiredate) {
this.effectiveDateTypeAble = true
this.userInfo.effectiveDateType = false
}
}
}
}
break
case '1':
{
//证件截止日
//如果已经勾选了长期
// if (this.userInfo.effectiveDateType) {
// //清空数据并返回
// this.userInfo.certiexpiredate = ''
// this.$refs.certiexpiredate.date = ''
// return
// }
this.userInfo.effectiveDateType = false
//如果录入日期早于当前日期
if (Date.parse(val) < Date.parse(new Date())) {
this.userInfo.certiexpiredate = ''
this.$refs.certiexpiredate.date = ''
return this.$toast('亲,请您核实受益人身份证件有效期~')
}
//身份证证件类型的判断
if (this.userInfo.idType == '1') {
//获取年龄
let age = utilsAge.getAge(this.userInfo.birthday, new Date())
if(this.userInfo.birthday){
this.userInfo.certificateValidate = countCredentialValidity.getStartDate(age,val)
}
case '1': {
//证件截止日期
//如果已经勾选了长
// if (this.userInfo.effectiveDateType) {
// //清空数据并返回
// this.userInfo.certiexpiredate = ''
// this.$refs.certiexpiredate.date = ''
// return
// }
this.userInfo.effectiveDateType = false
//如果录入日期早于当前日期
if (Date.parse(val) < Date.parse(new Date())) {
this.userInfo.certiexpiredate = ''
this.$refs.certiexpiredate.date = ''
return this.$toast('亲,请您核实受益人身份证件有效期~')
}
//身份证证件类型的判断
if (this.userInfo.idType == '1') {
//获取年龄
let age = utilsAge.getAge(this.userInfo.birthday, new Date())
if (this.userInfo.birthday) {
this.userInfo.certificateValidate = countCredentialValidity.getStartDate(age, val)
}
}
}
break
case '2':
{
//出生日期
//如果录入日期晚于当前日期
if (Date.parse(val) > Date.parse(new Date())) {
case '2': {
//出生日期
//如果录入日期晚于当前日期
if (Date.parse(val) > Date.parse(new Date())) {
this.userInfo.birthday = ''
this.$refs.birthday.date = ''
return this.$toast('出生日期不晚于当日')
}
//长期判断
if (this.userInfo.idType == '1') {
let age = utilsAge.getAge(this.userInfo.birthday, new Date())
this.effectiveDateTypeAble = age <= 45
}
//出生证有效期
if (this.userInfo.idType == '3') {
if (Date.parse(this.userInfo.certiexpiredate) - Date.parse(val) > Date.parse('1973-01-01')) {
this.userInfo.birthday = ''
this.$refs.birthday.date = ''
return this.$toast('出生日期不晚于当日')
}
//长期判断
if (this.userInfo.idType == '1') {
let age = utilsAge.getAge(this.userInfo.birthday, new Date())
this.effectiveDateTypeAble = age <= 45
}
//出生证有效期
if (this.userInfo.idType == '3') {
if (Date.parse(this.userInfo.certiexpiredate) - Date.parse(val) > Date.parse('1973-01-01')) {
this.userInfo.birthday = ''
this.$refs.birthday.date = ''
return this.$toast('出生证有效期或出生日期有误')
}
}
let age = utilsAge.getAge(this.userInfo.birthday, new Date())
if (this.userInfo.certificateValidate && !this.userInfo.certiexpiredate) {
this.userInfo.certiexpiredate = countCredentialValidity.getEndDate(age,this.userInfo.certificateValidate)
}
if (this.userInfo.certiexpiredate && !this.userInfo.certificateValidate) {
this.userInfo.certificateValidate = countCredentialValidity.getEndDate(age,this.userInfo.certiexpiredate)
return this.$toast('出生证有效期或出生日期有误')
}
}
let age = utilsAge.getAge(this.userInfo.birthday, new Date())
if (this.userInfo.certificateValidate && !this.userInfo.certiexpiredate) {
this.userInfo.certiexpiredate = countCredentialValidity.getEndDate(age, this.userInfo.certificateValidate)
}
if (this.userInfo.certiexpiredate && !this.userInfo.certificateValidate) {
this.userInfo.certificateValidate = countCredentialValidity.getEndDate(age, this.userInfo.certiexpiredate)
}
}
break
}
},
@@ -736,23 +756,23 @@ export default {
this.userInfo.birthday = data.birthday //出生日期
this.userInfo.idType = data.customerIdType //证件类型
// 证件截止日期证件截止日期应为第16周岁的生日日期
if(this.userInfo.idType == '2'){
if (this.userInfo.idType == '2') {
//证件类型如果是户口本时,证件有效止期不可编辑
this.idLimit = true
this.effectiveDateTypeAble = false
this.userInfo.effectiveDateType = false
}
//受益人证件类型如果是户口本时证件截止日期证件截止日期应为第16周岁的生日日期。
if(this.userInfo.idType == '2' && idToData(this.userInfo.idNo).age <16){
if (this.userInfo.idType == '2' && idToData(this.userInfo.idNo).age < 16) {
// 获取出生日期年份16
let year = Number(this.userInfo.birthday.substr(0,4)) + 16
if(this.userInfo.birthday.substr(5,5) == '02-29'){
let year = Number(this.userInfo.birthday.substr(0, 4)) + 16
if (this.userInfo.birthday.substr(5, 5) == '02-29') {
// 获取某年某月一共多少天
let date = new Date(year, 2, 1)
let dayEnd = new Date(date.getTime() - 864e5).getDate()
this.userInfo.certiexpiredate = year +'-02-'+ dayEnd
}else{
this.userInfo.certiexpiredate = year +'-'+ this.userInfo.birthday.substr(5,5)
this.userInfo.certiexpiredate = year + '-02-' + dayEnd
} else {
this.userInfo.certiexpiredate = year + '-' + this.userInfo.birthday.substr(5, 5)
}
}
this.userInfo.idNo = data.customerIdNumber //证件号码
@@ -808,7 +828,6 @@ export default {
}
}
console.log(insuredDetail)
// 页面跳转
let valid = await this.$validator.validate()
// .then(valid => {
@@ -911,7 +930,6 @@ export default {
// 证件号码规则校验
if (!idNoCheck.isIdno(this.userInfo.idNo)) {
console.log('证件号码校验有误')
return this.$toast('您填写的证件号码有误')
}
//证件有效期不能为空
@@ -935,17 +953,17 @@ export default {
return this.$toast('16周岁以下的证件有效期为5年')
}
//年龄在16-21周岁之间
}else if (age >= 16 && age <= 21) {
} else if (age >= 16 && age <= 21) {
if (new Date(val).getFullYear() - new Date(this.userInfo.certificateValidate).getFullYear() != 10 && new Date(val).getFullYear() - new Date(this.userInfo.certificateValidate).getFullYear() != 5) {
return this.$toast('16周岁~21周岁的证件有效期为10年或5年')
}
//年龄在22-25周岁之间
}else if (age >= 22 && age <= 25) {
} else if (age >= 22 && age <= 25) {
if (new Date(val).getFullYear() - new Date(this.userInfo.certificateValidate).getFullYear() != 10) {
return this.$toast('22周岁~25周岁的证件有效期为10年')
}
//年龄在26-35周岁之间
}else if (age >= 26 && age <= 35) {
} else if (age >= 26 && age <= 35) {
if (new Date(val).getFullYear() - new Date(this.userInfo.certificateValidate).getFullYear() != 20 && new Date(val).getFullYear() - new Date(this.userInfo.certificateValidate).getFullYear() != 10) {
return this.$toast('26周岁~35周岁的证件有效期为20年或10年')
}
@@ -1147,8 +1165,8 @@ export default {
thirdOrderDTO: null
}
}
checkAppointBnf(params).then(res=>{
if(res.result == '0'){
checkAppointBnf(params).then(res => {
if (res.result == '0') {
beneficiaries.push(this.userInfo)
// 保存 新增的受益人信息 以及页面跳转字段
localStorage.beneficiaryInfo = JSON.stringify(beneficiaries)
@@ -1193,8 +1211,8 @@ export default {
let params = {
orderNo: this.$route.query.orderNo
}
getOrderDetail(params).then(res=>{
if(res.result == 0){
getOrderDetail(params).then(res => {
if (res.result == 0) {
let insuredDetail = res.orderDTO.appntDTO
this.userInfo.name = insuredDetail.name //姓名
this.nameLimit = Boolean(insuredDetail.name)
@@ -1211,17 +1229,14 @@ export default {
this.userInfo.effectiveDateType = insuredDetail.certiexpiredate == '9999-12-31' //是否长期
this.userInfo.mobile = insuredDetail.mobile
this.mobileLimit = Boolean(insuredDetail.mobile)
this.userInfo.marriage =insuredDetail.marriage
if(this.userInfo.marriage == 1){
this.userInfo.marriage = insuredDetail.marriage
if (this.userInfo.marriage == 1) {
this.userInfo.marriageStatus = '已婚'
}
else if(this.userInfo.marriage == 2){
} else if (this.userInfo.marriage == 2) {
this.userInfo.marriageStatus = '未婚'
}
else if(this.userInfo.marriage == 3){
} else if (this.userInfo.marriage == 3) {
this.userInfo.marriageStatus = '离异'
}
else if(this.userInfo.marriage == 4){
} else if (this.userInfo.marriage == 4) {
this.userInfo.marriageStatus = '丧偶'
}
let age = utilsAge.getAge(insuredDetail.birthday, new Date())
@@ -1236,7 +1251,7 @@ export default {
this.areaStr = getAreaName([
{ code: insuredDetail.homeProvince },
{ code: insuredDetail.homeCity },
{ code: insuredDetail.homeArea },
{ code: insuredDetail.homeArea }
])
this.userInfo.province = insuredDetail.homeProvince
this.userInfo.city = insuredDetail.homeCity
@@ -1308,26 +1323,26 @@ export default {
}
this.userInfo.effectiveDateType = false
this.effectiveDateTypeAble = idToData(val).age <= 45
if(this.userInfo.idType == '2' && idToData(this.userInfo.idNo).age <16) {
if (this.userInfo.idType == '2' && idToData(this.userInfo.idNo).age < 16) {
this.userInfo.birthday = idToData(val).birthday
this.userInfo.sex = idToData(val).sex
this.userInfo.certificateValidate = this.userInfo.birthday
let date2_29 = this.userInfo.certificateValidate.slice(5, 11)
if(date2_29 == '02-29'){
if (date2_29 == '02-29') {
let thisyear = Number(this.userInfo.certificateValidate.slice(0, 4)) + 16
if (thisyear % 4 == 0 && thisyear % 100 != 0 || thisyear % 400 == 0){
if (thisyear % 4 == 0 && thisyear % 100 != 0 || thisyear % 400 == 0) {
return this.userInfo.certiexpiredate = thisyear + '-02-29'
} else {
return this.userInfo.certiexpiredate = thisyear + '-02-28'
}
}else{
} else {
this.userInfo.certiexpiredate = String(Number(this.userInfo.certificateValidate.slice(0, 4)) + 16) + this.userInfo.certificateValidate.slice(4, 11)
}
}
if (idToData(val).age < 18) {
this.userInfo.marriageStatus = this.branchType == '14' ? '未婚' : this.userInfo.marriageStatus
this.userInfo.marriage = this.branchType == '14' ? 2 : this.userInfo.marriage
}else{
} else {
this.userInfo.marriageStatus = this.branchType == '14' ? '' : this.userInfo.marriageStatus
this.userInfo.marriage = this.branchType == '14' ? null : this.userInfo.marriage
}
@@ -1371,11 +1386,11 @@ export default {
async 'withRootUser.value'(n) {
const orderNo = this.$route.query.orderNo
if (n && orderNo) {
const rs = await getOrderDetail({ orderNo: orderNo});
const rs = await getOrderDetail({ orderNo: orderNo })
this.areaStr = getAreaName([
{ code: rs.orderDTO.appntDTO.homeProvince },
{ code: rs.orderDTO.appntDTO.homeCity },
{ code: rs.orderDTO.appntDTO.homeArea },
{ code: rs.orderDTO.appntDTO.homeArea }
])
this.userInfo.province = rs.orderDTO.appntDTO.homeProvince
this.userInfo.city = rs.orderDTO.appntDTO.homeCity
@@ -1385,6 +1400,13 @@ export default {
this.homeName = this.userInfo.homeAddress = ''
}
}
// beneficiary: {
// deep: true,
// handler(value, oldValue) {
// console.log(`value.relationToInsured `, value, value.relationToInsured)
// console.trace(value)
// }
// }
},
beforeRouteLeave(to, from, next) {
document.body.style.backgroundColor = ''
@@ -1398,9 +1420,11 @@ export default {
font-weight: 600;
border-bottom: 1px solid #dadada;
}
/deep/.van-checkbox {
/deep/ .van-checkbox {
margin-left: auto;
}
.address {
display: flex;
flex-direction: row-reverse;

View File

@@ -11,15 +11,23 @@
</div>
</div>
<!-- 受益人列表 -->
<div class="fs14 beneficiary-list" v-if="type === 'designateBeneficiary'">
<ul>
<!-- 受益人信息-->
<ul v-if="true">
<li v-for="(item, index) in beneficiaries" :key="index">
<!-- 身份证扫描 -->
<IdentityCardScan @getScanInfo="getIdentityInfo" :options="{ showIDInfo: false }" />
<!-- 受益人信息 -->
<slot :beneficiary="item" />
</li>
</ul>
<ul v-else>
<li class="pv20 ph15 item" v-for="(item, index) in beneficiaries" :key="index">
<div class="bg-white p15">
<div class="flex justify-content-s c-gray-darker">
<div>
<img src="@/assets/images/bnf_avatar.png" width="40" height="40" class="radius50 v-middle" />
<img src="@/assets/images/bnf_avatar.png" width="40" height="40" class="radius50 v-middle" alt="" />
<span class="ml10 c-gray-base">{{ item.name }}</span>
</div>
<van-icon name="delete" size="20" @click="deleteBeneficiary(index)" />
@@ -37,7 +45,7 @@
</ul>
<div class="add-btn mt20 text-center p15 c-gray-base" @click="add">+ 添加指定受益人</div>
</div>
<!-- <van-button type="danger" class="bottom-btn" @click="nextStep">下一步</van-button>-->
<!-- <van-button type="danger" class="bottom-btn" @click="nextStep">下一步</van-button>-->
</div>
</template>
@@ -46,6 +54,7 @@ import { RadioGroup, Radio, Icon, Dialog } from 'vant'
import dataDictionary from '@/assets/js/utils/data-dictionary'
import { saveOrUpdateOrderInfo, getOrderDetail } from '@/api/ebiz/sale/sale'
import IndexBar from '@/components/ebiz/sale/IndexBar'
import { getIdentityInfo } from '@/views/ebiz/saleFlowProImprove/js/methods'
export default {
name: 'beneficiary',
@@ -54,7 +63,8 @@ export default {
[Radio.name]: Radio,
[Icon.name]: Icon,
[Dialog.name]: Dialog,
[IndexBar.name]: IndexBar
[IndexBar.name]: IndexBar,
IdentityCardScan: () => import('@/views/ebiz/saleFlowProImprove/components/IdentityCardScan.vue')
},
data() {
return {
@@ -66,35 +76,29 @@ export default {
bnfFlag: '0', // 受益人类型
bnfType: '0', // 0 身故受益人 1 身前受益人
salePageFlag: '4',
isShowEvaluationPoint:'0'
isShowEvaluationPoint: '0'
}
},
created() {
// 是否从添加指定受益人页面跳转
if (localStorage.fromAddBeneficiaryInfo) {
this.type = '2'
this.beneficiaries = this.beneficiaries.concat(JSON.parse(localStorage.beneficiaryInfo))
this.type = '2'
console.log(this.beneficiaries)
} else {
getOrderDetail({ orderNo: this.$route.query.orderNo }).then(res => {
if (res.result == 0) {
this.isShowEvaluationPoint = res.orderDTO.riskEvaluationDTO.isShowEvaluationPoint
this.renovate = new Date().getTime()
this.$utils.intLocalStorage(res)
this.type = res.orderDTO.orderInfoDTO.bnfFlag == '1' ? '2' : '1' //bnfFlag 0-法定受益人 1-指定受益人
if (res.orderDTO.orderInfoDTO.bnfFlag == null) {
localStorage.setItem('salePageFlag', this.salePageFlag)
}
if (res.orderDTO.insuredDTOs[0].bnfDTOs !== null) {
this.beneficiaries = this.beneficiaries.concat(res.orderDTO.insuredDTOs[0].bnfDTOs)
localStorage.beneficiaryInfo = JSON.stringify(res.orderDTO.insuredDTOs[0].bnfDTOs)
} else {
localStorage.beneficiaryInfo = []
}
getOrderDetail({ orderNo: this.$route.query.orderNo }).then(res => {
if (res.result === '0') {
this.isShowEvaluationPoint = res.orderDTO.riskEvaluationDTO ? res.orderDTO.riskEvaluationDTO.isShowEvaluationPoint : ''
this.renovate = new Date().getTime()
this.$utils.intLocalStorage(res)
this.type = res.orderDTO.orderInfoDTO.bnfFlag === '0' ? 'beneficiary' : 'designateBeneficiary' //bnfFlag 0-法定受益人 1-指定受益人
if (res.orderDTO.orderInfoDTO.bnfFlag == null) {
localStorage.setItem('salePageFlag', this.salePageFlag)
}
})
}
if (res.orderDTO.insuredDTOs[0].bnfDTOs !== null) {
this.beneficiaries = this.beneficiaries.concat(res.orderDTO.insuredDTOs[0].bnfDTOs)
localStorage.beneficiaryInfo = JSON.stringify(res.orderDTO.insuredDTOs[0].bnfDTOs)
} else {
localStorage.beneficiaryInfo = []
}
}
})
this.insuredPerson = JSON.parse(this.$CacheUtils.getLocItem('saleInsuredPersonInfo')).name
},
mounted() {
@@ -113,6 +117,7 @@ export default {
next()
},
methods: {
getIdentityInfo,
appCallBack(data) {
if (data.trigger == 'left_button_click') {
return this.$dialog
@@ -172,10 +177,8 @@ export default {
thirdOrderDTO: null
}
}
console.log(this.beneficiaries)
//调接口保存受益人
saveOrUpdateOrderInfo(data).then(res => {
// console.log(res)
if (res.result == 0) {
localStorage.removeItem('applicant')
localStorage.removeItem('fromAddBeneficiaryInfo')
@@ -199,11 +202,9 @@ export default {
//添加受益人
add() {
let beneRatio = 0
console.log(this.beneficiaries)
this.beneficiaries.forEach(item => {
beneRatio += parseInt(item.bnfLot)
})
console.log(beneRatio)
if (beneRatio >= 100) {
return this.$toast('受益份额已满~')
}
@@ -219,7 +220,7 @@ export default {
},
// 单选按钮切换
radioChange(val) {
this.$emit("changeBeneficiary", val)
this.$emit('changeBeneficiary', val)
},
// 删除受益人
deleteBeneficiary(index) {
@@ -232,8 +233,6 @@ export default {
})
.then(() => {
// on confirm
console.log(this.beneficiaries[index].idNo)
if (this.beneficiaries[index].asAppntAddress == true) {
localStorage.removeItem('applicant')
}
@@ -257,7 +256,6 @@ export default {
//获取受益人列表
async getBeneficiaryList() {
const res = await getOrderDetail({ orderNo: this.$route.query.orderNo })
console.log(res)
if (res.result == 0 && res.orderDTO) {
this.beneficiaries = res.orderDTO.inuseredDTOs[0].bnfDTOs
}
@@ -283,9 +281,11 @@ export default {
margin: 20px auto;
border: 1px dashed #999;
}
.beneficiary-list {
margin-bottom: 65px;
}
.item {
background-color: #f5f5f5;
}

View File

@@ -24,8 +24,10 @@ export default {
<template>
<div class="iaf-beneficiary-container">
<Beneficiary @changeBeneficiary="handleBeneficiaryChange" />
<DesignateBeneficiary v-if="showDesignateBeneficiary" />
<Beneficiary @changeBeneficiary="handleBeneficiaryChange" >
<template #default="{beneficiary}">
<DesignateBeneficiary v-if="showDesignateBeneficiary" :beneficiary.sync="beneficiary"/></template>
</Beneficiary>
</div>
</template>