feat(ui): refine order detail pages

This commit is contained in:
zetaloop
2026-04-25 21:23:55 +08:00
parent 8e02c8ca97
commit 8b71e7e70e
3 changed files with 103 additions and 63 deletions
+43 -27
View File
@@ -2,6 +2,7 @@
import { Button } from "@/components/ui/button"
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"
import { EmptyState } from "@/components/ui/empty-state"
import { Label } from "@/components/ui/label"
import { Textarea } from "@/components/ui/textarea"
import { getOrderById, listReviewsByOrder } from "@/lib/api"
@@ -54,14 +55,16 @@ export default function ReviewPage({ params }: { params: Promise<{ id: string }>
if (loading) {
return (
<div className="container mx-auto py-8 px-4 text-center text-muted-foreground">...</div>
<div className="container mx-auto max-w-lg px-4 py-8">
<EmptyState title="加载中" description="正在读取评价信息..." icon={Star} />
</div>
)
}
if (!order) {
return (
<div className="container mx-auto py-8 px-4 text-center text-muted-foreground">
<div className="container mx-auto max-w-lg px-4 py-8">
<EmptyState title="订单不存在" description="该订单可能已被删除或暂不可访问。" />
</div>
)
}
@@ -71,38 +74,51 @@ export default function ReviewPage({ params }: { params: Promise<{ id: string }>
if (order.status !== "pending_review") {
return (
<div className="container mx-auto py-8 px-4 max-w-lg text-center space-y-4">
<h2 className="text-xl font-bold"></h2>
<p className="text-sm text-muted-foreground"></p>
<Link href={`/order/${id}`} className="text-sm text-primary hover:underline">
</Link>
<div className="container mx-auto max-w-lg px-4 py-8">
<EmptyState
title="当前阶段不可评价"
description="仅待评价状态的订单可以提交评价。"
icon={Star}
action={
<Button variant="outline" asChild>
<Link href={`/order/${id}`}></Link>
</Button>
}
/>
</div>
)
}
if (hasSubmitted && !isRevealed) {
return (
<div className="container mx-auto py-8 px-4 max-w-lg text-center space-y-4">
<Lock className="h-12 w-12 mx-auto text-muted-foreground" />
<h2 className="text-xl font-bold"></h2>
<p className="text-sm text-muted-foreground"></p>
<p className="text-sm text-muted-foreground"></p>
<Link href={`/order/${id}`} className="text-sm text-primary hover:underline">
</Link>
<div className="container mx-auto max-w-lg px-4 py-8">
<EmptyState
title="评价已提交"
description="等待对方提交评价,双方都提交后将同时揭晓。"
icon={Lock}
action={
<Button variant="outline" asChild>
<Link href={`/order/${id}`}></Link>
</Button>
}
/>
</div>
)
}
if (hasSubmitted && isRevealed) {
return (
<div className="container mx-auto py-8 px-4 max-w-lg text-center space-y-4">
<h2 className="text-xl font-bold"></h2>
<p className="text-sm text-muted-foreground"></p>
<Link href={`/order/${id}`} className="text-sm text-primary hover:underline">
</Link>
<div className="container mx-auto max-w-lg px-4 py-8">
<EmptyState
title="评价已揭晓"
description="双方评价已同步公开,可在订单详情查看。"
icon={Star}
action={
<Button variant="outline" asChild>
<Link href={`/order/${id}`}></Link>
</Button>
}
/>
</div>
)
}
@@ -117,7 +133,7 @@ export default function ReviewPage({ params }: { params: Promise<{ id: string }>
</Link>
<Card className="hover:shadow-card-hover">
<Card className="border-border/80 shadow-sm">
<CardHeader>
<CardTitle></CardTitle>
<p className="text-sm text-muted-foreground">{order.service.title}</p>
@@ -138,8 +154,8 @@ export default function ReviewPage({ params }: { params: Promise<{ id: string }>
<Star
className={`h-8 w-8 transition-colors ${
star <= (hoverRating || rating)
? "fill-yellow-400 text-yellow-400"
: "text-muted"
? "fill-warning text-warning"
: "text-muted stroke-muted-foreground"
}`}
/>
</button>
@@ -158,7 +174,7 @@ export default function ReviewPage({ params }: { params: Promise<{ id: string }>
/>
</div>
<div className="rounded-md bg-muted/50 p-3 text-xs text-muted-foreground flex items-start gap-2">
<div className="rounded-lg border border-border/60 bg-muted/30 p-3 text-xs text-muted-foreground flex items-start gap-2">
<Lock className="h-4 w-4 shrink-0 mt-0.5" />
<span></span>
</div>