Commit 0bdf25bb authored by 郭志伟's avatar 郭志伟

Merge branch 'fix/goods' into 'master'

Fix/goods

See merge request !85
parents a21bf51d fbfc9905
let protocol = window.location.protocol;
export default {
basicHost: "http://yapi.quantgroups.com/mock/329/",
// basicHost: "https://hathaway-mg.liangkebang.net/",
// basicHost: "http://yapi.quantgroups.com/mock/329/",
basicHost: "https://hathaway-mg.liangkebang.net/",
// basicHost: "http://192.168.29.211:8964/",
wxAppId: "wx514de17b23d53a20",
shenceUrl: `${protocol}//bn.xyqb.com/sa?project=default`, // 神策数据请求地址
......
......@@ -222,3 +222,16 @@ export function getRealAge(strBirthday) {
}
return returnAge; //返回周岁年龄
}
export function getBirthDate(idCard) {
let birthday = "";
if (idCard) {
if (idCard.length == 15) {
birthday = "19" + idCard.substr(6, 6);
} else if (idCard.length == 18) {
birthday = idCard.substr(6, 8);
}
birthday = birthday.replace(/(.{4})(.{2})/, "$1-$2-");
}
return birthday;
}
......@@ -175,7 +175,7 @@ export default {
birthday: "1990-01-01",
socialSecurity: "",
annualIncome: "10万",
loan: "房贷",
loan: "贷款",
addressCode: "北京市,北京市",
questionType: "",
userName: "",
......@@ -270,7 +270,7 @@ export default {
],
// 贷款
loanOptions: [
"房贷",
"贷款",
"1000元",
"2000元",
"3000元",
......@@ -280,7 +280,7 @@ export default {
"7000元",
"8000元",
"9000元",
"1万元以上",
"1万元",
"1万元以上"
],
solveOptions: [
......@@ -300,7 +300,10 @@ export default {
currentStep(val) {
this.$forceUpdate();
if (val === 3) {
this.$refs["income"].refreshColumns();
if (this.formData.annualIncome === "10万") {
this.setPickerDefaultVal("income", "10万", this.incomeOptions);
this.$refs["income"].refreshColumns();
}
}
if (val === 4) {
this.$refs["loan"].refreshColumns();
......@@ -310,7 +313,6 @@ export default {
}
}
},
mounted() {},
methods: {
nextQuestion() {
const { currentStep, stepTips, formData } = this;
......@@ -344,6 +346,15 @@ export default {
}
this.formData[type] = value;
},
setPickerDefaultVal(refName, value, options) {
setTimeout(() => {
const $picker = this.$refs[refName];
$picker.setColumnIndex(
0,
options.findIndex(item => item === value)
);
});
},
async onSubmit() {
const { formData } = this;
const { socialSecurity, gender } = formData;
......
......@@ -97,6 +97,7 @@ import localStorage from "@/service/localStorage";
import Detail from "@/api/detail.zhongan.yiwai";
import { trail, list } from "@/api/product";
import { isIdNo } from "@/service/validation";
import { getRealAge, getBirthDate } from "@/service/utils";
export default {
name: "GoodsDetail-AI",
......@@ -141,9 +142,10 @@ export default {
payType: "1",
amountInsured: "1000000",
autoRenewPolicy: false,
read: true
read: false
},
goInsureState: false
goInsureState: false,
isCalPrice: false
};
},
watch: {
......@@ -222,6 +224,10 @@ export default {
this.popupShow = true;
},
onSubmit() {
if (!this.isCalPrice) {
this.$notify({ type: "warn", message: "被保人年龄不在可投保范围,请仔细核对" });
return;
}
if (localStorage.get("mongoToken")) {
this.$refs.insureForm.getFamilyList_I().then(() => {
this.getIsRead();
......@@ -306,6 +312,26 @@ export default {
delete this.subFormData.insuredUserInfo;
}
},
getRealIdNo() {
const { relation, userInfoSecId: userId, idNo: idNoMask } = this.formData;
const { selfSecId: holderUserId, selfIdNo: holderIdNoMask } = this.formData;
let currentIdNo = !relation || relation === "1" ? holderIdNoMask : idNoMask;
const currentUserId = !relation || relation === "1" ? holderUserId : userId;
const familyList = this.$refs["insureForm"].familyList;
if (!currentIdNo) return "";
currentIdNo =
currentIdNo.indexOf("**") > -1
? familyList.find(item => item.userInfoSecId === currentUserId).idNo
: currentIdNo;
return currentIdNo;
},
checkAgeInRange() {
const currentIdNo = this.getRealIdNo();
if (!currentIdNo) return;
const birthday = getBirthDate(currentIdNo);
const realAge = getRealAge(birthday);
return realAge >= 18 && realAge <= 65;
},
async getDetail() {
this.goodId = this.$route.query.id;
const res = await list();
......@@ -325,7 +351,8 @@ export default {
let idNoWho = !relation || relation === "1" ? selfIdNo : idNo;
let idWho = !relation || relation === "1" ? selfSecId : userInfoSecId;
idWho = idNoWho.indexOf("**") > -1 ? idWho || undefined : undefined;
if (!idNoWho && !amountInsured) return;
this.isCalPrice = this.checkAgeInRange();
if (!this.isCalPrice || (!idNoWho && !amountInsured)) return;
const _param = {
productNo: this.goodId,
productUserInfo: {
......@@ -338,15 +365,20 @@ export default {
}
}
};
const res = await trail(_param);
if (res) {
price[0] = res.downPayPrice;
price[1] = "元/年";
this.goodActionInfo = {
title: price
};
this.goodBuyModalInfo = [{ title: `每年保费`, value: `${price[0]}元` }];
noticeCellInfo[amountInsured][2].value = `${price[0] + price[1]}`;
try {
const res = await trail(_param);
if (res) {
price[0] = res.downPayPrice;
price[1] = "元/年";
this.goodActionInfo = {
title: price
};
this.goodBuyModalInfo = [{ title: `每年保费`, value: `${price[0]}元` }];
noticeCellInfo[amountInsured][2].value = `${price[0] + price[1]}`;
}
this.isCalPrice = true;
} catch (error) {
this.isCalPrice = false;
}
}
}
......
......@@ -90,10 +90,12 @@ import ProtocolRead from "./modules/ProtocolRead";
import NavTab from "./modules/NavTab";
import detailLoginMixin from "./modules/detailLogin.mixin";
import fromNow from "date-fns/formatDistanceToNowStrict";
import localStorage from "@/service/localStorage";
import Detail from "@/api/detail.huatai.zhongjixian";
import { trail, list } from "@/api/product";
import { isIdNo } from "@/service/validation";
import { getRealAge, getBirthDate } from "@/service/utils";
export default {
name: "GoodsDetail-CII",
......@@ -138,9 +140,10 @@ export default {
payType: "1",
amountInsured: "300000",
autoRenewPolicy: false,
read: true
read: false
},
goInsureState: false
goInsureState: false,
isCalPrice: false
};
},
watch: {
......@@ -281,6 +284,10 @@ export default {
this.popupShow = true;
},
onSubmit() {
if (!this.isCalPrice) {
this.$notify({ type: "warn", message: "被保人年龄不在可投保范围,请仔细核对" });
return;
}
if (localStorage.get("mongoToken")) {
this.$refs.insureForm.getFamilyList_I().then(() => {
this.getIsRead();
......@@ -322,6 +329,26 @@ export default {
nextStep() {
this.$router.push({ path: "/goods/inform" });
},
getRealIdNo() {
const { relation, userInfoSecId: userId, idNo: idNoMask } = this.formData;
const { selfSecId: holderUserId, selfIdNo: holderIdNoMask } = this.formData;
let currentIdNo = !relation || relation === "1" ? holderIdNoMask : idNoMask;
const currentUserId = !relation || relation === "1" ? holderUserId : userId;
const familyList = this.$refs["insureForm"].familyList;
if (!currentIdNo) return "";
currentIdNo =
currentIdNo.indexOf("**") > -1
? familyList.find(item => item.userInfoSecId === currentUserId).idNo
: currentIdNo;
return currentIdNo;
},
checkAgeInRange() {
const currentIdNo = this.getRealIdNo();
if (!currentIdNo) return;
const birthday = getBirthDate(currentIdNo);
const isOverMonth = birthday && parseInt(fromNow(new Date(birthday), { unit: "day" })) >= 30;
return isOverMonth && getRealAge(birthday) <= 50;
},
async getDetail() {
this.goodId = this.$route.query.id;
const res = await list();
......@@ -348,7 +375,8 @@ export default {
userInfoSecId
} = this.formData;
let idNoWho = !relation || relation === "1" ? selfIdNo : idNo;
if (!idNoWho || !payType) return;
this.isCalPrice = this.checkAgeInRange();
if (!idNoWho || !payType || !this.isCalPrice) return;
const _param = {
productNo: this.goodId,
productUserInfo: {
......@@ -363,27 +391,31 @@ export default {
}
}
};
const res = await trail(_param);
if (res) {
price[2] = payType === "2" ? "" : "首月";
price[0] = res.downPayPrice;
subPrice[1] = "元/月";
subPrice[0] = payType === "2" ? "" : res.regularPrice;
this.goodActionInfo = {
title: price,
sub: subPrice[0] ? subPrice : ""
};
this.goodBuyModalInfo = [
{ title: `${price[2]}保费`, value: `${price[0]}${price[1]}` },
{
title: `${subPrice[2]}保费`,
value: subPrice[0] ? `${subPrice[0]}${subPrice[1]}${subPrice[3]}` : ""
}
];
noticeCellInfo[amountInsured][3].value.tpl = `保费与保额、被保人年龄有关<br />${price[2] +
price[0] +
price[1]}${subPrice[0] ? subPrice[2] + subPrice[0] + subPrice[1] : ""}`;
try {
const res = await trail(_param);
if (res) {
price[2] = payType === "2" ? "" : "首月";
price[0] = res.downPayPrice;
subPrice[1] = "元/月";
subPrice[0] = payType === "2" ? "" : res.regularPrice;
this.goodActionInfo = {
title: price,
sub: subPrice[0] ? subPrice : ""
};
this.goodBuyModalInfo = [
{ title: `${price[2]}保费`, value: `${price[0]}${price[1]}` },
{
title: `${subPrice[2]}保费`,
value: subPrice[0] ? `${subPrice[0]}${subPrice[1]}${subPrice[3]}` : ""
}
];
noticeCellInfo[amountInsured][3].value.tpl = `保费与保额、被保人年龄有关<br />${price[2] +
price[0] +
price[1]}${subPrice[0] ? subPrice[2] + subPrice[0] + subPrice[1] : ""}`;
}
this.isCalPrice = true;
} catch (error) {
this.isCalPrice = false;
}
}
}
......
......@@ -47,6 +47,7 @@
:options="[]"
:text-bold="true"
v-model="read"
:show-radio="false"
:cell-data="noticeCellInfo"
@cell-click="openIframePupop"
>
......
......@@ -90,8 +90,10 @@ import NavTab from "./modules/NavTab";
import detailPayMixin from "./modules/detailPay.mixin";
import detailLoginMixin from "./modules/detailLogin.mixin";
import fromNow from "date-fns/formatDistanceToNowStrict";
import { trail, list } from "@/api/product";
import localStorage from "@/service/localStorage";
import { getRealAge, getBirthDate } from "@/service/utils";
import Detail from "@/api/detail.taikang.yiliaobaozhang";
import { isIdNo } from "@/service/validation";
......@@ -140,10 +142,11 @@ export default {
payType: "1",
planValue: "3",
autoRenewPolicy: false,
read: true
read: false
},
goodActionShow: false,
goInsureState: false
goInsureState: false,
isCalPrice: false
};
},
watch: {
......@@ -217,6 +220,10 @@ export default {
this.popupShow = true;
},
onSubmit() {
if (!this.isCalPrice) {
this.$notify({ type: "warning", message: "被保人年龄不在可投保范围,请仔细核对" });
return;
}
if (localStorage.get("mongoToken")) {
socialSecurityCache = this.formData.socialSecurity;
this.$refs.insureForm.getFamilyList_I().then(() => {
......@@ -315,6 +322,26 @@ export default {
delete this.subFormData.insuredUserInfo;
}
},
getRealIdNo() {
const { relation, userInfoSecId: userId, idNo: idNoMask } = this.formData;
const { selfSecId: holderUserId, selfIdNo: holderIdNoMask } = this.formData;
let currentIdNo = !relation || relation === "1" ? holderIdNoMask : idNoMask;
const currentUserId = !relation || relation === "1" ? holderUserId : userId;
const familyList = this.$refs["insureForm"].familyList;
if (!currentIdNo) return "";
currentIdNo =
currentIdNo.indexOf("**") > -1
? familyList.find(item => item.userInfoSecId === currentUserId).idNo
: currentIdNo;
return currentIdNo;
},
checkAgeInRange() {
const currentIdNo = this.getRealIdNo();
if (!currentIdNo) return;
const birthday = getBirthDate(currentIdNo);
const isOverMonth = birthday && parseInt(fromNow(new Date(birthday), { unit: "day" })) >= 30;
return isOverMonth && getRealAge(birthday) <= 60;
},
async getDetail() {
this.goodId = this.$route.query.id;
const res = await list();
......@@ -332,7 +359,8 @@ export default {
let { price, subPrice } = this.headerInfo;
const { idNo, socialSecurity, payType, userInfoSecId, relation, selfIdNo } = this.formData;
let idNoWho = !relation || relation === "1" ? selfIdNo : idNo;
if (!idNoWho || !payType || !socialSecurity) return;
this.isCalPrice = this.checkAgeInRange();
if (!idNoWho || !payType || !socialSecurity || !this.isCalPrice) return;
const _param = {
productNo: this.goodId,
productUserInfo: {
......@@ -347,26 +375,31 @@ export default {
}
}
};
const res = await trail(_param);
if (res) {
price[2] = payType === "2" ? "" : "首月";
price[0] = res.downPayPrice;
subPrice[0] = payType === "2" ? "" : res.regularPrice;
subPrice[1] = "元/月";
this.goodActionInfo = {
title: price,
sub: subPrice[0] ? subPrice : ""
};
this.goodBuyModalInfo = [
{ title: `${price[2]}保费`, value: `${price[0]}${price[1]}` },
{
title: `${subPrice[2]}保费`,
value: subPrice[0] ? `${subPrice[0]}${subPrice[1]}${subPrice[3]}` : ""
}
];
this.noticeCellInfo[3].value.tpl = `保费于被保人年龄、有无社保有关<br />${price[2] +
price[0] +
price[1]}${subPrice[0] ? subPrice[2] + subPrice[0] + subPrice[1] : ""}`;
try {
const res = await trail(_param);
if (res) {
price[2] = payType === "2" ? "" : "首月";
price[0] = res.downPayPrice;
subPrice[0] = payType === "2" ? "" : res.regularPrice;
subPrice[1] = "元/月";
this.goodActionInfo = {
title: price,
sub: subPrice[0] ? subPrice : ""
};
this.goodBuyModalInfo = [
{ title: `${price[2]}保费`, value: `${price[0]}${price[1]}` },
{
title: `${subPrice[2]}保费`,
value: subPrice[0] ? `${subPrice[0]}${subPrice[1]}${subPrice[3]}` : ""
}
];
this.noticeCellInfo[3].value.tpl = `保费于被保人年龄、有无社保有关<br />${price[2] +
price[0] +
price[1]}${subPrice[0] ? subPrice[2] + subPrice[0] + subPrice[1] : ""}`;
}
this.isCalPrice = true;
} catch (error) {
this.isCalPrice = false;
}
}
}
......
......@@ -4,13 +4,14 @@
<slot></slot>
<template v-slot:footer>
<div class="insure-form-pact" slot="footer">
<cr-field name="pact">
<cr-field name="pact" v-show="showRadio">
<template #input>
<cr-checkbox shape="round" icon-size="13px" v-model="pact" checked-color="#FFC842">
投保前请阅读
</cr-checkbox>
</template>
</cr-field>
<div v-show="!showRadio"></div>
<div class="insure-form-pact-link">
<a
href="javascript:;"
......@@ -50,6 +51,10 @@ export default {
return ["查看完整费率表"];
}
},
showRadio: {
type: Boolean,
default: true
},
protocolData: {
type: Array,
default() {
......
......@@ -527,7 +527,7 @@ import autoSaveForm from "@/mixins/autoSaveForm.mixin";
import liCalFee from "@/views/Goods/Detail/modules/liCalFee.mixin";
import { addDays, addYears, format as dateFormat } from "date-fns";
import debounce from "lodash/debounce";
import { getRealAge } from "@/service/utils";
import { getRealAge, getBirthDate } from "@/service/utils";
import localStorage from "@/service/localStorage";
import { mapState, mapActions } from "vuex";
import Detail from "@/api/detail.huagui.shouxian";
......@@ -586,7 +586,7 @@ export default {
goodBuyModalInfo: [],
mongoToken: localStorage.get("mongoToken"),
policyFormData: JSON.parse(sessionStorage.getItem("policyFormData") || "{}"),
pact: true,
pact: false,
formData: {
insuredUserInfo: {
relation: "",
......@@ -706,7 +706,7 @@ export default {
age() {
const currentIdNo = this.getRealIdNo();
if (!currentIdNo) return;
const birthday = this.getBirthDate(currentIdNo);
const birthday = getBirthDate(currentIdNo);
const userAge = birthday ? getRealAge(birthday) : "";
return isNaN(userAge) ? 18 : userAge;
},
......@@ -794,13 +794,20 @@ export default {
this.onRelationCancel();
},
onFormSubmit() {
this.goInsureState = true;
this.getIsRead();
},
onFormFailed(errorInfo) {
console.log(errorInfo);
const { errors } = errorInfo;
this.$notify({ type: "warning", message: errors[0].message });
},
getIsRead() {
if (this.pact) {
this.nextStep();
} else {
this.goInsureState = true;
}
},
nextStep() {
this.subFormData = JSON.parse(JSON.stringify(this.formData));
const { socialSecurity, longTerm, relation } = this.subFormData.insuredUserInfo;
......@@ -906,19 +913,6 @@ export default {
}
this.$forceUpdate();
},
getBirthDate(idCard) {
let birthday = "";
if (idCard) {
if (idCard.length == 15) {
birthday = "19" + idCard.substr(6, 6);
} else if (idCard.length == 18) {
birthday = idCard.substr(6, 8);
}
birthday = birthday.replace(/(.{4})(.{2})/, "$1-$2-");
}
return birthday;
},
getRealIdNo() {
const { relation, userInfoSecId: userId, idNo: idNoMask } = this.formData.insuredUserInfo;
const { userInfoSecId: holderUserId, idNo: holderIdNoMask } = this.formData.holderUserInfo;
......@@ -934,7 +928,7 @@ export default {
setEffectiveDate: debounce(function() {
const currentIdNo = this.getRealIdNo();
if (!currentIdNo) return;
const birthday = this.getBirthDate(currentIdNo);
const birthday = getBirthDate(currentIdNo);
const birthdayArr = birthday.split("-");
const currentdayArr = dateFormat(new Date(), "yyyy-MM-dd").split("-");
const nextDate =
......@@ -945,7 +939,7 @@ export default {
}),
resetFormItemVal(key, val) {
const currentIdNo = this.getRealIdNo();
const birthday = this.getBirthDate(currentIdNo);
const birthday = getBirthDate(currentIdNo);
if (birthday && this.formData.productItem[key] === val && val) {
switch (key) {
case "amountInsured":
......
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