Commit adae88d6 authored by 郭志伟's avatar 郭志伟 Committed by 郝聪敏

feat: 保单晚上

parent 90023f66
export default { export default {
basicHost: "http://yapi.quantgroups.com/mock/329/", basicHost: "http://yapi.quantgroups.com/mock/329/",
// basicHost: "http://192.168.29.211:80/", // basicHost: "http://192.168.29.100:8964/",
wxAppId: "wx514de17b23d53a20" wxAppId: "wx514de17b23d53a20"
}; };
...@@ -4,19 +4,19 @@ ...@@ -4,19 +4,19 @@
<detail-header :det="headerInfo" /> <detail-header :det="headerInfo" />
<div class="det-body"> <div class="det-body">
<card title="保险计划" :option="['查看详情']" @option-click="openIframePupop(4)"> <card title="保险计划" :option="['查看详情']" @option-click="openIframePupop(4)">
<cr-radio-btn v-model="formData.planValue" :radio-data="planOptions" /> <cr-radio-btn v-model="formData.amountInsured" :radio-data="planOptions" />
<compactCellGroup :cell-data="planCellData" :text-bold="true" /> <compactCellGroup :cell-data="planCellData" :text-bold="true" />
<plan-tip :tip-list="planTipOptions" /> <plan-tip :tip-list="planTipOptions" />
</card> </card>
<div id="det_insure"> <div id="det_insure">
<insure-person-form v-model="formData" :radio-options="personFormOptions" /> <insure-person-form v-model="formData" :radio-options="personFormOptions" />
<auto-deduct <auto-deduct
v-model="formData.auto" v-model="formData.autoRenewPolicy"
:cell-data="autoCellInfo" :cell-data="autoCellInfo"
@cell-click="openIframePupop" @cell-click="openIframePupop"
/> />
<protocol-read <protocol-read
v-model="formData.autoRenewPolicy" v-model="formData.read"
:cell-data="noticeCellData" :cell-data="noticeCellData"
:protocol-data="protocolData" :protocol-data="protocolData"
@cell-click="openIframePupop" @cell-click="openIframePupop"
...@@ -130,10 +130,10 @@ export default { ...@@ -130,10 +130,10 @@ export default {
idNo: "", idNo: "",
socialSecurity: "1", socialSecurity: "1",
relation: "0", relation: "0",
type: "1", payType: "1",
planValue: "10", amountInsured: "1000000",
auto: false, autoRenewPolicy: false,
autoRenewPolicy: true read: true
}, },
goInsureState: false goInsureState: false
}; };
...@@ -154,11 +154,11 @@ export default { ...@@ -154,11 +154,11 @@ export default {
if (this.calTimer) { if (this.calTimer) {
clearTimeout(this.calTimer); clearTimeout(this.calTimer);
} }
const { name, idNo } = val; const { idNo } = val;
const { name: oldName, idNo: oldNo } = oldVal; const { idNo: oldNo } = oldVal;
if (name === oldName && idNo === oldNo) return; if (idNo === oldNo) return;
this.calTimer = setTimeout(() => { this.calTimer = setTimeout(() => {
this.calFee({ name, idNo }); this.calFee();
}, 600); }, 600);
} }
} }
...@@ -170,13 +170,13 @@ export default { ...@@ -170,13 +170,13 @@ export default {
}, },
planCellData() { planCellData() {
const { planCellInfo } = this; const { planCellInfo } = this;
const { planValue } = this.formData; const { amountInsured } = this.formData;
return planCellInfo[planValue]; return planCellInfo[amountInsured];
}, },
noticeCellData() { noticeCellData() {
const { noticeCellInfo } = this; const { noticeCellInfo } = this;
const { planValue } = this.formData; const { amountInsured } = this.formData;
return noticeCellInfo[planValue]; return noticeCellInfo[amountInsured];
}, },
personFormOptions() { personFormOptions() {
const { insuredOptions, paywayOptions } = this; const { insuredOptions, paywayOptions } = this;
...@@ -203,7 +203,10 @@ export default { ...@@ -203,7 +203,10 @@ export default {
}, },
onSubmit() { onSubmit() {
this.goInsureState = true; this.goInsureState = true;
sessionStorage.setItem("policyFormData", JSON.stringify(this.formData)); sessionStorage.setItem(
"policyFormData",
JSON.stringify(Object.assign(this.formData, { productNo: this.goodId }))
);
}, },
onFailed(errorInfo) { onFailed(errorInfo) {
const { errors } = errorInfo; const { errors } = errorInfo;
...@@ -221,18 +224,31 @@ export default { ...@@ -221,18 +224,31 @@ export default {
const res = await list(); const res = await list();
if (res) { if (res) {
res.forEach(item => { res.forEach(item => {
if (item.id === this.goodId) { if (item.productNo === this.goodId) {
this.headerInfo.price[0] = item.downPayPrice; this.headerInfo.price[0] = item.downPayPrice;
this.headerInfo.insuredNum = item.sellCount; this.headerInfo.insuredNum = item.sellCount;
} }
}); });
} }
}, },
async calFee({ name, idNo }) { async calFee() {
let { price } = this.headerInfo; let { price } = this.headerInfo;
const res = await trail({ name, idNo, productNo: this.goodId }); const { idNo, amountInsured } = this.formData;
if (!idNo || !amountInsured) return;
const _param = {
productNo: this.goodId,
productUserInfo: {
userInfo: {
idNo
},
productItem: {
amountInsured
}
}
};
const res = await trail(_param);
if (res) { if (res) {
price[0] = res.regularPrice; price[0] = res.downPayPrice;
this.goodActionInfo = { this.goodActionInfo = {
title: price title: price
}; };
......
...@@ -11,12 +11,12 @@ ...@@ -11,12 +11,12 @@
<div id="det_insure"> <div id="det_insure">
<insure-person-form v-model="formData" :radio-options="personFormOptions" /> <insure-person-form v-model="formData" :radio-options="personFormOptions" />
<auto-deduct <auto-deduct
v-model="formData.auto" v-model="formData.autoRenewPolicy"
:cell-data="autoCellInfo" :cell-data="autoCellInfo"
@cell-click="openIframePupop" @cell-click="openIframePupop"
/> />
<protocol-read <protocol-read
v-model="formData.autoRenewPolicy" v-model="formData.read"
:cell-data="noticeCellData" :cell-data="noticeCellData"
@cell-click="openIframePupop" @cell-click="openIframePupop"
/> />
...@@ -128,8 +128,8 @@ export default { ...@@ -128,8 +128,8 @@ export default {
relation: "0", relation: "0",
payType: "1", payType: "1",
amountInsured: "300000", amountInsured: "300000",
auto: false, autoRenewPolicy: false,
autoRenewPolicy: true read: true
}, },
goInsureState: false goInsureState: false
}; };
...@@ -205,7 +205,10 @@ export default { ...@@ -205,7 +205,10 @@ export default {
}, },
onSubmit() { onSubmit() {
this.goInsureState = true; this.goInsureState = true;
sessionStorage.setItem("policyFormData", JSON.stringify(this.formData)); sessionStorage.setItem(
"policyFormData",
JSON.stringify(Object.assign(this.formData, { productNo: this.goodId }))
);
}, },
onFailed(errorInfo) { onFailed(errorInfo) {
const { errors } = errorInfo; const { errors } = errorInfo;
...@@ -219,9 +222,9 @@ export default { ...@@ -219,9 +222,9 @@ export default {
const res = await list(); const res = await list();
if (res) { if (res) {
res.forEach(item => { res.forEach(item => {
if (item.id === this.goodId) { if (item.productNo === this.goodId) {
this.headerInfo.price[0] = res.downPayPrice; this.headerInfo.price[0] = item.downPayPrice;
this.headerInfo.subPrice[0] = res.regularPrice; this.headerInfo.subPrice[0] = item.regularPrice;
this.headerInfo.insuredNum = item.sellCount; this.headerInfo.insuredNum = item.sellCount;
} }
}); });
...@@ -229,18 +232,23 @@ export default { ...@@ -229,18 +232,23 @@ export default {
}, },
async calFee() { async calFee() {
let { price, subPrice } = this.headerInfo; let { price, subPrice } = this.headerInfo;
const { idNo, socialSecurity, payType, amountInsured } = this.formData; const { idNo, socialSecurity, payType, amountInsured, userInfoSecId } = this.formData;
if (!idNo || !socialSecurity || !payType) return;
const _param = { const _param = {
productNo: this.goodId, productNo: this.goodId,
productUserInfo: { productUserInfo: {
userInfo: {
idNo, idNo,
socialSecurity, socialSecurity: !!Number(socialSecurity),
payType userInfoSecId: userInfoSecId ?? null
}, },
productItem: { productItem: {
payType,
amountInsured amountInsured
} }
}
}; };
const res = await trail(_param); const res = await trail(_param);
if (res) { if (res) {
price[0] = res.downPayPrice; price[0] = res.downPayPrice;
......
...@@ -46,7 +46,7 @@ ...@@ -46,7 +46,7 @@
title="理赔须知" title="理赔须知"
:options="[]" :options="[]"
:text-bold="true" :text-bold="true"
v-model="formData.autoRenewPolicy" v-model="formData.read"
:cell-data="noticeCellInfo" :cell-data="noticeCellInfo"
@cell-click="openIframePupop" @cell-click="openIframePupop"
> >
...@@ -139,7 +139,7 @@ export default { ...@@ -139,7 +139,7 @@ export default {
popupShow: false, popupShow: false,
currentPupopIndex: null, currentPupopIndex: null,
formData: { formData: {
autoRenewPolicy: false read: false
}, },
showLayer: false showLayer: false
}; };
...@@ -162,9 +162,9 @@ export default { ...@@ -162,9 +162,9 @@ export default {
if (this.calTimer) { if (this.calTimer) {
clearTimeout(this.calTimer); clearTimeout(this.calTimer);
} }
const { autoRenewPolicy } = val; const { read } = val;
const { autoRenewPolicy: oldAutoRenewPolicy } = oldVal; const { read: oldread } = oldVal;
if (autoRenewPolicy !== oldAutoRenewPolicy) return; if (read !== oldread) return;
this.calTimer = setTimeout(() => { this.calTimer = setTimeout(() => {
this.calFee(); this.calFee();
}, 600); }, 600);
...@@ -181,7 +181,7 @@ export default { ...@@ -181,7 +181,7 @@ export default {
} }
}, },
mounted() { mounted() {
// this.getDetail(); this.getDetail();
}, },
methods: { methods: {
openIframePupop(index) { openIframePupop(index) {
...@@ -193,7 +193,10 @@ export default { ...@@ -193,7 +193,10 @@ export default {
this.popupShow = true; this.popupShow = true;
}, },
onSubmit() { onSubmit() {
sessionStorage.setItem("policyFormData", JSON.stringify(this.formData)); sessionStorage.setItem(
"policyFormData",
JSON.stringify(Object.assign(this.formData, { productNo: this.goodId }))
);
this.nextStep(); this.nextStep();
}, },
onFailed(errorInfo) { onFailed(errorInfo) {
...@@ -208,8 +211,8 @@ export default { ...@@ -208,8 +211,8 @@ export default {
const res = await list(); const res = await list();
if (res) { if (res) {
res.forEach(item => { res.forEach(item => {
if (item.id === this.goodId) { if (item.productNo === this.goodId) {
this.headerInfo.price[0] = res.downPayPrice; this.headerInfo.price[0] = item.downPayPrice;
this.headerInfo.insuredNum = item.sellCount; this.headerInfo.insuredNum = item.sellCount;
} }
}); });
...@@ -217,7 +220,23 @@ export default { ...@@ -217,7 +220,23 @@ export default {
}, },
async calFee() { async calFee() {
let { price } = this.headerInfo; let { price } = this.headerInfo;
const res = await trail(Object.assign(this.formData, { productNo: this.goodId })); const { birth, gender, amountInsured, policyPeriod, payPeriod, payType } = this.formData;
const _param = {
productNo: this.goodId,
productUserInfo: {
userInfo: {
birth,
gender
},
productItem: {
amountInsured,
policyPeriod,
payPeriod,
payType
}
}
};
const res = await trail(_param);
if (res) { if (res) {
price[0] = res.regularPrice; price[0] = res.regularPrice;
this.goodActionInfo = { title: price }; this.goodActionInfo = { title: price };
......
...@@ -10,12 +10,12 @@ ...@@ -10,12 +10,12 @@
<div id="det_insure"> <div id="det_insure">
<insure-person-form v-model="formData" :radio-options="personFormOptions" /> <insure-person-form v-model="formData" :radio-options="personFormOptions" />
<auto-deduct <auto-deduct
v-model="formData.auto" v-model="formData.autoRenewPolicy"
:cell-data="autoCellInfo" :cell-data="autoCellInfo"
@cell-click="openIframePupop" @cell-click="openIframePupop"
/> />
<protocol-read <protocol-read
v-model="formData.autoRenewPolicy" v-model="formData.read"
:cell-data="noticeCellInfo" :cell-data="noticeCellInfo"
@cell-click="openIframePupop" @cell-click="openIframePupop"
/> />
...@@ -128,10 +128,10 @@ export default { ...@@ -128,10 +128,10 @@ export default {
idNo: "", idNo: "",
socialSecurity: "1", socialSecurity: "1",
relation: "0", relation: "0",
type: "1", payType: "1",
planValue: "3", planValue: "3",
auto: false, autoRenewPolicy: false,
autoRenewPolicy: true read: true
}, },
goInsureState: false goInsureState: false
}; };
...@@ -158,22 +158,11 @@ export default { ...@@ -158,22 +158,11 @@ export default {
if (this.calTimer) { if (this.calTimer) {
clearTimeout(this.calTimer); clearTimeout(this.calTimer);
} }
const { name, idNo, socialSecurity, type } = val; const { idNo, socialSecurity, payType } = val;
const { const { idNo: oldNo, socialSecurity: oldSocialSecurity, payType: oldType } = oldVal;
name: oldName, if (idNo === oldNo && socialSecurity === oldSocialSecurity && payType === oldType) return;
idNo: oldNo,
socialSecurity: oldSocialSecurity,
type: oldType
} = oldVal;
if (
name === oldName &&
idNo === oldNo &&
socialSecurity === oldSocialSecurity &&
type === oldType
)
return;
this.calTimer = setTimeout(() => { this.calTimer = setTimeout(() => {
this.calFee({ name, idNo, socialSecurity, type }); this.calFee();
}, 600); }, 600);
} }
} }
...@@ -196,7 +185,7 @@ export default { ...@@ -196,7 +185,7 @@ export default {
} }
}, },
mounted() { mounted() {
// this.getDetail(); this.getDetail();
}, },
methods: { methods: {
openIframePupop(index) { openIframePupop(index) {
...@@ -220,26 +209,75 @@ export default { ...@@ -220,26 +209,75 @@ export default {
this.generateOrder(); this.generateOrder();
}, },
generateFormData() { generateFormData() {
this.subFromData = {}; const {
userInfoSecId,
name,
idNo,
relation,
socialSecurity,
// selfSocialSecurity,
selfName,
selfIdNo,
selfPhone,
selfSecId,
payType,
autoRenewPolicy
} = this.formData;
this.subFromData = {
insuredUserInfo: {
userInfoSecId: userInfoSecId ?? null,
name,
idNo,
relation,
socialSecurity: !!Number(socialSecurity)
},
productNo: this.goodId,
holderUserInfo: {
phoneNo: selfPhone,
userInfoSecId: selfSecId ?? null,
name: selfName,
idNo: selfIdNo
// socialSecurity: selfSocialSecurity ? !!Number(selfSocialSecurity) : null
},
productItem: {
payType
},
autoRenewPolicy: autoRenewPolicy
};
}, },
async getDetail() { async getDetail() {
this.goodId = this.$route.query.id; this.goodId = this.$route.query.id;
const res = await list(); const res = await list();
if (res) { if (res) {
res.forEach(item => { res.forEach(item => {
if (item.id === this.goodId) { if (item.productNo === this.goodId) {
this.headerInfo.price[0] = res.downPayPrice; this.headerInfo.price[0] = item.downPayPrice;
this.headerInfo.subPrice[0] = res.regularPrice; this.headerInfo.subPrice[0] = item.regularPrice;
this.headerInfo.insuredNum = item.sellCount; this.headerInfo.insuredNum = item.sellCount;
} }
}); });
} }
}, },
async calFee({ name, idNo, socialSecurity, type }) { async calFee() {
let { price, subPrice } = this.headerInfo; let { price, subPrice } = this.headerInfo;
const res = await trail({ name, idNo, socialSecurity, type }); const { idNo, socialSecurity, payType, userInfoSecId } = this.formData;
if (!idNo || !socialSecurity || !payType) return;
const _param = {
productNo: this.goodId,
productUserInfo: {
userInfo: {
idNo,
socialSecurity: !!Number(socialSecurity),
userInfoSecId: userInfoSecId ?? null
},
productItem: {
payType
}
}
};
const res = await trail(_param);
if (res) { if (res) {
price[0] = res.firstPrice; price[0] = res.downPayPrice;
subPrice[0] = res.regularPrice; subPrice[0] = res.regularPrice;
this.goodActionInfo = { this.goodActionInfo = {
title: price, title: price,
......
...@@ -2,38 +2,50 @@ ...@@ -2,38 +2,50 @@
<cr-form ref="calFeeForm" class="policy-form" @submit="onFormSubmit"> <cr-form ref="calFeeForm" class="policy-form" @submit="onFormSubmit">
<cr-cell-group title="被保人年龄需满足18周岁~60周岁"> <cr-cell-group title="被保人年龄需满足18周岁~60周岁">
<cr-field <cr-field
v-model="formData.birthday" v-model="formData.birth"
name="birthday" name="birth"
label="出生日期" label="出生日期"
:rules="[{ required: true, message: 'required' }]" :rules="[{ required: true, message: 'required' }]"
> >
<template #input> <template #input>
<popup-date-picker v-model="formData.birthday" placeholder="请选择被保人出生日期" /> <popup-date-picker v-model="formData.birth" placeholder="请选择被保人出生日期" />
</template> </template>
</cr-field> </cr-field>
<cr-field name="price" label="保障额度" :rules="[{ required: true, message: 'required' }]"> <cr-field
name="amountInsured"
label="保障额度"
:rules="[{ required: true, message: 'required' }]"
>
<template #input> <template #input>
<cr-radio-btn v-model="formData.price" :radio-data="countOptions" /> <cr-radio-btn v-model="formData.amountInsured" :radio-data="countOptions" />
</template> </template>
</cr-field> </cr-field>
<cr-field name="term" label="保险期限" :rules="[{ required: true, message: 'required' }]"> <cr-field
name="policyPeriod"
label="保险期限"
:rules="[{ required: true, message: 'required' }]"
>
<template #input> <template #input>
<cr-radio-btn v-model="formData.term" :radio-data="termOptions" /> <cr-radio-btn v-model="formData.policyPeriod" :radio-data="termOptions" />
</template> </template>
</cr-field> </cr-field>
<cr-field name="range" label="交费年限" :rules="[{ required: true, message: 'required' }]"> <cr-field
name="payPeriod"
label="交费年限"
:rules="[{ required: true, message: 'required' }]"
>
<template #input> <template #input>
<cr-radio-btn v-model="formData.range" :radio-data="benefitOptions" /> <cr-radio-btn v-model="formData.payPeriod" :radio-data="benefitOptions" />
</template> </template>
</cr-field> </cr-field>
<cr-field name="sex" label="性别" :rules="[{ required: true, message: 'required' }]"> <cr-field name="gender" label="性别" :rules="[{ required: true, message: 'required' }]">
<template #input> <template #input>
<cr-radio-btn v-model="formData.sex" :radio-data="sexOptions" /> <cr-radio-btn v-model="formData.gender" :radio-data="sexOptions" />
</template> </template>
</cr-field> </cr-field>
<cr-field name="type" label="交费方式" :rules="[{ required: true, message: 'required' }]"> <cr-field name="payType" label="交费方式" :rules="[{ required: true, message: 'required' }]">
<template #input> <template #input>
<cr-radio-btn v-model="formData.type" :radio-data="paywayOptions" /> <cr-radio-btn v-model="formData.payType" :radio-data="paywayOptions" />
</template> </template>
</cr-field> </cr-field>
</cr-cell-group> </cr-cell-group>
...@@ -63,16 +75,16 @@ export default { ...@@ -63,16 +75,16 @@ export default {
return { return {
formData: {}, formData: {},
sexOptions: [ sexOptions: [
{ label: "", value: "1" }, { label: "", value: "0" },
{ label: "", value: "2" } { label: "", value: "1" }
], ],
countOptions: [ countOptions: [
{ label: "100万", value: "1" }, { label: "100万", value: "1000000" },
{ label: "150万", value: "2" }, { label: "150万", value: "15000000" },
{ label: "200万", value: "3" }, { label: "200万", value: "2000000" },
{ label: "250万", value: "4" }, { label: "250万", value: "2500000" },
{ label: "300万", value: "5" }, { label: "300万", value: "3000000" },
{ label: "350万", value: "6" } { label: "350万", value: "3500000" }
], ],
termOptions: [ termOptions: [
{ label: "10年", value: "1" }, { label: "10年", value: "1" },
......
...@@ -86,6 +86,7 @@ ...@@ -86,6 +86,7 @@
<script> <script>
import Card from "@/components/Card"; import Card from "@/components/Card";
import { mapState, mapActions } from "vuex"; import { mapState, mapActions } from "vuex";
import { getFamilyList } from "@/api/user";
import localStorage from "@/service/localStorage"; import localStorage from "@/service/localStorage";
import CrRadioBtn from "@/components/CrRadioBtn"; import CrRadioBtn from "@/components/CrRadioBtn";
const DATA_CHANGE_EVENT = "input"; const DATA_CHANGE_EVENT = "input";
...@@ -112,6 +113,7 @@ export default { ...@@ -112,6 +113,7 @@ export default {
data() { data() {
return { return {
formData: {}, formData: {},
familyList: [],
mongoToken: localStorage.get("mongoToken"), mongoToken: localStorage.get("mongoToken"),
xyqbAuthState: localStorage.get("xyqbAuthState") xyqbAuthState: localStorage.get("xyqbAuthState")
}; };
...@@ -150,34 +152,50 @@ export default { ...@@ -150,34 +152,50 @@ export default {
} }
}, },
computed: { computed: {
...mapState(["showAuthXyqb"]), ...mapState(["showAuthXyqb"])
...mapState("user", ["familyList"])
}, },
mounted() { mounted() {
this.setFamilyList(); this.getFamilyList();
}, },
methods: { methods: {
...mapActions(["setAuthXyqb"]), ...mapActions(["setAuthXyqb"]),
...mapActions("user", ["setFamilyList"]),
inputClick() { inputClick() {
if (this.showAuthXyqb === 1) { if (this.showAuthXyqb === 1) {
this.setAuthXyqb(2); this.setAuthXyqb(2);
} }
}, },
relationChange(relation = this.formData.relation) { relationChange(relation = this.formData.relation) {
this.familyList.forEach(item => {
const {
relation,
nameMask: selfName,
idNoMask: selfIdNo,
userInfoSecId: selfSecId,
socialSecurity
} = item;
if (relation === 0) {
this.formData = {
...this.formData,
...{ selfName, selfIdNo, selfSecId, selfSocialSecurity: socialSecurity ? "1" : "0" }
};
}
});
const userArray = this.familyList.filter(item => item.relation === +relation); const userArray = this.familyList.filter(item => item.relation === +relation);
if (userArray.length > 0) { let [name, idNo, userInfoSecId, socialSecurity] = ["", "", "", "0"];
this.formData.name = userArray[0].nameMask; if (userArray.length) {
this.formData.idNo = userArray[0].idNoMask; let { nameMask, idNoMask, userInfoSecId: id, socialSecurity: ss } = userArray[0];
this.formData.socialSecurity = userArray[0].socialSecurity ? "1" : "0"; [name, idNo, userInfoSecId, socialSecurity] = [nameMask, idNoMask, id, ss];
if (relation === "0") { }
this.formData.selfName = userArray[0].nameMask; this.formData = {
this.formData.selfIdNo = userArray[0].idNoMask; ...this.formData,
} ...{ name, idNo, userInfoSecId, socialSecurity: socialSecurity ? "1" : "0" }
} else { };
this.formData.name = ""; },
this.formData.idNo = ""; async getFamilyList() {
this.formData.socialSecurity = "0"; const res = await getFamilyList();
if (res) {
this.familyList = res;
this.showAuthXyqb && this.relationChange();
} }
} }
} }
......
...@@ -43,7 +43,42 @@ export default { ...@@ -43,7 +43,42 @@ export default {
this.generateOrder(); this.generateOrder();
}, },
generateFormData() { generateFormData() {
this.subFromData = {}; const {
productNo,
userInfoSecId,
name,
idNo,
relation,
// socialSecurity,
// selfSocialSecurity,
selfName,
selfIdNo,
selfPhone,
selfSecId,
payType,
autoRenewPolicy
} = this.formData;
this.subFromData = {
insuredUserInfo: {
userInfoSecId: userInfoSecId ?? null,
name,
idNo,
relation
// socialSecurity: socialSecurity ? !!Number(socialSecurity) : null
},
productNo,
holderUserInfo: {
phoneNo: selfPhone,
userInfoSecId: selfSecId,
name: selfName,
idNo: selfIdNo
// socialSecurity: selfSocialSecurity ? !!Number(selfSocialSecurity) : null
},
productItem: {
payType: payType ? payType : null
},
autoRenewPolicy: autoRenewPolicy
};
} }
} }
}; };
......
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
label="姓名" label="姓名"
placeholder="请输入投保人姓名" placeholder="请输入投保人姓名"
:rules="[{ require: true, message: '请输入投保人姓名' }]" :rules="[{ require: true, message: '请输入投保人姓名' }]"
@click.native="inputClick"
/> />
<cr-field <cr-field
v-model="formData.holderUserInfo.idNo" v-model="formData.holderUserInfo.idNo"
...@@ -24,6 +25,7 @@ ...@@ -24,6 +25,7 @@
label="身份证号" label="身份证号"
placeholder="请填写投保人身份证号" placeholder="请填写投保人身份证号"
:rules="[{ require: true, message: '请填写投保人身份证号' }]" :rules="[{ require: true, message: '请填写投保人身份证号' }]"
@click.native="inputClick"
/> />
<cr-field <cr-field
v-model="formData.holderUserInfo.phoneNo" v-model="formData.holderUserInfo.phoneNo"
...@@ -32,6 +34,7 @@ ...@@ -32,6 +34,7 @@
label="手机号" label="手机号"
placeholder="请填写投保人手机号" placeholder="请填写投保人手机号"
:rules="[{ require: true, message: '请填写投保人手机号' }]" :rules="[{ require: true, message: '请填写投保人手机号' }]"
@click.native="inputClick"
/> />
<cr-field <cr-field
v-model="formData.holderUserInfo.email" v-model="formData.holderUserInfo.email"
...@@ -119,6 +122,7 @@ ...@@ -119,6 +122,7 @@
<template #input> <template #input>
<cr-radio-btn <cr-radio-btn
v-model="formData.insuredUserInfo.relation" v-model="formData.insuredUserInfo.relation"
@input="relationChange"
:radio-data="insuredOptions" :radio-data="insuredOptions"
/> />
</template> </template>
...@@ -277,7 +281,7 @@ ...@@ -277,7 +281,7 @@
:rules="[{ require: true, message: '请选择交费方式' }]" :rules="[{ require: true, message: '请选择交费方式' }]"
> >
<template #input> <template #input>
<cr-radio-btn v-model="formData.payPeriod" :radio-data="paywayOptions" /> <cr-radio-btn v-model="formData.productItem.payType" :radio-data="paywayOptions" />
</template> </template>
</cr-field> </cr-field>
<cr-field <cr-field
...@@ -349,8 +353,11 @@ import Stepper from "@/components/Stepper"; ...@@ -349,8 +353,11 @@ import Stepper from "@/components/Stepper";
import GoInsureDialog from "@/views/Goods/Detail/modules/GoInsureDialog"; import GoInsureDialog from "@/views/Goods/Detail/modules/GoInsureDialog";
import detailPayMixin from "@/views/Goods/Detail/modules/detailPay.mixin"; import detailPayMixin from "@/views/Goods/Detail/modules/detailPay.mixin";
import localStorage from "@/service/localStorage";
import { mapState, mapActions } from "vuex";
import Detail from "@/api/detail.huagui.shouxian"; import Detail from "@/api/detail.huagui.shouxian";
import { detail, trail } from "@/api/product"; import { list, trail } from "@/api/product";
import { getFamilyList } from "@/api/user";
const { headerInfo, popupArray } = Detail; const { headerInfo, popupArray } = Detail;
export default { export default {
name: "AddPolicy", name: "AddPolicy",
...@@ -372,13 +379,17 @@ export default { ...@@ -372,13 +379,17 @@ export default {
goInsureState: false, goInsureState: false,
goodActionInfo: {}, goodActionInfo: {},
goodBuyModalInfo: [], goodBuyModalInfo: [],
policyFormData: JSON.parse(sessionStorage.getItem("policyFormData") || "{}"),
formData: { formData: {
insuredUserInfo: {}, insuredUserInfo: {
relation: "0"
},
holderUserInfo: {}, holderUserInfo: {},
productItem: { productItem: {
insuredAmount: "50" insuredAmount: "500000"
} }
}, },
familyList: [],
formMaskData: {}, formMaskData: {},
idCardInvaildOptions: [ idCardInvaildOptions: [
{ label: "非长期", value: "1" }, { label: "非长期", value: "1" },
...@@ -451,17 +462,38 @@ export default { ...@@ -451,17 +462,38 @@ export default {
}); });
}, 600); }, 600);
} }
},
showAuthXyqb: {
immediate: true,
handler(val) {
if (val === 4) {
const xyqbUserInfo = localStorage.get("xyqbUserInfo");
this.formData.holderUserInfo.name = xyqbUserInfo.nameMask;
this.formData.holderUserInfo.idNo = xyqbUserInfo.idNoMask;
this.formData.holderUserInfo.phoneNo = xyqbUserInfo.phoneNoMask;
this.$forceUpdate();
}
}
} }
}, },
computed: { computed: {
...mapState(["showAuthXyqb"]),
formDataCpu() { formDataCpu() {
return JSON.parse(JSON.stringify(this.formData)); return JSON.parse(JSON.stringify(this.formData));
} }
}, },
mounted() { mounted() {
this.getParamFromSession();
this.getDetail(); this.getDetail();
this.getFamilyList();
}, },
methods: { methods: {
...mapActions(["setAuthXyqb"]),
inputClick() {
if (this.showAuthXyqb === 1) {
this.setAuthXyqb(2);
}
},
onFormSubmit() { onFormSubmit() {
this.goInsureState = true; this.goInsureState = true;
}, },
...@@ -470,33 +502,86 @@ export default { ...@@ -470,33 +502,86 @@ export default {
this.$notify({ type: "warning", message: errors[0].message }); this.$notify({ type: "warning", message: errors[0].message });
}, },
nextStep() { nextStep() {
this.generateFormData();
this.generateOrder(); this.generateOrder();
}, },
generateFormData() { relationChange(relation = this.formData.insuredUserInfo.relation) {
this.subFromData = {}; this.familyList.forEach(item => {
const { relation, nameMask: name, idNoMask: idNo, userInfoSecId, socialSecurity } = item;
if (relation === 0) {
this.formData.holderUserInfo = {
...this.formData.holderUserInfo,
...{ name, idNo, userInfoSecId, socialSecurity: socialSecurity ? "1" : "0" }
};
}
});
const userArray = this.familyList.filter(item => item.relation === +relation);
let [name, idNo, userInfoSecId, socialSecurity] = ["", "", "", "0"];
if (userArray.length) {
let { nameMask, idNoMask, userInfoSecId: id, socialSecurity: ss } = userArray[0];
[name, idNo, userInfoSecId, socialSecurity] = [nameMask, idNoMask, id, ss];
}
this.formData.insuredUserInfo = {
...this.formData.insuredUserInfo,
...{ name, idNo, userInfoSecId, socialSecurity: socialSecurity ? "1" : "0" }
};
},
getParamFromSession() {
const {
amountInsured: insuredAmount,
policyPeriod,
payPeriod: paymentPeriod,
payType,
productNo
} = this.policyFormData;
this.formData.productNo = productNo;
this.formData.insuredUserInfo = {
...this.formData.insuredUserInfo,
...{ insuredAmount, policyPeriod, paymentPeriod, payType }
};
this.$forceUpdate();
}, },
async getDetail() { async getDetail() {
this.goodId = this.$route.query.id; const res = await list();
const res = await detail({ productNo: this.goodId });
if (res) { if (res) {
this.headerInfo.price[0] = res.firstMonthPrice; res.forEach(item => {
this.headerInfo.subPrice[0] = res.price; if (item.productNo === this.formData.productNo) {
this.headerInfo.price[0] = item.downPayPrice;
}
});
}
},
async getFamilyList() {
const res = await getFamilyList();
if (res) {
this.familyList = res;
this.showAuthXyqb && this.relationChange();
} }
}, },
async calFee() { async calFee() {
let { price, subPrice } = this.headerInfo; let { price } = this.headerInfo;
const res = await trail(this.formData); const { birth, gender, insuredAmount, policyPeriod, paymentPeriod, payType } = this.formData;
const _param = {
productNo: this.goodId,
productUserInfo: {
userInfo: {
birth,
gender
},
productItem: {
amountInsured: insuredAmount,
policyPeriod,
payPeriod: paymentPeriod,
payType
}
}
};
const res = await trail(_param);
if (res) { if (res) {
price[0] = res.firstPrice; price[0] = res.downPayPrice;
subPrice[0] = res.regularPrice;
this.goodActionInfo = { this.goodActionInfo = {
title: price title: price
}; };
this.goodBuyModalInfo = [ this.goodBuyModalInfo = [{ title: `${price[2]}保费`, value: `${price[0]}${price[1]}` }];
{ title: `${price[2]}保费`, value: `${price[0]}${price[1]}` },
{ title: `${subPrice[2]}保费`, value: `${subPrice[0]}${subPrice[1]}${subPrice[3]}` }
];
} }
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment