优化订单跳转

This commit is contained in:
TOP糯米 2023-03-22 21:52:05 +08:00
parent 482ff54eb8
commit f27b2cdb1a
5 changed files with 19 additions and 0 deletions

View File

@ -377,6 +377,7 @@ export default {
}) })
.then((response) => { .then((response) => {
this.$utils.toast(response.msg).then(() => { this.$utils.toast(response.msg).then(() => {
this.$store.commit("system/currentOrderTabIndex", 1);
this.$utils.toPage("/pages/order/order", {}, "switch"); this.$utils.toPage("/pages/order/order", {}, "switch");
}); });
}); });

View File

@ -174,6 +174,7 @@ export default {
}) })
.then((id) => { .then((id) => {
this.$store.dispatch("cart/updateAll"); this.$store.dispatch("cart/updateAll");
this.$store.commit("system/currentOrderTabIndex", 0);
this.$models.order this.$models.order
.pay({ .pay({
request: { request: {

View File

@ -57,6 +57,7 @@ import AppLayout from "@/components/layout/layout";
import OrderItem from "@/components/order/item"; import OrderItem from "@/components/order/item";
import OrderAction from "@/components/order/action"; import OrderAction from "@/components/order/action";
import WidgetLoadMore from "@/components/widgets/loadmore"; import WidgetLoadMore from "@/components/widgets/loadmore";
import { mapState } from "vuex";
export default { export default {
name: "order", name: "order",
data() { data() {
@ -94,11 +95,22 @@ export default {
OrderAction, OrderAction,
WidgetLoadMore, WidgetLoadMore,
}, },
computed: {
...mapState({
currentOrderTabIndex: (state) => state.system.currentOrderTabIndex,
}),
},
onLoad() {}, onLoad() {},
onShow() { onShow() {
if (this.currentOrderTabIndex) {
this.tabIndex = this.currentOrderTabIndex;
}
this.switchTab(this.tabIndex); this.switchTab(this.tabIndex);
}, },
onReady() {}, onReady() {},
onHide() {
this.$store.commit("system/currentOrderTabIndex", 0);
},
onReachBottom() { onReachBottom() {
this.loadData(); this.loadData();
}, },

View File

@ -207,6 +207,7 @@ export default {
distance: this.distance, distance: this.distance,
}) })
.then((data) => { .then((data) => {
this.$store.commit("system/currentOrderTabIndex", 2);
this.$models.order this.$models.order
.pay({ .pay({
request: { request: {

View File

@ -2,11 +2,15 @@ export default {
namespaced: true, namespaced: true,
state: { state: {
currentCateId: 0, currentCateId: 0,
currentOrderTabIndex: 0,
}, },
getters: {}, getters: {},
mutations: { mutations: {
currentCateId(state, data) { currentCateId(state, data) {
state.currentCateId = data; state.currentCateId = data;
},
currentOrderTabIndex(state, data) {
state.currentOrderTabIndex = data;
} }
}, },
actions: {} actions: {}