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

feat: 详情联调

parent e9d11fea
......@@ -69,10 +69,10 @@ export default {
{ label: "无社保", value: "0" }
],
insuredOptions: [
{ label: "本人", value: "0" },
{ label: "配偶", value: "1" },
{ label: "父母", value: "2" },
{ label: "子女", value: "3" }
{ label: "本人", value: "1" },
{ label: "配偶", value: "2" },
{ label: "父母", value: "3" },
{ label: "子女", value: "4" }
],
medicalOptions: [
{ label: "有<small style='color: #999;font-size: 11px'>(含新农合)</small>", value: "1" },
......
......@@ -82,10 +82,10 @@ export default {
{ label: "10万", value: "100000" }
],
insuredOptions: [
{ label: "本人", value: "0" },
{ label: "配偶", value: "1" },
{ label: "父母", value: "2" },
{ label: "子女", value: "3" }
{ label: "本人", value: "1" },
{ label: "配偶", value: "2" },
{ label: "父母", value: "3" },
{ label: "子女", value: "4" }
],
paywayOptions: [
{ label: "月缴<small style='color: #999;font-size: 11px'>(12期)</small>", value: "1" },
......
......@@ -71,10 +71,10 @@ export default {
],
planTipOptions: ["不限社保", "报销自费药", "额外400万特定赔付"],
insuredOptions: [
{ label: "本人", value: "0" },
{ label: "配偶", value: "1" },
{ label: "父母", value: "2" },
{ label: "子女", value: "3" }
{ label: "本人", value: "1" },
{ label: "配偶", value: "2" },
{ label: "父母", value: "3" },
{ label: "子女", value: "4" }
],
medicalOptions: [
{ label: "有<small style='color: #999;font-size: 11px'>(含新农合)</small>", value: "1" },
......
......@@ -4,7 +4,7 @@
* @Description:众安50万意外险
* @Date: 2020-07-27 15:46:37
* @LastEditors: gzw
* @LastEditTime: 2020-08-12 14:13:20
* @LastEditTime: 2020-08-13 10:37:30
*/
import goodsBg from "@/assets/images/goods/detail/yiwaixian/bg.png";
......@@ -100,10 +100,10 @@ export default {
{ label: "10万", value: "100000" }
],
insuredOptions: [
{ label: "本人", value: "0" },
{ label: "配偶", value: "1" },
{ label: "父母", value: "2" },
{ label: "子女", value: "3" }
{ label: "本人", value: "1" },
{ label: "配偶", value: "2" },
{ label: "父母", value: "3" },
{ label: "子女", value: "4" }
],
noticeCellInfo: {
"1000000": [
......
<template>
<cr-radio-group v-model="radioVal" class="radio-btn">
<cr-radio-group v-model="radioVal" class="radio-btn" :class="{ readonly }">
<cr-radio
:name="item.value"
:class="{ checked: value === item.value }"
......@@ -26,6 +26,10 @@ export default {
return [];
}
},
readonly: {
type: Boolean,
default: false
},
value: null
},
watch: {
......@@ -51,6 +55,21 @@ export default {
justify-content: space-around;
align-items: center;
margin-bottom: 12px;
&.readonly {
position: relative;
z-index: 1;
&::after {
display: block;
content: " ";
position: absolute;
z-index: 2;
background-color: rgba(0, 0, 0, 0);
top: 0;
left: 0;
width: 100%;
height: 100%;
}
}
@{deep} .cr-radio {
margin-right: 10px;
flex: 1;
......
......@@ -92,9 +92,9 @@ export default {
if (res) {
this.$notify({ type: "success", message: "登录成功" });
this.setIsShowLogin(false);
// localStorage.setItem("mongoToken", res.token);
localStorage.setItem("mongoToken", res.token);
// TODO 开发目前使用这个token
localStorage.setItem("mongoToken", "6ae7da7dd4c543f1a36c702c6f419f12");
// localStorage.setItem("mongoToken", "6ae7da7dd4c543f1a36c702c6f419f12");
}
},
async getCode() {
......
export default {
basicHost: "http://192.168.29.211:80/",
basicHost: "http://192.168.29.100:8964/",
// basicHost: "http://127.0.0.1:8964/",
// basicHost: "https://hathaway-mg.liangkebang.net/",
wxAppId: "wx514de17b23d53a20"
......
......@@ -5,7 +5,7 @@ import router from "./router";
import store from "./store";
import "./style/index.less";
import "amfe-flexible";
// import vConsole from "vconsole";
import vConsole from "vconsole";
import "@/assets/icons/index";
import "@/service/cherry-ui";
......@@ -18,5 +18,5 @@ new Vue({
// if (process.env.NODE_ENV !== "development") {
// ! 上线后务必取掉
// new vConsole();
new vConsole();
// }
......@@ -42,7 +42,6 @@ async function getAuthInfo(xyqbToken) {
async function getWxOpenId(code) {
if (localStorage.get("openId")) return;
const res = await getwxOpenId({ code, appId: cfg.wxAppId });
this.openId = res.openId;
localStorage.set("openId", res.openId);
}
// router.afterEach(() => {});
......
......@@ -2,12 +2,12 @@
* @Description: 支付微信h5, jsapi, 第三方收银台,跳转)
* @Date: 2020-07-28 15:03:52
* @LastEditors: gzw
* @LastEditTime: 2020-08-12 17:59:02
* @LastEditTime: 2020-08-13 14:14:32
*/
import cherry from "@qg/cherry-ui";
import qs from "qs";
const { Notify } = cherry;
// import cherry from "@qg/cherry-ui";
// import qs from "qs";
// const { Notify } = cherry;
/**
* payByWeixinJsapi
......@@ -22,17 +22,18 @@ function payByWeixinJsapi(info = {}, callback) {
// eslint-disable-next-line no-undef
WeixinJSBridge.invoke("getBrandWCPayRequest", info, function(res) {
console.log(res);
if (res.err_msg == "get_brand_wcpay_request:ok") {
// 使用以上方式判断前端返回,微信团队郑重提示:
//res.err_msg将在用户支付成功后返回ok,但并不保证它绝对可靠。
callback("ok");
} else if (res.err_msg == "get_brand_wcpay_request:cancel") {
// 支付取消
callback("cancel");
} else {
// 支付失败
callback("fail");
}
callback();
// if (res.err_msg == "get_brand_wcpay_request:ok") {
// // 使用以上方式判断前端返回,微信团队郑重提示:
// //res.err_msg将在用户支付成功后返回ok,但并不保证它绝对可靠。
// callback("ok");
// } else if (res.err_msg == "get_brand_wcpay_request:cancel") {
// // 支付取消
// callback("cancel");
// } else {
// // 支付失败
// callback("fail");
// }
});
}
if (typeof WeixinJSBridge == "undefined") {
......@@ -54,12 +55,12 @@ function payByWeixinJsapi(info = {}, callback) {
* @param {type}
* @return:
*/
function payByWeixinH5(info) {
if (info.url) return;
const currentPath = encodeURIComponent(
window.location.href + qs.stringify(info.params, { encode: true, addQueryPrefix: true })
);
window.location.href = `${info.url}&redirect_url=${currentPath}`;
function payByWeixinH5() {
// if (info.url) return;
// const currentPath = encodeURIComponent(
// window.location.href + qs.stringify(info.params, { encode: true, addQueryPrefix: true })
// );
// window.location.href = `${info.url}&redirect_url=${currentPath}`;
}
/**
......@@ -70,12 +71,12 @@ function payByWeixinH5(info) {
* @param {type}
* @return:
*/
function payByThirdPartyCashier(info) {
if (info.url) return;
const currentPath = encodeURIComponent(
window.location.href + qs.stringify(info.params, { encode: true, addQueryPrefix: true })
);
window.location.href = `${info.url}&redirect_uri=${currentPath}`;
function payByThirdPartyCashier() {
// if (info.url) return;
// const currentPath = encodeURIComponent(
// window.location.href + qs.stringify(info.params, { encode: true, addQueryPrefix: true })
// );
// window.location.href = `${info.url}&redirect_uri=${currentPath}`;
}
/**
......@@ -88,13 +89,13 @@ function payByThirdPartyCashier(info) {
export function payByWay(type = "THIRD", payInfo) {
return new Promise(resolve => {
if (type === "JSAPI") {
payByWeixinJsapi(payInfo, function(e) {
if (e === "ok") {
Notify({ type: "success", message: "支付成功" });
} else {
Notify({ type: "warning", message: "支付失败" });
}
resolve(e);
payByWeixinJsapi(payInfo, function() {
// if (e === "ok") {
// Notify({ type: "success", message: "支付成功" });
// } else {
// Notify({ type: "warning", message: "支付失败" });
// }
resolve();
});
} else if (type === "MWEB") {
payByWeixinH5(payInfo);
......
......@@ -9,7 +9,11 @@
<plan-tip :tip-list="planTipOptions" />
</card>
<div id="det_insure">
<insure-person-form v-model="formData" :radio-options="personFormOptions" />
<insure-person-form
v-model="formData"
:radio-options="personFormOptions"
ref="insureForm"
/>
<auto-deduct
v-model="formData.autoRenewPolicy"
:cell-data="autoCellInfo"
......@@ -129,8 +133,7 @@ export default {
formData: {
name: "",
idNo: "",
socialSecurity: "1",
relation: "0",
relation: "1",
payType: "1",
amountInsured: "1000000",
autoRenewPolicy: false,
......@@ -204,8 +207,10 @@ export default {
},
onSubmit() {
const { selfPhone, selfCode } = this.formData;
if (localStorage.get("mongoToken")) return;
this.login(selfPhone, selfCode).then(() => {
this.goInsureState = true;
this.$refs.insureForm.getFamilyList();
});
// sessionStorage.setItem(
// "policyFormData",
......@@ -221,7 +226,37 @@ export default {
this.generateOrder();
},
generateFormData() {
this.subFromData = {};
const {
userInfoSecId,
name,
idNo,
relation,
selfName,
selfIdNo,
selfPhone,
selfSecId,
payType,
autoRenewPolicy
} = this.formData;
this.subFromData = {
insuredUserInfo: {
userInfoSecId: userInfoSecId ?? null,
name,
idNo,
relation
},
productNo: this.goodId,
holderUserInfo: {
phoneNo: selfPhone,
userInfoSecId: selfSecId ?? null,
name: selfName,
idNo: selfIdNo
},
productItem: {
payType
},
autoRenewPolicy: autoRenewPolicy
};
},
async getDetail() {
this.goodId = this.$route.query.id;
......
......@@ -9,7 +9,11 @@
<plan-tip :tip-list="planTipOptions" />
</card>
<div id="det_insure">
<insure-person-form v-model="formData" :radio-options="personFormOptions" />
<insure-person-form
v-model="formData"
:radio-options="personFormOptions"
ref="insureForm"
/>
<auto-deduct
v-model="formData.autoRenewPolicy"
:cell-data="autoCellInfo"
......@@ -126,8 +130,7 @@ export default {
formData: {
name: "",
idNo: "",
socialSecurity: "1",
relation: "0",
relation: "1",
payType: "1",
amountInsured: "300000",
autoRenewPolicy: false,
......@@ -160,6 +163,12 @@ export default {
}
const { idNo, payType } = val;
const { idNo: oldNo, payType: oldType } = oldVal;
if (this.goInsureState) {
sessionStorage.setItem(
"policyFormData",
JSON.stringify(Object.assign(this.formData, { productNo: this.goodId }))
);
}
if (idNo === oldNo && payType === oldType) return;
this.calTimer = setTimeout(() => {
this.calFee();
......@@ -207,12 +216,10 @@ export default {
},
onSubmit() {
const { selfPhone, selfCode } = this.formData;
if (localStorage.get("mongoToken")) return;
this.login(selfPhone, selfCode).then(() => {
this.goInsureState = true;
sessionStorage.setItem(
"policyFormData",
JSON.stringify(Object.assign(this.formData, { productNo: this.goodId }))
);
this.$refs.insureForm.getFamilyList();
});
},
onFailed(errorInfo) {
......
......@@ -8,7 +8,11 @@
<plan-tip :tip-list="planTipOptions" />
</card>
<div id="det_insure">
<insure-person-form v-model="formData" :radio-options="personFormOptions" />
<insure-person-form
v-model="formData"
:radio-options="personFormOptions"
ref="insureForm"
/>
<auto-deduct
v-model="formData.autoRenewPolicy"
:cell-data="autoCellInfo"
......@@ -86,6 +90,7 @@ import detailPayMixin from "./modules/detailPay.mixin";
import detailLoginMixin from "./modules/detailLogin.mixin";
import { trail, list } from "@/api/product";
import localStorage from "@/service/localStorage";
import Detail from "@/api/detail.taikang.yiliaobaozhang";
export default {
......@@ -128,7 +133,7 @@ export default {
name: "",
idNo: "",
socialSecurity: "1",
relation: "0",
relation: "1",
payType: "1",
planValue: "3",
autoRenewPolicy: false,
......@@ -199,8 +204,10 @@ export default {
},
onSubmit() {
const { selfPhone, selfCode } = this.formData;
if (localStorage.get("mongoToken")) return;
this.login(selfPhone, selfCode).then(() => {
this.goInsureState = true;
this.$refs.insureForm.getFamilyList();
});
// sessionStorage.setItem("policyFormData", JSON.stringify(this.formData));
},
......@@ -219,7 +226,7 @@ export default {
idNo,
relation,
socialSecurity,
// selfSocialSecurity,
selfSocialSecurity,
selfName,
selfIdNo,
selfPhone,
......@@ -228,26 +235,31 @@ export default {
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
};
if (relation === "1") {
this.subFromData.holderUserInfo.socialSecurity = !!Number(
selfSocialSecurity || socialSecurity
);
} else {
this.subFromData.insuredUserInfo = {
userInfoSecId: userInfoSecId ?? null,
name,
idNo,
relation,
socialSecurity: !!Number(socialSecurity)
};
}
},
async getDetail() {
this.goodId = this.$route.query.id;
......
......@@ -7,6 +7,7 @@
v-model="formData.selfName"
placeholder="请输入投保人姓名"
label="姓名"
:readonly="selfInfoReadonly"
:rules="[{ required: true, message: '请输入姓名' }]"
@click.native="inputClick"
/>
......@@ -15,6 +16,7 @@
v-model="formData.selfIdNo"
placeholder="信息保密,仅用于投保"
label="身份证号"
:readonly="selfInfoReadonly"
:rules="[{ required: true, message: '请输入身份证号' }]"
@click.native="inputClick"
/>
......@@ -23,13 +25,14 @@
v-model="formData.selfPhone"
placeholder="请输入您的手机号码"
label="手机号码"
:readonly="selfInfoReadonly"
:rules="[{ required: true, message: '请输入手机号码' }]"
@click.native="inputClick"
/>
<cr-field
name="selfCode"
v-model="formData.selfCode"
v-if="xyqbAuthState !== 4 || !mongoToken"
v-if="(!!xyqbAuthState && xyqbAuthState !== 4) || !mongoToken"
placeholder="请输入短信验证码"
label="验证码"
:rules="[{ required: true, message: '请输入验证码' }]"
......@@ -50,17 +53,19 @@
<cr-cell-group class="insure-form">
<cr-field
name="relativeName"
v-if="formData.relation !== '0'"
v-if="formData.relation !== '1'"
v-model="formData.name"
placeholder="请输入被保人姓名"
:readonly="infoReadonly"
label="姓名"
:rules="[{ required: true, message: '请输入姓名' }]"
/>
<cr-field
name="relativeIdNo"
v-if="formData.relation !== '0'"
v-if="formData.relation !== '1'"
v-model="formData.idNo"
placeholder="信息保密,仅用于投保"
:readonly="infoReadonly"
label="身份证号"
:rules="[{ required: true, message: '请输入身份证号' }]"
/>
......@@ -73,6 +78,7 @@
name="socialSecurity"
v-model="formData.socialSecurity"
:radio-data="radioOptions.medicalOptions"
:readonly="socialSecurityReadonly"
/>
</cr-cell>
<cr-cell title="缴费方式" class="insure-form-item_nobg" v-if="radioOptions.paywayOptions">
......@@ -122,7 +128,9 @@ export default {
count: "",
timer: null,
mongoToken: localStorage.get("mongoToken"),
xyqbAuthState: localStorage.get("xyqbAuthState")
xyqbAuthState: localStorage.get("xyqbAuthState"),
selfInfoReadonly: false,
infoReadonly: false
};
},
watch: {
......@@ -133,6 +141,14 @@ export default {
this.formData = val;
}
},
userInfo: {
immediate: true,
deep: true,
handler(val) {
this.formData.selfPhone =
val.phoneNoMask && val.phoneNoMask !== "点击登录" ? val.phoneNoMask : "";
}
},
formData: {
immediate: true,
deep: true,
......@@ -144,12 +160,13 @@ export default {
showAuthXyqb: {
immediate: true,
handler(val) {
if (val === 4) {
if (val === 4 && this.userInfo.phoneNoMask === "点击登录") {
const xyqbUserInfo = localStorage.get("xyqbUserInfo");
this.formData.selfName = xyqbUserInfo.nameMask;
this.formData.selfIdNo = xyqbUserInfo.idNoMask;
this.formData.selfPhone = xyqbUserInfo.phoneNoMask;
this.xyqbAuthState = localStorage.get("xyqbAuthState");
this.selfInfoReadonly = true;
this.$forceUpdate();
}
}
......@@ -160,13 +177,19 @@ export default {
},
computed: {
...mapState(["showAuthXyqb"]),
...mapState("user", ["userInfo"])
...mapState("user", ["userInfo"]),
socialSecurityReadonly() {
const { relation } = this.formData;
const { selfInfoReadonly, infoReadonly } = this;
return (relation === "1" && selfInfoReadonly) || (relation !== "1" && infoReadonly);
}
},
mounted() {
this.getFamilyList();
},
methods: {
...mapActions(["setAuthXyqb"]),
...mapActions("user", ["setUserInfo"]),
inputClick() {
if (this.showAuthXyqb === 1) {
this.setAuthXyqb(2);
......@@ -181,18 +204,17 @@ export default {
userInfoSecId: selfSecId,
socialSecurity
} = item;
if (relation === 0) {
const { phoneNoMask: selfPhone } = this.userInfo;
if (relation === 1) {
this.formData = {
...this.formData,
...{
selfName,
selfIdNo,
selfSecId,
selfPhone: selfPhone !== "phoneNoMask" ? selfPhone : "",
selfSocialSecurity: socialSecurity ? "1" : "0"
}
};
this.selfInfoReadonly = true;
}
});
const userArray = this.familyList.filter(item => item.relation === +relation);
......@@ -200,6 +222,9 @@ export default {
if (userArray.length) {
let { nameMask, idNoMask, userInfoSecId: id, socialSecurity: ss } = userArray[0];
[name, idNo, userInfoSecId, socialSecurity] = [nameMask, idNoMask, id, ss];
this.infoReadonly = true;
} else {
this.infoReadonly = false;
}
this.formData = {
...this.formData,
......@@ -207,12 +232,16 @@ export default {
};
},
async getFamilyList() {
this.mongoToken = localStorage.get("mongoToken");
if (!this.mongoToken) return;
this.setUserInfo();
const res = await getFamilyList();
if (res) {
this.familyList = res;
(this.showAuthXyqb || this.mongoToken) && this.relationChange();
}
},
// TODO 倒计时未回显
async getCode() {
const TIME_COUNT = 60;
const { selfPhone } = this.formData;
......@@ -234,6 +263,8 @@ export default {
this.timer = null;
}
}, 1000);
} else {
this.$notify({ type: "warning", message: "获取短信验证码失败,请稍后重试" });
}
}
}
......
......@@ -16,8 +16,10 @@ export default {
},
methods: {
...mapActions(["setIsShowLogin"]),
...mapActions("user", ["setUserInfo"]),
showLoginPopup() {
if (localStorage.get("mongoToken")) {
this.setUserInfo();
this.nextStep();
} else {
this.setIsShowLogin(true);
......@@ -37,10 +39,11 @@ export default {
};
const res = await loginByPhone(formData);
if (res) {
this.$notify("登录成功");
// localStorage.setItem("mongoToken", res.token);
this.setUserInfo();
this.$notify({ type: "success", message: "登录成功" });
localStorage.set("mongoToken", res.token);
// TODO 开发目前使用这个token
localStorage.set("mongoToken", "6ae7da7dd4c543f1a36c702c6f419f12");
// localStorage.set("mongoToken", "6ae7da7dd4c543f1a36c702c6f419f12");
}
return new Promise(resolve => {
resolve();
......
import { payByWay } from "@/service/pay";
import { isXyqb, isWeixinBrower } from "@/service/validation";
import { placeOrder } from "@/api/product";
import localStorage from "@/service/localStorage";
import { mapActions } from "vuex";
export default {
data() {
return {
subFromData: {}, // 组装好的数据
orderInfo: {},
tradeType: ""
openId: localStorage.get("openId"),
tradeType: "",
payTimer: null
// customTradeType: ""
};
},
......@@ -15,6 +19,7 @@ export default {
this.tradeType = this.customTradeType ?? (isXyqb ? "MWEB" : isWeixinBrower ? "JSAPI" : "MWEB");
},
methods: {
...mapActions(["setIsLoading"]),
async generateOrder() {
const res = await placeOrder.create({
...this.subFromData
......@@ -25,13 +30,21 @@ export default {
}
},
async goPay() {
const { tradeType, orderInfo } = this;
const { payOrderNo, payType, orderNo } = orderInfo;
const { tradeType, orderInfo, openId } = this;
const { payOrderNo, payType } = orderInfo;
if (!payOrderNo) {
this.$toast("请先生成订单");
return;
}
const res = await placeOrder.pay({ payOrderNo, payType, tradeType });
const params = {
payOrderNo,
payOrderType: payType,
tradeType
};
if (openId && tradeType === "JSAPI") {
params.openId = openId;
}
const res = await placeOrder.pay(params);
if (res) {
let payInfo = {
mock: true,
......@@ -46,9 +59,23 @@ export default {
payInfo = res.payInfo;
}
payByWay(tradeType, payInfo).then(() => {
this.$router.push({ path: "/policy/detail/" + orderNo });
this.getPayResult();
});
}
},
getPayResult() {
const { payOrderNo, orderNo } = this.orderInfo;
this.setIsLoading(true);
placeOrder.polling({ payOrderNo, payOrderType: 1 }).then(payRes => {
if (!payRes.result && (payRes.payState === 1 || payRes.payState === 2)) {
this.payTimer = setTimeout(() => {
this.getPayResult();
}, 3000);
} else {
this.setIsLoading(false);
this.$router.push({ path: "/policy/detail/" + orderNo });
}
});
}
}
};
......@@ -121,11 +121,10 @@ export default {
if (!this.isLogin) {
return "去投票";
}
return "";
}
},
created() {
},
created() {},
methods: {
gameStart() {
this.$nextTick(() => {
......
......@@ -16,6 +16,7 @@
name="holderUserInfo_name"
label="姓名"
placeholder="请输入投保人姓名"
:readonly="selfInfoReadonly"
:rules="[{ required: true, message: '请输入投保人姓名' }]"
@click.native="inputClick"
/>
......@@ -24,6 +25,7 @@
name="holderUserInfo_idNo"
label="身份证号"
placeholder="请填写投保人身份证号"
:readonly="selfInfoReadonly"
:rules="[{ required: true, message: '请填写投保人身份证号' }]"
@click.native="inputClick"
/>
......@@ -33,6 +35,7 @@
type="tel"
label="手机号"
placeholder="请填写投保人手机号"
:readonly="selfInfoReadonly"
:rules="[{ required: true, message: '请填写投保人手机号' }]"
@click.native="inputClick"
/>
......@@ -137,6 +140,7 @@
<cr-radio-btn
v-model="formData.insuredUserInfo.socialSecurity"
:radio-data="socialSecOptions"
:readonly="socialSecurityReadonly"
/>
</template>
</cr-field>
......@@ -160,12 +164,13 @@
>
<div class="form-unit" slot="button">公斤</div>
</cr-field>
<template v-if="formData.insuredUserInfo.relation !== '0'">
<template v-if="formData.insuredUserInfo.relation !== '1'">
<cr-field
v-model="formData.insuredUserInfo.name"
name="insuredUserInfo_name"
label="姓名"
placeholder="请输入投保人姓名"
:readonly="infoReadonly"
:rules="[{ required: true, message: '请输入投保人姓名' }]"
/>
<cr-field
......@@ -173,6 +178,7 @@
name="insuredUserInfo_idNo"
label="身份证号"
placeholder="请填写投保人身份证号"
:readonly="infoReadonly"
:rules="[{ required: true, message: '请填写投保人身份证号' }]"
/>
<cr-field
......@@ -387,10 +393,11 @@ export default {
currentPupopIndex: null,
goodActionInfo: {},
goodBuyModalInfo: [],
mongoToken: localStorage.get("mongoToken"),
policyFormData: JSON.parse(sessionStorage.getItem("policyFormData") || "{}"),
formData: {
insuredUserInfo: {
relation: "0"
relation: "1"
},
holderUserInfo: {},
productItem: {
......@@ -406,13 +413,23 @@ export default {
termOptions,
paywayOptions,
benefitOptions,
insuredAmountOptions
insuredAmountOptions,
selfInfoReadonly: false,
infoReadonly: false
};
},
watch: {
popupShow(val) {
if (!val && this.currentPupopIndex === 6) this.currentPupopIndex = null;
},
userInfo: {
immediate: true,
deep: true,
handler(val) {
this.formData.holderUserInfo.phoneNo =
val.phoneNoMask && val.phoneNoMask !== "点击登录" ? val.phoneNoMask : "";
}
},
headerInfo: {
deep: true,
handler(val) {
......@@ -442,6 +459,7 @@ export default {
this.formData.holderUserInfo.name = xyqbUserInfo.nameMask;
this.formData.holderUserInfo.idNo = xyqbUserInfo.idNoMask;
this.formData.holderUserInfo.phoneNo = xyqbUserInfo.phoneNoMask;
this.selfInfoReadonly = true;
this.$forceUpdate();
}
}
......@@ -449,12 +467,18 @@ export default {
},
computed: {
...mapState(["showAuthXyqb"]),
...mapState("user", ["userInfo"]),
pupopData() {
const { popupArray, currentPupopIndex } = this;
return popupArray[currentPupopIndex] || {};
},
formDataCpu() {
return JSON.parse(JSON.stringify(this.formData));
},
socialSecurityReadonly() {
const { relation } = this.formData.insuredUserInfo;
const { selfInfoReadonly, infoReadonly } = this;
return (relation === "1" && selfInfoReadonly) || (relation !== "1" && infoReadonly);
}
},
mounted() {
......@@ -464,6 +488,7 @@ export default {
},
methods: {
...mapActions(["setAuthXyqb"]),
...mapActions("user", ["setUserInfo"]),
inputClick() {
if (this.showAuthXyqb === 1) {
this.setAuthXyqb(2);
......@@ -485,23 +510,30 @@ export default {
relationChange(relation = this.formData.insuredUserInfo.relation) {
this.familyList.forEach(item => {
const { relation, nameMask: name, idNoMask: idNo, userInfoSecId, socialSecurity } = item;
if (+relation === 0) {
if (+relation === 1) {
this.formData.holderUserInfo = {
...this.formData.holderUserInfo,
...{ name, idNo, userInfoSecId, socialSecurity: socialSecurity ? "1" : "0" }
};
this.selfInfoReadonly = true;
}
});
const userArray = this.familyList.filter(item => item.relation === +relation);
const userArray = this.familyList.filter(
item => item.relation === +relation && item.relation !== 1
);
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.infoReadonly = true;
} else {
this.infoReadonly = false;
}
this.formData.insuredUserInfo = {
...this.formData.insuredUserInfo,
...{ name, idNo, userInfoSecId, socialSecurity: socialSecurity ? "1" : "0" }
...{ name, idNo, userInfoSecId, socialSecurity: socialSecurity }
};
this.$forceUpdate();
},
openIframePupop(index) {
this.currentPupopIndex = index;
......@@ -535,6 +567,8 @@ export default {
}
},
async getFamilyList() {
if (!this.mongoToken) return;
this.setUserInfo();
const res = await getFamilyList();
if (res) {
this.familyList = res;
......@@ -551,7 +585,7 @@ export default {
} = this.formData.productItem;
let idNo = "";
const { socialSecurity } = this.formData.insuredUserInfo;
if (this.formData.insuredUserInfo.relation !== "0") {
if (this.formData.insuredUserInfo.relation !== "1") {
idNo = this.formData.insuredUserInfo.idNo;
} else {
idNo = this.formData.holderUserInfo.idNo;
......
......@@ -137,8 +137,8 @@ export default {
orderNo: item?.orderNo
};
this.goPay();
} else if (text === "联系客服") {
}
// eslint-disable-next-line
} else if (text === "联系客服") {}
},
goDetail(orderNo) {
const policy = this.list.find(v => v.orderNo === orderNo);
......
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