feat: connect dashboard shop pages to mutable state
This commit is contained in:
@@ -14,11 +14,12 @@ import {
|
||||
SelectValue,
|
||||
} from "@/components/ui/select"
|
||||
import { Switch } from "@/components/ui/switch"
|
||||
import { mockShops } from "@/lib/mock"
|
||||
import type { Shop } from "@/lib/types"
|
||||
import { useShopStore } from "@/store/shops"
|
||||
|
||||
export default function ShopRulesPage() {
|
||||
const shop = mockShops[0]
|
||||
const shop = useShopStore((state) => state.shops[0])
|
||||
const updateShop = useShopStore((state) => state.updateShop)
|
||||
|
||||
const [allowMultiShop, setAllowMultiShop] = useState(shop.allowMultiShop)
|
||||
const [allowIndependentOrders, setAllowIndependentOrders] = useState(shop.allowIndependentOrders)
|
||||
@@ -27,7 +28,13 @@ export default function ShopRulesPage() {
|
||||
const [commissionValue, setCommissionValue] = useState(shop.commissionValue.toString())
|
||||
|
||||
const handleSave = () => {
|
||||
alert("设置已保存")
|
||||
updateShop(shop.id, {
|
||||
allowMultiShop,
|
||||
allowIndependentOrders,
|
||||
dispatchMode,
|
||||
commissionType,
|
||||
commissionValue: Number(commissionValue),
|
||||
})
|
||||
}
|
||||
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user