优化订单跳转

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) => {
this.$utils.toast(response.msg).then(() => {
this.$store.commit("system/currentOrderTabIndex", 1);
this.$utils.toPage("/pages/order/order", {}, "switch");
});
});

View File

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

View File

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

View File

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

View File

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