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

fix: 试算修正;健康告知

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