feat: add shop dashboard order overview, income stats, and rule settings pages

This commit is contained in:
zetaloop
2026-02-20 23:04:38 +08:00
parent 1362a29755
commit 7e632ce092
4 changed files with 386 additions and 1 deletions
@@ -0,0 +1,143 @@
"use client"
import { Save } from "lucide-react"
import { useState } from "react"
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 { Switch } from "@/components/ui/switch"
import { mockShops } from "@/lib/mock-data"
export default function ShopRulesPage() {
const shop = mockShops[0]
const [allowMultiShop, setAllowMultiShop] = useState(shop.allowMultiShop)
const [allowIndependentOrders, setAllowIndependentOrders] = useState(shop.allowIndependentOrders)
const [dispatchMode, setDispatchMode] = useState(shop.dispatchMode)
const [commissionType, setCommissionType] = useState(shop.commissionType)
const [commissionValue, setCommissionValue] = useState(shop.commissionValue.toString())
const handleSave = () => {
alert("设置已保存")
}
return (
<div className="space-y-6">
<div className="flex items-center justify-between">
<h1 className="text-2xl font-bold"></h1>
<Button onClick={handleSave}>
<Save className="mr-2 h-4 w-4" />
</Button>
</div>
<div className="grid gap-6">
<Card>
<CardHeader>
<CardTitle className="text-base"></CardTitle>
</CardHeader>
<CardContent className="space-y-6">
<div className="flex items-center justify-between space-x-2">
<Label htmlFor="allow-multi-shop" className="flex flex-col space-y-1">
<span></span>
<span className="font-normal text-sm text-muted-foreground">
</span>
</Label>
<Switch
id="allow-multi-shop"
checked={allowMultiShop}
onCheckedChange={setAllowMultiShop}
/>
</div>
<div className="flex items-center justify-between space-x-2">
<Label htmlFor="allow-independent" className="flex flex-col space-y-1">
<span></span>
<span className="font-normal text-sm text-muted-foreground">
</span>
</Label>
<Switch
id="allow-independent"
checked={allowIndependentOrders}
onCheckedChange={setAllowIndependentOrders}
/>
</div>
</CardContent>
</Card>
<Card>
<CardHeader>
<CardTitle className="text-base"></CardTitle>
</CardHeader>
<CardContent className="space-y-4">
<div className="space-y-2">
<Label></Label>
<Select
value={dispatchMode}
onValueChange={(v: "manual" | "auto") => setDispatchMode(v)}
>
<SelectTrigger>
<SelectValue />
</SelectTrigger>
<SelectContent>
<SelectItem value="manual"></SelectItem>
<SelectItem value="auto"></SelectItem>
</SelectContent>
</Select>
<p className="text-sm text-muted-foreground">
</p>
</div>
</CardContent>
</Card>
<Card>
<CardHeader>
<CardTitle className="text-base"></CardTitle>
</CardHeader>
<CardContent className="space-y-4">
<div className="grid gap-4 sm:grid-cols-2">
<div className="space-y-2">
<Label></Label>
<Select
value={commissionType}
onValueChange={(v: "fixed" | "percentage") => setCommissionType(v)}
>
<SelectTrigger>
<SelectValue />
</SelectTrigger>
<SelectContent>
<SelectItem value="fixed"></SelectItem>
<SelectItem value="percentage"></SelectItem>
</SelectContent>
</Select>
</div>
<div className="space-y-2">
<Label></Label>
<div className="relative">
<Input
type="number"
value={commissionValue}
onChange={(e) => setCommissionValue(e.target.value)}
/>
<div className="absolute right-3 top-2.5 text-sm text-muted-foreground">
{commissionType === "percentage" ? "%" : "元"}
</div>
</div>
</div>
</div>
</CardContent>
</Card>
</div>
</div>
)
}