feat(ebiz): 优化投保流程与职业选择功能

- 注释掉 initPersonInfo 方法调用,调整初始化逻辑
- 新增 source 为 productDetail 时的字段忽略逻辑,保留默认值
- 更新 InsuredInfo 组件中的 nativeplace 显示与选择逻辑
- 移除有无社保选择组件,注释相关代码
- 增加 van-picker 的 default-index 属性支持默认索引
- 更新导入状态模块 applicant 替代 insured
- 修改订单类型为 APPNT_ORDER_NEW 以适配新流程
- 优化婚姻状态监听器,增加 deep 和 immediate 配置
- 在 InsuredPerson 组件中新增“同投保人”地址复选框
- 更新地址选择器默认索引逻辑及条件判断
- 职业选择组件中禁止选择特定职业代码并提示错误
- 设置 isNewPeopleFlag 默认值为 '0' 以确保初始状态正确
This commit is contained in:
hz
2025-11-25 15:28:06 +08:00
parent a167479f24
commit 96f1ad7a3e
5 changed files with 157 additions and 79 deletions

View File

@@ -669,7 +669,7 @@ export default {
this.branchTypeVal = 'Y'
}
})
this.initPersonInfo()
// this.initPersonInfo()
this.init()
Array.prototype.min = function() {
@@ -702,13 +702,18 @@ export default {
const { appntDTO, insuredDTOs } = orderDTO
const [insuredPersonInfo] = insuredDTOs
Object.assign(this.saleInsuredInfo, appntDTO)
Object.assign(this.saleInsuredPersonInfo, insuredPersonInfo)
// this.saleInsuredInfo = { ...this.saleInsuredInfo, ...appntDTO }
// setLocItem('saleInsuredInfo', JSON.stringify(agppntDTO))
// this.saleInsuredPersonInfo = { ...this.saleInsuredPersonInfo, ...insuredPersonInfo }
// setLocItem('saleInsuredPersonInfo', JSON.stringify(insuredPersonInfo))
// 如果从产品详情进入, 则不校验一些属性内容, 保留默认值
const defaultKeys = this.$route.query.source === 'productDetail' ? ['isNewPeopleFlag'] : []
const applicantIgnoreKeys = [...defaultKeys]
for (const key in appntDTO) {
if (applicantIgnoreKeys.includes(key)) continue
this.saleInsuredInfo[key] = appntDTO[key]
}
const insuredIgnoreKeys = [...defaultKeys]
for (const key in insuredPersonInfo) {
if (insuredIgnoreKeys.includes(key)) continue
this.saleInsuredPersonInfo[key] = insuredPersonInfo[key]
}
})
// }
},

View File

