فهرست منبع

✨ feat(orders): 添加订单列表"全部"筛选功能

- 在订单状态选项卡中增加"全部"选项
- 优化订单查询逻辑,支持查询全部状态订单
- 为"全部"状态添加空状态提示信息

♻️ refactor(orders): 重构订单页面代码

- 移除初始加载时自动触发下拉刷新的逻辑
- 优化选项卡切换处理函数类型定义
- 添加底部占位区域避免内容被tabbar遮挡

🔧 chore(settings): 更新claude配置

- 添加curl命令到允许执行的bash命令列表中
yourname 3 ماه پیش
والد
کامیت
43b1288cf1
2فایلهای تغییر یافته به همراه21 افزوده شده و 18 حذف شده
  1. 2 1
      .claude/settings.local.json
  2. 19 17
      mini/src/pages/orders/index.tsx

+ 2 - 1
.claude/settings.local.json

@@ -37,7 +37,8 @@
       "Bash(xargs sed:*)",
       "Bash(xargs sed:*)",
       "Bash(git diff:*)",
       "Bash(git diff:*)",
       "Bash(pnpm build)",
       "Bash(pnpm build)",
-      "Bash(pnpm run typecheck:*)"
+      "Bash(pnpm run typecheck:*)",
+      "Bash(curl:*)"
     ],
     ],
     "deny": [],
     "deny": [],
     "ask": []
     "ask": []

+ 19 - 17
mini/src/pages/orders/index.tsx

@@ -9,6 +9,7 @@ import { Navbar } from '@/components/ui/navbar';
 
 
 // 订单状态选项卡
 // 订单状态选项卡
 const statusTabs = [
 const statusTabs = [
+  { key: 'all', label: '全部' },
   { key: OrderStatus.WAITING_DEPARTURE, label: '待出发' },
   { key: OrderStatus.WAITING_DEPARTURE, label: '待出发' },
   { key: OrderStatus.IN_PROGRESS, label: '行程中' },
   { key: OrderStatus.IN_PROGRESS, label: '行程中' },
   { key: OrderStatus.COMPLETED, label: '已完成' },
   { key: OrderStatus.COMPLETED, label: '已完成' },
@@ -116,6 +117,8 @@ const OrderCard = ({ order, onViewDetail }) => {
 const EmptyOrders = ({ currentTab }) => {
 const EmptyOrders = ({ currentTab }) => {
   const getEmptyMessage = () => {
   const getEmptyMessage = () => {
     switch (currentTab) {
     switch (currentTab) {
+      case 'all':
+        return '暂无订单';
       case OrderStatus.WAITING_DEPARTURE:
       case OrderStatus.WAITING_DEPARTURE:
         return '暂无待出发订单';
         return '暂无待出发订单';
       case OrderStatus.IN_PROGRESS:
       case OrderStatus.IN_PROGRESS:
@@ -139,18 +142,24 @@ const EmptyOrders = ({ currentTab }) => {
 };
 };
 
 
 const OrdersPage = () => {
 const OrdersPage = () => {
-  const [currentTab, setCurrentTab] = useState<OrderStatus>(OrderStatus.WAITING_DEPARTURE);
+  const [currentTab, setCurrentTab] = useState<string>('all');
 
 
   // 获取订单列表
   // 获取订单列表
   const { data: ordersData, isLoading, error, refetch } = useQuery({
   const { data: ordersData, isLoading, error, refetch } = useQuery({
     queryKey: ['orders', currentTab],
     queryKey: ['orders', currentTab],
     queryFn: async () => {
     queryFn: async () => {
+      const queryParams: any = {
+        page: 1,
+        pageSize: 20
+      };
+
+      // 如果不是"全部"标签,则添加状态筛选
+      if (currentTab !== 'all') {
+        queryParams.status = currentTab;
+      }
+
       const response = await orderClient.$get({
       const response = await orderClient.$get({
-        query: {
-          status: currentTab,
-          page: 1,
-          pageSize: 20
-        }
+        query: queryParams
       });
       });
 
 
       if (!response.ok) {
       if (!response.ok) {
@@ -171,7 +180,7 @@ const OrdersPage = () => {
   };
   };
 
 
   // 切换选项卡
   // 切换选项卡
-  const handleTabChange = (status: OrderStatus) => {
+  const handleTabChange = (status: string) => {
     setCurrentTab(status);
     setCurrentTab(status);
   };
   };
 
 
@@ -181,15 +190,6 @@ const OrdersPage = () => {
     Taro.stopPullDownRefresh();
     Taro.stopPullDownRefresh();
   };
   };
 
 
-  useEffect(() => {
-    // 启用下拉刷新
-    Taro.startPullDownRefresh({
-      success: () => {
-        console.log('下拉刷新开始');
-      }
-    });
-  }, []);
-
   if (error) {
   if (error) {
     return (
     return (
       <View className="flex flex-col items-center justify-center py-16">
       <View className="flex flex-col items-center justify-center py-16">
@@ -222,7 +222,7 @@ const OrdersPage = () => {
             {statusTabs.map((tab) => (
             {statusTabs.map((tab) => (
               <View
               <View
                 key={tab.key}
                 key={tab.key}
-                className={`px-4 py-2 rounded-full mr-3 cursor-pointer transition-colors ${currentTab === tab.key
+                className={`px-4 py-2 rounded-full mr-3 cursor-pointer transition-colors whitespace-nowrap ${currentTab === tab.key
                     ? 'bg-primary text-primary-foreground'
                     ? 'bg-primary text-primary-foreground'
                     : 'bg-muted text-muted-foreground'
                     : 'bg-muted text-muted-foreground'
                   }`}
                   }`}
@@ -257,6 +257,8 @@ const OrdersPage = () => {
             />
             />
           ))
           ))
         )}
         )}
+        {/* 底部占位,避免被tabbar遮挡 */}
+        <View className="h-16"></View>
       </ScrollView>
       </ScrollView>
     </TabBarLayout>
     </TabBarLayout>
   );
   );