导入和平精英商品目录并优化皮肤列表展示
- 皮肤增加 sku 字段,启动时按 sku 幂等导入 27 个和平精英商品 - 佣金默认 0,支持中英文名搜索 - 列表去掉品类列并固定列宽,避免中文名列空白过大 - 新增商品中英文名对照文档
This commit is contained in:
@@ -51,7 +51,12 @@ export default function Skins() {
|
||||
const openCreate = () => {
|
||||
setEditing(null)
|
||||
form.resetFields()
|
||||
form.setFieldsValue({ stock: -1, commission: 0.1, status: 1 })
|
||||
form.setFieldsValue({
|
||||
game: '和平精英',
|
||||
stock: -1,
|
||||
commission: 0,
|
||||
status: 1,
|
||||
})
|
||||
setOpen(true)
|
||||
}
|
||||
|
||||
@@ -99,20 +104,26 @@ export default function Skins() {
|
||||
|
||||
const columns: ColumnsType<Skin> = [
|
||||
{ title: 'ID', dataIndex: 'id', width: 70 },
|
||||
{ title: '名称', dataIndex: 'name' },
|
||||
{ title: '游戏', dataIndex: 'game', width: 120 },
|
||||
{ title: '分类', dataIndex: 'category', width: 100 },
|
||||
{ title: '中文名', dataIndex: 'name', width: 180, ellipsis: true },
|
||||
{
|
||||
title: '英文名',
|
||||
dataIndex: 'sku',
|
||||
width: 220,
|
||||
ellipsis: true,
|
||||
render: (v: string) => <Typography.Text code>{v}</Typography.Text>,
|
||||
},
|
||||
{ title: '游戏', dataIndex: 'game', width: 100 },
|
||||
{
|
||||
title: '售价',
|
||||
dataIndex: 'price',
|
||||
width: 100,
|
||||
render: (v: number) => `¥${v.toFixed(2)}`,
|
||||
render: (v: number) => `¥${Number(v ?? 0).toFixed(2)}`,
|
||||
},
|
||||
{
|
||||
title: '佣金比例',
|
||||
dataIndex: 'commission',
|
||||
width: 100,
|
||||
render: (v: number) => `${(v * 100).toFixed(0)}%`,
|
||||
render: (v: number) => `${((v ?? 0) * 100).toFixed(0)}%`,
|
||||
},
|
||||
{
|
||||
title: '库存',
|
||||
@@ -130,7 +141,7 @@ export default function Skins() {
|
||||
{
|
||||
title: '操作',
|
||||
key: 'action',
|
||||
width: isAdmin ? 200 : 100,
|
||||
width: isAdmin ? 140 : 80,
|
||||
render: (_, record) => (
|
||||
<Space>
|
||||
{isAdmin ? (
|
||||
@@ -145,7 +156,12 @@ export default function Skins() {
|
||||
</Popconfirm>
|
||||
</>
|
||||
) : (
|
||||
<Button type="link" size="small" disabled={record.status !== 1} onClick={() => onOrder(record)}>
|
||||
<Button
|
||||
type="link"
|
||||
size="small"
|
||||
disabled={record.status !== 1}
|
||||
onClick={() => onOrder(record)}
|
||||
>
|
||||
下单
|
||||
</Button>
|
||||
)}
|
||||
@@ -162,13 +178,13 @@ export default function Skins() {
|
||||
</Typography.Title>
|
||||
<Space>
|
||||
<Input.Search
|
||||
placeholder="搜索名称"
|
||||
placeholder="搜索中文名 / 英文名"
|
||||
allowClear
|
||||
onSearch={(v) => {
|
||||
setPage(1)
|
||||
setKeyword(v)
|
||||
}}
|
||||
style={{ width: 220 }}
|
||||
style={{ width: 240 }}
|
||||
/>
|
||||
<Button icon={<ReloadOutlined />} onClick={load}>
|
||||
刷新
|
||||
@@ -186,6 +202,7 @@ export default function Skins() {
|
||||
loading={loading}
|
||||
columns={columns}
|
||||
dataSource={list}
|
||||
tableLayout="fixed"
|
||||
pagination={{
|
||||
current: page,
|
||||
pageSize: size,
|
||||
@@ -207,15 +224,39 @@ export default function Skins() {
|
||||
width={560}
|
||||
>
|
||||
<Form form={form} layout="vertical" style={{ marginTop: 16 }}>
|
||||
<Form.Item name="name" label="名称" rules={[{ required: true }]}>
|
||||
<Input />
|
||||
<Form.Item name="name" label="中文名" rules={[{ required: true }]}>
|
||||
<Input placeholder="如:套装-糯粉咩咩" />
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
name="sku"
|
||||
label="英文名 (sku)"
|
||||
rules={[{ required: true, message: '请填写英文固定标识' }]}
|
||||
>
|
||||
<Input placeholder="如:suit_pink_sheep" disabled={!!editing} />
|
||||
</Form.Item>
|
||||
<Space style={{ width: '100%' }} size="middle">
|
||||
<Form.Item name="game" label="游戏" style={{ width: 240 }}>
|
||||
<Input />
|
||||
<Select
|
||||
options={[
|
||||
{ value: '和平精英', label: '和平精英' },
|
||||
{ value: '王者荣耀', label: '王者荣耀' },
|
||||
{ value: '英雄联盟', label: '英雄联盟' },
|
||||
]}
|
||||
/>
|
||||
</Form.Item>
|
||||
<Form.Item name="category" label="分类" style={{ width: 240 }}>
|
||||
<Input />
|
||||
<Form.Item name="category" label="品类" style={{ width: 240 }}>
|
||||
<Select
|
||||
allowClear
|
||||
options={[
|
||||
{ value: '套装', label: '套装' },
|
||||
{ value: '上衣', label: '上衣' },
|
||||
{ value: '背包', label: '背包' },
|
||||
{ value: '头盔', label: '头盔' },
|
||||
{ value: '枪械', label: '枪械' },
|
||||
{ value: '投掷物', label: '投掷物' },
|
||||
{ value: '礼包', label: '礼包' },
|
||||
]}
|
||||
/>
|
||||
</Form.Item>
|
||||
</Space>
|
||||
<Space style={{ width: '100%' }} size="middle">
|
||||
|
||||
@@ -12,6 +12,7 @@ export interface User {
|
||||
export interface Skin {
|
||||
id: number
|
||||
name: string
|
||||
sku: string
|
||||
game: string
|
||||
category: string
|
||||
cover_url: string
|
||||
|
||||
Reference in New Issue
Block a user