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

fix: 顾问下单查询优化

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