fix: complete disputed order flow and wallet entry

This commit is contained in:
zetaloop
2026-02-21 15:43:21 +08:00
parent e2e0b5a06a
commit 1ff499720f
3 changed files with 64 additions and 30 deletions
+44 -30
View File
@@ -9,7 +9,7 @@ import { statusLabels } from "@/lib/constants"
import { mockChatSessions, mockOrders, mockReviews } from "@/lib/mock"
import type { OrderStatus } from "@/lib/types"
const statusSteps: OrderStatus[] = [
const normalStatusSteps: OrderStatus[] = [
"pending_payment",
"pending_accept",
"in_progress",
@@ -18,6 +18,16 @@ const statusSteps: OrderStatus[] = [
"completed",
]
const disputedStatusSteps: OrderStatus[] = [
"pending_payment",
"pending_accept",
"in_progress",
"pending_close",
"disputed",
]
const cancelledStatusSteps: OrderStatus[] = ["pending_payment", "pending_accept", "cancelled"]
export default async function OrderDetailPage({ params }: { params: Promise<{ id: string }> }) {
const { id } = await params
const order = mockOrders.find((o) => o.id === id)
@@ -25,6 +35,12 @@ export default async function OrderDetailPage({ params }: { params: Promise<{ id
const reviews = mockReviews.filter((r) => r.orderId === id)
const chatSession = mockChatSessions.find((s) => s.orderId === id)
const statusSteps =
order.status === "disputed"
? disputedStatusSteps
: order.status === "cancelled"
? cancelledStatusSteps
: normalStatusSteps
const currentStepIndex = statusSteps.indexOf(order.status)
return (
@@ -42,36 +58,34 @@ export default async function OrderDetailPage({ params }: { params: Promise<{ id
<Badge variant="outline">{statusLabels[order.status]}</Badge>
</div>
{order.status !== "disputed" && order.status !== "cancelled" && (
<Card className="mb-6">
<CardContent className="pt-6">
<div className="flex items-center justify-between">
{statusSteps.map((step, i) => {
const isActive = i <= currentStepIndex
const isCurrent = i === currentStepIndex
return (
<div key={step} className="flex flex-col items-center gap-1 flex-1">
<div
className={`h-8 w-8 rounded-full flex items-center justify-center text-xs font-medium ${
isCurrent
? "bg-primary text-primary-foreground"
: isActive
? "bg-primary/20 text-primary"
: "bg-muted text-muted-foreground"
}`}
>
{isActive ? <CheckCircle className="h-4 w-4" /> : i + 1}
</div>
<span className="text-[10px] text-muted-foreground text-center">
{statusLabels[step]}
</span>
<Card className="mb-6">
<CardContent className="pt-6">
<div className="flex items-center justify-between">
{statusSteps.map((step, i) => {
const isActive = i <= currentStepIndex
const isCurrent = i === currentStepIndex
return (
<div key={step} className="flex flex-col items-center gap-1 flex-1">
<div
className={`h-8 w-8 rounded-full flex items-center justify-center text-xs font-medium ${
isCurrent
? "bg-primary text-primary-foreground"
: isActive
? "bg-primary/20 text-primary"
: "bg-muted text-muted-foreground"
}`}
>
{isActive ? <CheckCircle className="h-4 w-4" /> : i + 1}
</div>
)
})}
</div>
</CardContent>
</Card>
)}
<span className="text-[10px] text-muted-foreground text-center">
{statusLabels[step]}
</span>
</div>
)
})}
</div>
</CardContent>
</Card>
<Card className="mb-6">
<CardHeader>