GFRS-2504 指定生效日需求-修改localstorage取值为空问题-提交人:白金岩

This commit is contained in:
bai.jinyan
2021-05-27 15:43:46 +08:00
parent ae8c2d8990
commit 3bd21b06ec
3 changed files with 72 additions and 74 deletions

View File

@@ -384,7 +384,7 @@ export default {
data() {
return {
activeRadio: '1',
activeType: localStorage.getItem('active_type'),
activeType: this.$CacheUtils.getLocItem('active_type'),
cvalidateFlag : false,
cvalidateStr:'',
chooseProducts: [],
@@ -404,7 +404,7 @@ export default {
influenceAddRiskCodes: [],
influences: [],
nextStepFlag: false,
isRelated: localStorage.isRelated === '0', //关联保单号
isRelated: this.$CacheUtils.getLocItem('isRelated') === '0', //关联保单号
policyNo: '',
// 份数
mult: '',
@@ -412,7 +412,7 @@ export default {
// 默认钱数
defalutAmt: '',
//是否需存在特殊配置 0-是 1-否
isTrial: localStorage.isTrial,
isTrial: this.$CacheUtils.getLocItem('isTrial'),
//缴费期间对应index索引
payEndYearColumnsIndex: 0,
// 后台配置的校验规则
@@ -445,7 +445,7 @@ export default {
//初始化数据
init() {
// 获取是否从建议书过来的
this.isFrom = window.localStorage.isFrom
this.isFrom = this.$CacheUtils.getLocItem('isFrom')
//获取投保人信息
if (this.$CacheUtils.getLocItem('saleInsuredInfo')) {
this.saleInsuredInfo = JSON.parse(this.$CacheUtils.getLocItem('saleInsuredInfo'))
@@ -455,7 +455,7 @@ export default {
this.saleInsuredPersonInfo = JSON.parse(this.$CacheUtils.getLocItem('saleInsuredPersonInfo'))
}
//构建提交数据、渲染险种
this.chooseProducts = JSON.parse(localStorage.chooseProducts)
this.chooseProducts = JSON.parse(this.$CacheUtils.getLocItem('chooseProducts'))
this.chooseProducts.map(item => {
this.cvalidateFlag = item.isMainRisk == 0 && (this.activeType == 'KMH'||this.activeType == 'SQY') && this.isFrom != 'proposal'
this.cvalidateStr = this.cvalidateFlag?this.activeType == 'KMH'?'2021-01-01':this.activeType == 'SQY'?'2021-06-01':'':''
@@ -537,8 +537,8 @@ export default {
})
// 判断是否 含有 后台配置js验证函数
if (localStorage.ruleExpression) {
let ruleExpression = JSON.parse(localStorage.ruleExpression)
if (this.$CacheUtils.getLocItem('ruleExpression')) {
let ruleExpression = JSON.parse(this.$CacheUtils.getLocItem('ruleExpression'))
this.ruleExpression = ruleExpression
let productCodes = Object.keys(ruleExpression)
productCodes.forEach(itemKey => {
@@ -655,8 +655,8 @@ export default {
},
//特殊处理 GFRS_M0016 GFRS_A0004 GFRS_A0005 赔付比例处理
async dogetLimitAndGetRate() {
const orderNo = localStorage.getItem('orderNo')
let detailPromise = this.isFrom === 'proposal' ? localStorage.proposalMedical : await getOrderDetail({ orderNo })
const orderNo = this.$CacheUtils.getLocItem('orderNo')
let detailPromise = this.isFrom === 'proposal' ? this.$CacheUtils.getLocItem('proposalMedical') : await getOrderDetail({ orderNo })
this.chooseProducts.map(item => {
if (
!(item.mainRiskCode === 'GFRS_M0016' || item.productCode === 'GFRS_A0004' || item.productCode === 'GFRS_A0008' || item.productCode === 'GFRS_A0005')
@@ -1179,7 +1179,7 @@ export default {
item.showContent = item.insuYear + '年'
}
if (item.code == 'amt') {
let trialList = JSON.parse(localStorage.trialList)
let trialList = JSON.parse(this.$CacheUtils.getLocItem('trialList'))
item.amt = trialList[0].prem
item.defaultValue = trialList[0].prem
item.moneyUnit = 1
@@ -1198,7 +1198,7 @@ export default {
try {
v.amt = mainRiskInfo.inputPrem.displayAmount * mainRiskInfo.inputPrem.moneyUnit
} catch (e) {
let trialList = JSON.parse(localStorage.trialList)
let trialList = JSON.parse(this.$CacheUtils.getLocItem('trialList'))
v.amt = trialList[0].prem
// v.amt = mainRiskInfo.inputAmt.displayAmount * mainRiskInfo.inputAmt.moneyUnit
}
@@ -1213,7 +1213,7 @@ export default {
item.amt = mainRiskInfo.inputPrem.displayAmount * mainRiskInfo.inputPrem.moneyUnit
item.defaultValue = mainRiskInfo.inputPrem.displayAmount * mainRiskInfo.inputPrem.moneyUnit
} catch (e) {
let trialList = JSON.parse(localStorage.trialList)
let trialList = JSON.parse(this.$CacheUtils.getLocItem('trialList'))
item.defaultValue = trialList[0].prem
item.amt = trialList[0].prem
}
@@ -1309,12 +1309,11 @@ export default {
path: '/common/selectedProduct'
}
})
localStorage.trialList = ''
this.$CacheUtils.setLocItem('trialList','')
} else {
this.chooseProducts.splice(index, 1)
}
localStorage.chooseProducts = JSON.stringify(this.chooseProducts)
this.$CacheUtils.setLocItem('chooseProducts',JSON.stringify(this.chooseProducts))
this.getTrial()
})
.catch(() => {})
@@ -1343,7 +1342,7 @@ export default {
this.richChildrenFlag = true
}
this.trialList = resultData.trialList
localStorage.trialList = JSON.stringify(resultData.trialList)
this.$CacheUtils.setLocItem('trialList',JSON.stringify(resultData.trialList))
//设置豁免险保额
this.setRemitRisk()
this.nextStepFlag = false
@@ -1351,7 +1350,7 @@ export default {
this.nextStepFlag = true
this.$toast(resultData.resultMessage)
}
localStorage.chooseProducts = JSON.stringify(this.chooseProducts)
this.$CacheUtils.setLocItem('chooseProducts', JSON.stringify(this.chooseProducts))
},
//获取试算参数
getParams() {
@@ -1465,15 +1464,14 @@ export default {
addRiskCodes.push(item.productCode)
}
})
if (localStorage.oldAddRiskCodes && JSON.parse(localStorage.oldAddRiskCodes)) {
addRiskCodes = addRiskCodes.concat(JSON.parse(localStorage.oldAddRiskCodes))
if (this.$CacheUtils.getLocItem('oldAddRiskCodes') && JSON.parse(this.$CacheUtils.getLocItem('oldAddRiskCodes'))) {
addRiskCodes = addRiskCodes.concat(JSON.parse(this.$CacheUtils.getLocItem('oldAddRiskCodes')))
}
//930折中方案豁免险挂订单
addRiskCodes = addRiskCodes.filter(riskCode => {
return riskCode != 'DCRS_A0001'
})
localStorage.addRiskCodes = JSON.stringify(addRiskCodes)
this.$CacheUtils.setLocItem('addRiskCodes',JSON.stringify(addRiskCodes))
this.$jump({
flag: 'h5',
extra: {
@@ -1487,13 +1485,13 @@ export default {
//保额份数变化
stepperChange(defalutValue, productIndex, calFactorIndex, min, max, riskFactor) {
let currentEle =
localStorage.isTrial !== '1' && this.chooseProducts[productIndex].isMainRisk == '0'
this.$CacheUtils.getLocItem('isTrial') !== '1' && this.chooseProducts[productIndex].isMainRisk == '0'
? this.chooseProducts[productIndex].productTrialYearDTOS[calFactorIndex]
: this.chooseProducts[productIndex].calFactorLst[calFactorIndex]
//改动原因:孝心保产品有对年龄的特殊要求
//添加判断,是否是孝心保产品
let showHint = this.chooseProducts[productIndex].hint
let productCode = localStorage.trialList == '' ? '' : JSON.parse(localStorage.trialList)[0].productCode
let productCode = this.$CacheUtils.getLocItem('trialList') == '' ? '' : JSON.parse(this.$CacheUtils.getLocItem('trialList'))[0].productCode
if (productCode == 'GFRS_M0014') {
//被保险人年龄如果在50-65区间
if (this.saleInsuredPersonInfo.age >= 50 && this.saleInsuredPersonInfo.age <= 65) {
@@ -1712,7 +1710,7 @@ export default {
let rollInResult = '' //校验预计转入保费结果
this.chooseProducts.forEach((item, index) => {
console.log(item)
if (localStorage.trialList != '') {
if (this.$CacheUtils.getLocItem('trialList') != '') {
if (item.isMainRisk == 0) {
mainRiskCode = item.productCode
}
@@ -1757,7 +1755,7 @@ export default {
}
//万能型产品保费赋值给保额
//增加判断是否是从建议书跳转过来了的
if (localStorage.isFrom != 'proposal') {
if (this.$CacheUtils.getLocItem('isFrom') != 'proposal') {
if (
this.trialList[index].productCode == 'GFRS_M0003' ||
this.trialList[index].productCode == 'GFRS_M0015' ||
@@ -1810,7 +1808,7 @@ export default {
orderType: 'RISK_ORDER',
orderDTO: {
orderInfoDTO: {
orderNo: localStorage.orderNo
orderNo: this.$CacheUtils.getLocItem('orderNo')
},
// appntDTO: {},
insuredDTOs: [insuredDTOItem]
@@ -1836,7 +1834,7 @@ export default {
}
let resultData
if (localStorage.isFrom == 'proposal') {
if (this.$CacheUtils.getLocItem('isFrom') == 'proposal') {
// 从建议书进入, 豁免险保费空值特殊处理
let prdCodes = ['GFRS_A0001', 'GFRS_A0007']
params.orderDTO.insuredDTOs[0].riskDTOLst.forEach(item => {
@@ -1855,11 +1853,11 @@ export default {
if (resultData.result == 0) {
//电投
if (localStorage.isFrom == 'sale' && resultData.deleteFlag == '0') {
localStorage.salePageFlag = '3'
if (this.$CacheUtils.getLocItem('isFrom') == 'sale' && resultData.deleteFlag == '0') {
this.$CacheUtils.setLocItem('salePageFlag','3')
}
//建议书
if (localStorage.isFrom == 'proposal' && resultData.content.id) {
if (this.$CacheUtils.getLocItem('isFrom') == 'proposal' && resultData.content.id) {
this.saleInsuredPersonInfo.insuredId = resultData.content.id
this.$CacheUtils.setLocItem('saleInsuredPersonInfo', JSON.stringify(this.saleInsuredPersonInfo))
}

View File

@@ -38,14 +38,14 @@ export default {
result: '',
delList: [],
radioVal: '',
isFrom: localStorage.isFrom,
isFrom: this.$CacheUtils.getLocItem('isFrom'),
activeFlag: ''
}
},
async mounted() {
if (localStorage.isFrom == 'sale') {
if (this.$CacheUtils.getLocItem('isFrom') == 'sale') {
return new Promise((resolve, reject) => {
getOrderDetail({ orderNo: localStorage.orderNo }).then(
getOrderDetail({ orderNo: this.$CacheUtils.getLocItem('orderNo') }).then(
res => {
if (res.result == 0) {
//------------------------专为桂/惠企写死--begin---------------//
@@ -97,7 +97,7 @@ export default {
},
//获取主险列表
async getMainRiskList() {
let mainRiskCodes = localStorage.mainRiskCodes && JSON.parse(localStorage.mainRiskCodes)
let mainRiskCodes = this.$CacheUtils.getLocItem('mainRiskCodes') && JSON.parse(this.$CacheUtils.getLocItem('mainRiskCodes'))
let mainListDate = { platform: 'app' }
switch (this.isFrom) {
case 'proposal':
@@ -127,7 +127,7 @@ export default {
}
this.list = resultData.mainRiskDTOS
//------------------------专为惠企写死--begin---------------//
if (this.list.length > 0 && this.specilFlag == '1' && localStorage.isFrom == 'sale') {
if (this.list.length > 0 && this.specilFlag == '1' && this.$CacheUtils.getLocItem('isFrom') == 'sale') {
this.result = this.list.find(v => {
return v.riskProductCode == 'GFRS_M0040'
})
@@ -159,20 +159,20 @@ export default {
return
}
//置空产品
localStorage.chooseProducts = ''
this.$CacheUtils.setLocItem('chooseProducts','')
//添加主险
this.addMainRisk()
},
//储存主险
async addMainRisk() {
localStorage.setItem('isTrial', '1')
this.$CacheUtils.setLocItem('isTrial', '1')
let riskProductCode = this.result.riskProductCode
let resultData = await calculatePremium({ productCodes: [riskProductCode], platform: 'app', type: '1' })
if (resultData.result == 0) {
resultData = resultData.trialDTOS[0]
localStorage.isTrial = resultData.productTrialInfoDTO.productTrialYearDTOS != null ? '0' : '1'
localStorage.hint = resultData.hint
this.$CacheUtils.setLocItem('isTrial',resultData.productTrialInfoDTO.productTrialYearDTOS != null ? '0' : '1')
this.$CacheUtils.setLocItem('hint',resultData.hint)
if (resultData.productTrialInfoDTO.dutyGroup != null) {
resultData.productTrialInfoDTO.dutyGroup.map(item => {
if (item.dutyName == '意外身故/伤残保险金') {
@@ -182,9 +182,9 @@ export default {
}
if (resultData.productTrialInfoDTO.ruleExpression) {
let ruleExpression = localStorage.ruleExpression ? JSON.parse(localStorage.ruleExpression) : {}
let ruleExpression = this.$CacheUtils.getLocItem('ruleExpression') ? JSON.parse(this.$CacheUtils.getLocItem('ruleExpression')) : {}
ruleExpression[resultData.productCode] = resultData.productTrialInfoDTO.ruleExpression
localStorage.ruleExpression = JSON.stringify(ruleExpression)
this.$CacheUtils.setLocItem('ruleExpression',JSON.stringify(ruleExpression))
}
/********start 主险选择限制 start******/
@@ -224,30 +224,30 @@ export default {
}
let flagPermission = await riskRules.getProductSellPermissionList(resultData.productCode, this)
if (flagPermission && localStorage.isFrom != 'proposal') {
if (flagPermission && this.$CacheUtils.getLocItem('isFrom') != 'proposal') {
//校验该代理人是否有该产品的售卖权限
return this.$toast('抱歉,您没有该产品的销售权限!')
}
let flagCompany = await riskRules.checkCompany(resultData.productCode, JSON.parse(this.$CacheUtils.getLocItem('saleInsuredInfo')).workcompany, this)
if (flagCompany && localStorage.isFrom != 'proposal') {
if (flagCompany && this.$CacheUtils.getLocItem('isFrom') != 'proposal') {
//校验该投保人的工作单位是否能够投保该产品
return this.$toast('该投保人工作单位不能投保该产品')
}
/********end 主险选择限制 end******/
//保存附加险
localStorage.addtionRiskLst = JSON.stringify(resultData.productTrialInfoDTO.addtionRiskLst)
localStorage.isAutoPay = resultData.isAutoPay
localStorage.isRenew = resultData.isRenew
localStorage.isForceRenew = resultData.isForceRenew
localStorage.isRelated = resultData.isRelated
this.$CacheUtils.setLocItem('addtionRiskLst',JSON.stringify(resultData.productTrialInfoDTO.addtionRiskLst))
this.$CacheUtils.setLocItem('isAutoPay',resultData.isAutoPay)
this.$CacheUtils.setLocItem('isRenew',resultData.isRenew)
this.$CacheUtils.setLocItem('isForceRenew',resultData.isForceRenew)
this.$CacheUtils.setLocItem('isRelated',resultData.isRelated)
let calFactorLst = this.getFactorList(resultData)
let productTrialYearDTOS = resultData.productTrialInfoDTO.productTrialYearDTOS != null ? resultData.productTrialInfoDTO.productTrialYearDTOS : null
let hasAddtionRisk = resultData.productTrialInfoDTO.addtionRiskLst ? true : false
let currentProductInfo =
localStorage.isTrial == '1'
this.$CacheUtils.getLocItem('isTrial') == '1'
? {
calFactorLst,
hasAddtionRisk,
@@ -282,15 +282,15 @@ export default {
//构建险种数组
let productsData
if (localStorage.chooseProducts) {
productsData = JSON.parse(localStorage.chooseProducts)
if (this.$CacheUtils.getLocItem('chooseProducts')) {
productsData = JSON.parse(this.$CacheUtils.getLocItem('chooseProducts'))
productsData.push(currentProductInfo)
} else {
productsData = [currentProductInfo]
}
//保存选择险种
productsData = this.$utils.unrepeatObj(productsData, 'productCode') //产品数组去重,跳转试算页面未成功重复添加同一产品的情况
localStorage.chooseProducts = JSON.stringify(productsData)
this.$CacheUtils.setLocItem('chooseProducts',JSON.stringify(productsData))
this.jumpTo()
}
},

View File

@@ -121,7 +121,7 @@ export default {
nextStepFlag: true,
isShow: true,
appntDTO: {},
isFrom: localStorage.isFrom,
isFrom: this.$CacheUtils.getLocItem('isFrom'),
salePageFlag: '3',
active_show: false,
active_sqy_show:false,
@@ -142,9 +142,9 @@ export default {
[VanImage.name]: VanImage
},
mounted() {
if (localStorage.isFrom == 'sale') {
if (this.$CacheUtils.getLocItem('isFrom') == 'sale') {
// 清除活动标志
localStorage.removeItem('active_type')
this.$CacheUtils.removeLocItem('active_type')
setTimeout(() => {
// eslint-disable-next-line no-undef
EWebBridge.webCallAppInJs('webview_left_button', {
@@ -158,14 +158,14 @@ export default {
this.getProductList()
if (!this.$route.query.edit) {
//如果不是编辑/导航条跳转进来的
localStorage.setItem('salePageFlag', this.salePageFlag)
this.$CacheUtils.setLocItem('salePageFlag', this.salePageFlag)
} else if (this.$route.query.edit && !this.$route.query.salePageFlag) {
//如果从保单列表点击编辑按钮进入
this.salePageFlag = '3'
localStorage.setItem('salePageFlag', this.salePageFlag)
this.$CacheUtils.setLocItem('salePageFlag', this.salePageFlag)
} else if (this.$route.query.salePageFlag) {
//如果是从导航栏点击进入
this.salePageFlag = localStorage.salePageFlag
this.salePageFlag = this.$CacheUtils.getLocItem('salePageFlag')
}
// localStorage.orderNo = '19090510425500178912'
@@ -187,7 +187,7 @@ export default {
},
methods: {
appCallBack(data) {
if (data.trigger == 'left_button_click' && localStorage.isFrom == 'sale') {
if (data.trigger == 'left_button_click' && this.$CacheUtils.getLocItem('isFrom') == 'sale') {
return this.$dialog
.confirm({
className: 'dialog-delete',
@@ -219,7 +219,7 @@ export default {
async getProductList() {
//建议书、电投详情
let resultData
let isProposal = localStorage.isFrom == 'proposal' ? true : false
let isProposal = this.$CacheUtils.getLocItem('isFrom') == 'proposal' ? true : false
if (isProposal) {
let saleInsuredPersonInfo = this.$CacheUtils.getLocItem('saleInsuredPersonInfo') && JSON.parse(this.$CacheUtils.getLocItem('saleInsuredPersonInfo'))
console.log(saleInsuredPersonInfo)
@@ -235,7 +235,7 @@ export default {
message: '加载中……'
})
resultData = await getDetail({
orderNo: localStorage.orderNo,
orderNo: this.$CacheUtils.getLocItem('orderNo'),
isMerge: '1',
orderType: 'proposalInsuredInfo',
orderDTO: { insuredDTOs: [{ insuredId: insuredId }] }
@@ -247,7 +247,7 @@ export default {
loadingType: 'spinner',
message: '加载中……'
})
resultData = await orderDetail({ orderNo: localStorage.orderNo, isMerge: '1' })
resultData = await orderDetail({ orderNo: this.$CacheUtils.getLocItem('orderNo'), isMerge: '1' })
}
if (resultData.result == 0) {
let riskDTOLst
@@ -309,14 +309,14 @@ export default {
})
},
async delProduct(index) {
let isProposal = localStorage.isFrom == 'proposal' ? true : false
let isProposal = this.$CacheUtils.getLocItem('isFrom') == 'proposal' ? true : false
let resultData = ''
if (isProposal) {
resultData = await deleteProposal({
orderDTO: {
orderInfoDTO: {
orderNo: localStorage.orderNo
orderNo: this.$CacheUtils.getLocItem('orderNo')
},
insuredDTOs: [
{
@@ -336,7 +336,7 @@ export default {
id: this.chooseProducts[index].insuanceId,
orderDTO: {
orderInfoDTO: {
orderNo: localStorage.orderNo
orderNo: this.$CacheUtils.getLocItem('orderNo')
}
}
})
@@ -352,14 +352,14 @@ export default {
nextStep() {
if (!this.$route.query.salePageFlag) {
//如果从保单列表编辑按钮进入
localStorage.salePageFlag = '4'
this.$CacheUtils.setLocItem('salePageFlag','4')
}
console.log('this.chooseProducts', this.chooseProducts)
if (this.chooseProducts.length == 0) {
return this.$toast('请添加产品')
}
//930折中方案豁免险选择
let oldAddRiskCodes = JSON.parse(localStorage.oldAddRiskCodes)
let oldAddRiskCodes = JSON.parse(this.$CacheUtils.getLocItem('oldAddRiskCodes'))
if (oldAddRiskCodes.includes('DCRS_A0001')) {
let chooseProducts = this.chooseProducts
for (let i = 0; i < chooseProducts.length; i++) {
@@ -378,7 +378,7 @@ export default {
}
}
let routerUrl
if (localStorage.isFrom == 'proposal') {
if (this.$CacheUtils.getLocItem('isFrom') == 'proposal') {
routerUrl = '/proposal/chooseInsuredPerson'
let page = this.$route.query.proposalEdit == '1' ? '-1' : '-2'
@@ -411,7 +411,7 @@ export default {
//添加产品
async addProduct() {
// 1、处理判断活动 1、电投流程 2、后端接口提供弹出判断
if (localStorage.isFrom == 'sale') {
if (this.$CacheUtils.getLocItem('isFrom') == 'sale') {
let param = {
activeType: 'KMH'
}
@@ -458,7 +458,7 @@ export default {
let param = {
orderDTO: {
orderInfoDTO: {
orderNo: localStorage.orderNo,
orderNo: this.$CacheUtils.getLocItem('orderNo'),
activeType: type=='KMH'?this.active_radio == '1'?'KMH':'':type=='SQY'?this.active_sqy_radio=='1'?'SQY':'':''
}
}
@@ -466,7 +466,7 @@ export default {
saveOrderActiveType(param).then(res => {
this.active_show = false
this.active_sqy_show = false
localStorage.setItem('active_type', type=='KMH'?this.active_radio == '1'?'KMH':'':type=='SQY'?this.active_sqy_radio=='1'?'SQY':'':'')
this.$CacheUtils.setLocItem('active_type', type=='KMH'?this.active_radio == '1'?'KMH':'':type=='SQY'?this.active_sqy_radio=='1'?'SQY':'':'')
if (res.result == 0) {
this.$jump({
flag: 'h5',
@@ -498,9 +498,9 @@ export default {
},
nextPageShow() {
let routerUrl = '/sale/beneficiary'
localStorage.beneficiaryInfo = ''
localStorage.fromAddBeneficiaryInfo = ''
localStorage.removeItem('applicant')
this.$CacheUtils.setLocItem('beneficiaryInfo','')
this.$CacheUtils.setLocItem('fromAddBeneficiaryInfo','')
this.$CacheUtils.removeLocItem('applicant')
this.$jump({
flag: 'h5',
extra: {