Commit 8ac62bba authored by 郭志伟's avatar 郭志伟

feat: 功能补全

parent f27b15a5
......@@ -83,7 +83,7 @@ export default [
itype: "cii",
scope: [1, 3],
img: good02,
url: "http://www.baidu.com",
url: "",
title: "百年康惠保(2.0)重大疾病险",
sub: "终身保障155种重疾,最多赔付6次",
glory: "",
......
......@@ -5,6 +5,15 @@ export const list = param => {
return req.get("product/list", param);
};
// 获取产品H5链接
export const getLink = () => {
return req.get("third/bainian/insurance_url", {
params: {
goBackUrl: `${window.location.origin}/policy/detail/`
}
});
};
// 产品详情
// export const detail = param => {
// return req.get("product/detail", param);
......
export default {
basicHost: "http://yapi.quantgroups.com/mock/329/",
// basicHost: "http://192.168.29.100:8964/",
// basicHost: "http://192.168.29.211:8964/",
wxAppId: "wx514de17b23d53a20"
};
export default {
basicHost: "http://192.168.29.100:8964/",
basicHost: "http://192.168.29.211:8964/",
// basicHost: "http://127.0.0.1:8964/",
// basicHost: "https://hathaway-mg.liangkebang.net/",
wxAppId: "wx514de17b23d53a20"
......
/*
* @Description: autoSaveForm mixins
* @LastEditors: gzw
* @Date: 2019-08-14 15:53:37
* @LastEditTime: 2020-08-14 16:16:58
*/
import localStorage from "@/service/localStorage";
export default {
data() {
return {
autoSaveTimer: null
};
},
methods: {
autoSaveHandler(key, saveKey, interval = 1000) {
if (this.autoSaveTimer) {
clearTimeout(this.autoSaveTimer);
}
const val = this[key];
this.autoSaveTimer = setTimeout(() => {
localStorage.set(saveKey, val);
}, interval);
},
clearSaveHandler(key) {
localStorage.remove(key);
},
hasAutoSaveData(key) {
return !!localStorage.get(key);
},
getSaveInfoHandler(key, target) {
this[target] = localStorage.get(key);
this.$forceUpdate();
}
}
};
......@@ -88,6 +88,7 @@ import { create, goPay } from "@/api/consultant";
import Card from "@/components/Card";
import Collapse from "@/components/Collapse";
import CpsQa from "../../Goods/Detail/modules/CpsQA";
export default {
name: "ConsultantBuy",
components: {
......@@ -105,7 +106,7 @@ export default {
data() {
return {
isLogin: localStorage.get("mongoToken"),
remain: 126,
remain: 0,
price: [0.99, 199],
consultantOrderNo: "",
tradeType: isXyqb ? "MWEB" : "JSAPI",
......@@ -211,7 +212,9 @@ export default {
}
}
},
mounted() {},
mounted() {
this.updateRemain();
},
methods: {
...mapActions(["setIsShowLogin"]),
checkLogin() {
......@@ -225,10 +228,21 @@ export default {
this.generateOrder();
}
},
updateRemain(isBuy = false) {
let historyRemain = sessionStorage.getItem("historyRemain");
if (historyRemain && +historyRemain > 100) {
isBuy && historyRemain--;
} else {
historyRemain = Math.floor(Math.random() * (200 - 100) + 100);
}
this.remain = historyRemain;
sessionStorage.setItem("historyRemain", historyRemain);
},
async generateOrder() {
const res = await create();
if (res) {
this.consultantOrderNo = res.consultantOrderNo;
this.updateRemain(true);
this.goPay();
}
},
......
......@@ -43,7 +43,7 @@ export default {
},
computed: {
orderState() {
return this.orderInfo[0].state;
return this.orderInfo[0] ? this.orderInfo[0].state : 0;
},
...mapState(["isShowLogin"])
},
......@@ -51,6 +51,7 @@ export default {
isShowLogin(val) {
if (!val) {
this.isLogin = localStorage.get("mongoToken");
this.getOrderInfo();
}
}
},
......
<template>
<cr-form scroll-to-error @submit="onSubmit" @failed="onFailed" class="container">
<nav-tab :nav-list="navBarOptions" @show="e => (goodActionShow = e)" />
<nav-tab :nav-list="navBarOptions" ref="navTab" @show="e => (goodActionShow = e)" />
<detail-header :det="headerInfo" />
<div class="det-body">
<card title="保险计划" :option="['查看详情']" @option-click="openIframePupop(4)">
......@@ -228,6 +228,9 @@ export default {
},
onFailed(errorInfo) {
const { errors } = errorInfo;
setTimeout(() => {
this.$refs.navTab.showNavBar = false;
}, 0);
this.$notify({ type: "warning", message: errors[0].message });
},
nextStep() {
......
<template>
<cr-form scroll-to-error @submit="onSubmit" @failed="onFailed" class="container">
<nav-tab :nav-list="navBarOptions" @show="e => (goodActionShow = e)" />
<nav-tab :nav-list="navBarOptions" ref="navTab" @show="e => (goodActionShow = e)" />
<detail-header :det="headerInfo" />
<div class="det-body">
<card title="保险计划" :option="['查看详情']" @option-click="openIframePupop(4)">
......@@ -233,6 +233,9 @@ export default {
},
onFailed(errorInfo) {
const { errors } = errorInfo;
setTimeout(() => {
this.$refs.navTab.showNavBar = false;
}, 0);
this.$notify({ type: "warning", message: errors[0].message });
},
nextStep() {
......
<template>
<cr-form scroll-to-error @submit="onSubmit" @failed="onFailed" class="container">
<nav-tab :nav-list="navBarOptions" @show="e => (goodActionShow = e)" />
<nav-tab :nav-list="navBarOptions" ref="navTab" @show="e => (goodActionShow = e)" />
<detail-header :det="headerInfo">
<div class="li-header">
<plan-tip :tip-list="planTipOptions" />
......@@ -204,6 +204,9 @@ export default {
},
onFailed(errorInfo) {
const { errors } = errorInfo;
setTimeout(() => {
this.$refs.navTab.showNavBar = false;
}, 0);
this.$notify({ type: "warning", message: errors[0].message });
},
nextStep() {
......
<template>
<cr-form scroll-to-error @submit="onSubmit" @failed="onFailed" class="container">
<nav-tab :nav-list="navBarOptions" @show="e => (goodActionShow = e)" />
<nav-tab :nav-list="navBarOptions" ref="navTab" @show="e => (goodActionShow = e)" />
<detail-header :det="headerInfo" />
<div class="det-body">
<card title="保险计划" :option="['查看详情']" @option-click="openIframePupop(4)">
......@@ -222,6 +222,9 @@ export default {
},
onFailed(errorInfo) {
const { errors } = errorInfo;
setTimeout(() => {
this.$refs.navTab.showNavBar = false;
}, 0);
this.$notify({ type: "warning", message: errors[0].message });
},
nextStep() {
......@@ -247,7 +250,7 @@ export default {
productNo: this.goodId,
holderUserInfo: {
phoneNo: selfPhone,
userInfoSecId: selfSecId ?? null,
userInfoSecId: selfSecId ? selfSecId : null,
name: selfName,
idNo: selfIdNo
},
......@@ -257,17 +260,17 @@ export default {
autoRenewPolicy: autoRenewPolicy
};
if (relation === "1") {
this.subFromData.holderUserInfo.socialSecurity = !!Number(
selfSocialSecurity || socialSecurity
);
this.subFromData.holderUserInfo.socialSecurity = !!Number(selfSocialSecurity);
this.subFromData.productItem.socialSecurity = !!Number(selfSocialSecurity);
} else {
this.subFromData.insuredUserInfo = {
userInfoSecId: userInfoSecId ?? null,
userInfoSecId: userInfoSecId ? userInfoSecId : undefined,
name,
idNo,
relation,
socialSecurity: !!Number(socialSecurity)
};
this.subFromData.productItem.socialSecurity = !!Number(socialSecurity);
}
},
async getDetail() {
......
......@@ -4,7 +4,7 @@
<mi-detail v-if="detailType === 'mi'" />
<ai-detail v-if="detailType === 'ai'" />
<li-detail v-if="detailType === 'li'" />
<advisor-rec-dialog v-model="showRec" @close="pageBack" />
<advisor-rec-dialog :value="showRec" @close="pageBack" />
</div>
</template>
......@@ -14,8 +14,8 @@ import miDetail from "./MIDetail";
import liDetail from "./LIDetail";
import aiDetail from "./AIDetail";
import AdvisorRecDialog from "./modules/AdvisorRecDialog";
import localStorage from "@/service/localStorage";
import { getCulOrder } from "@/api/consultant";
import localStorage from "@/service/localStorage";
export default {
name: "GoodsDetail",
......@@ -29,42 +29,39 @@ export default {
data() {
return {
detailType: "",
showRecFlag: "",
showRec: false,
noOrder: false,
isLogin: ""
noOrder: true,
userClickState: false,
userBackState: false
};
},
beforeRouteLeave(to, from, next) {
const { showRecFlag, noOrder, isLogin } = this;
if (showRecFlag && !noOrder && isLogin) {
next();
} else {
next(false);
if (this.noOrder && !this.userClickState && to.name === "Goods") {
this.showRec = true;
next(false);
} else {
next();
}
},
mounted() {
this.getOrderInfo();
this.showRecFlag = localStorage.get("recFlag");
this.detailType = this.$route.query.type;
},
methods: {
async getOrderInfo() {
this.isLogin = localStorage.get("mongoToken");
if (!this.isLogin) {
const isLogin = localStorage.get("mongoToken");
if (!isLogin) {
this.noOrder = true;
return;
}
const res = await getCulOrder();
this.noOrder = res[0].state && res[0].state <= 2;
},
pageBack(e) {
this.showRecFlag = e;
localStorage.set("recFlag", e);
if (e === 1) {
this.$router.back();
} else {
this.$router.push({ path: "/consultant" });
this.showRec = false;
this.userClickState = true;
if (e === 2) {
this.$router.replace({ path: "/consultant" });
}
}
}
......
<template>
<modal
v-model="show"
:value="show"
:closeable="true"
cancel-btn=""
confirm-btn="0.99元聘请"
......@@ -32,7 +32,6 @@
<script>
import Modal from "@/components/Modal";
const DIALOG_CHANGE_EVENT = "input";
const DIALOG_CLOSE_EVENT = "close";
export default {
......@@ -54,9 +53,6 @@ export default {
handler(val) {
this.show = val;
}
},
show(val) {
this.$emit(DIALOG_CHANGE_EVENT, val);
}
},
methods: {
......
......@@ -115,6 +115,10 @@ import { getFamilyList, getCaptchaSms } from "@/api/user";
import { isPhone } from "@/service/validation";
import localStorage from "@/service/localStorage";
import CrRadioBtn from "@/components/CrRadioBtn";
import autoSaveForm from "@/mixins/autoSaveForm.mixin";
const AUTO_SAVE_KEY = "DetailFormData";
const AUTO_SAVE_TARGET = "formData";
const DATA_CHANGE_EVENT = "input";
export default {
name: "InsurePersonForm",
......@@ -123,6 +127,7 @@ export default {
Card,
Modal
},
mixins: [autoSaveForm],
props: {
value: {
type: Object,
......@@ -171,6 +176,7 @@ export default {
immediate: true,
deep: true,
handler(val) {
this.autoSaveHandler(AUTO_SAVE_TARGET, AUTO_SAVE_KEY);
this.$emit(DATA_CHANGE_EVENT, val);
this.$forceUpdate();
}
......@@ -256,8 +262,12 @@ 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 {
(this.showAuthXyqb || this.mongoToken) && this.relationChange();
}
}
},
// TODO 倒计时未回显
async getCode() {
......
......@@ -17,7 +17,7 @@
<script>
import goodsList from "@/api/goodsList.mock";
import { list } from "@/api/product";
import { list, getLink } from "@/api/product";
import AiTestTip from "./modules/AiTestTip";
import GoodList from "@/components/GoodList/index";
......@@ -59,12 +59,13 @@ export default {
return {
active: 0,
showLayer: false,
goodsList: []
goodsList: [],
goodsLink: ""
};
},
computed: {
list() {
const { active } = this;
const { active, goodsLink } = this;
const _catList = JSON.parse(JSON.stringify(categoryList));
this.goodsList.forEach(item => {
switch (item.itype) {
......@@ -72,6 +73,9 @@ export default {
_catList[0].children.push(item);
break;
case "cii":
if (item.id === "BNZJX001") {
item.url = goodsLink;
}
(item.scope.includes(active) || active === 0) && _catList[1].children.push(item);
break;
case "ai":
......@@ -89,6 +93,7 @@ export default {
},
mounted() {
this.getList();
this.getGoodsLink();
},
methods: {
async getList() {
......@@ -106,6 +111,12 @@ export default {
});
this.goodsList = goodsList;
}
},
async getGoodsLink() {
const res = await getLink();
if (res) {
this.goodsLink = res.url;
}
}
}
};
......
......@@ -100,7 +100,7 @@
import GoodList from "@/components/GoodList/index";
import Tabbar from "@/components/Tabbar";
import Copyright from "@/components/Copyright";
import { list } from "@/api/product";
import { list, getLink } from "@/api/product";
import goodsList from "@/api/goodsList.mock";
import settings from "@/api/settings";
......@@ -153,6 +153,13 @@ export default {
});
});
this.goodsList = goodsList;
this.getGoodsLink();
}
},
async getGoodsLink() {
const res = await getLink();
if (res) {
this.goodsList[3].url = res.url;
}
}
}
......
......@@ -351,6 +351,7 @@ import PopupWithIframe from "@/components/PopupWithIframe";
import Stepper from "@/components/Stepper";
import GoInsureDialog from "@/views/Goods/Detail/modules/GoInsureDialog";
import detailPayMixin from "@/views/Goods/Detail/modules/detailPay.mixin";
import autoSaveForm from "@/mixins/autoSaveForm.mixin";
import localStorage from "@/service/localStorage";
import { mapState, mapActions } from "vuex";
......@@ -358,6 +359,9 @@ import Detail from "@/api/detail.huagui.shouxian";
import { list, trail } from "@/api/product";
import { getFamilyList } from "@/api/user";
import { parseTime } from "@/service/utils";
const AUTO_SAVE_KEY = "PolicyFormData";
const AUTO_SAVE_TARGET = "formData";
const {
headerInfo,
popupArray,
......@@ -371,7 +375,7 @@ const {
} = Detail;
export default {
name: "AddPolicy",
mixins: [detailPayMixin],
mixins: [detailPayMixin, autoSaveForm],
components: {
GoodAction,
CrRadioBtn,
......@@ -442,6 +446,7 @@ export default {
formDataCpu: {
deep: true,
handler() {
this.autoSaveHandler(AUTO_SAVE_TARGET, AUTO_SAVE_KEY);
if (this.calTimer) {
clearTimeout(this.calTimer);
}
......@@ -571,7 +576,11 @@ export default {
const res = await getFamilyList();
if (res) {
this.familyList = res;
this.showAuthXyqb === -1 && this.relationChange();
if (this.hasAutoSaveData(AUTO_SAVE_KEY)) {
this.getSaveInfoHandler(AUTO_SAVE_KEY, AUTO_SAVE_TARGET);
} else {
(this.showAuthXyqb || this.mongoToken) && this.relationChange();
}
}
},
async calFee() {
......
......@@ -887,9 +887,9 @@
integrity sha512-shAmDyaQC4H92APFoIaVDHCx5bStIocgvbwQyxPRrbUY20V1EYTbSDchWbuwlMG3V17cprZhA6+78JfB+3DTPw==
"@qg/cherry-ui@^1.1.2":
version "1.1.2"
resolved "http://npmprivate.quantgroups.com/@qg%2fcherry-ui/-/cherry-ui-1.1.2.tgz#9019e409b3cf66ebf634b1090c5a8321cb78a05d"
integrity sha512-P2bFNNcoFNF1xgBO5p0XSejulyriIAtsYCK0KICUXq5nRhP+zCOCPZPVghbVtZvmEDCFibNgGZFzqFn0rkjEfg==
version "1.2.1"
resolved "http://npmprivate.quantgroups.com/@qg%2fcherry-ui/-/cherry-ui-1.2.1.tgz#5f59ebf0ed677c6d3f41dd04e3b9f6a43811936b"
integrity sha512-icj5WLUCJswPLF02YtCdppdfSDwQQrFoLxhRFCie2SFffIKVZSMEtSVVuEh2nZv2khPd/cvEISGpmzwDcBS7tw==
"@qg/qg-scroll@^1.4.2":
version "1.4.2"
......
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