mirror of
http://112.124.100.131/GFRS/ebiz-h5.git
synced 2025-12-10 05:46:44 +08:00
【国富惠桂保团体医疗保险产品上线金掌桂投保开发需求】GFRS_M0058 团体医疗保险 统一生效时间为投保次月1日0时
This commit is contained in:
@@ -38,5 +38,33 @@ export default {
|
||||
const diff = date1.getTime() - date2.getTime(); //目标时间减去当前时间
|
||||
const diffDate = diff / (24 * 60 * 60 * 1000); //计算当前时间与结束时间之间相差天数
|
||||
return diffDate
|
||||
},
|
||||
//获取次月1日0时
|
||||
getNextMonth : function(date){
|
||||
var arr = date.split('-');
|
||||
var year = arr[0]; //获取当前日期的年份
|
||||
var month = arr[1]; //获取当前日期的月份
|
||||
// var day = arr[2]; //获取当前日期的日
|
||||
// var days = new Date(year, month, 0);
|
||||
// days = days.getDate(); //获取当前日期中的月的天数
|
||||
var year2 = year;
|
||||
var month2 = parseInt(month) + 1;
|
||||
if (month2 == 13) {
|
||||
year2 = parseInt(year2) + 1;
|
||||
month2 = 1;
|
||||
}
|
||||
// var day2 = day;
|
||||
// var days2 = new Date(year2, month2, 0);
|
||||
// days2 = days2.getDate();
|
||||
// if (day2 > days2) {
|
||||
// day2 = days2;
|
||||
// }
|
||||
if (month2 < 10) {
|
||||
month2 = '0' + month2;
|
||||
}
|
||||
|
||||
// var t2 = year2 + '-' + month2 + '-' + day2;
|
||||
var t2 = year2 + '-' + month2 + '-' + '01';
|
||||
return t2;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -306,7 +306,7 @@
|
||||
placeholder='请选择'
|
||||
@click="toSelect('10')"
|
||||
/>
|
||||
<van-field v-if="this.itemProductDTOS.productCode === 'GFRS_M0041'||this.itemProductDTOS.productCode === 'GFRS_M0052'" v-model='cvaliDate' readonly label='生效日期' name='生效日期' placeholder='请输入' />
|
||||
<van-field v-if="this.itemProductDTOS.productCode === 'GFRS_M0058'" v-model='cvaliDate' readonly label='生效日期' name='生效日期' placeholder='请输入' />
|
||||
<FieldDatePicter
|
||||
v-else
|
||||
label='指定生效日期'
|
||||
@@ -473,7 +473,6 @@ export default {
|
||||
insuredSex: '男',
|
||||
isScan: false, //是否显示证件扫描组件
|
||||
isScan2: false, //是否显示证件扫描组件--被保人
|
||||
allPrice: 0,
|
||||
result: [],
|
||||
checked: true,
|
||||
current: 'userInfo',
|
||||
@@ -622,82 +621,93 @@ export default {
|
||||
// })
|
||||
// }
|
||||
|
||||
if (this.itemProductDTOS.productCode === 'GFRS_M0048' || this.itemProductDTOS.productCode === 'GFRS_M0049' || this.itemProductDTOS.productCode === 'GFRS_M0050') {
|
||||
//金掌桂学平险产品指定生效日规则调整的申请,学平险+60
|
||||
this.filterMaxDate = afterDate.getAfterDays(60)
|
||||
this.userInfo.relationToInsured = ''
|
||||
this.showField = true
|
||||
let currentTime = dateUtils.formatDate(new Date(), 'yyyy-MM-dd')
|
||||
let currentDataArr = currentTime.split('-')
|
||||
if (currentDataArr[1] >= 6 && currentDataArr[1] <= 8) {
|
||||
this.cvaliDate = currentDataArr[0] + '-09-01'
|
||||
this.onDateConfirm(this.cvaliDate, '6')
|
||||
} else {
|
||||
this.cvaliDate = dateUtils.formatDate(afterDate.getAfterDays(1), 'yyyy-MM-dd')
|
||||
this.onDateConfirm(this.cvaliDate, '6')
|
||||
}
|
||||
}
|
||||
// if (this.itemProductDTOS.productCode === 'GFRS_M0048' || this.itemProductDTOS.productCode === 'GFRS_M0049' || this.itemProductDTOS.productCode === 'GFRS_M0050') {
|
||||
// //金掌桂学平险产品指定生效日规则调整的申请,学平险+60
|
||||
// this.filterMaxDate = afterDate.getAfterDays(60)
|
||||
// this.userInfo.relationToInsured = ''
|
||||
// this.showField = true
|
||||
// let currentTime = dateUtils.formatDate(new Date(), 'yyyy-MM-dd')
|
||||
// let currentDataArr = currentTime.split('-')
|
||||
// if (currentDataArr[1] >= 6 && currentDataArr[1] <= 8) {
|
||||
// this.cvaliDate = currentDataArr[0] + '-09-01'
|
||||
// this.onDateConfirm(this.cvaliDate, '6')
|
||||
// } else {
|
||||
// this.cvaliDate = dateUtils.formatDate(afterDate.getAfterDays(1), 'yyyy-MM-dd')
|
||||
// this.onDateConfirm(this.cvaliDate, '6')
|
||||
// }
|
||||
// }
|
||||
//金掌桂无忧卡,少儿安康卡两款卡单产品关闭指定生效日功能,默认自承保之日起第四日零时生效
|
||||
//GFRS_M0052 国富人寿少儿安康保险产品组合、GFRS_M0041 国富无忧卡-国富人寿综合意外伤害保险计划
|
||||
if (this.itemProductDTOS.productCode === 'GFRS_M0052' || this.itemProductDTOS.productCode === 'GFRS_M0041') {
|
||||
this.cvaliDate = dateUtils.formatDate(afterDate.getAfterDays(Number(this.trialList[0].timeliness)), 'yyyy-MM-dd')
|
||||
// if (this.itemProductDTOS.productCode === 'GFRS_M0052' || this.itemProductDTOS.productCode === 'GFRS_M0041') {
|
||||
// this.cvaliDate = dateUtils.formatDate(afterDate.getAfterDays(Number(this.trialList[0].timeliness)), 'yyyy-MM-dd')
|
||||
// //保险期间计算逻辑
|
||||
// let val = this.cvaliDate
|
||||
// if (Date.parse(val) < Date.parse(new Date())) {
|
||||
// return this.$toast('当前日期早于当日')
|
||||
// }
|
||||
// let currentDataArr = val.split('-')
|
||||
// let currentData = currentDataArr[0] + '年' + currentDataArr[1] + '月' + currentDataArr[2] + '日'
|
||||
// let insuYear = JSON.parse(localStorage.insuYear)
|
||||
// let insuYearM, productDate, productDateTime
|
||||
// let insuYearD, hoDate
|
||||
// switch (insuYear.insuYearFlag) {
|
||||
// case 'D':
|
||||
// hoDate = Date.parse(val) / 1000 + (insuYear['insuYear'] - 1) * 24 * 3600
|
||||
// break
|
||||
// case 'Y':
|
||||
// hoDate = Date.parse(val) / 1000 + insuYear['insuYear'] * 24 * 3600 * (afterDate.isLeapYear(new Date(val).getFullYear()) - 1)
|
||||
// break
|
||||
// }
|
||||
// productDate = new Date(parseInt(hoDate) * 1000)
|
||||
// insuYearM = productDate.getMonth() + 1 < 10 ? '0' + (productDate.getMonth() + 1) : productDate.getMonth() + 1
|
||||
// insuYearD = productDate.getDate() < 10 ? '0' + productDate.getDate() : productDate.getDate()
|
||||
// productDateTime = productDate.getFullYear() + '年' + insuYearM + '月' + insuYearD + '日'
|
||||
// this.productDate = currentData + '0时至' + productDateTime + '24时止'
|
||||
// }
|
||||
// //GFRS-2641 少儿安康
|
||||
// if (this.itemProductDTOS.productCode === 'GFRS_M0052') {
|
||||
// this.userInfo.relationToInsured = '3'
|
||||
// //GFRS-2641 保留首次投保、保险期间届满重新投保,默认首次投保
|
||||
// this.showFirstOr = true
|
||||
// //GFRS-2641 被保险人去掉电子邮箱、手机号码字段
|
||||
// this.isLessEighteen = false
|
||||
// }
|
||||
// this.userInfo.homeName = getAreaName([{ code: 450000 }, { code: 450100 }, { code: 450101 }]) //家庭地址
|
||||
|
||||
//GFRS_M0058 团体医疗保险 统一生效时间为投保次月1日0时
|
||||
if (this.itemProductDTOS.productCode === 'GFRS_M0058') {
|
||||
let currentTime = dateUtils.formatDate(new Date(), 'yyyy-MM-dd')
|
||||
this.cvaliDate = afterDate.getNextMonth(currentTime)
|
||||
//保险期间计算逻辑
|
||||
let val = this.cvaliDate
|
||||
if (Date.parse(val) < Date.parse(new Date())) {
|
||||
return this.$toast('当前日期早于当日')
|
||||
}
|
||||
let currentDataArr = val.split('-')
|
||||
let currentData = currentDataArr[0] + '年' + currentDataArr[1] + '月' + currentDataArr[2] + '日'
|
||||
let insuYear = JSON.parse(localStorage.insuYear)
|
||||
let insuYearM, productDate, productDateTime
|
||||
let insuYearD, hoDate
|
||||
switch (insuYear.insuYearFlag) {
|
||||
case 'D':
|
||||
hoDate = Date.parse(val) / 1000 + (insuYear['insuYear'] - 1) * 24 * 3600
|
||||
break
|
||||
case 'Y':
|
||||
hoDate = Date.parse(val) / 1000 + insuYear['insuYear'] * 24 * 3600 * (afterDate.isLeapYear(new Date(val).getFullYear()) - 1)
|
||||
break
|
||||
}
|
||||
productDate = new Date(parseInt(hoDate) * 1000)
|
||||
insuYearM = productDate.getMonth() + 1 < 10 ? '0' + (productDate.getMonth() + 1) : productDate.getMonth() + 1
|
||||
insuYearD = productDate.getDate() < 10 ? '0' + productDate.getDate() : productDate.getDate()
|
||||
productDateTime = productDate.getFullYear() + '年' + insuYearM + '月' + insuYearD + '日'
|
||||
this.productDate = currentData + '0时至' + productDateTime + '24时止'
|
||||
return this.$toast('当前日期早于当日')
|
||||
}
|
||||
let currentDataArr = val.split('-')
|
||||
let currentData = currentDataArr[0] + '年' + currentDataArr[1] + '月' + currentDataArr[2] + '日'
|
||||
let insuYear = JSON.parse(localStorage.insuYear)
|
||||
let insuYearM, productDate, productDateTime
|
||||
let insuYearD, hoDate
|
||||
switch (insuYear.insuYearFlag) {
|
||||
case 'D':
|
||||
hoDate = Date.parse(val) / 1000 + (insuYear['insuYear'] - 1) * 24 * 3600
|
||||
break
|
||||
case 'Y':
|
||||
hoDate = Date.parse(val) / 1000 + insuYear['insuYear'] * 24 * 3600 * (afterDate.isLeapYear(new Date(val).getFullYear()) - 1)
|
||||
break
|
||||
}
|
||||
productDate = new Date(parseInt(hoDate) * 1000)
|
||||
insuYearM = productDate.getMonth() + 1 < 10 ? '0' + (productDate.getMonth() + 1) : productDate.getMonth() + 1
|
||||
insuYearD = productDate.getDate() < 10 ? '0' + productDate.getDate() : productDate.getDate()
|
||||
productDateTime = productDate.getFullYear() + '年' + insuYearM + '月' + insuYearD + '日'
|
||||
this.productDate = currentData + '0时至' + productDateTime + '24时止'
|
||||
}
|
||||
//GFRS-2641 少儿安康
|
||||
if (this.itemProductDTOS.productCode === 'GFRS_M0052') {
|
||||
this.userInfo.relationToInsured = '3'
|
||||
//GFRS-2641 保留首次投保、保险期间届满重新投保,默认首次投保
|
||||
this.showFirstOr = true
|
||||
//GFRS-2641 被保险人去掉电子邮箱、手机号码字段
|
||||
this.isLessEighteen = false
|
||||
}
|
||||
this.userInfo.homeName = getAreaName([{ code: 450000 }, { code: 450100 }, { code: 450101 }]) //家庭地址
|
||||
},
|
||||
mounted() {
|
||||
// 2516--除万福卡,投保人、被保险人年收入,默认为0,允许修改
|
||||
if (this.itemProductDTOS.productCode != 'GFRS_M0032') {
|
||||
this.userInfo.averageAnnualIncome = '0'
|
||||
}
|
||||
// 筛选按钮的点击事件
|
||||
window.appCallBack = this.appCallBack
|
||||
if (this.itemProductDTOS.productCode === 'GFRS_M0022') {
|
||||
this.proScheme = '畅行无忧'
|
||||
this.proSchemeCode = ''
|
||||
this.allPrice = this.trialList[0].prem
|
||||
} else if (this.itemProductDTOS.productCode === 'GFRS_M0052'){
|
||||
this.proScheme = this.trialList[0].proScheme,
|
||||
this.proSchemeCode = this.trialList[0].proSchemeCode,
|
||||
this.chooseKind = this.trialList[0].chooseKind
|
||||
this.allPrice = this.trialList[0].prem
|
||||
this.now = afterDate.getAfterDays(Number(this.trialList[0].timeliness))
|
||||
}else {
|
||||
// this.proScheme = this.trialList[0].proScheme
|
||||
// this.proSchemeCode = this.trialList[0].proSchemeCode
|
||||
// this.allPrice = this.trialList[0].prem
|
||||
this.now = afterDate.getAfterDays(Number(this.trialList[0].timeliness))
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
//长期状态改变时
|
||||
@@ -1019,6 +1029,7 @@ export default {
|
||||
this.chooseKind = value.label
|
||||
for (let item of this.trialList) {
|
||||
if (item.proSchemeCode === this.proSchemeCode) {
|
||||
//todo
|
||||
this.allPrice = item.prem
|
||||
break
|
||||
}
|
||||
@@ -1745,92 +1756,14 @@ export default {
|
||||
supportBank: '0'
|
||||
},
|
||||
appntDTO: this.userInfo,
|
||||
insuredDTOs: [this.insuredInfo]
|
||||
// insuredDTOs: [this.insuredInfo]
|
||||
}
|
||||
}
|
||||
|
||||
//组装险种提交数据
|
||||
let [mainRiskCode, riskDTOLst] = ['', []]
|
||||
let rollInResult = '' //校验预计转入保费结果
|
||||
this.chooseProducts.forEach((item, index) => {
|
||||
console.log('itemssss', item)
|
||||
if (item.isMainRisk == 0) {
|
||||
mainRiskCode = item.productCode
|
||||
}
|
||||
let insuYearDate = JSON.parse(localStorage.insuYear)
|
||||
let riskItem = {
|
||||
cvaliDate: this.cvaliDate,
|
||||
isMainRisk: item.isMainRisk,
|
||||
riskName: item.riskName,
|
||||
riskType: item.riskType,
|
||||
riskCode: item.productCode,
|
||||
mainRiskCode: mainRiskCode,
|
||||
prem: this.allPrice,
|
||||
standPrem: this.allPrice,
|
||||
predictTransferPrem: item.predictTransferPrem,
|
||||
thirdInsuraceNo: this.policyNo,
|
||||
mult: this.mult,
|
||||
proScheme: this.proScheme,
|
||||
proSchemeCode: this.proSchemeCode,
|
||||
insuYear: insuYearDate.insuYear,
|
||||
insuYearFlag: insuYearDate.insuYearFlag,
|
||||
firstOr: this.firstOr,
|
||||
medical: this.medical,
|
||||
chooseKind: this.chooseKind
|
||||
}
|
||||
if (item.hasPredictTransferPrem && item.hasPredictTransferPrem === '0') {
|
||||
//增加万能险 预计转入保费校验
|
||||
rollInResult = this.rollInCheck(item.predictTransferPrem)
|
||||
} else {
|
||||
rollInResult = true
|
||||
}
|
||||
//责任险保存参数构建
|
||||
if (this.trialList[index].duty) {
|
||||
riskItem['dutyLst'] = this.trialList[index].duty
|
||||
//930折中方案,责任险分档
|
||||
riskItem['amt'] = this.trialList[index].amt
|
||||
}
|
||||
|
||||
//保费算保额
|
||||
if (this.trialList[index].trialType == '1') {
|
||||
riskItem['amt'] = this.trialList[index].amt
|
||||
}
|
||||
//万能型产品保费赋值给保额
|
||||
if (this.trialList[index].productCode == 'GFRS_M0003') {
|
||||
riskItem['amt'] = this.trialList[index].prem
|
||||
}
|
||||
// //豁免险保额处理
|
||||
// if (item.isRemit == '0') {
|
||||
// this.trialInfos[index].amt = this.trialList[0].prem
|
||||
// }
|
||||
// console.log()
|
||||
// riskItem = Object.assign(riskItem, this.trialInfos[index])
|
||||
|
||||
riskDTOLst.push(riskItem)
|
||||
})
|
||||
if (!rollInResult) {
|
||||
return
|
||||
}
|
||||
params.orderDTO.insuredDTOs[0].riskDTOLst = riskDTOLst
|
||||
|
||||
let resultData = await saveOrUpdateCard(params)
|
||||
if (resultData.result == 0) {
|
||||
console.log('resultData.orderNo', resultData.content.object)
|
||||
//存储被保人信息
|
||||
// let age = utilsAge.getAge(this.userInfo.birthday, new Date())
|
||||
// localStorage.saleInsuredInfo = JSON.stringify({
|
||||
// birthday: this.userInfo.birthday,
|
||||
// name: this.userInfo.name,
|
||||
// sex: this.userInfo.sex,
|
||||
// idType: this.userInfo.idType,
|
||||
// age
|
||||
// })
|
||||
// this.userInfo.age = age
|
||||
// localStorage.saleInsuredInfo = JSON.stringify(this.userInfo)
|
||||
// console.log(this.userInfo)
|
||||
|
||||
let orderNo = (localStorage.orderNo = resultData.content.object)
|
||||
|
||||
this.underWrite(orderNo)
|
||||
} else {
|
||||
console.error(resultData.resultMessage)
|
||||
|
||||
@@ -0,0 +1,397 @@
|
||||
<template>
|
||||
<div class="choose-insuredPerson pb60 bg-white">
|
||||
<!-- <BreadcrumbNavigator :current="1" :moveOn.sync="moveOn" /> -->
|
||||
<p class='fs15 fwb pl10 pv12'>被保人信息</p>
|
||||
<div slot="content" class="pl20 pr20 flex justify-content-s">
|
||||
<div v-for="item in persons" class="text-center" :key="item.code" @click="handleChoose(item)">
|
||||
<!-- <div class="relative">
|
||||
<img :src="item.icon" class="w50 radius50" />
|
||||
<span class="absolute" style="right:0px">
|
||||
<van-icon color="#E9332E" name="checked" v-if="item.check" />
|
||||
<van-icon color="gray" name="checked" v-else />
|
||||
</span>
|
||||
</div> -->
|
||||
<p class="tab fs12">{{ item.relationName }}</p>
|
||||
</div>
|
||||
</div>
|
||||
<ul>
|
||||
<li class="flex pv15 ph10 bg-white align-items-c" style="flex-wrap: wrap;border-top:1px solid #DADADA" v-for="(choose, index) in chooseList" :key="index">
|
||||
<img class="w35 mr10 radius50" :src="choose.icon" />
|
||||
<span class="mr20 fs15">{{ choose.relationName }}</span>
|
||||
<div v-if="choose.hasRisk" class="fs15 c-gray-dark">
|
||||
<div>姓名: {{ choose.name }}</div>
|
||||
<div v-if="choose.totalPrem != '0.00'">首期总保费(元): {{ choose.totalPrem | moneyFormat }}</div>
|
||||
</div>
|
||||
<div class="mr10 fs15 c-gray-dark" @click="insure(choose)" v-else>点击为他/她投保</div>
|
||||
<div style="flex-grow:1" :class="[choose.totalAmt == '0.00' || choose.hasRisk == false ? '' : 'mt10', 'flex', 'justify-content-fe']">
|
||||
<van-button v-if="choose.code > 3" round class="ph0 w40" hairline type="danger" size="small" style="margin-right:5px;" @click="addPerson(choose)"
|
||||
>添加</van-button
|
||||
>
|
||||
<van-button v-if="choose.hasRisk" round class="ph0 w40" hairline type="danger" size="small" style="margin-right:5px;" @click="edit(choose)"
|
||||
>编辑</van-button
|
||||
>
|
||||
<van-button class="ph0 w40" plain round @click="deletePerson(choose, index)" type="danger" size="small" style="margin-right:5px;">删除</van-button>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
<van-button type="danger" @click="produceProposal" class="bottom-btn fs16">生成建议书</van-button>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import { Icon, Dialog, Toast } from 'vant'
|
||||
import { getDetail, saveProposal, deleteProposal } from '@/api/ebiz/proposal/proposal.js'
|
||||
import BreadcrumbNavigator from '@/components/ebiz/proposal/BreadcrumbNavigator'
|
||||
|
||||
import data from '@/assets/js/utils/data-dictionary.js'
|
||||
let relation = data.relationToAppnt
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
persons: [
|
||||
//页头的备用的被保险人
|
||||
{
|
||||
relationName: '本人',
|
||||
code: 0,
|
||||
check: false,
|
||||
relation: relation[0].id
|
||||
},
|
||||
{
|
||||
relationName: '配偶',
|
||||
code: 1,
|
||||
check: false,
|
||||
relation: relation[1].id
|
||||
},
|
||||
{
|
||||
relationName: '父母',
|
||||
code: 2,
|
||||
check: false,
|
||||
relation: relation[2].id
|
||||
},
|
||||
{
|
||||
relationName: '子女',
|
||||
code: 4,
|
||||
check: false,
|
||||
relation: relation[3].id
|
||||
}
|
||||
],
|
||||
chooseList: [], //添加上的被保险人
|
||||
proposalInfo: '', //查询中的建议书信息
|
||||
proposalOrderNo: ''
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
moveOn() {
|
||||
return this.$CacheUtils.getLocItem('canMoveOn') === '1'
|
||||
}
|
||||
},
|
||||
components: {
|
||||
[Icon.name]: Icon,
|
||||
[Toast.name]: Toast
|
||||
},
|
||||
mounted() {
|
||||
if (this.$route.query.proposalOrderNo) {
|
||||
this.proposalOrderNo = this.$route.query.proposalOrderNo
|
||||
}else if (this.$CacheUtils.getLocItem('orderNo')) {
|
||||
this.proposalOrderNo = this.$CacheUtils.getLocItem('orderNo')
|
||||
}
|
||||
//根据后台数据来展示
|
||||
let proposalInfoDTO = {
|
||||
orderNo: this.proposalOrderNo
|
||||
}
|
||||
getDetail(proposalInfoDTO).then(res => {
|
||||
if (res.result == '0') {
|
||||
this.chooseList = res.content[0].insuredDTOs
|
||||
this.$CacheUtils.setLocItem('proposalAppnt', JSON.stringify(res.content[0].appntDTO))
|
||||
this.proposalInfo = res.content[0]
|
||||
if (this.chooseList != null) {
|
||||
this.chooseList.forEach(v => {
|
||||
relation.forEach(r => {
|
||||
if (r.id == v.relationToAppnt) {
|
||||
//根据关系id 获取关系name
|
||||
v.relationName = r.text
|
||||
if (v.relationToAppnt == '3' && v.sex == '0') {
|
||||
//判断父亲和母亲
|
||||
v.relationName = '父亲'
|
||||
} else if (v.relationToAppnt == '3' && v.sex == '1') {
|
||||
v.relationName = '母亲'
|
||||
}
|
||||
}
|
||||
})
|
||||
if (v.insuredId) {
|
||||
//判断是否已经添加被保险人及险种
|
||||
v.hasRisk = true
|
||||
}
|
||||
this.persons.forEach(p => {
|
||||
if (v.relationToAppnt == p.relation) {
|
||||
v.icon = p.icon
|
||||
v.code = p.code
|
||||
if (v.sex == '0' && v.relationToAppnt == '3') {
|
||||
v.icon = icon3
|
||||
v.code = 2
|
||||
} else if (v.sex == '1' && v.relationToAppnt == '3') {
|
||||
v.icon = icon4
|
||||
v.code = 3
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
this.chooseList.forEach(v => {
|
||||
this.persons.forEach(p => {
|
||||
if (v.code == p.code) {
|
||||
p.check = true
|
||||
}
|
||||
})
|
||||
})
|
||||
this.sortarr(this.chooseList, 'code')
|
||||
} else {
|
||||
this.chooseList = []
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
stepIn() {
|
||||
this.$jump({
|
||||
flag: 'h5',
|
||||
extra: {
|
||||
url: location.origin + '/#/proposal/appnt',
|
||||
needRefresh: '1'
|
||||
},
|
||||
routerInfo: {
|
||||
path: '/proposal/appnt'
|
||||
}
|
||||
})
|
||||
},
|
||||
//生成建议书
|
||||
produceProposal() {
|
||||
let chooseList = this.chooseList
|
||||
let result = false
|
||||
let hasRisk = true
|
||||
if (chooseList.length == 0) {
|
||||
return Toast.fail('请选择被保险人')
|
||||
}
|
||||
|
||||
chooseList.forEach(insured => {
|
||||
if (insured.hasRisk == undefined || insured.hasRisk == false) {
|
||||
result = true
|
||||
}
|
||||
if (insured.riskDTOLst == null) {
|
||||
hasRisk = false
|
||||
}
|
||||
})
|
||||
if (result) {
|
||||
return Toast.fail('请填写被保险人信息')
|
||||
}
|
||||
if (!hasRisk) {
|
||||
return Toast.fail('请选择保险产品信息')
|
||||
}
|
||||
//请选择保险产品信息
|
||||
|
||||
let params = {
|
||||
orderDTO: {
|
||||
orderInfoDTO: {
|
||||
orderStatus: '02',
|
||||
orderNo: this.proposalInfo.orderInfoDTO.orderNo
|
||||
}
|
||||
}
|
||||
}
|
||||
saveProposal(params).then(res => {
|
||||
if (res.result == '0') {
|
||||
this.$CacheUtils.setLocItem('orderNo', res.content.orderNo)
|
||||
let url = `/proposal/proposalInfo?proposalNo=${res.content.orderNo}`
|
||||
//调用保存接口
|
||||
this.$jump({
|
||||
flag: 'h5',
|
||||
extra: {
|
||||
url: location.origin + `/#${url}`
|
||||
},
|
||||
routerInfo: {
|
||||
path: url
|
||||
}
|
||||
})
|
||||
}else{
|
||||
this.$toast(res.resultMessage)
|
||||
return
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
//从页头选择被保险人
|
||||
handleChoose(item) {
|
||||
if (!item.check) {
|
||||
//增加
|
||||
item.check = !item.check
|
||||
item.hasRisk = false
|
||||
this.chooseList.push(item)
|
||||
this.sortarr(this.chooseList, 'code')
|
||||
} else {
|
||||
//删除
|
||||
Dialog.confirm({
|
||||
className: 'dialog-delete',
|
||||
title: '提示',
|
||||
message: '确认删除该被保险人?',
|
||||
cancelButtonColor: '#E9332E',
|
||||
confirmButtonColor: '#FFFFFF'
|
||||
})
|
||||
.then(() => {
|
||||
let deletePerson = []
|
||||
let hasRisk = false
|
||||
this.chooseList.forEach(v => {
|
||||
if (item.code == v.code) {
|
||||
if (v.hasRisk) {
|
||||
hasRisk = true
|
||||
v.insuredNo = v.insuredId
|
||||
deletePerson.push(v)
|
||||
}
|
||||
}
|
||||
})
|
||||
if (!hasRisk) {
|
||||
item.check = !item.check
|
||||
this.chooseList = this.chooseList.filter(v => item.code != v.code)
|
||||
}
|
||||
let parans = {
|
||||
orderDTO: {
|
||||
orderInfoDTO: {
|
||||
orderNo: this.$CacheUtils.getLocItem('orderNo')
|
||||
},
|
||||
insuredDTOs: deletePerson
|
||||
},
|
||||
type: '2'
|
||||
}
|
||||
deleteProposal(parans).then(res => {
|
||||
//删除从接口中获取的
|
||||
if (res.result == '0') {
|
||||
item.check = !item.check
|
||||
this.chooseList = this.chooseList.filter(v => item.code != v.code)
|
||||
}
|
||||
})
|
||||
})
|
||||
.catch(() => {})
|
||||
}
|
||||
},
|
||||
//删除被保险人
|
||||
deletePerson(choose, index) {
|
||||
Dialog.confirm({
|
||||
className: 'dialog-delete',
|
||||
title: '提示',
|
||||
message: '确认删除该被保险人?',
|
||||
cancelButtonColor: '#E9332E',
|
||||
confirmButtonColor: '#FFFFFF'
|
||||
})
|
||||
.then(() => {
|
||||
if (choose.hasRisk == false) {
|
||||
return this.formatChoose(choose, index)
|
||||
}
|
||||
let params = {
|
||||
orderDTO: {
|
||||
orderInfoDTO: {
|
||||
orderNo: this.$CacheUtils.getLocItem('orderNo')
|
||||
},
|
||||
insuredDTOs: [
|
||||
{
|
||||
insuredNo: choose.insuredId
|
||||
}
|
||||
]
|
||||
},
|
||||
type: '2'
|
||||
}
|
||||
deleteProposal(params).then(res => {
|
||||
if (res.result == '0') {
|
||||
this.formatChoose(choose, index)
|
||||
}
|
||||
})
|
||||
})
|
||||
.catch(() => {})
|
||||
},
|
||||
//将数组排序
|
||||
sortarr(arr, factor) {
|
||||
for (let i = 0; i < arr.length - 1; i++) {
|
||||
for (let j = 0; j < arr.length - 1 - i; j++) {
|
||||
if (arr[j][factor] > arr[j + 1][factor]) {
|
||||
var temp = arr[j]
|
||||
arr[j] = arr[j + 1]
|
||||
arr[j + 1] = temp
|
||||
}
|
||||
}
|
||||
}
|
||||
return arr
|
||||
},
|
||||
//为他投保
|
||||
insure(person) {
|
||||
let saleInsuredPersonInfo = {
|
||||
relationToAppnt: person.relation,
|
||||
relationName: person.relationName
|
||||
}
|
||||
this.$CacheUtils.setLocItem('saleInsuredPersonInfo', JSON.stringify(saleInsuredPersonInfo)) //存储被保险人信息
|
||||
localStorage.chooseProductCodes = '' //置空所选险种
|
||||
|
||||
let url = `/proposal/insuredPerson?proposalOrderNo=${this.proposalOrderNo}`
|
||||
this.$jump({
|
||||
flag: 'h5',
|
||||
extra: {
|
||||
url: location.origin + `/#${url}`
|
||||
},
|
||||
routerInfo: {
|
||||
path: url
|
||||
}
|
||||
})
|
||||
},
|
||||
//编辑被保险人
|
||||
edit(item) {
|
||||
item.birthday = item.birthdayLabel
|
||||
item.age = item.insuredAge
|
||||
this.$CacheUtils.setLocItem('saleInsuredPersonInfo', JSON.stringify(item)) //存储被保险人信息
|
||||
localStorage.isFrom = 'proposal'
|
||||
let url = `/common/selectedProduct?proposalEdit=1&proposalOrderNo=${item.orderNo}`
|
||||
this.$jump({
|
||||
flag: 'h5',
|
||||
extra: {
|
||||
url: location.origin + `/#${url}`
|
||||
},
|
||||
routerInfo: {
|
||||
path: url
|
||||
}
|
||||
})
|
||||
},
|
||||
//添加被保险人 添加一个没有险种的被保险人
|
||||
addPerson(item) {
|
||||
let code = item.code
|
||||
let persons = this.persons
|
||||
persons.forEach(p => {
|
||||
if (p.code == code) {
|
||||
p.hasRisk = false
|
||||
this.chooseList.push(p)
|
||||
}
|
||||
})
|
||||
this.sortarr(this.chooseList, 'code')
|
||||
},
|
||||
|
||||
formatChoose(choose, index) {
|
||||
let has = false //判断当前是否有相同的已经选中的
|
||||
this.chooseList.splice(index, 1)
|
||||
this.chooseList.forEach(value => {
|
||||
if (value.code == choose.code) {
|
||||
has = true
|
||||
}
|
||||
})
|
||||
this.persons.forEach(v => {
|
||||
if (v.code == choose.code) {
|
||||
if (!has) {
|
||||
v.check = false
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.tab{
|
||||
border: 1px solid #a9a9a9;
|
||||
padding: 2px 20px;
|
||||
border-radius: 5px;
|
||||
}
|
||||
li:last-child {
|
||||
border-bottom: 1px solid #dadada;
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user