订单页首次进入不显示+重复点击相同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
},
onShow() {
this.isLogin = uni.getStorageSync("accessToken") ? true : false;
if (this.isLogin) {
//
if(!this.activeFirstId) this.activeFirstId = 1;
if(!this.activeSecondId) this.activeSecondId = 3;
this.searchList();
} else {
this.activeFirstId = null;
this.activeSecondId = null;
}
},
watch: {
isLogin(newVal) {
if (newVal) {
this.activeFirstId = 1;
this.activeSecondId = 2; // ""
this.searchList();
}
},
},
this.isLogin = uni.getStorageSync("accessToken") ? true : false;
if (this.isLogin) {
//
if(!this.activeFirstId) this.activeFirstId = 1;
if(!this.activeSecondId) this.activeSecondId = 3; // 2 ()
// 使 $nextTick CommonList
this.$nextTick(() => {
this.searchList();
});
} else {
this.activeFirstId = null;
this.activeSecondId = null;
this.popList = []; //
}
},
// watch: {
// isLogin(newVal) {
// if (newVal) {
// this.activeFirstId = 1;
// this.activeSecondId = 2; // ""
// this.searchList();
// }
// },
// },
methods: {
searchList() {
if (this.syrId && this.idType) {
@ -342,50 +347,55 @@
},
// tab
handleFirstTabClick(item) {
this.popList = []
if (!this.isLogin) return;
//
if (this.activeFirstId === item.id) return;
// 1
this.activeFirstId = item.id;
if (!this.isLogin) return;
// ()
if (this.activeFirstId === item.id) return;
//
this.popList = [];
// 1
this.activeFirstId = item.id;
this.haveButton = true
if (this.activeFirstId == 4 || this.activeFirstId == 5) {
this.haveButton = false
}
this.haveButton = true;
if (this.activeFirstId == 4 || this.activeFirstId == 5) {
this.haveButton = false;
}
// 2""
if (this.activeFirstId == 1 || this.activeFirstId == 2) {
this.activeSecondId = 3;
} else {
this.activeSecondId = 2;
}
// 2
if (this.activeFirstId == 1 || this.activeFirstId == 2) {
this.activeSecondId = 3;
} else {
this.activeSecondId = 2;
}
// 1
this.$emit("tabChange", {
firstId: this.activeFirstId,
secondId: this.activeSecondId,
});
this.$nextTick(() => {
this.searchList();
});
},
this.$emit("tabChange", {
firstId: this.activeFirstId,
secondId: this.activeSecondId,
});
this.$nextTick(() => {
this.searchList();
});
},
// tab
handleSecondTabClick(id, title) {
this.popList = []
if (!this.isLogin) return;
if (this.activeSecondId === id) return;
// 2
this.activeSecondId = id;
// 2
this.$emit("tabChange", {
firstId: this.activeFirstId,
secondId: this.activeSecondId,
});
this.$nextTick(() => {
this.searchList();
});
},
if (!this.isLogin) return;
//
if (this.activeSecondId === id) return;
//
this.popList = [];
// 2
this.activeSecondId = id;
this.$emit("tabChange", {
firstId: this.activeFirstId,
secondId: this.activeSecondId,
});
this.$nextTick(() => {
this.searchList();
});
},
cancelOrder(e, order) {
uni.showModal({
title: "取消订单",