Browse Source

feat: 订单列表入参页面增加

liangan 1 tháng trước cách đây
mục cha
commit
3fae53a862
1 tập tin đã thay đổi với 14 bổ sung2 xóa
  1. 14 2
      src/pages/myOrders/myOrders.vue

+ 14 - 2
src/pages/myOrders/myOrders.vue

@@ -15,7 +15,7 @@ import { onPageScroll, onReachBottom } from '@dcloudio/uni-app'
 import useZPaging from 'z-paging/components/z-paging/js/hooks/useZPaging.js'
 import { orderList, orderStatusEnum } from '@/api/order'
 import { formatNumber } from '@/utils'
-import { toPage } from '@/utils/page'
+import { getPageParams, toPage } from '@/utils/page'
 
 defineOptions({
   name: 'MyOrders', // 我的订单
@@ -80,8 +80,20 @@ async function queryList(pageNo: number, pageSize: number) {
     paging.value.complete(false)
   }
 }
-onLoad(() => {
+onLoad((options) => {
   getOrderStatus()
+
+  // 处理页面参数,如果有type参数则切换到对应的tab
+  if (options) {
+    const params = getPageParams(options)
+    if (params.type !== undefined) {
+      // 确保type值在有效范围内
+      const typeValue = Number(params.type)
+      if (typeValue >= 0 && typeValue <= 4) {
+        tab.value = typeValue
+      }
+    }
+  }
 })
 </script>