Commit 8544fe6d authored by 郭志伟's avatar 郭志伟

fix: 华贵保单填写回显

parent dbb1e9d7
...@@ -13,7 +13,7 @@ export default { ...@@ -13,7 +13,7 @@ export default {
avator: "", avator: "",
serveNum: "-", serveNum: "-",
rate: "-%", rate: "-%",
tel: "13888888888", tel: "16710080673",
date: "9:00 ~ 21:00" date: "9:00 ~ 21:00"
} }
}; };
...@@ -20,10 +20,6 @@ ...@@ -20,10 +20,6 @@
<script> <script>
import popupPickerMixin from "../mixins/popupPicker.mixin.js"; import popupPickerMixin from "../mixins/popupPicker.mixin.js";
import { parseTime } from "@/service/utils"; import { parseTime } from "@/service/utils";
const CURRENT_TIME = new Date();
const CURRENT_YEAR = CURRENT_TIME.getFullYear();
// const START_YEAR = 1949;
const END_YEAR = CURRENT_YEAR;
export default { export default {
name: "PopupDatePicker", name: "PopupDatePicker",
mixins: [popupPickerMixin], mixins: [popupPickerMixin],
...@@ -34,24 +30,41 @@ export default { ...@@ -34,24 +30,41 @@ export default {
return 100; return 100;
} }
}, },
needInit: {
type: Boolean,
default: true
},
later: { later: {
type: Number, type: Number,
default() { default() {
return END_YEAR - CURRENT_YEAR; return 60;
} }
} }
}, },
data() { data() {
return { return {
refName: "datepicker", refName: "datepicker",
initVal: parseTime("", "{y}-{m}-{d}") initVal: ""
}; };
}, },
watch: { watch: {
value(val) { value: {
if (val) { immediate: true,
this.initVal = val; handler(val) {
this.handleResult(val); if (val) {
this.initVal = val;
this.handleResult(val);
}
}
},
needInit: {
immediate: true,
handler(val) {
if (!val) {
this.initVal = "";
} else {
this.initVal = parseTime("", "{y}-{m}-{d}");
}
} }
} }
}, },
......
...@@ -23,6 +23,14 @@ import popupPickerMixin from "../mixins/popupPicker.mixin.js"; ...@@ -23,6 +23,14 @@ import popupPickerMixin from "../mixins/popupPicker.mixin.js";
export default { export default {
name: "PopupPicker", name: "PopupPicker",
mixins: [popupPickerMixin], mixins: [popupPickerMixin],
watch: {
value(val) {
if (val) {
this.setDefaultVal();
this.handleResult([this.pickerData.find(item => item.value === this.value)]);
}
}
},
methods: { methods: {
handleResult(res) { handleResult(res) {
this.pickerValShow = res[0].title; this.pickerValShow = res[0].title;
...@@ -31,7 +39,10 @@ export default { ...@@ -31,7 +39,10 @@ export default {
setDefaultVal() { setDefaultVal() {
setTimeout(() => { setTimeout(() => {
const $picker = this.$refs.picker; const $picker = this.$refs.picker;
$picker.setColumnIndex(0, this.pickerData.indexOf(this.value)); $picker.setColumnIndex(
0,
this.pickerData.findIndex(item => item.value === this.value)
);
}); });
} }
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Description: PopupPicker mixin * @Description: PopupPicker mixin
* @Date: 2020-07-28 19:46:31 * @Date: 2020-07-28 19:46:31
* @LastEditors: gzw * @LastEditors: gzw
* @LastEditTime: 2020-08-17 16:52:26 * @LastEditTime: 2020-08-19 18:08:05
*/ */
// TODO 默认值需要处理 // TODO 默认值需要处理
...@@ -34,9 +34,11 @@ export default { ...@@ -34,9 +34,11 @@ export default {
watch: { watch: {
show(val) { show(val) {
if (val && !this.refreshed && this.$refs[this.refName]) { if (val && !this.refreshed && this.$refs[this.refName]) {
this.refreshed = true; setTimeout(() => {
this.$refs[this.refName].refreshColumns(); this.refreshed = true;
this.setDefaultVal(); this.$refs[this.refName].refreshColumns();
this.setDefaultVal();
}, 500);
} }
} }
// value: { // value: {
......
...@@ -165,9 +165,13 @@ export default { ...@@ -165,9 +165,13 @@ export default {
if (this.calTimer) { if (this.calTimer) {
clearTimeout(this.calTimer); clearTimeout(this.calTimer);
} }
const { idNo, amountInsured } = val; const { idNo, amountInsured, relation, selfIdNo } = val;
const { idNo: oldidNo, amountInsured: oldamountInsured } = oldVal; const { idNo: oldidNo, amountInsured: oldamountInsured, selfIdNo: oldselfIdNo } = oldVal;
if (!isIdNo(idNo) && idNo === oldidNo && amountInsured === oldamountInsured) return; let idNoWho = !relation || relation === "1" ? selfIdNo : idNo;
let oldidNoWho = !relation || relation === "1" ? oldselfIdNo : oldidNo;
if (!isIdNo(idNoWho) && idNoWho === oldidNoWho && amountInsured === oldamountInsured) {
return;
}
this.calTimer = setTimeout(() => { this.calTimer = setTimeout(() => {
this.calFee(); this.calFee();
}, 1000); }, 1000);
...@@ -297,13 +301,14 @@ export default { ...@@ -297,13 +301,14 @@ export default {
}, },
async calFee() { async calFee() {
let { price } = this.headerInfo; let { price } = this.headerInfo;
const { idNo, amountInsured, userInfoSecId } = this.formData; const { idNo, selfIdNo, relation, amountInsured, userInfoSecId } = this.formData;
if (!idNo || !amountInsured) return; let idNoWho = !relation || relation === "1" ? selfIdNo : idNo;
if (!idNoWho || !amountInsured) return;
const _param = { const _param = {
productNo: this.goodId, productNo: this.goodId,
productUserInfo: { productUserInfo: {
insuredUserInfo: { insuredUserInfo: {
idNo, idNo: idNoWho,
userInfoSecId: userInfoSecId ? userInfoSecId : undefined userInfoSecId: userInfoSecId ? userInfoSecId : undefined
}, },
productItem: { productItem: {
......
...@@ -138,7 +138,7 @@ export default { ...@@ -138,7 +138,7 @@ export default {
name: "", name: "",
idNo: "", idNo: "",
relation: "", relation: "",
payType: "", payType: "2",
amountInsured: "300000", amountInsured: "300000",
autoRenewPolicy: false, autoRenewPolicy: false,
read: true read: true
...@@ -168,8 +168,22 @@ export default { ...@@ -168,8 +168,22 @@ export default {
if (this.calTimer) { if (this.calTimer) {
clearTimeout(this.calTimer); clearTimeout(this.calTimer);
} }
const { idNo, payType, amountInsured } = val; const { idNo, payType, amountInsured, relation, selfIdNo } = val;
const { idNo: oldidNo, payType: oldpayType, amountInsured: oldamountInsured } = oldVal; const {
idNo: oldidNo,
payType: oldpayType,
amountInsured: oldamountInsured,
selfIdNo: oldselfIdNo
} = oldVal;
let idNoWho = !relation || relation === "1" ? selfIdNo : idNo;
let oldidNoWho = !relation || relation === "1" ? oldselfIdNo : oldidNo;
if (!relation && relation === "1") {
idNoWho = selfIdNo;
oldidNoWho = oldselfIdNo;
} else {
idNoWho = idNo;
oldidNoWho = oldidNo;
}
if (this.goInsureState) { if (this.goInsureState) {
sessionStorage.setItem( sessionStorage.setItem(
"policyFormData", "policyFormData",
...@@ -177,8 +191,8 @@ export default { ...@@ -177,8 +191,8 @@ export default {
); );
} }
if ( if (
!isIdNo(idNo) && !isIdNo(idNoWho) &&
idNo === oldidNo && idNoWho === oldidNoWho &&
payType === oldpayType && payType === oldpayType &&
amountInsured === oldamountInsured amountInsured === oldamountInsured
) )
...@@ -275,18 +289,27 @@ export default { ...@@ -275,18 +289,27 @@ export default {
}, },
async calFee() { async calFee() {
let { price, subPrice } = this.headerInfo; let { price, subPrice } = this.headerInfo;
const { idNo, socialSecurity, payType, amountInsured, userInfoSecId } = this.formData; const {
if (!idNo) return; idNo,
socialSecurity,
relation,
selfIdNo,
payType,
amountInsured,
userInfoSecId
} = this.formData;
let idNoWho = !relation || relation === "1" ? selfIdNo : idNo;
if (!idNoWho || !socialSecurity || !payType) return;
const _param = { const _param = {
productNo: this.goodId, productNo: this.goodId,
productUserInfo: { productUserInfo: {
insuredUserInfo: { insuredUserInfo: {
idNo, idNo,
socialSecurity: socialSecurity ? !!Number(socialSecurity) : true, socialSecurity: socialSecurity ? !!Number(socialSecurity) : undefined,
userInfoSecId: userInfoSecId ? userInfoSecId : undefined userInfoSecId: userInfoSecId ? userInfoSecId : undefined
}, },
productItem: { productItem: {
payType: payType || "2", payType: payType || undefined,
amountInsured amountInsured
} }
} }
......
...@@ -222,6 +222,7 @@ export default { ...@@ -222,6 +222,7 @@ export default {
}, },
onSubmit() { onSubmit() {
this.showLoginPopup(); this.showLoginPopup();
this.popupShow = false;
}, },
onFailed(errorInfo) { onFailed(errorInfo) {
const { errors } = errorInfo; const { errors } = errorInfo;
......
...@@ -140,7 +140,7 @@ export default { ...@@ -140,7 +140,7 @@ export default {
idNo: "", idNo: "",
socialSecurity: "", socialSecurity: "",
relation: "", relation: "",
payType: "", payType: "2",
planValue: "3", planValue: "3",
autoRenewPolicy: false, autoRenewPolicy: false,
read: true read: true
...@@ -171,9 +171,11 @@ export default { ...@@ -171,9 +171,11 @@ export default {
if (this.calTimer) { if (this.calTimer) {
clearTimeout(this.calTimer); clearTimeout(this.calTimer);
} }
const { idNo } = val; const { idNo, relation, selfIdNo } = val;
const { idNo: oldidNo } = oldVal; const { idNo: oldidNo, selfIdNo: oldselfIdNo } = oldVal;
if (!isIdNo(idNo) && idNo === oldidNo) return; let idNoWho = !relation || relation === "1" ? selfIdNo : idNo;
let oldidNoWho = !relation || relation === "1" ? oldselfIdNo : oldidNo;
if (!isIdNo(idNoWho) && idNoWho === oldidNoWho) return;
this.calTimer = setTimeout(() => { this.calTimer = setTimeout(() => {
this.calFee(); this.calFee();
}, 1000); }, 1000);
...@@ -301,19 +303,20 @@ export default { ...@@ -301,19 +303,20 @@ export default {
}, },
async calFee() { async calFee() {
let { price, subPrice } = this.headerInfo; let { price, subPrice } = this.headerInfo;
const { idNo, socialSecurity, payType, userInfoSecId } = this.formData; const { idNo, socialSecurity, payType, userInfoSecId, relation, selfIdNo } = this.formData;
if (!idNo) return; let idNoWho = !relation || relation === "1" ? selfIdNo : idNo;
if (!idNoWho || !payType || !socialSecurity) return;
const _param = { const _param = {
productNo: this.goodId, productNo: this.goodId,
productUserInfo: { productUserInfo: {
insuredUserInfo: { insuredUserInfo: {
idNo, idNo,
socialSecurity: socialSecurity ? !!Number(socialSecurity) : true, socialSecurity: socialSecurity ? !!Number(socialSecurity) : undefined,
userInfoSecId: userInfoSecId ? userInfoSecId : undefined userInfoSecId: userInfoSecId ? userInfoSecId : undefined
}, },
productItem: { productItem: {
payType: payType || "2", payType: payType || undefined,
socialSecurity: socialSecurity ? !!Number(socialSecurity) : true socialSecurity: socialSecurity ? !!Number(socialSecurity) : undefined
} }
} }
}; };
......
...@@ -111,6 +111,7 @@ ...@@ -111,6 +111,7 @@
<template #input> <template #input>
<popup-date-picker <popup-date-picker
v-model="formData.holderUserInfo.validEnd" v-model="formData.holderUserInfo.validEnd"
:later="100"
placeholder="请选择您的证件有效止期" placeholder="请选择您的证件有效止期"
/> />
</template> </template>
...@@ -125,7 +126,7 @@ ...@@ -125,7 +126,7 @@
<template #input> <template #input>
<cr-radio-btn <cr-radio-btn
v-model="formData.insuredUserInfo.relation" v-model="formData.insuredUserInfo.relation"
@input="relationChange" @input="relationOptionChange"
:radio-data="insuredOptions" :radio-data="insuredOptions"
/> />
</template> </template>
...@@ -253,6 +254,7 @@ ...@@ -253,6 +254,7 @@
<template #input> <template #input>
<popup-date-picker <popup-date-picker
v-model="formData.insuredUserInfo.validEnd" v-model="formData.insuredUserInfo.validEnd"
:later="100"
placeholder="请选择您的证件有效止期" placeholder="请选择您的证件有效止期"
/> />
</template> </template>
...@@ -424,6 +426,7 @@ export default { ...@@ -424,6 +426,7 @@ export default {
popupArray, popupArray,
headerInfo, headerInfo,
calTimer: null, calTimer: null,
clearInsured: false,
goInsureState: false, goInsureState: false,
popupShow: false, popupShow: false,
currentPupopIndex: null, currentPupopIndex: null,
...@@ -440,7 +443,8 @@ export default { ...@@ -440,7 +443,8 @@ export default {
longTerm: "1" longTerm: "1"
}, },
productItem: { productItem: {
amountInsured: "500000" amountInsured: "500000",
payType: "1"
}, },
payPeriod: "1" payPeriod: "1"
}, },
...@@ -489,18 +493,26 @@ export default { ...@@ -489,18 +493,26 @@ export default {
clearTimeout(this.calTimer); clearTimeout(this.calTimer);
} }
const { relation, idNo } = val.insuredUserInfo; const { relation, idNo } = val.insuredUserInfo;
const { amountInsured, policyPeriod, payPeriod, payType } = val.productItem;
const { idNo: oldIdNo } = oldVal.insuredUserInfo; const { idNo: oldIdNo } = oldVal.insuredUserInfo;
if (relation === "1") { const {
const { idNo: holderIdNo } = val.holderUserInfo; amountInsured: oldamountInsured,
const { idNo: oldHolderIdNo } = oldVal.holderUserInfo; policyPeriod: oldpolicyPeriod,
if (!isIdNo(holderIdNo) || holderIdNo === oldHolderIdNo) { payPeriod: oldpayPeriod,
return; payType: oldpayType
} } = val.productItem;
} else { let idNoWho = !relation || relation === "1" ? val.holderUserInfo.idNo : idNo;
if (!isIdNo(idNo) || idNo === oldIdNo) { let oldidNoWho = !relation || relation === "1" ? oldVal.holderUserInfo.idNo : oldIdNo;
return; if (
} !isIdNo(idNoWho) ||
} (idNoWho === oldidNoWho &&
amountInsured === oldamountInsured &&
policyPeriod === oldpolicyPeriod &&
payPeriod === oldpayPeriod &&
payType === oldpayType)
)
return;
this.calTimer = setTimeout(() => { this.calTimer = setTimeout(() => {
this.calFee(); this.calFee();
}, 1000); }, 1000);
...@@ -571,11 +583,19 @@ export default { ...@@ -571,11 +583,19 @@ export default {
} }
this.generateOrder(); this.generateOrder();
}, },
relationChange(relation = this.formData.insuredUserInfo.relation) { relationOptionChange(relation) {
this.formData.insuredUserInfo = { this.relationChange(relation, this.clearInsured);
relation, setTimeout(() => {
longTerm: "1" this.clearInsured = true;
}; }, 1000);
},
relationChange(relation = this.formData.insuredUserInfo.relation, clear = false) {
if (clear) {
this.formData.insuredUserInfo = {
relation,
longTerm: "1"
};
}
this.familyList.forEach(item => { this.familyList.forEach(item => {
const { relation, nameMask: name, idNoMask: idNo, userInfoSecId } = item; const { relation, nameMask: name, idNoMask: idNo, userInfoSecId } = item;
if (+relation === 1) { if (+relation === 1) {
...@@ -658,22 +678,27 @@ export default { ...@@ -658,22 +678,27 @@ export default {
if (queryId) { if (queryId) {
relation = this.familyList.filter(item => item.userInfoSecId === queryId)[0].relation; relation = this.familyList.filter(item => item.userInfoSecId === queryId)[0].relation;
} }
(this.showAuthXyqb || this.mongoToken) && this.relationChange(relation); (this.showAuthXyqb || this.mongoToken) && this.relationChange(relation, false);
} }
} }
}, },
async calFee() { async calFee() {
let { price } = this.headerInfo; let { price } = this.headerInfo;
const { amountInsured, policyPeriod, payPeriod, payType } = this.formData.productItem; const { amountInsured, policyPeriod, payPeriod, payType } = this.formData.productItem;
const {
relation,
userInfoSecId: insureidId,
idNo: insureidNo,
socialSecurity
} = this.formData.insuredUserInfo;
let idNo = ""; let idNo = "";
let userInfoSecId = undefined; let userInfoSecId = undefined;
const { socialSecurity } = this.formData.insuredUserInfo; if (!relation || relation === "1") {
if (this.formData.insuredUserInfo.relation !== "1") {
userInfoSecId = this.formData.insuredUserInfo.userInfoSecId;
idNo = this.formData.insuredUserInfo.idNo;
} else {
userInfoSecId = this.formData.holderUserInfo.userInfoSecId; userInfoSecId = this.formData.holderUserInfo.userInfoSecId;
idNo = this.formData.holderUserInfo.idNo; idNo = this.formData.holderUserInfo.idNo;
} else {
userInfoSecId = insureidId;
idNo = insureidNo;
} }
if (!amountInsured || !policyPeriod || !payPeriod || !payType || !idNo) return; if (!amountInsured || !policyPeriod || !payPeriod || !payType || !idNo) return;
const _param = { const _param = {
......
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