diff --git a/app/(dashboard)/dashboard/page.tsx b/app/(dashboard)/dashboard/page.tsx index af3bcb9..f73edb2 100644 --- a/app/(dashboard)/dashboard/page.tsx +++ b/app/(dashboard)/dashboard/page.tsx @@ -1,8 +1,146 @@ +"use client" + +import { CheckCircle, Clock, DollarSign, ListOrdered, Star, TrendingUp, Users } from "lucide-react" +import Link from "next/link" +import { Badge } from "@/components/ui/badge" +import { Button } from "@/components/ui/button" +import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card" +import { Progress } from "@/components/ui/progress" +import { mockOrders, mockPlayers, mockServices, mockShops } from "@/lib/mock-data" +import { useAuthStore } from "@/store/auth" + +const statusLabels: Record = { + pending_payment: "待支付", + pending_accept: "待接单", + in_progress: "进行中", + pending_close: "待结单", + pending_review: "待评价", + disputed: "争议中", + completed: "已完成", + cancelled: "已取消", +} + export default function DashboardPage() { + const { currentRole } = useAuthStore() + const isOwner = currentRole === "owner" + + const player = mockPlayers[0] + const shop = mockShops[0] + const recentOrders = mockOrders.slice(0, 3) + return ( -
-

管理后台

-

根据当前身份显示对应的管理面板

+
+

概览

+ +
+ + + 总订单 + + + +
+ {isOwner ? shop.totalOrders : player.totalOrders} +
+
+
+ + + 评分 + + + +
{isOwner ? shop.rating : player.rating}
+
+
+ + + {isOwner ? "签约打手" : "完成率"} + {isOwner ? ( + + ) : ( + + )} + + + {isOwner ? ( +
{shop.playerCount}
+ ) : ( +
+
+ {(player.completionRate * 100).toFixed(0)}% +
+ +
+ )} +
+
+ + + {isOwner ? "本月收入" : "服务数"} + {isOwner ? ( + + ) : ( + + )} + + +
+ {isOwner ? "¥12,800" : mockServices.filter((s) => s.playerId === player.id).length} +
+
+
+
+ + + + 最近订单 + + + +
+ {recentOrders.map((order) => ( + +
+
+

{order.service.title}

+

+ {order.consumerName} → {order.playerName} +

+
+
+ ¥{order.totalPrice} + + {statusLabels[order.status]} + +
+
+ + ))} +
+
+
+ + {!isOwner && ( + + + 快捷操作 + + + + + + + )}
) } diff --git a/app/(dashboard)/dashboard/services/new/page.tsx b/app/(dashboard)/dashboard/services/new/page.tsx index a3c2550..5054b97 100644 --- a/app/(dashboard)/dashboard/services/new/page.tsx +++ b/app/(dashboard)/dashboard/services/new/page.tsx @@ -1,8 +1,151 @@ +"use client" + +import { standardSchemaResolver } from "@hookform/resolvers/standard-schema" +import { ArrowLeft } from "lucide-react" +import Link from "next/link" +import { useRouter } from "next/navigation" +import { useForm } from "react-hook-form" +import { z } from "zod" +import { Button } from "@/components/ui/button" +import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card" +import { Input } from "@/components/ui/input" +import { Label } from "@/components/ui/label" +import { + Select, + SelectContent, + SelectItem, + SelectTrigger, + SelectValue, +} from "@/components/ui/select" +import { Textarea } from "@/components/ui/textarea" +import { mockGames } from "@/lib/mock-data" + +const serviceSchema = z.object({ + title: z.string().min(2, "标题至少2个字符"), + description: z.string().min(10, "描述至少10个字符"), + price: z.string().min(1, "请输入价格"), + unit: z.string().min(1, "请输入单位"), + rankRange: z.string().optional(), + availability: z.string().min(1, "请输入可用时间"), +}) + export default function NewServicePage() { + const router = useRouter() + const { + register, + handleSubmit, + formState: { errors, isSubmitting }, + } = useForm({ + resolver: standardSchemaResolver(serviceSchema), + }) + + const onSubmit = async () => { + await new Promise((r) => setTimeout(r, 500)) + router.push("/dashboard/services") + } + return ( -
-

发布服务

-

创建或编辑陪玩服务

+
+ + + 返回服务列表 + + + + + 发布服务 + + +
+
+ + +
+ +
+ + + {errors.title &&

{errors.title.message}

} +
+ +
+ +