From f27b2cdb1a22dc0d934a81f581d7c4f908e89948 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?TOP=E7=B3=AF=E7=B1=B3?= <1130395124@qq.com> Date: Wed, 22 Mar 2023 21:52:05 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E8=AE=A2=E5=8D=95=E8=B7=B3?= =?UTF-8?q?=E8=BD=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/demand/demand.vue | 1 + src/pages/order/create.vue | 1 + src/pages/order/order.vue | 12 ++++++++++++ src/pages/service/other/distribution.vue | 1 + src/store/modules/system.js | 4 ++++ 5 files changed, 19 insertions(+) diff --git a/src/pages/demand/demand.vue b/src/pages/demand/demand.vue index 8941da2..7029fff 100644 --- a/src/pages/demand/demand.vue +++ b/src/pages/demand/demand.vue @@ -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"); }); }); diff --git a/src/pages/order/create.vue b/src/pages/order/create.vue index 52403ef..d26b165 100644 --- a/src/pages/order/create.vue +++ b/src/pages/order/create.vue @@ -174,6 +174,7 @@ export default { }) .then((id) => { this.$store.dispatch("cart/updateAll"); + this.$store.commit("system/currentOrderTabIndex", 0); this.$models.order .pay({ request: { diff --git a/src/pages/order/order.vue b/src/pages/order/order.vue index 10f7b12..f777a67 100644 --- a/src/pages/order/order.vue +++ b/src/pages/order/order.vue @@ -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(); }, diff --git a/src/pages/service/other/distribution.vue b/src/pages/service/other/distribution.vue index ea5676f..dacd581 100644 --- a/src/pages/service/other/distribution.vue +++ b/src/pages/service/other/distribution.vue @@ -207,6 +207,7 @@ export default { distance: this.distance, }) .then((data) => { + this.$store.commit("system/currentOrderTabIndex", 2); this.$models.order .pay({ request: { diff --git a/src/store/modules/system.js b/src/store/modules/system.js index 8e6f587..a16a6b9 100644 --- a/src/store/modules/system.js +++ b/src/store/modules/system.js @@ -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: {}