import AddOutlined from "@mui/icons-material/AddOutlined"; import DeleteOutlineOutlined from "@mui/icons-material/DeleteOutlineOutlined"; import SaveOutlined from "@mui/icons-material/SaveOutlined"; import Drawer from "@mui/material/Drawer"; import IconButton from "@mui/material/IconButton"; import TextField from "@mui/material/TextField"; import { AdminSwitch } from "@/shared/ui/AdminSwitch.jsx"; import { Button } from "@/shared/ui/Button.jsx"; import styles from "@/features/red-packets/red-packets.module.css"; export function RedPacketConfigDrawer({ abilities, configLoading, configSaving, form, onClose, onSubmit, open, setForm, }) { const disabled = !abilities.canUpdate || configLoading || configSaving; const updateValue = (key, value) => { setForm((current) => ({ ...current, [key]: value })); }; const updateTier = (key, index, value) => { setForm((current) => ({ ...current, [key]: (current[key] || []).map((item, itemIndex) => (itemIndex === index ? value : item)), })); }; const addTier = (key) => { setForm((current) => ({ ...current, [key]: [...(current[key] || []), ""] })); }; const removeTier = (key, index) => { setForm((current) => ({ ...current, [key]: (current[key] || []).filter((_, itemIndex) => itemIndex !== index), })); }; return (

红包配置

发放状态
updateValue("enabled", event.target.checked)} />
updateValue("delayedOpenSeconds", event.target.value)} /> updateValue("expireSeconds", event.target.value)} /> updateValue("dailySendLimit", event.target.value)} />
); } function TierSection({ disabled, label, onAdd, onRemove, onUpdate, tierKey, values }) { return (
{label}
{(values || []).map((value, index) => (
onUpdate(tierKey, index, event.target.value)} /> onRemove(tierKey, index)} >
))}
); }