From 7ea3153c667142eb23565701a82e98ec337aabfd Mon Sep 17 00:00:00 2001 From: lyt Date: Tue, 11 Apr 2023 17:58:11 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E8=BF=90=E8=90=A5=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E9=83=A8=E5=85=B3=E4=BA=8E=E5=9C=B0=E5=9D=80=E7=A0=81=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E7=9A=84=E9=9C=80=E6=B1=82=E3=80=91=E5=85=88=E9=81=8D?= =?UTF-8?q?=E5=8E=86=E6=89=80=E6=9C=89=E8=A2=AB=E4=BF=9D=E4=BA=BA=EF=BC=8C?= =?UTF-8?q?=E5=86=8D=E9=81=8D=E5=8E=86=E6=89=80=E6=9C=89=E9=99=A9=E7=A7=8D?= =?UTF-8?q?=E6=8A=8A=E4=B8=BB=E9=99=A9=E6=8C=91=E5=87=BA=E6=9D=A5=EF=BC=8C?= =?UTF-8?q?=E5=86=8D=E7=9C=8B=E4=B8=BB=E9=99=A9=E7=BC=96=E7=A0=81=E6=98=AF?= =?UTF-8?q?=E5=90=A6=E5=85=A8=E9=83=A8=E7=9B=B8=E5=90=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/ebiz/proposal/ProposalInfo.vue | 30 +++++++++++-------- .../ebiz/proposal/js/exhibitionMethod.js | 11 +++++++ 2 files changed, 28 insertions(+), 13 deletions(-) diff --git a/src/views/ebiz/proposal/ProposalInfo.vue b/src/views/ebiz/proposal/ProposalInfo.vue index 194ae964e..feb7b21d1 100644 --- a/src/views/ebiz/proposal/ProposalInfo.vue +++ b/src/views/ebiz/proposal/ProposalInfo.vue @@ -321,7 +321,7 @@ import { import SelectRadio from '@/components/ebiz/SelectRadio' import { getDemo, toInsurance, getDemoByProposalNo, share, getSharingToken } from '@/api/ebiz/proposal/proposal.js' import { funcPermCheck } from '@/api/ebiz/common/common' -import { haveTap, getTapIndex, relevanceByInsure } from './js/exhibitionMethod.js' +import { haveTap, getTapIndex, relevanceByInsure,isAllEqual } from './js/exhibitionMethod.js' import { formatRiskList } from '@/assets/js/utils/formatRiskList.js' import { weixinShare } from '@/assets/js/utils/wxShare.js' import { getAgentInfo } from '@/api/ebiz/my/my.js' @@ -605,20 +605,24 @@ export default { shareContent = this.agent.name+'为您设计的专属保险计划书,请查阅!因为国富,所以民安!'; } let title - let riskList = [] - this.pageShowInfo.insuredDTOs[0].mainRisk.map(item => { - if (item.isMainRisk == '0') { //主险 - riskList.push(item) - } + let riskList = [] //所有险种 + let riskCodeList = [] //所有险种code + this.pageShowInfo.insuredDTOs.map(item => { + item.mainRisk.map(item01 => { + if (item01.isMainRisk == '0') { //主险 + riskList.push(item01) + } + }) }) - console.log(riskList,'riskList') - console.log(title,'title') - - // 多被保人,单个被保人一个产品 - if(this.pageShowInfo.insuredDTOs.length > 1 || riskList.length > 1){ - title='家庭综合保障计划' - }else{ + riskList.map(item => { + riskCodeList.push(item.riskCode) + }) + let sameRisk = isAllEqual(riskCodeList) + // 以主险为单位,一个主险,显示主险名称。 多个主险,显示“家庭综合保障计划”,跟被保人人数无关 + if(sameRisk){ title= riskList[0].riskName + }else{ + title='家庭综合保障计划' } let res = await getSharingToken({ shareType: 'proposal_demonstrate' }) if (res.result == '0') { diff --git a/src/views/ebiz/proposal/js/exhibitionMethod.js b/src/views/ebiz/proposal/js/exhibitionMethod.js index e48d5460c..dca693350 100644 --- a/src/views/ebiz/proposal/js/exhibitionMethod.js +++ b/src/views/ebiz/proposal/js/exhibitionMethod.js @@ -171,3 +171,14 @@ export function relevanceByInsure(insured, insuredLabelResult, insuredResult, in }) return insured } + +//js判断数组参数是否全部相等,或对象数组相同的key参数是否相等 +export function isAllEqual(array) { + if (array.length > 0) { + return !array.some(function (value, index) { + return value !== array[0]; + }); + } else { + return true; + } +} \ No newline at end of file