diff --git a/src/assets/js/utils/url.js b/src/assets/js/utils/url.js new file mode 100644 index 000000000..c6c439ab9 --- /dev/null +++ b/src/assets/js/utils/url.js @@ -0,0 +1,15 @@ +/** + * 处理 json 键值对,到 url 中 + */ +export function processJson(json) { + if (typeof json !== 'object') return + if (window.URLSearchParams) return new URLSearchParams(json).toString() + + let url = '' + for (const key in json) { + if (json.hasOwnProperty(key)) { + url += key + '=' + json[key] + '&' + } + } + return url.substring(0, url.length - 1) +} diff --git a/src/views/ebiz/productFlowImprove/components/CalculatePremium.vue b/src/views/ebiz/productFlowImprove/components/CalculatePremium.vue index 083fca73f..61a41a7c8 100644 --- a/src/views/ebiz/productFlowImprove/components/CalculatePremium.vue +++ b/src/views/ebiz/productFlowImprove/components/CalculatePremium.vue @@ -471,6 +471,7 @@ import { validateRelationshipToInsured } from '@/views/ebiz/productFlowImprove/c import TotalPremium from '@/views/ebiz/saleFlowProImprove/components/TotalPremium.vue' import { deepClone } from '@/assets/js/utils/objectUtils' import { applicant, insured } from '@/views/ebiz/saleFlowProImprove/js/state' +import { processJson } from '@/assets/js/utils/url' const DUTY_DEFAULT_MUTIPLE = 1000 const DUTY_DEFAULT_MIN = 10000 @@ -532,7 +533,6 @@ export default { branchTypeVal: '', //个险渠道G 中介渠道Z isEnterAddtionRisk: true, //附加险list activeRadio: '1', - // activeType: localStorage.getItem('active_type'), 现在从订单详情接口取值了 activeType: '', cvalidateFlag: false, cvalidateStr: '', //活动生效日 @@ -669,15 +669,7 @@ export default { /** 初始化用户详情信息 */ initPersonInfo() { if (this.personMessageInfo) return - // const { getLocItem, setLocItem } = cacheUtils - // const saleInsuredInfo = getLocItem('saleInsuredInfo') - // const saleInsuredPersonInfo = getLocItem('saleInsuredPersonInfo') - // 如果本地存在之前编辑过的数据, 优先采用这个,如果没有数据,就从网络获取 - // if (!(saleInsuredInfo && saleInsuredPersonInfo)) { - // if (false){ - // this.saleInsuredInfo = JSON.parse(saleInsuredInfo) - // this.saleInsuredPersonInfo = JSON.parse(saleInsuredPersonInfo) - // } else { + const orderNo = this.$route.query.orderNo getOrderDetail({ orderNo }).then(({ orderDTO }) => { @@ -697,34 +689,6 @@ export default { this.saleInsuredPersonInfo[key] = insuredPersonInfo[key] } }) - // } - }, - appCallBack(data) { - if (data.trigger === 'right_button_click' && localStorage.isFrom === 'proposal') { - return this.$dialog - .confirm({ - className: 'dialog-delete', - title: '提示', - message: '退出流程可能会丢失部分数据,是否确认退出?', - cancelButtonColor: '#E9332E', - confirmButtonColor: '#FFFFFF' - }) - .then(() => { - this.$jump({ - flag: 'h5', - extra: { - title: '建议书列表', - forbidSwipeBack: 1, //当前页面禁止右滑返回 - url: location.origin + `/#/proposal/list` - }, - routerInfo: { - path: `/proposal/list`, - type: '1' - } - }) - }) - .catch(() => {}) - } }, renewalShow(productCode) { let codes = ['GFRS_M0016', 'GFRS_M0005', 'GFRS_M0018', 'GFRS_M0070'] @@ -740,57 +704,62 @@ export default { calFactorLst.forEach(item => { item['isMainRisk'] = 0 item.columns = [] - if (item.type == 0) { - //1、type=0 select 2、type=1 input+stepper - productTrialInfoDTO[item.code].forEach(factor => { - if (factor.defaultValue == 0) { - item.showContent = factor.showContent - if (factor[item.code + 'Flag'] != undefined) { - item[item.code] = factor[item.code] - item[item.code + 'Flag'] = factor[item.code + 'Flag'] - item.hasFlag = '1' - } else if (item.code === 'pensionAge') { - //养老保险金领取年龄 - item[item.code] = factor[item.code] - item['sex'] = factor.sex + switch (Number(item.type)) { + case 0: + //1、type=0 select 2、type=1 input+stepper + productTrialInfoDTO[item.code].forEach(factor => { + if (Number(factor.defaultValue) === 0) { + item.showContent = factor.showContent + if (![void 0, null, NaN].includes(factor[item.code + 'Flag'])) { + item[item.code] = factor[item.code] + item[item.code + 'Flag'] = factor[item.code + 'Flag'] + item.hasFlag = '1' + } else if (item.code === 'pensionAge') { + //养老保险金领取年龄 + item[item.code] = factor[item.code] + item['sex'] = factor.sex + } else { + item[item.code] = factor[item.code] + } + } + let itemColumns = { + text: factor.showContent, + value: factor[item.code], + flag: factor[item.code + 'Flag'], + sex: factor.sex + } + if (factor.medical !== undefined) { + itemColumns.medical = factor.medical + } + item.columns.push(itemColumns) + }) + + break + case 1: + //按年龄选择 + if (productTrialInfoDTO[item.code] != null) { + productTrialInfoDTO[item.code].forEach(factor => { + item = Object.assign(item, factor) + // if ( + // JSON.parse(this.saleInsuredPersonInfo).insuredAge >= Number(factor.minAge) && + // JSON.parse(this.saleInsuredPersonInfo).insuredAge <= Number(factor.maxAge) + // ) { + // item = Object.assign(item, factor) + // } + }) + if (item.code === 'inputPrem') { + item['inputPrem'] = Number(item.minPrem) * Number(item.moneyUnit) } else { - item[item.code] = factor[item.code] + item['amt'] = Number(item.minAmt) * Number(item.moneyUnit) } } - let itemColumns = { - text: factor.showContent, - value: factor[item.code], - flag: factor[item.code + 'Flag'], - sex: factor.sex - } - if (factor.medical !== undefined) { - itemColumns.medical = factor.medical - } - item.columns.push(itemColumns) - }) - } else if (item.type == 1) { - //按年龄选择 - if (productTrialInfoDTO[item.code] != null) { - productTrialInfoDTO[item.code].forEach(factor => { - item = Object.assign(item, factor) - // todo: 流程缩减 - // if ( - // JSON.parse(this.$CacheUtils.getLocItem('saleInsuredPersonInfo')).insuredAge >= Number(factor.minAge) && - // JSON.parse(this.$CacheUtils.getLocItem('saleInsuredPersonInfo')).insuredAge <= Number(factor.maxAge) - // ) { - // // if(JSON.parse(this.$CacheUtils.getLocItem('saleInsuredPersonInfo')).age >= Number(factor.minAge) && JSON.parse(this.$CacheUtils.getLocItem('saleInsuredPersonInfo')).age <= Number(factor.maxAge)){ - // item = Object.assign(item, factor) - // } - }) - if (item.code == 'inputPrem') { - item['inputPrem'] = Number(item.minPrem) * Number(item.moneyUnit) - } else { - item['amt'] = Number(item.minAmt) * Number(item.moneyUnit) - } - } - } else if (item.type == 5) { - // 单元格,用于展示文案,从extra中获取 - item['showContent'] = item.extra + + break + case 5: + // 单元格,用于展示文案,从extra中获取 + item['showContent'] = item.extra + + break } //规则储存 item['rules'] = productTrialInfoDTO[item.code] @@ -826,22 +795,6 @@ export default { query: params } }) - - /** - * 处理 json 键值对,到 url 中 - */ - function processJson(json) { - if (typeof json !== 'object') return - if (window.URLSearchParams) return new URLSearchParams(json).toString() - - let url = '' - for (const key in json) { - if (json.hasOwnProperty(key)) { - url += key + '=' + json[key] + '&' - } - } - return url.substring(0, url.length - 1) - } }, updateFactorByGFRS_M0077(item) { if (item.mainRiskCode === 'GFRS_M0077') { @@ -933,7 +886,8 @@ export default { let flagPermission = await riskRules.getProductSellPermissionList(resultData.productCode, this, this.isCrossChannel) if (flagPermission.flag && localStorage.isFrom !== 'proposal') { //校验该代理人是否有该产品的售卖权限 - return this.$toast(flagPermission.resultMessage) + this.$toast(flagPermission.resultMessage) + return false } /********end 主险选择限制 end******/ @@ -988,8 +942,8 @@ export default { //构建险种数组 let productsData - /**在不添加 this.refer !== "flow" 之前, 会意外的出现显示两个主险。此只针对当处于流程录入的时候 ,不处理额外信息*/ - if (localStorage.chooseProducts && this.refer !== 'flow') { + /**在不添加 this.refer !== "flow" 之前, 会意外出现显示两个主险。此只针对当处于流程录入的时候 ,不处理额外信息*/ + if (localStorage.chooseProducts) { productsData = JSON.parse(localStorage.chooseProducts) productsData.push(currentProductInfo) } else { @@ -998,7 +952,6 @@ export default { //保存选择险种 productsData = this.$utils.unrepeatObj(productsData, 'productCode') //产品数组去重,跳转试算页面未成功重复添加同一产品的情况 localStorage.chooseProducts = JSON.stringify(productsData) - // this.jumpTo() this.chooseProducts = (window.structuredClone ? structuredClone : deepClone)(productsData) @@ -3461,27 +3414,6 @@ export default { this.trialResultsShow = true this.verifyResultList = res.content.data.verifyResultList } - // this.$jump({ - // flag: 'h5', - // extra: { - // url: location.origin + '/#' + url - // }, - // routerInfo: { - // path: url - // } - // }) - // this.$jump({ - // flag: 'goBack', - // extra: { - // refresh: '1', - // index: '-2' - // }, - // routerInfo: { - // type: 2, - // index: -2, - // path: url - // } - // }) } else { this.$toast(res.resMessage) } @@ -3681,7 +3613,7 @@ export default { const { birthday, relationToAppnt, sex } = obj this.saleInsuredPersonInfo.insuredAge = utilsAge.getAge(birthday, new Date()) this.processProducts() - // console.log(`saleInsuredPersonInfo value change`, this.saleInsuredPersonInfo) + if (Number(relationToAppnt) === 1) [this.saleInsuredInfo.sex, this.saleInsuredInfo.birthday] = [sex, birthday] } }, @@ -3690,7 +3622,6 @@ export default { handler: function(obj) { const { birthday, sex } = obj this.saleInsuredInfo.insuredAge = utilsAge.getAge(birthday, new Date()) - // console.log(`saleInsuredInfo value change`, this.saleInsuredInfo) if (this.saleInsuredPersonInfo.relationToAppnt === 1) { ;[this.saleInsuredPersonInfo.sex, this.saleInsuredPersonInfo.birthday] = [sex, birthday] } diff --git a/src/views/ebiz/saleFlowProImprove/InsuranceApplicationFlow.vue b/src/views/ebiz/saleFlowProImprove/InsuranceApplicationFlow.vue index 50aab13ac..b6f85d84b 100644 --- a/src/views/ebiz/saleFlowProImprove/InsuranceApplicationFlow.vue +++ b/src/views/ebiz/saleFlowProImprove/InsuranceApplicationFlow.vue @@ -265,7 +265,6 @@ export default { // 同步两者相同属性的数据 if (!this.insuredData.hasOwnProperty(key) || !this.applicant.hasOwnProperty(key)) continue if (['relationToAppnt', 'email', 'taxResidentId', 'appntId'].includes(key)) continue - // eslint-disable-next-line vue/no-side-effects-in-computed-properties this.insuredData[key] = this.applicantData[key] } }