diff --git a/app/(order)/chat/[id]/page.tsx b/app/(order)/chat/[id]/page.tsx index 1dbd0ec..ad98c7a 100644 --- a/app/(order)/chat/[id]/page.tsx +++ b/app/(order)/chat/[id]/page.tsx @@ -4,6 +4,7 @@ import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar" import { Badge } from "@/components/ui/badge" import { Button } from "@/components/ui/button" import { Card } from "@/components/ui/card" +import { EmptyState } from "@/components/ui/empty-state" import { Input } from "@/components/ui/input" import { ScrollArea } from "@/components/ui/scroll-area" import { getChatSessionById, listChatMessages } from "@/lib/api" @@ -11,7 +12,7 @@ import { sendImageMessage, sendTextMessage } from "@/lib/api/chat" import { notifyInfo } from "@/lib/toast" import { cn } from "@/lib/utils" import { useAuthStore } from "@/store/auth" -import { ArrowLeft, ImagePlus, Send } from "lucide-react" +import { ArrowLeft, ImagePlus, MessageSquare, Send } from "lucide-react" import Image from "next/image" import Link from "next/link" import { use, useEffect, useRef, useState } from "react" @@ -55,22 +56,32 @@ export default function ChatDetailPage({ params }: { params: Promise<{ id: strin if (loading) { return ( -
加载中...
+
+ +
) } if (!session) { return ( -
- 会话不存在 +
+
) } if (!user?.id) { return ( -
- 请先登录后查看会话 +
+
) } @@ -79,8 +90,12 @@ export default function ChatDetailPage({ params }: { params: Promise<{ id: strin const isParticipant = session.participants.some((participant) => participant.id === userId) if (!isParticipant) { return ( -
- 仅会话参与方可查看并发送消息 +
+
) } @@ -89,8 +104,8 @@ export default function ChatDetailPage({ params }: { params: Promise<{ id: strin return (
- -
+ +
@@ -101,7 +116,10 @@ export default function ChatDetailPage({ params }: { params: Promise<{ id: strin
{other.nickname}
- + {session.type === "order" ? "订单会话" : "咨询会话"}
@@ -114,7 +132,7 @@ export default function ChatDetailPage({ params }: { params: Promise<{ id: strin if (msg.type === "system") { return (
- + {msg.content}
@@ -143,8 +161,10 @@ export default function ChatDetailPage({ params }: { params: Promise<{ id: strin ) : (

{msg.content} @@ -163,7 +183,7 @@ export default function ChatDetailPage({ params }: { params: Promise<{ id: strin

-
+
setInput(e.target.value)} placeholder="输入消息..." - className="flex-1" + className="flex-1 border-border/60" />
) } diff --git a/app/(order)/orders/page.tsx b/app/(order)/orders/page.tsx index 39f8ac2..358611c 100644 --- a/app/(order)/orders/page.tsx +++ b/app/(order)/orders/page.tsx @@ -3,6 +3,8 @@ import { Badge } from "@/components/ui/badge" import { Button } from "@/components/ui/button" import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card" +import { EmptyState } from "@/components/ui/empty-state" +import { StatusBadge } from "@/components/ui/status-badge" import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs" import { listChatSessions, listOrders } from "@/lib/api" import { statusLabels } from "@/lib/constants" @@ -14,21 +16,22 @@ import { } from "@/lib/domain/order-filters" import { useMyShop } from "@/lib/hooks/use-my-shop" import type { OrderStatus, UserRole } from "@/lib/types" -import { cn } from "@/lib/utils" import { useAuthStore } from "@/store/auth" -import { Clock, MessageSquare, RefreshCw } from "lucide-react" +import { ClipboardList, Clock, MessageSquare, RefreshCw } from "lucide-react" import Link from "next/link" import { useEffect, useState } from "react" -const statusColors: Record = { - pending_payment: "bg-yellow-100 text-yellow-800", - pending_accept: "bg-blue-100 text-blue-800", - in_progress: "bg-green-100 text-green-800", - pending_close: "bg-orange-100 text-orange-800", - pending_review: "bg-purple-100 text-purple-800", - disputed: "bg-red-100 text-red-800", - completed: "bg-gray-100 text-gray-800", - cancelled: "bg-gray-100 text-gray-500", +type OrderStatusBadgeVariant = "success" | "warning" | "info" | "neutral" | "destructive" + +const statusVariants: Record = { + pending_payment: "warning", + pending_accept: "info", + in_progress: "success", + pending_close: "info", + pending_review: "info", + disputed: "destructive", + completed: "success", + cancelled: "neutral", } type TabFilter = "all" | "active" | "completed" | "disputed" @@ -71,11 +74,19 @@ export default function OrderListPage() { } = useMyShop(currentRole === "owner") if (currentRole === "owner" && shopLoading) { - return
加载中...
+ return ( +
+ +
+ ) } if (currentRole === "owner" && shopError) { - return
{shopError}
+ return ( +
+ +
+ ) } return ( @@ -179,14 +190,14 @@ function OrderListContent({
{!orderRole ? ( - - - 当前身份暂不支持订单视角 - - + ) : ( setTab(v as TabFilter | "pending")}> - + {tabs.map((item) => ( {item.label} @@ -196,20 +207,23 @@ function OrderListContent({ {filtered.length === 0 ? ( - - - 暂无订单 - - + ) : ( filtered.map((order) => ( - +
{order.service.title} - + {statusLabels[order.status]} - +

{order.service.title}

diff --git a/components/order-actions.tsx b/components/order-actions.tsx index e231379..f5a71e2 100644 --- a/components/order-actions.tsx +++ b/components/order-actions.tsx @@ -108,11 +108,12 @@ export default function OrderActions({ ) return ( -
+
{status === "pending_payment" && isConsumer && ( <> )}