@@ -120,6 +120,8 @@
right-icon="arrow"
@click="toSelect('10')"
/>
{{ userInfo.nativeplace }}
<van-field
v-validate="'required'"
:value="userInfo.nativeplace | idToText('nativeplace')"
@@ -237,15 +239,15 @@
v-validate="'required'"
@click="toSelect('3')"
/> -->
<select-radio
v-if="Number(branchType) !== 14"
v-validate="'required'"
:radios="medicalRadio"
:value.sync="userInfo.medical"
label="有无社保"
name="有无社保"
required
/>
<!-- <select-radio-->
<!-- v-if="Number(branchType) !== 14"-->
<!-- v-validate="'required'"-->
<!-- :radios="medicalRadio"-->
<!-- :value.sync="userInfo.medical"-->
<!-- label="有无社保"-->
<!-- name="有无社保"-->
<!-- required-->
<!-- />-->
<van-field
v-validate="'required'"
:value="userInfo.taxResidentId | idToText('taxIdentity')"
@@ -475,7 +477,7 @@
<!-- 字段选择 -->
<van-popup v-model="popupShow" position="bottom">
<van-picker :columns="columns" show-toolbar @cancel="popupShow = false" @confirm="onConfirm" />
<van-picker :columns="columns" :default-index="defaultIndex" show-toolbar @cancel="popupShow = false" @confirm="onConfirm" />
</van-popup>
<!-- 地区选择 -->
<!-- <van-popup v-model="areaShow" position="bottom">
@@ -592,7 +594,7 @@ import { gbcProjectDetail, getDepartmentByProjectNo } from '@/api/GBC/GBC'
import { getCheckModelAgentInfo } from '@/api/ebiz/common/common'
import { getAgentInfo } from '@/api/ebiz/my/my'
import { cardSide, imageType, subBusinessType, user } from '@/views/ebiz/saleFlowProImprove/js/enum'
import { insured } from '@/views/ebiz/saleFlowProImprove/js/state'
import { applicant } from '@/views/ebiz/saleFlowProImprove/js/state'
export default {
name: 'insuredInfo',
@@ -677,6 +679,7 @@ export default {
// censusShow: false, //户籍联动
pickerType: undefined,
columns: [],
defaultIndex: 0,
valueKey: 'text',
// census: '', //户籍
// areaName: '', //单位地址
@@ -687,7 +690,7 @@ export default {
sessionId: '', //后台返回的 id
effectiveDateTypeAble: false, //长期按钮是否禁用
isElecCont: '', // 保单类型 0 为电子 2 为纸质加电子
userInfo: insured,
userInfo: applicant,
areaList: areaList,
areaLists: areaLists,
currentPopupIndex: '',
@@ -742,8 +745,11 @@ export default {
getOrderDetail({ orderNo: orderNo }).then(res => {
if (res.result == 0) {
this.renovate = new Date().getTime()
const ignoreKeys = this.$route.query.source === 'productDetail' ? ['isNewPeopleFlag'] : []
//投保人信息返显
for (const [key, value] of Object.entries(res.orderDTO.appntDTO)) {
if (ignoreKeys.includes(key)) continue
this.userInfo[key] = value
}
// 保单信息-投保单号返显
@@ -1024,8 +1030,13 @@ export default {
})
this.occupationShowPicker = false
},
setColumnIndex(index) {
this.defaultIndex = index
},
//弹框选择
toSelect(pickerType, valueKey) {
// 默认从 索引为0
this.setColumnIndex(0)
//pickerType 1、国家地区 2、证件类型 3、文化程度 4、有无社保(弃用) 5、税收居民身份 6、婚姻状况 7、在职情况 8、收入来源 11、新市民类型
;[this.popupShow, this.pickerType] = [true, pickerType]
if (valueKey) this.valueKey = valueKey
@@ -1035,7 +1046,17 @@ export default {
this.columns = DataDictionary.nativeplace
break
case '2':
// eslint-disable-next-line no-case-declarations
const age = utilsAge.getAge(this.userInfo.birthday, new Date())
this.setColumnIndex(age <= 18 ? 1 : 0)
this.columns = DataDictionary.insuredIdType
.map(item => {
// 去除禁用标识
return item.id !== 3 ? { id: item.id, text: item.text } : undefined
})
// 去除空项
.filter(item => item)
break
// case '3':
// this.columns = DataDictionary.degree
@@ -1081,6 +1102,9 @@ export default {
break
case 'dialogInsuredIdType':
this.columns = DataDictionary.insuredIdType
break
default:
break
}
// if (pickerType == '1') {
@@ -1116,10 +1140,21 @@ export default {
},
//确认选择字段
onConfirm(value) {
// /** 如果身份证类型为 居民身份证或者户口本时,国家为非中国,则报错*/
// function validateCountry({ value, type }) {
// if (
// ![1, 2, 3, 4].includes(Number(type === 1 ? value.id : this.userInfo.nativeplace)) &&
// [1, 2].includes(Number(type === 1 ? this.userInfo.idType : value.id))
// ) {
// this.$toast('国籍选择错误')
// return false
// }
// }
this.popupShow = false
if (this.pickerType == '1') {
if (Number(this.pickerType) === 1) {
this.userInfo.nativeplace = value.id
} else if (this.pickerType == '2') {
} else if (Number(this.pickerType) === 2) {
//身份证以外的证件类型可以使用长期
if (value.id != '1') {
this.effectiveDateTypeAble = false
@@ -1174,7 +1209,6 @@ export default {
},
//证件起始截止日期
onDateConfirm(val, type) {
console.log(val, type)
switch (type) {
case '0':
{
@@ -1675,7 +1709,7 @@ export default {
}
try {
let params = {
orderType: 'APPNT_ORDER',
orderType: 'APPNT_ORDER_NEW',
orderDTO: {
orderInfoDTO: {
orderNo: this.$route.query.orderNo
@@ -1978,10 +2012,14 @@ export default {
this.userInfo.otherSalarySource = ''
}
},
'userInfo.marriageStatus'(nv) {
for (let status of DataDictionary.marriage) {
if (status.text === nv) {
this.userInfo.marriage = status.id
'userInfo.marriageStatus': {
deep: true,
immediate: true,
handler(nv) {
for (let status of DataDictionary.marriage) {
if (status.text === nv) {
this.userInfo.marriage = status.id
}
}
}
},

View File

@@ -5,7 +5,6 @@
<template v-if="uploadComponentInfo">
<Component :is="uploadComponentInfo.component" v-bind="uploadComponentInfo.props" v-on="uploadComponentInfo.event" />
</template>
<van-field
v-validate="'required'"
:value="userInfo.relationToAppnt | idToText('relationToAppnt')"
@@ -306,19 +305,19 @@
placeholder="请输入,单位万元"
required
/>
<van-field
v-if="branchType != '14'"
v-model="userInfo.liabilitiesMoney"
v-validate="'required|onlyNumber'"
:readonly="isAppnt"
clearable
maxlength="5"
name="负债金额"
placeholder="请输入,单位万元"
required
>
<div slot="label" class="flex flex-wrap"><span>负债金额</span><span>万元</span></div>
</van-field>
<!-- <van-field-->
<!-- v-if="branchType != '14'"-->
<!-- v-model="userInfo.liabilitiesMoney"-->
<!-- v-validate="'required|onlyNumber'"-->
<!-- :readonly="isAppnt"-->
<!-- clearable-->
<!-- maxlength="5"-->
<!-- name="负债金额"-->
<!-- placeholder="请输入,单位万元"-->
<!-- required-->
<!-- >-->
<!-- <div slot="label" class="flex flex-wrap"><span>负债金额</span><span>万元</span></div>-->
<!-- </van-field>-->
<!-- <van-field
:value="userInfo.jobStatus | idToText('workCondition')"
readonly
@@ -430,6 +429,7 @@
<van-field
v-model="userInfo.homeAddress"
v-validate="'required|homeAddressNum|homeAddressCh'"
:disabled="withRootUser.value"
:readonly="isAppnt"
clearable
label=""
@@ -438,6 +438,9 @@
placeholder="具体到街道、门牌号、楼号、单元号、室号"
style="font-size: 3.5vw"
/>
<div class="pl10 pt10 pb10 pr10 address fs14">
<van-checkbox v-model="withRootUser.value">同投保人</van-checkbox>
</div>
<!-- <van-field
v-model="userInfo.homeZip"
label="邮编"
@@ -470,7 +473,7 @@
<van-area :area-list="areaList" :columns-num="2" value="110101" @cancel="censusShow = false" @confirm="sureArea($event, '3')" />
</van-popup>
<van-popup v-model="isMarriageStatusShow" position="bottom">
<van-picker :columns="columns" show-toolbar @cancel="isMarriageStatusShow = false" @confirm="onMarriageConfirm" />
<van-picker :columns="columns" :default-index="defaultIndex" show-toolbar @cancel="isMarriageStatusShow = false" @confirm="onMarriageConfirm" />
</van-popup>
<van-dialog v-model="isNewPeopleFlagTipshow" :showConfirmButton="false">
<div slot="title">
@@ -509,7 +512,7 @@ import IndexBar from '@/components/ebiz/sale/IndexBar'
import SearchField from './components/SearchField'
import riskRules from '@/views/ebiz/common/risk-rules'
import { cardSide, subBusinessType, user } from '@/views/ebiz/saleFlowProImprove/js/enum'
import { applicant } from '@/views/ebiz/saleFlowProImprove/js/state'
import { applicant, insured } from '@/views/ebiz/saleFlowProImprove/js/state'
export default {
name: 'insuredInfo',
@@ -584,11 +587,12 @@ export default {
censusShow: false, //户籍联动
pickerType: undefined,
columns: [],
defaultIndex: 0,
valueKey: 'text',
// census: '', //户籍
// areaName: '',
isRequired: '', //长期前是否有*
userInfo: applicant,
userInfo: insured,
areaList: areaList,
areaLists: areaLists,
currentPopupIndex: '',
@@ -626,7 +630,7 @@ export default {
this.isAppnt = true
//获取投保人信息
let insuredInfo = res.orderDTO.appntDTO
for (let key in this.userInfo) {
for (let key in insuredInfo) {
this.userInfo[key] = insuredInfo[key]
}
// let insuredCustomer = res.orderDTO.insuredDTOs[0]
@@ -662,16 +666,23 @@ export default {
this.effectiveDateTypeAble = age <= 45
}
})
}
// this.appntMarriage = res.orderDTO.appntDTO.marriage
this.$utils.intLocalStorage(res)
if (res.orderDTO.insuredDTOs[0]) {
} else if (Array.isArray(res.orderDTO.insuredDTOs) && res.orderDTO.insuredDTOs[0]) {
let insuredPersonInfo = res.orderDTO.insuredDTOs[0]
for (let key in this.userInfo) {
this.userInfo[key] = res.orderDTO.insuredDTOs[0][key]
const ignoreKeys = this.$route.query.source === 'productDetail' ? ['isNewPeopleFlag', 'marriage'] : []
for (let key in insuredPersonInfo) {
if (ignoreKeys.includes(key)) {
// 如果是投保人的配偶, 那么需要把婚姻状态重置为已婚
if (key === 'marriage' && Number(insuredPersonInfo.relationToAppnt) === 2) {
this.userInfo.marriageStatus = '已婚'
}
continue
}
this.userInfo[key] = insuredPersonInfo[key]
}
//是否长期
this.userInfo.effectiveDateType = insuredPersonInfo.effectiveDateType == 'false' ? false : true
this.userInfo.effectiveDateType = String(insuredPersonInfo.effectiveDateType) !== 'false'
//设为联系地址
// this.userInfo.addressStatus = '0'
@@ -697,7 +708,7 @@ export default {
])
}
//是否长期
this.userInfo.effectiveDateType = insuredPersonInfo.effectiveDateType == 'false' ? false : true
this.userInfo.effectiveDateType = String(insuredPersonInfo.effectiveDateType) !== 'false'
// let saleInsuredPersonInfo = JSON.parse(localStorage.saleInsuredPersonInfo)
// this.userInfo = saleInsuredPersonInfo
// this.census = getAreaName([{ code: saleInsuredPersonInfo.householdProvince }, { code: saleInsuredPersonInfo.householdCity }]) //户籍
@@ -722,7 +733,7 @@ export default {
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') {
if (this.userInfo.birthday.substr(5, 5) === '02-29') {
// 获取某年某月一共多少天
let date = new Date(year, 2, 1)
let dayEnd = new Date(date.getTime() - 864e5).getDate()
@@ -735,13 +746,13 @@ export default {
//------------------------专为惠企写死--begin---------------//
if (res.orderDTO.insuredDTOs[0] && res.orderDTO.insuredDTOs[0].riskDTOLst) {
this.specilFlag = res.orderDTO.insuredDTOs[0].riskDTOLst.some(v => {
return v.riskCode == 'GFRS_M0024' || v.riskCode == 'GFRS_M0040'
return v.riskCode === 'GFRS_M0024' || v.riskCode === 'GFRS_M0040'
})
? '1'
: '0'
} else if (res.orderDTO.orderInfoDTO.productCode == 'GFRS_M0024') {
} else if (res.orderDTO.orderInfoDTO.productCode === 'GFRS_M0024') {
this.specilFlag = '1'
} else if (res.orderDTO.orderInfoDTO.productCode == 'GFRS_M0040') {
} else if (res.orderDTO.orderInfoDTO.productCode === 'GFRS_M0040') {
this.specilFlag = '1'
}
// ------------------------专为惠企写死--end---------------//
@@ -789,6 +800,9 @@ export default {
this.registerMainTask()
},
methods: {
setColumnIndex(index) {
this.defaultIndex = index
},
isNewPeopleFlagTip() {
this.isNewPeopleFlagTipshow = true
},
@@ -813,6 +827,9 @@ export default {
if (this.isReadonly) {
return
}
const age = utilsAge.getAge(this.userInfo.birthday, new Date())
this.setColumnIndex(age <= 18 ? 1 : 0)
this.isMarriageStatusShow = true
this.columns = DataDictionary.marriage
},
@@ -861,6 +878,7 @@ export default {
},
//弹框选择
toSelect(pickerType, valueKey) {
this.setColumnIndex(0)
// 投被同人不允许编辑
if (this.isReadonly && pickerType != '7') {
return
@@ -1943,7 +1961,7 @@ export default {
},
//地区选择
areaChoose(index) {
if (this.isReadonly) {
if (this.isReadonly || this.withRootUser.value) {
return
}
switch (index) {
@@ -2145,6 +2163,9 @@ export default {
imagePath: this.mediaDTOS ? applicantBack.rgssUrl : ''
}
}
},
applicant() {
return applicant
}
},
beforeDestroy() {
@@ -2157,18 +2178,28 @@ export default {
watch: {
userInfo: {
deep: true,
immediate: true,
async handler() {}
},
async 'withRootUser.value'(n) {
const orderNo = this.$route.query.orderNo
if (n && orderNo) {
const rs = await getOrderDetail({ orderNo: orderNo })
this.userInfo.homeProvince = rs.orderDTO.appntDTO.homeProvince
this.userInfo.homeCity = rs.orderDTO.appntDTO.homeCity
this.userInfo.homeArea = rs.orderDTO.appntDTO.homeArea
this.userInfo.homeAddress = rs.orderDTO.appntDTO.homeAddress
} else {
this.userInfo.homeAddress = ''
applicant: {
deep: true,
immediate: true,
async handler(applicant) {
if (this.withRootUser.value) {
this.userInfo.homeProvince = applicant.homeProvince
this.userInfo.homeCity = applicant.homeCity
this.userInfo.homeArea = applicant.homeArea
this.userInfo.homeAddress = applicant.homeAddress
}
}
},
async 'withRootUser.value'(value) {
if (value) {
const applicant = this.applicant
this.userInfo.homeProvince = applicant.homeProvince
this.userInfo.homeCity = applicant.homeCity
this.userInfo.homeArea = applicant.homeArea
this.userInfo.homeAddress = applicant.homeAddress
}
},
'userInfo.marriageStatus'(nv) {

View File

@@ -1,9 +1,9 @@
<template>
<div class="occupation pb70">
<van-search v-model="searchParams" @input="onSearch" placeholder="请输入搜索关键词" show-action shape="round" @clear="clearSearch" @search="onSearch">
<van-search v-model="searchParams" placeholder="请输入搜索关键词" shape="round" show-action @clear="clearSearch" @input="onSearch" @search="onSearch">
<div slot="action" @click="onSearch">搜索</div>
</van-search>
<div class="choose-result fs12 pl25" v-if="third.code">
<div v-if="third.code" class="choose-result fs12 pl25">
<p>职业代码{{ third.code }}</p>
<p>职业{{ chooseName }}</p>
</div>
@@ -11,7 +11,7 @@
<div :class="[isSearch ? 'hidden' : '']">
<p class="fs14 pl20 fwb pv5">常用职业</p>
<div class="common-occupation flex flex-wrap fs12 ph25">
<div v-for="(item, index) in commonList" @click="commonChoose(item, index)" :key="index" :class="[item.isActive ? 'active' : '', 'fwb']">
<div v-for="(item, index) in commonList" :key="index" :class="[item.isActive ? 'active' : '', 'fwb']" @click="commonChoose(item, index)">
{{ item.name }}
</div>
</div>
@@ -20,17 +20,17 @@
<p class="fs14 pl20 fwb pv5">全部职业</p>
<div class="main-area fs12 ph10">
<div class="item ph10">
<p class="p5" v-for="(item, index) in occupationList" :key="index" @click="handleFirst(item)" :class="{ active: first.code == item.code }">
<p v-for="(item, index) in occupationList" :key="index" :class="{ active: first.code == item.code }" class="p5" @click="handleFirst(item)">
{{ item.name }}
</p>
</div>
<div class="item ph10">
<p class="p5" v-for="(item, index) in sec" :key="index" @click="handleSec(item)" :class="{ active: second.code == item.code }">
<p v-for="(item, index) in sec" :key="index" :class="{ active: second.code == item.code }" class="p5" @click="handleSec(item)">
{{ item.name }}
</p>
</div>
<div class="item ph10">
<p class="p5" v-for="(item, index) in thi" :key="index" @click="handleThi(item)" :class="{ active: third.code == item.code }">
<p v-for="(item, index) in thi" :key="index" :class="{ active: third.code == item.code }" class="p5" @click="handleThi(item)">
{{ item.name }}
</p>
</div>
@@ -39,7 +39,7 @@
<div :class="[isSearch ? '' : 'hidden']">
<p class="fs14 pl20 fwb pv5">搜索结果</p>
<div class="item p10 search-result fs14 flex flex-direction-colunm">
<p class="p5 mv5" :class="[item.isActive ? 'active' : '']" v-for="(item, index) in searchList" @click="searchChoose(item, index)" :key="index">
<p v-for="(item, index) in searchList" :key="index" :class="[item.isActive ? 'active' : '']" class="p5 mv5" @click="searchChoose(item, index)">
<span v-html="item.showName.replace(new RegExp(searchParams, 'g'), `<span class=&quot;red&quot;>${searchParams}</span>`)"></span>
</p>
</div>
@@ -141,6 +141,10 @@ export default {
this.commonInit()
},
ensureChoose() {
if (this.third.code === '2099908') {
this.$toast('投保人职业选择错误')
return false
}
if (this.third.code) {
this.$emit('chooseOccupation', this.third)
} else {

View File

@@ -1,4 +1,4 @@
import Vue, { ref } from 'vue'
import Vue from 'vue'
import { syncLocalstorageData } from '@/assets/js/syncLocalstorageData'
/**
@@ -57,7 +57,7 @@ export const applicant = Vue.observable(
// householdProvince: '', //户籍省
// householdCity: '' //户籍市
// addressStatus: '0' //是否是联系地址
isNewPeopleFlag: '', //新市民身份
isNewPeopleFlag: '0', //新市民身份
npType: '' //新市民类型
},
{ name: 'saleInsuredInfo', release: true }
@@ -124,7 +124,7 @@ export const insured = Vue.observable(
// householdProvince: '', //户籍省
// householdCity: '' //户籍市
// addressStatus: '' //是否是联系地址
isNewPeopleFlag: '', //新市民身份
isNewPeopleFlag: '0', //新市民身份
npType: '' //新市民类型
},
{ name: 'saleInsuredPersonInfo', release: true }