Files
juwan-frontend/app/(dashboard)/dashboard/shop/page.tsx
T

141 lines
5.3 KiB
TypeScript

import { DollarSign, Edit, ExternalLink, ListOrdered, Star, 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 { Input } from "@/components/ui/input"
import { Label } from "@/components/ui/label"
import { Separator } from "@/components/ui/separator"
import { Textarea } from "@/components/ui/textarea"
import { mockShops } from "@/lib/mock"
export default function ShopManagementPage() {
const shop = mockShops[0]
return (
<div className="space-y-6">
<div className="flex items-center justify-between">
<h1 className="text-2xl font-bold"></h1>
<Button variant="outline" size="sm" asChild>
<Link href={`/shop/${shop.id}`}>
<ExternalLink className="mr-1 h-4 w-4" />
</Link>
</Button>
</div>
<div className="grid gap-4 sm:grid-cols-2 lg:grid-cols-4">
<Card>
<CardHeader className="flex flex-row items-center justify-between pb-2">
<CardTitle className="text-sm font-medium"></CardTitle>
<ListOrdered className="h-4 w-4 text-muted-foreground" />
</CardHeader>
<CardContent>
<div className="text-2xl font-bold">{shop.totalOrders}</div>
</CardContent>
</Card>
<Card>
<CardHeader className="flex flex-row items-center justify-between pb-2">
<CardTitle className="text-sm font-medium"></CardTitle>
<Star className="h-4 w-4 text-muted-foreground" />
</CardHeader>
<CardContent>
<div className="text-2xl font-bold">{shop.rating}</div>
</CardContent>
</Card>
<Card>
<CardHeader className="flex flex-row items-center justify-between pb-2">
<CardTitle className="text-sm font-medium"></CardTitle>
<Users className="h-4 w-4 text-muted-foreground" />
</CardHeader>
<CardContent>
<div className="text-2xl font-bold">{shop.playerCount}</div>
</CardContent>
</Card>
<Card>
<CardHeader className="flex flex-row items-center justify-between pb-2">
<CardTitle className="text-sm font-medium"></CardTitle>
<DollarSign className="h-4 w-4 text-muted-foreground" />
</CardHeader>
<CardContent>
<div className="text-2xl font-bold">
{shop.commissionType === "percentage"
? `${shop.commissionValue}%`
: `¥${shop.commissionValue}`}
</div>
</CardContent>
</Card>
</div>
<Card>
<CardHeader>
<CardTitle className="text-base"></CardTitle>
</CardHeader>
<CardContent className="space-y-4">
<div className="space-y-2">
<Label htmlFor="shop-name"></Label>
<Input id="shop-name" defaultValue={shop.name} />
</div>
<div className="space-y-2">
<Label htmlFor="shop-desc"></Label>
<Textarea id="shop-desc" defaultValue={shop.description} rows={3} />
</div>
<Button>
<Edit className="mr-1 h-4 w-4" />
</Button>
</CardContent>
</Card>
<Card>
<CardHeader>
<CardTitle className="text-base"></CardTitle>
</CardHeader>
<CardContent className="space-y-3">
{shop.announcements.map((announcement) => (
<div
key={announcement}
className="flex items-center justify-between rounded-md border p-3"
>
<span className="text-sm">{announcement}</span>
<Button variant="ghost" size="sm">
</Button>
</div>
))}
<Separator />
<Button variant="outline" size="sm">
</Button>
</CardContent>
</Card>
<Card>
<CardHeader>
<CardTitle className="text-base"></CardTitle>
</CardHeader>
<CardContent className="space-y-3 text-sm">
<div className="flex items-center justify-between">
<span className="text-muted-foreground"></span>
<Badge variant="outline">
{shop.dispatchMode === "manual" ? "手动派单" : "自动派单"}
</Badge>
</div>
<div className="flex items-center justify-between">
<span className="text-muted-foreground"></span>
<Badge variant={shop.allowMultiShop ? "default" : "secondary"}>
{shop.allowMultiShop ? "是" : "否"}
</Badge>
</div>
<div className="flex items-center justify-between">
<span className="text-muted-foreground"></span>
<Badge variant={shop.allowIndependentOrders ? "default" : "secondary"}>
{shop.allowIndependentOrders ? "是" : "否"}
</Badge>
</div>
</CardContent>
</Card>
</div>
)
}