|
|
@@ -29,6 +29,7 @@
|
|
|
onMounted
|
|
|
} from "vue";
|
|
|
import {
|
|
|
+ onLoad,
|
|
|
onShow,
|
|
|
onReachBottom
|
|
|
} from "@dcloudio/uni-app";
|
|
|
@@ -86,24 +87,30 @@
|
|
|
|
|
|
const list = ref([{
|
|
|
name: '待付款',
|
|
|
- orderStatus: 0
|
|
|
+ orderStatus: 0,
|
|
|
+ value: 0
|
|
|
},
|
|
|
{
|
|
|
name: '待发货',
|
|
|
- orderStatus: 1
|
|
|
+ orderStatus: 1,
|
|
|
+ value: 1
|
|
|
},
|
|
|
{
|
|
|
name: '待收货',
|
|
|
- orderStatus: 2
|
|
|
+ orderStatus: 2,
|
|
|
+ value: 2
|
|
|
},
|
|
|
+ {
|
|
|
+ name: '退款/换货',
|
|
|
+ orderStatus: -3,
|
|
|
+ value: 3
|
|
|
+ },
|
|
|
{
|
|
|
name: '已完成',
|
|
|
- orderStatus: 4
|
|
|
- },
|
|
|
- {
|
|
|
- name: '退货/退款',
|
|
|
- orderStatus: -3
|
|
|
+ orderStatus: 4,
|
|
|
+ value: 4
|
|
|
},
|
|
|
+
|
|
|
]) //头部导航
|
|
|
|
|
|
// 生命周期
|
|
|
@@ -120,7 +127,6 @@
|
|
|
});
|
|
|
|
|
|
// 页面显示时
|
|
|
-
|
|
|
onShow(() => {
|
|
|
if (appStore.isLogin) {
|
|
|
loadend.value = false;
|
|
|
@@ -132,7 +138,27 @@
|
|
|
toLogin();
|
|
|
}
|
|
|
});
|
|
|
+ onLoad((options) => {
|
|
|
+ if (options.status) {
|
|
|
+ const statusValue = parseInt(options.status);
|
|
|
+
|
|
|
+ // 验证状态是否有效
|
|
|
+ const validStatuses = [0, 1, 2, 4, -3];
|
|
|
+ if (validStatuses.includes(statusValue)) {
|
|
|
+ // 设置状态
|
|
|
+ orderStatus.value = statusValue;
|
|
|
+ // 找到对应的索引
|
|
|
+ const index = list.value.findIndex(item => item.orderStatus === statusValue);
|
|
|
+ if (index !== -1) {
|
|
|
+ oldOrderStatus.value = index; // 设置索引值
|
|
|
+ }
|
|
|
|
|
|
+ console.log("设置订单状态为:", statusValue, "索引为:", index);
|
|
|
+ } else {
|
|
|
+ console.warn("无效的状态参数:", statusValue);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
// 下拉加载
|
|
|
onReachBottom(() => {
|
|
|
getOrderListFn();
|
|
|
@@ -226,7 +252,7 @@
|
|
|
}
|
|
|
|
|
|
function statusClick(item) {
|
|
|
-
|
|
|
+ console.log(item)
|
|
|
if (item.orderStatus === orderStatus.value) return;
|
|
|
|
|
|
orderStatus.value = item.orderStatus;
|