订单页首次进入不显示+重复点击相同tab会清空数据bug

This commit is contained in:
BAKEYi 2026-06-03 16:54:10 +08:00
parent 811a72cf34
commit 12826becd5
1 changed files with 69 additions and 59 deletions

View File

@ -289,26 +289,31 @@
uni.hideTabBar(); // TabBar uni.hideTabBar(); // TabBar
}, },
onShow() { onShow() {
this.isLogin = uni.getStorageSync("accessToken") ? true : false; this.isLogin = uni.getStorageSync("accessToken") ? true : false;
if (this.isLogin) { if (this.isLogin) {
// //
if(!this.activeFirstId) this.activeFirstId = 1; if(!this.activeFirstId) this.activeFirstId = 1;
if(!this.activeSecondId) this.activeSecondId = 3; if(!this.activeSecondId) this.activeSecondId = 3; // 2 ()
this.searchList();
} else { // 使 $nextTick CommonList
this.activeFirstId = null; this.$nextTick(() => {
this.activeSecondId = null; this.searchList();
} });
}, } else {
watch: { this.activeFirstId = null;
isLogin(newVal) { this.activeSecondId = null;
if (newVal) { this.popList = []; //
this.activeFirstId = 1; }
this.activeSecondId = 2; // "" },
this.searchList(); // watch: {
} // isLogin(newVal) {
}, // if (newVal) {
}, // this.activeFirstId = 1;
// this.activeSecondId = 2; // ""
// this.searchList();
// }
// },
// },
methods: { methods: {
searchList() { searchList() {
if (this.syrId && this.idType) { if (this.syrId && this.idType) {
@ -342,50 +347,55 @@
}, },
// tab // tab
handleFirstTabClick(item) { handleFirstTabClick(item) {
this.popList = [] if (!this.isLogin) return;
if (!this.isLogin) return; // ()
// if (this.activeFirstId === item.id) return;
if (this.activeFirstId === item.id) return;
// 1
this.activeFirstId = item.id;
this.haveButton = true //
if (this.activeFirstId == 4 || this.activeFirstId == 5) { this.popList = [];
this.haveButton = false
}
// 2"" // 1
if (this.activeFirstId == 1 || this.activeFirstId == 2) { this.activeFirstId = item.id;
this.activeSecondId = 3;
} else {
this.activeSecondId = 2;
}
// 1 this.haveButton = true;
this.$emit("tabChange", { if (this.activeFirstId == 4 || this.activeFirstId == 5) {
firstId: this.activeFirstId, this.haveButton = false;
secondId: this.activeSecondId, }
});
this.$nextTick(() => { // 2
this.searchList(); if (this.activeFirstId == 1 || this.activeFirstId == 2) {
}); this.activeSecondId = 3;
}, } else {
this.activeSecondId = 2;
}
this.$emit("tabChange", {
firstId: this.activeFirstId,
secondId: this.activeSecondId,
});
this.$nextTick(() => {
this.searchList();
});
},
// tab // tab
handleSecondTabClick(id, title) { handleSecondTabClick(id, title) {
this.popList = [] if (!this.isLogin) return;
if (!this.isLogin) return; //
if (this.activeSecondId === id) return; if (this.activeSecondId === id) return;
// 2 //
this.activeSecondId = id; this.popList = [];
// 2 // 2
this.$emit("tabChange", { this.activeSecondId = id;
firstId: this.activeFirstId, this.$emit("tabChange", {
secondId: this.activeSecondId, firstId: this.activeFirstId,
}); secondId: this.activeSecondId,
this.$nextTick(() => { });
this.searchList();
}); this.$nextTick(() => {
}, this.searchList();
});
},
cancelOrder(e, order) { cancelOrder(e, order) {
uni.showModal({ uni.showModal({
title: "取消订单", title: "取消订单",