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

feat: 详情联调

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