Commit f3cbcd3f authored by 郭志伟's avatar 郭志伟

fix: 试算修正;健康告知

parent f576da6c
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* @Description: 华贵大麦2020定期寿险 * @Description: 华贵大麦2020定期寿险
* @Date: 2020-07-27 15:46:37 * @Date: 2020-07-27 15:46:37
* @LastEditors: gzw * @LastEditors: gzw
* @LastEditTime: 2020-08-19 14:07:08 * @LastEditTime: 2020-08-20 14:51:17
*/ */
import goodsBg from "@/assets/images/goods/detail/shouxian/bg.png"; import goodsBg from "@/assets/images/goods/detail/shouxian/bg.png";
......
export default { export default {
basicHost: "http://yapi.quantgroups.com/mock/329/", // basicHost: "http://yapi.quantgroups.com/mock/329/",
basicHost: "https://hathaway-mg.liangkebang.net/",
// basicHost: "http://192.168.29.211:8964/", // basicHost: "http://192.168.29.211:8964/",
wxAppId: "wx514de17b23d53a20" wxAppId: "wx514de17b23d53a20"
}; };
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Description: autoSaveForm mixins * @Description: autoSaveForm mixins
* @LastEditors: gzw * @LastEditors: gzw
* @Date: 2019-08-14 15:53:37 * @Date: 2019-08-14 15:53:37
* @LastEditTime: 2020-08-14 16:16:58 * @LastEditTime: 2020-08-20 13:49:26
*/ */
import localStorage from "@/service/localStorage"; import localStorage from "@/service/localStorage";
...@@ -28,6 +28,9 @@ export default { ...@@ -28,6 +28,9 @@ export default {
hasAutoSaveData(key) { hasAutoSaveData(key) {
return !!localStorage.get(key); return !!localStorage.get(key);
}, },
getSaveParams(key) {
return localStorage.get(key);
},
getSaveInfoHandler(key, target) { getSaveInfoHandler(key, target) {
this[target] = localStorage.get(key); this[target] = localStorage.get(key);
this.$forceUpdate(); this.$forceUpdate();
......
...@@ -269,9 +269,10 @@ export function isBankNumber(str) { ...@@ -269,9 +269,10 @@ export function isBankNumber(str) {
// 判断中文地址不能少于5个汉字,且必须有一位数字 // 判断中文地址不能少于5个汉字,且必须有一位数字
export function isChnAddress(str) { export function isChnAddress(str) {
const isNum = /[0-9]\d*/;
const isChinese_var = /[\u0391-\uFFE5]{5,}/g;
if (!isNull(str)) { if (!isNull(str)) {
const reg = /^(\d|[\u4e00-\u9fa5]){5,10}$/; return isNum.test(str) && isChinese_var.test(str);
return reg.test(str);
} }
return false; return false;
} }
......
...@@ -170,7 +170,13 @@ export default { ...@@ -170,7 +170,13 @@ export default {
const { idNo: oldidNo, amountInsured: oldamountInsured, selfIdNo: oldselfIdNo } = oldVal; const { idNo: oldidNo, amountInsured: oldamountInsured, selfIdNo: oldselfIdNo } = oldVal;
let idNoWho = !relation || relation === "1" ? selfIdNo : idNo; let idNoWho = !relation || relation === "1" ? selfIdNo : idNo;
let oldidNoWho = !relation || relation === "1" ? oldselfIdNo : oldidNo; let oldidNoWho = !relation || relation === "1" ? oldselfIdNo : oldidNo;
if (!isIdNo(idNoWho) && idNoWho === oldidNoWho && amountInsured === oldamountInsured) { if (
idNoWho &&
idNoWho.indexOf("************") === -1 &&
!isIdNo(idNoWho) &&
idNoWho === oldidNoWho &&
amountInsured === oldamountInsured
) {
return; return;
} }
this.calTimer = setTimeout(() => { this.calTimer = setTimeout(() => {
...@@ -268,7 +274,7 @@ export default { ...@@ -268,7 +274,7 @@ export default {
payType, payType,
autoRenewPolicy autoRenewPolicy
} = this.formData; } = this.formData;
this.subFromData = { this.subFormData = {
insuredUserInfo: { insuredUserInfo: {
userInfoSecId: userInfoSecId ?? null, userInfoSecId: userInfoSecId ?? null,
name, name,
......
...@@ -186,12 +186,52 @@ export default { ...@@ -186,12 +186,52 @@ export default {
oldidNoWho = oldidNo; oldidNoWho = oldidNo;
} }
if (this.goInsureState) { if (this.goInsureState) {
sessionStorage.setItem( const subFormData = JSON.parse(JSON.stringify(this.formData));
"policyFormData", const {
JSON.stringify(Object.assign(this.formData, { productNo: this.goodId })) userInfoSecId,
); name,
idNo,
relation,
socialSecurity,
selfSocialSecurity,
selfName,
selfIdNo,
selfPhone,
selfSecId,
payType,
amountInsured,
autoRenewPolicy
} = subFormData;
const subFormDataCache = {
productNo: this.goodId,
holderUserInfo: {
phoneNo: selfPhone,
userInfoSecId: selfSecId ? selfSecId : null,
name: selfName,
idNo: selfIdNo
},
productItem: {
payType,
amountInsured
},
autoRenewPolicy: autoRenewPolicy
};
if (relation === "1") {
subFormDataCache.holderUserInfo.socialSecurity = !!Number(selfSocialSecurity);
} else {
subFormDataCache.insuredUserInfo = {
userInfoSecId: userInfoSecId ? userInfoSecId : undefined,
name,
idNo,
relation,
socialSecurity: !!Number(socialSecurity)
};
}
sessionStorage.setItem("policyFormData", JSON.stringify(subFormDataCache));
} }
if ( if (
idNoWho &&
idNoWho.indexOf("************") === -1 &&
!isIdNo(idNoWho) && !isIdNo(idNoWho) &&
idNoWho === oldidNoWho && idNoWho === oldidNoWho &&
payType === oldpayType && payType === oldpayType &&
......
...@@ -117,7 +117,6 @@ import detailLoginMixin from "./modules/detailLogin.mixin"; ...@@ -117,7 +117,6 @@ import detailLoginMixin from "./modules/detailLogin.mixin";
import Detail from "@/api/detail.huagui.shouxian"; import Detail from "@/api/detail.huagui.shouxian";
import { trail, list } from "@/api/product"; import { trail, list } from "@/api/product";
export default { export default {
name: "GoodsDetail-LI", name: "GoodsDetail-LI",
components: { components: {
...@@ -143,7 +142,7 @@ export default { ...@@ -143,7 +142,7 @@ export default {
mixins: [detailLoginMixin], mixins: [detailLoginMixin],
data() { data() {
return { return {
...Detail, ...JSON.parse(JSON.stringify(Detail)),
goodId: "", goodId: "",
calTimer: null, calTimer: null,
goodActionInfo: {}, goodActionInfo: {},
......
...@@ -161,7 +161,10 @@ export default { ...@@ -161,7 +161,10 @@ export default {
}; };
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]}` } {
title: `${subPrice[2]}保费`,
value: `${subPrice[0]}${subPrice[1]}${subPrice[3]}`
}
]; ];
} }
}, },
...@@ -175,7 +178,13 @@ export default { ...@@ -175,7 +178,13 @@ export default {
const { idNo: oldidNo, selfIdNo: oldselfIdNo } = oldVal; const { idNo: oldidNo, selfIdNo: oldselfIdNo } = oldVal;
let idNoWho = !relation || relation === "1" ? selfIdNo : idNo; let idNoWho = !relation || relation === "1" ? selfIdNo : idNo;
let oldidNoWho = !relation || relation === "1" ? oldselfIdNo : oldidNo; let oldidNoWho = !relation || relation === "1" ? oldselfIdNo : oldidNo;
if (!isIdNo(idNoWho) && idNoWho === oldidNoWho) return; if (
idNoWho &&
idNoWho.indexOf("************") === -1 &&
!isIdNo(idNoWho) &&
idNoWho === oldidNoWho
)
return;
this.calTimer = setTimeout(() => { this.calTimer = setTimeout(() => {
this.calFee(); this.calFee();
}, 1000); }, 1000);
...@@ -246,7 +255,7 @@ export default { ...@@ -246,7 +255,7 @@ export default {
this.generateOrder(); this.generateOrder();
}, },
generateFormData() { generateFormData() {
const subFromData = JSON.parse(JSON.stringify(this.formData)); const subFormData = JSON.parse(JSON.stringify(this.formData));
const { const {
userInfoSecId, userInfoSecId,
name, name,
...@@ -260,8 +269,8 @@ export default { ...@@ -260,8 +269,8 @@ export default {
selfSecId, selfSecId,
payType, payType,
autoRenewPolicy autoRenewPolicy
} = subFromData; } = subFormData;
this.subFromData = { this.subFormData = {
productNo: this.goodId, productNo: this.goodId,
holderUserInfo: { holderUserInfo: {
phoneNo: selfPhone, phoneNo: selfPhone,
...@@ -275,17 +284,17 @@ export default { ...@@ -275,17 +284,17 @@ export default {
autoRenewPolicy: autoRenewPolicy autoRenewPolicy: autoRenewPolicy
}; };
if (relation === "1") { if (relation === "1") {
this.subFromData.holderUserInfo.socialSecurity = !!Number(selfSocialSecurity); this.subFormData.holderUserInfo.socialSecurity = !!Number(selfSocialSecurity);
this.subFromData.productItem.socialSecurity = !!Number(selfSocialSecurity); this.subFormData.productItem.socialSecurity = !!Number(selfSocialSecurity);
} else { } else {
this.subFromData.insuredUserInfo = { this.subFormData.insuredUserInfo = {
userInfoSecId: userInfoSecId ? userInfoSecId : undefined, userInfoSecId: userInfoSecId ? userInfoSecId : undefined,
name, name,
idNo, idNo,
relation, relation,
socialSecurity: !!Number(socialSecurity) socialSecurity: !!Number(socialSecurity)
}; };
this.subFromData.productItem.socialSecurity = !!Number(socialSecurity); this.subFormData.productItem.socialSecurity = !!Number(socialSecurity);
} }
}, },
async getDetail() { async getDetail() {
......
...@@ -7,7 +7,7 @@ import { mapActions } from "vuex"; ...@@ -7,7 +7,7 @@ import { mapActions } from "vuex";
export default { export default {
data() { data() {
return { return {
subFromData: {}, // 组装好的数据 subFormData: {}, // 组装好的数据
orderInfo: {}, orderInfo: {},
openId: localStorage.get("openId"), openId: localStorage.get("openId"),
tradeType: "", tradeType: "",
...@@ -22,7 +22,7 @@ export default { ...@@ -22,7 +22,7 @@ export default {
...mapActions(["setIsLoading"]), ...mapActions(["setIsLoading"]),
async generateOrder() { async generateOrder() {
const res = await placeOrder.create({ const res = await placeOrder.create({
...this.subFromData ...this.subFormData
}); });
if (res) { if (res) {
this.orderInfo = res; this.orderInfo = res;
......
...@@ -11,7 +11,13 @@ ...@@ -11,7 +11,13 @@
请如实告知 请如实告知
<strong>被保人</strong> 是否有以下情形之一 <strong>被保人</strong> 是否有以下情形之一
</span> </span>
<iframe class="inform-frame" :src="url" frameborder="0" height="100%"></iframe> <iframe
class="inform-frame"
:src="url"
frameborder="0"
height="100%"
v-if="refreshIframe"
></iframe>
</card> </card>
<div class="inform-btns"> <div class="inform-btns">
<cr-button @click="$router.back()">不符合</cr-button> <cr-button @click="$router.back()">不符合</cr-button>
...@@ -31,58 +37,25 @@ export default { ...@@ -31,58 +37,25 @@ export default {
}, },
data() { data() {
return { return {
formData: JSON.parse(sessionStorage.getItem("policyFormData") || "{}"), subFormData: JSON.parse(sessionStorage.getItem("policyFormData") || "{}"),
orderInfo: {}, orderInfo: {},
refreshIframe: true,
tradeType: "JSAPI", tradeType: "JSAPI",
url: "http://mangguo-contract.qthbx.com/huatai-jian-kang-gao-zhi-v1/" url: "http://mangguo-contract.qthbx.com/huatai-jian-kang-gao-zhi-v1/"
}; };
}, },
mounted() {
this.url = this.$route.query.url || this.url;
this.refreshIframe = false;
setTimeout(() => {
this.refreshIframe = true;
}, 1000);
},
methods: { methods: {
conform() { conform() {
// this.$router.push(`/policy/detail/123`); // this.$router.push(`/policy/detail/123`);
this.generateFormData(); // this.generateFormData();
this.generateOrder(); this.generateOrder();
},
generateFormData() {
const subFromData = JSON.parse(JSON.stringify(this.formData));
const {
userInfoSecId,
name,
idNo,
relation,
socialSecurity,
selfSocialSecurity,
selfName,
selfIdNo,
selfPhone,
selfSecId,
payType,
autoRenewPolicy
} = subFromData;
this.subFromData = {
productNo: this.goodId,
holderUserInfo: {
phoneNo: selfPhone,
userInfoSecId: selfSecId ? selfSecId : null,
name: selfName,
idNo: selfIdNo
},
productItem: {
payType
},
autoRenewPolicy: autoRenewPolicy
};
if (relation === "1") {
this.subFromData.holderUserInfo.socialSecurity = !!Number(selfSocialSecurity);
} else {
this.subFromData.insuredUserInfo = {
userInfoSecId: userInfoSecId ? userInfoSecId : undefined,
name,
idNo,
relation,
socialSecurity: !!Number(socialSecurity)
};
}
} }
} }
}; };
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
:rules="[ :rules="[
{ required: true, message: '请填写投保人姓名' }, { required: true, message: '请填写投保人姓名' },
{ {
validator: isChineseName, validator: isChineseNameMask,
message: '请填写正确的投保人姓名,最少2个中文字符' message: '请填写正确的投保人姓名,最少2个中文字符'
} }
]" ]"
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
:rules="[ :rules="[
{ required: true, message: '请填写投保人身份证号' }, { required: true, message: '请填写投保人身份证号' },
{ {
validator: isIdNo, validator: isIdNoMask,
message: '请填写正确的投保人身份证号' message: '请填写正确的投保人身份证号'
} }
]" ]"
...@@ -51,7 +51,7 @@ ...@@ -51,7 +51,7 @@
:rules="[ :rules="[
{ required: true, message: '请填写投保人手机号' }, { required: true, message: '请填写投保人手机号' },
{ {
validator: isPhone, validator: isPhoneMask,
message: '请填写正确的投保人手机号' message: '请填写正确的投保人手机号'
} }
]" ]"
...@@ -78,7 +78,9 @@ ...@@ -78,7 +78,9 @@
type="digit" type="digit"
placeholder="请填写投保人年收入" placeholder="请填写投保人年收入"
:rules="[{ required: true, message: '请填写投保人年收入' }]" :rules="[{ required: true, message: '请填写投保人年收入' }]"
/> >
<div class="form-unit" slot="button">万元</div>
</cr-field>
<cr-field <cr-field
v-model="formData.holderUserInfo.addressCode" v-model="formData.holderUserInfo.addressCode"
name="holderUserInfo_addressCode" name="holderUserInfo_addressCode"
...@@ -223,7 +225,7 @@ ...@@ -223,7 +225,7 @@
:rules="[ :rules="[
{ required: true, message: '请填写投保人姓名' }, { required: true, message: '请填写投保人姓名' },
{ {
validator: isChineseName, validator: isChineseNameMask,
message: '请填写正确的被保人姓名,最少2个中文字符' message: '请填写正确的被保人姓名,最少2个中文字符'
} }
]" ]"
...@@ -237,7 +239,7 @@ ...@@ -237,7 +239,7 @@
:rules="[ :rules="[
{ required: true, message: '请填写被保人身份证号' }, { required: true, message: '请填写被保人身份证号' },
{ {
validator: isIdNo, validator: isIdNoMask,
message: '请填写正确的被保人身份证号' message: '请填写正确的被保人身份证号'
} }
]" ]"
...@@ -251,7 +253,7 @@ ...@@ -251,7 +253,7 @@
:rules="[ :rules="[
{ required: true, message: '请填写被保人手机号' }, { required: true, message: '请填写被保人手机号' },
{ {
validator: isPhone, validator: isPhoneMask,
message: '请填写正确的被保人手机号' message: '请填写正确的被保人手机号'
} }
]" ]"
...@@ -263,7 +265,9 @@ ...@@ -263,7 +265,9 @@
type="digit" type="digit"
placeholder="请填写被保人年收入" placeholder="请填写被保人年收入"
:rules="[{ required: true, message: '请填写被保人年收入' }]" :rules="[{ required: true, message: '请填写被保人年收入' }]"
/> >
<div class="form-unit" slot="button">万元</div>
</cr-field>
<cr-field <cr-field
v-model="formData.insuredUserInfo.addressCode" v-model="formData.insuredUserInfo.addressCode"
name="insuredUserInfo_addressCode" name="insuredUserInfo_addressCode"
...@@ -500,7 +504,7 @@ const { ...@@ -500,7 +504,7 @@ const {
idCardInvaildOptions, idCardInvaildOptions,
socialSecOptions, socialSecOptions,
bankInfo bankInfo
} = Detail; } = JSON.parse(JSON.stringify(Detail));
export default { export default {
name: "AddPolicy", name: "AddPolicy",
mixins: [detailPayMixin, autoSaveForm], mixins: [detailPayMixin, autoSaveForm],
...@@ -542,7 +546,7 @@ export default { ...@@ -542,7 +546,7 @@ export default {
}, },
payPeriod: "1" payPeriod: "1"
}, },
subFromData: {}, subFormData: {},
familyList: [], familyList: [],
formMaskData: {}, formMaskData: {},
idCardInvaildOptions, idCardInvaildOptions,
...@@ -598,7 +602,7 @@ export default { ...@@ -598,7 +602,7 @@ export default {
let idNoWho = !relation || relation === "1" ? val.holderUserInfo.idNo : idNo; let idNoWho = !relation || relation === "1" ? val.holderUserInfo.idNo : idNo;
let oldidNoWho = !relation || relation === "1" ? oldVal.holderUserInfo.idNo : oldIdNo; let oldidNoWho = !relation || relation === "1" ? oldVal.holderUserInfo.idNo : oldIdNo;
if ( if (
!isIdNo(idNoWho) || (idNoWho && idNoWho.indexOf("************") === -1 && !isIdNo(idNoWho)) ||
(idNoWho === oldidNoWho && (idNoWho === oldidNoWho &&
amountInsured === oldamountInsured && amountInsured === oldamountInsured &&
policyPeriod === oldpolicyPeriod && policyPeriod === oldpolicyPeriod &&
...@@ -648,9 +652,27 @@ export default { ...@@ -648,9 +652,27 @@ export default {
this.getFamilyList(); this.getFamilyList();
}, },
methods: { methods: {
isIdNo, isIdNoMask(str) {
isChineseName, if (str && str.indexOf("************") > -1) {
isPhone, return true;
} else {
return isIdNo(str);
}
},
isChineseNameMask(str) {
if (str && str.indexOf("*") > -1) {
return true;
} else {
return isChineseName(str);
}
},
isPhoneMask(str) {
if (str && str.indexOf("****") > -1) {
return true;
} else {
return isPhone(str);
}
},
isEmail, isEmail,
isBankNumber, isBankNumber,
isChnAddress, isChnAddress,
...@@ -681,19 +703,21 @@ export default { ...@@ -681,19 +703,21 @@ export default {
this.$notify({ type: "warning", message: errors[0].message }); this.$notify({ type: "warning", message: errors[0].message });
}, },
nextStep() { nextStep() {
this.subFromData = JSON.parse(JSON.stringify(this.formData)); this.subFormData = JSON.parse(JSON.stringify(this.formData));
const { socialSecurity, longTerm, relation } = this.subFromData.insuredUserInfo; const { socialSecurity, longTerm, relation } = this.subFormData.insuredUserInfo;
this.subFromData.insuredUserInfo.socialSecurity = socialSecurity === "1" ? true : false; this.subFormData.insuredUserInfo.socialSecurity = socialSecurity === "1" ? true : false;
this.subFromData.insuredUserInfo.longTerm = longTerm === "2" ? true : false; this.subFormData.insuredUserInfo.longTerm = longTerm === "2" ? true : false;
this.subFromData.holderUserInfo.longTerm = longTerm === "2" ? true : false; this.subFormData.holderUserInfo.longTerm = longTerm === "2" ? true : false;
if (relation === "1") { if (relation === "1") {
this.subFromData.holderUserInfo = { this.subFormData.holderUserInfo = {
...this.subFromData.holderUserInfo, ...this.subFormData.holderUserInfo,
...this.subFromData.insuredUserInfo ...this.subFormData.insuredUserInfo
}; };
delete this.subFromData.insuredUserInfo; delete this.subFormData.insuredUserInfo;
} }
this.generateOrder(); sessionStorage.setItem("policyFormData", JSON.stringify(this.subFormData));
this.$router.push({ path: "/goods/inform", query: { url: popupArray[1].url } });
// this.generateOrder();
}, },
relationOptionChange(relation) { relationOptionChange(relation) {
this.relationChange(relation, this.clearInsured); this.relationChange(relation, this.clearInsured);
...@@ -701,13 +725,15 @@ export default { ...@@ -701,13 +725,15 @@ export default {
this.clearInsured = true; this.clearInsured = true;
}, 1000); }, 1000);
}, },
relationChange(relation = this.formData.insuredUserInfo.relation, clear = false) { relationChange(relation, clear = false) {
if (clear) { if (clear) {
this.formData.insuredUserInfo = { this.formData.insuredUserInfo = {
relation, relation,
longTerm: "1" longTerm: "1"
}; };
} }
this.getSaveInfoHandler(AUTO_SAVE_KEY, AUTO_SAVE_TARGET);
// this.formData.insuredUserInfo.relation = relation;
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) {
...@@ -782,16 +808,12 @@ export default { ...@@ -782,16 +808,12 @@ export default {
const res = await getFamilyList(); const res = await getFamilyList();
if (res) { if (res) {
this.familyList = res; this.familyList = res;
if (this.hasAutoSaveData(AUTO_SAVE_KEY)) { const queryId = this.$route.query.userInfoSecId;
this.getSaveInfoHandler(AUTO_SAVE_KEY, AUTO_SAVE_TARGET); let relation = this.formData.insuredUserInfo.relation;
} else { if (queryId) {
const queryId = this.$route.query.userInfoSecId; relation = this.familyList.filter(item => item.userInfoSecId === queryId)[0].relation;
let relation = this.formData.insuredUserInfo.relation;
if (queryId) {
relation = this.familyList.filter(item => item.userInfoSecId === queryId)[0].relation;
}
(this.showAuthXyqb || this.mongoToken) && this.relationChange(relation, false);
} }
(this.showAuthXyqb || this.mongoToken) && this.relationChange(relation, false);
} }
}, },
async calFee() { async calFee() {
......
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