diff --git a/app/(dashboard)/dashboard/page.tsx b/app/(dashboard)/dashboard/page.tsx index 8e87611..9169907 100644 --- a/app/(dashboard)/dashboard/page.tsx +++ b/app/(dashboard)/dashboard/page.tsx @@ -1,9 +1,10 @@ "use client" -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 { Progress } from "@/components/ui/progress" +import { StatusBadge, type StatusBadgeProps } from "@/components/ui/status-badge" import { listOrders, listPlayers, listServices, listShops } from "@/lib/api" import { statusLabels } from "@/lib/constants" import type { Player, PlayerService, Shop } from "@/lib/types" @@ -12,6 +13,17 @@ import { CheckCircle, Clock, DollarSign, ListOrdered, Star, TrendingUp, Users } import Link from "next/link" import { useEffect, useState } from "react" +const orderStatusVariants: Record = { + pending_payment: "warning", + pending_accept: "info", + in_progress: "success", + pending_close: "info", + pending_review: "info", + disputed: "destructive", + completed: "success", + cancelled: "neutral", +} + function getOrderRole(role: "consumer" | "player" | "owner" | "admin") { if (role === "consumer" || role === "player" || role === "owner") { return role @@ -87,7 +99,7 @@ export default function DashboardPage() {

概览

- + 总订单 @@ -96,7 +108,7 @@ export default function DashboardPage() {
{totalOrders}
- + 评分 @@ -105,7 +117,7 @@ export default function DashboardPage() {
{rating}
- + {isOwner ? "签约打手" : "完成率"} {isOwner ? ( @@ -125,7 +137,7 @@ export default function DashboardPage() { )} - + {isOwner ? "本月收入" : "服务数"} {isOwner ? ( @@ -140,7 +152,7 @@ export default function DashboardPage() {
- + 最近订单 -
- {recentOrders.map((order) => ( - -
-
-

{order.service.title}

-

{order.service.title}

+ {recentOrders.length > 0 ? ( +
+ {recentOrders.map((order) => ( + +
+
+

{order.service.title}

+

{order.service.title}

+
+
+ ¥{order.totalPrice} + + {statusLabels[order.status]} + +
-
- ¥{order.totalPrice} - - {statusLabels[order.status]} - -
-
- - ))} -
+ + ))} +
+ ) : ( + + )} {!isOwner && ( - + 快捷操作 diff --git a/app/(dashboard)/dashboard/services/page.tsx b/app/(dashboard)/dashboard/services/page.tsx index 19840a0..918ce6f 100644 --- a/app/(dashboard)/dashboard/services/page.tsx +++ b/app/(dashboard)/dashboard/services/page.tsx @@ -3,6 +3,7 @@ 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 { Table, TableBody, @@ -17,7 +18,7 @@ import { useMyShop } from "@/lib/hooks/use-my-shop" import { notifyInfo, notifySuccess } from "@/lib/toast" import type { Player, PlayerService } from "@/lib/types" import { useAuthStore } from "@/store/auth" -import { Edit, Plus, Trash2 } from "lucide-react" +import { AlertCircle, Edit, Plus, Trash2 } from "lucide-react" import Link from "next/link" import { useCallback, useEffect, useMemo, useState } from "react" @@ -109,7 +110,7 @@ export default function ServicesPage() {
- + 已发布的服务 @@ -128,20 +129,30 @@ export default function ServicesPage() { {loading || (currentRole === "owner" && shopLoading) ? ( - - 加载中... + + ) : currentRole === "owner" && shopError ? ( - - {shopError} + + ) : scopedServices.length === 0 ? ( - - 暂无服务 + + ) : ( diff --git a/app/(dashboard)/dashboard/shop/income/page.tsx b/app/(dashboard)/dashboard/shop/income/page.tsx index 0dfda9e..8396dd1 100644 --- a/app/(dashboard)/dashboard/shop/income/page.tsx +++ b/app/(dashboard)/dashboard/shop/income/page.tsx @@ -2,6 +2,7 @@ import { Badge } from "@/components/ui/badge" import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card" +import { EmptyState } from "@/components/ui/empty-state" import { Table, TableBody, @@ -16,7 +17,7 @@ import { listWalletTransactions } from "@/lib/api/transactions" import { toApiError } from "@/lib/errors" import { useMyShop } from "@/lib/hooks/use-my-shop" import type { WalletTransaction } from "@/lib/types" -import { ArrowDownLeft, ArrowUpRight, CreditCard, DollarSign } from "lucide-react" +import { AlertCircle, ArrowDownLeft, ArrowUpRight, CreditCard, DollarSign } from "lucide-react" import { useEffect, useState } from "react" const emptyStats: ShopIncomeStats = { @@ -67,15 +68,27 @@ export default function ShopIncomePage() { }, [shop]) if (loading) { - return
加载中...
+ return ( +
+ +
+ ) } if (error) { - return
{error}
+ return ( +
+ +
+ ) } if (!shop) { - return
当前账号没有可管理的店铺
+ return ( +
+ +
+ ) } const relatedTransactions = transactions.filter( @@ -87,7 +100,7 @@ export default function ShopIncomePage() {

收入统计

- + 本月收入 @@ -96,7 +109,7 @@ export default function ShopIncomePage() {
¥{stats.monthlyIncome}
- + 待结算 @@ -105,7 +118,7 @@ export default function ShopIncomePage() {
¥{stats.pendingSettlement}
- + 累计提现 @@ -116,7 +129,7 @@ export default function ShopIncomePage() {
- + 交易明细 @@ -133,14 +146,19 @@ export default function ShopIncomePage() { {isLoading ? ( - - 加载中... + + ) : loadError ? ( - - {loadError} + + ) : relatedTransactions.length > 0 ? ( @@ -149,11 +167,11 @@ export default function ShopIncomePage() {
{Number(transaction.amount) > 0 ? ( - + ) : ( - + )} - 0 ? "default" : "secondary"}> + 0 ? "success" : "destructive"}> {transaction.type === "topup" ? "充值" : transaction.type === "payment" @@ -168,7 +186,9 @@ export default function ShopIncomePage() { {transaction.description} 0 ? "text-green-600" : "text-red-600"} + className={ + Number(transaction.amount) > 0 ? "text-success" : "text-destructive" + } > {Number(transaction.amount) > 0 ? "+" : ""} {transaction.amount} @@ -178,8 +198,12 @@ export default function ShopIncomePage() { )) ) : ( - - 暂无交易记录 + + )} diff --git a/app/(dashboard)/dashboard/shop/page.tsx b/app/(dashboard)/dashboard/shop/page.tsx index 87d22aa..e6f85d8 100644 --- a/app/(dashboard)/dashboard/shop/page.tsx +++ b/app/(dashboard)/dashboard/shop/page.tsx @@ -3,6 +3,7 @@ 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 { Input } from "@/components/ui/input" import { Label } from "@/components/ui/label" import { Separator } from "@/components/ui/separator" @@ -12,7 +13,7 @@ import { toApiError } from "@/lib/errors" import { useMyShop } from "@/lib/hooks/use-my-shop" import { notifyInfo, notifySuccess } from "@/lib/toast" import type { Shop } from "@/lib/types" -import { DollarSign, Edit, ExternalLink, ListOrdered, Star, Users } from "lucide-react" +import { AlertCircle, DollarSign, Edit, ExternalLink, ListOrdered, Star, Users } from "lucide-react" import Link from "next/link" import { useState } from "react" @@ -20,15 +21,27 @@ export default function ShopManagementPage() { const { shop, setShop, loading, error, refreshShop } = useMyShop() if (loading) { - return
加载中...
+ return ( +
+ +
+ ) } if (error) { - return
{error}
+ return ( +
+ +
+ ) } if (!shop) { - return
当前账号没有可管理的店铺
+ return ( +
+ +
+ ) } return ( @@ -114,7 +127,7 @@ function ShopManagementContent({
- + 总订单 @@ -123,7 +136,7 @@ function ShopManagementContent({
{shop.totalOrders}
- + 评分 @@ -132,7 +145,7 @@ function ShopManagementContent({
{shop.rating}
- + 签约打手 @@ -141,7 +154,7 @@ function ShopManagementContent({
{shop.playerCount}
- + 抽成比例 @@ -156,7 +169,7 @@ function ShopManagementContent({
- + 基本信息 @@ -186,29 +199,33 @@ function ShopManagementContent({
- + 公告管理 - {shop.announcements.map((announcement, index) => ( -
- {announcement} - -
- ))} + {announcement} + + + )) + ) : ( + + )}