订单页首次进入不显示+重复点击相同tab会清空数据bug
This commit is contained in:
parent
811a72cf34
commit
12826becd5
|
|
@ -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.popList = [];
|
||||||
|
|
||||||
|
// 更新1级选中状态
|
||||||
|
this.activeFirstId = item.id;
|
||||||
|
|
||||||
this.haveButton = true
|
this.haveButton = true;
|
||||||
if (this.activeFirstId == 4 || this.activeFirstId == 5) {
|
if (this.activeFirstId == 4 || this.activeFirstId == 5) {
|
||||||
this.haveButton = false
|
this.haveButton = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 重置2级选中状态(默认选中"全部")
|
// 重置2级选中状态
|
||||||
if (this.activeFirstId == 1 || this.activeFirstId == 2) {
|
if (this.activeFirstId == 1 || this.activeFirstId == 2) {
|
||||||
this.activeSecondId = 3;
|
this.activeSecondId = 3;
|
||||||
} else {
|
} else {
|
||||||
this.activeSecondId = 2;
|
this.activeSecondId = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 传递给父组件(1级选中数据)
|
this.$emit("tabChange", {
|
||||||
this.$emit("tabChange", {
|
firstId: this.activeFirstId,
|
||||||
firstId: this.activeFirstId,
|
secondId: this.activeSecondId,
|
||||||
secondId: this.activeSecondId,
|
});
|
||||||
});
|
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
this.searchList();
|
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: "取消订单",
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue