Commit 2838c5d2 authored by 郭志伟's avatar 郭志伟

fix: 顾问下单查询优化

parent 67bd3dc7
...@@ -222,7 +222,7 @@ export default { ...@@ -222,7 +222,7 @@ export default {
this.updateRemain(); this.updateRemain();
}, },
methods: { methods: {
...mapActions(["setIsShowLogin"]), ...mapActions(["setIsShowLogin", "setIsPayWait"]),
checkLogin() { checkLogin() {
if (!this.isLogin) { if (!this.isLogin) {
this.setIsShowLogin(true); this.setIsShowLogin(true);
...@@ -241,6 +241,7 @@ export default { ...@@ -241,6 +241,7 @@ export default {
} }
}, },
async generateOrder() { async generateOrder() {
this.setIsPayWait(true);
const res = await create(); const res = await create();
if (res) { if (res) {
this.consultantOrderNo = res.consultantOrderNo; this.consultantOrderNo = res.consultantOrderNo;
...@@ -249,18 +250,19 @@ export default { ...@@ -249,18 +250,19 @@ export default {
} }
}, },
async goPay() { async goPay() {
this.setIsPayWait(true);
try { try {
const res = await goPay({ tradeType: this.tradeType, openId: this.openId }); const res = await goPay({ tradeType: this.tradeType, openId: this.openId });
if (res) { if (res) {
payByWay(this.tradeType, res.payInfo).then(() => { payByWay(this.tradeType, res.payInfo).then(() => {
setTimeout(() => { setTimeout(() => {
this.$parent.getOrderInfo(); this.$parent.getOrderInfo(true);
}, 1000); }, 1000);
}); });
} }
} catch (error) { } catch (error) {
setTimeout(() => { setTimeout(() => {
this.$parent.getOrderInfo(); this.$parent.getOrderInfo(true);
}, 1000); }, 1000);
} }
} }
......
...@@ -17,9 +17,9 @@ import Buy from "./Buy"; ...@@ -17,9 +17,9 @@ import Buy from "./Buy";
import Success from "./Success"; import Success from "./Success";
import Question from "./Question"; import Question from "./Question";
import Exclusive from "./Exclusive"; import Exclusive from "./Exclusive";
import { mapState } from "vuex"; import { mapState, mapActions } from "vuex";
import localStorage from "@/service/localStorage"; import localStorage from "@/service/localStorage";
import { getCulOrder } from "@/api/consultant"; import { getCulOrder, getPayState } from "@/api/consultant";
export default { export default {
name: "Consultant", name: "Consultant",
components: { components: {
...@@ -60,16 +60,33 @@ export default { ...@@ -60,16 +60,33 @@ export default {
this.getOrderInfo(); this.getOrderInfo();
}, },
methods: { methods: {
...mapActions(["setIsPayWait"]),
// 1-待支付,3-支付成功,4-问卷收集完成,方案配置中,5-方案配置完成, -1 -支付失败订单关闭,-2 -支付超过1小时订单关闭,-3 -订单关闭 // 1-待支付,3-支付成功,4-问卷收集完成,方案配置中,5-方案配置完成, -1 -支付失败订单关闭,-2 -支付超过1小时订单关闭,-3 -订单关闭
async getOrderInfo() { async getOrderInfo(checkPayState = false) {
if (!this.isLogin) return; if (!this.isLogin) return;
this.showQuestion = false; this.showQuestion = false;
const res = await getCulOrder(); const res = await getCulOrder();
if (res) { if (res) {
this.orderInfo = res; this.orderInfo = res;
if (checkPayState && res.state < 3) {
this.getPayState();
} else {
this.setIsPayWait(false);
}
this.$forceUpdate(); this.$forceUpdate();
} }
}, },
async getPayState() {
const res = await getPayState();
if (res.state === 2) {
setTimeout(() => {
this.getPayState();
}, 3000);
} else {
this.setIsPayWait(false);
this.getOrderInfo();
}
},
changeQuestion() { changeQuestion() {
this.showQuestion = true; this.showQuestion = true;
}, },
......
...@@ -262,11 +262,18 @@ export default { ...@@ -262,11 +262,18 @@ export default {
handler(val) { handler(val) {
if (val === 4 && this.userInfo.phoneNoMask === "点击登录") { if (val === 4 && this.userInfo.phoneNoMask === "点击登录") {
const xyqbUserInfo = localStorage.get("xyqbUserInfo"); const xyqbUserInfo = localStorage.get("xyqbUserInfo");
this.formData.selfName = xyqbUserInfo.nameMask; const { nameMask, idNoMask, phoneNoMask } = xyqbUserInfo;
this.formData.selfIdNo = xyqbUserInfo.idNoMask; if (nameMask) {
this.formData.selfPhone = xyqbUserInfo.phoneNoMask; this.formData.selfName = nameMask;
}
if (idNoMask) {
this.formData.selfIdNo = idNoMask;
}
if (phoneNoMask) {
this.formData.selfPhone = phoneNoMask;
}
this.xyqbAuthState = localStorage.get("xyqbAuthState"); this.xyqbAuthState = localStorage.get("xyqbAuthState");
this.selfInfoReadonly = true; this.selfInfoReadonly = nameMask && idNoMask && phoneNoMask;
this.$forceUpdate(); this.$forceUpdate();
} }
} }
......
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