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 MenuItem from "@mui/material/MenuItem"; import TextField from "@mui/material/TextField"; import { AdminSwitch } from "@/shared/ui/AdminSwitch.jsx"; import { Button } from "@/shared/ui/Button.jsx"; import { ResourceGroupSelectField } from "@/shared/ui/ResourceGroupSelectDrawer.jsx"; import styles from "@/features/first-recharge-reward/first-recharge-reward.module.css"; const statusOptions = [ ["active", "启用"], ["inactive", "停用"], ]; export function FirstRechargeRewardConfigDrawer({ abilities, configLoading, configSaving, form, onClose, onSubmit, open, resourceGroups, setForm, }) { const disabled = !abilities.canUpdate || configLoading || configSaving; const addTier = () => { setForm((current) => ({ ...current, tiers: [ ...(current.tiers || []), { tierId: 0, tierCode: "", tierName: "", minCoinAmount: "", maxCoinAmount: "", resourceGroupId: "", status: "active", sortOrder: String((current.tiers || []).length), }, ], })); }; const updateTier = (index, patch) => { setForm((current) => ({ ...current, tiers: (current.tiers || []).map((tier, tierIndex) => (tierIndex === index ? { ...tier, ...patch } : tier)), })); }; const removeTier = (index) => { setForm((current) => ({ ...current, tiers: (current.tiers || []).filter((_, tierIndex) => tierIndex !== index), })); }; return (

首冲奖励配置

发放状态
setForm((current) => ({ ...current, enabled: event.target.checked }))} />
奖励档位
{(form.tiers || []).map((tier, index) => (
档位 {index + 1} removeTier(index)} >
updateTier(index, { tierCode: event.target.value })} /> updateTier(index, { tierName: event.target.value })} /> updateTier(index, { minCoinAmount: event.target.value })} /> updateTier(index, { maxCoinAmount: event.target.value })} /> updateTier(index, { resourceGroupId: value })} /> updateTier(index, { status: event.target.value })} > {statusOptions.map(([value, label]) => ( {label} ))} updateTier(index, { sortOrder: event.target.value })} />
))} {!form.tiers?.length ?
暂无档位
: null}
); }