feat(douyu): 增加协作单礼包字典与权限控制
This commit is contained in:
@@ -175,6 +175,15 @@ export interface DouyuCollabShop {
|
||||
remark: string;
|
||||
}
|
||||
|
||||
export interface DouyuCollabGift {
|
||||
id: number;
|
||||
name: string;
|
||||
points: number;
|
||||
sort_order: number;
|
||||
is_active: boolean;
|
||||
remark: string;
|
||||
}
|
||||
|
||||
export interface DouyuCollabAccountLookup {
|
||||
found: boolean;
|
||||
ok: boolean;
|
||||
@@ -300,6 +309,24 @@ export const douyuCollabApi = {
|
||||
api.delete<{ success: boolean; name: string; id: number }, { success: boolean; name: string; id: number }>(
|
||||
`/douyu/collab-shops/${id}`,
|
||||
),
|
||||
giftRecords: () =>
|
||||
api.get<DouyuCollabGift[], DouyuCollabGift[]>('/douyu/collab-gifts'),
|
||||
createGift: (data: { name: string; points: number; remark?: string }) =>
|
||||
api.post<DouyuCollabGift, DouyuCollabGift>('/douyu/collab-gifts', data),
|
||||
updateGift: (
|
||||
id: number,
|
||||
data: {
|
||||
name?: string;
|
||||
points?: number;
|
||||
sort_order?: number;
|
||||
is_active?: boolean;
|
||||
remark?: string;
|
||||
},
|
||||
) => api.put<DouyuCollabGift, DouyuCollabGift>(`/douyu/collab-gifts/${id}`, data),
|
||||
deleteGift: (id: number) =>
|
||||
api.delete<{ success: boolean; name: string; id: number }, { success: boolean; name: string; id: number }>(
|
||||
`/douyu/collab-gifts/${id}`,
|
||||
),
|
||||
gifts: () => api.get<string[], string[]>('/douyu/external-orders/gifts'),
|
||||
goods: () => api.get<DouyuCollabGoods[], DouyuCollabGoods[]>('/douyu/external-orders/goods'),
|
||||
refreshGoods: (accountId?: number) =>
|
||||
|
||||
@@ -0,0 +1,345 @@
|
||||
import { useEffect, useState } from 'react';
|
||||
import {
|
||||
Button,
|
||||
Col,
|
||||
Empty,
|
||||
Input,
|
||||
InputNumber,
|
||||
Modal,
|
||||
Popconfirm,
|
||||
Row,
|
||||
Space,
|
||||
Switch,
|
||||
Table,
|
||||
Tag,
|
||||
Tooltip,
|
||||
Typography,
|
||||
} from 'antd';
|
||||
import type { TableProps } from 'antd';
|
||||
import { DeleteOutlined, EditOutlined, PlusOutlined } from '@ant-design/icons';
|
||||
import { douyuCollabApi } from '../api/modules';
|
||||
import type { DouyuCollabGift } from '../api/douyuCollab';
|
||||
import { message } from '../utils/antdMessage';
|
||||
import { getErrorMessage } from '../utils/error';
|
||||
|
||||
const { Text } = Typography;
|
||||
|
||||
/**
|
||||
* 斗鱼协作礼包字典:管理员维护标准礼包名和所需积分,客服只能在下拉里选择。
|
||||
*
|
||||
* - 停用后不再出现在新建下拉里,历史订单不受影响;
|
||||
* - 改名会同步已有订单上的礼包名;
|
||||
* - 改积分只影响之后新建的单,不回填历史订单(避免改变已完成的积分核账);
|
||||
* - 删除只删字典行,仍有订单使用时后端会拒绝。
|
||||
*/
|
||||
export default function DouyuCollabGiftModal({
|
||||
open,
|
||||
gifts,
|
||||
canManage,
|
||||
onClose,
|
||||
onChanged,
|
||||
}: {
|
||||
open: boolean;
|
||||
gifts: DouyuCollabGift[];
|
||||
canManage: boolean;
|
||||
onClose: () => void;
|
||||
onChanged: () => void;
|
||||
}) {
|
||||
const [newName, setNewName] = useState('');
|
||||
const [newPoints, setNewPoints] = useState<number | null>(null);
|
||||
const [busy, setBusy] = useState(false);
|
||||
const [editTarget, setEditTarget] = useState<DouyuCollabGift | null>(null);
|
||||
const [editName, setEditName] = useState('');
|
||||
const [editPoints, setEditPoints] = useState<number | null>(null);
|
||||
const [editRemark, setEditRemark] = useState('');
|
||||
|
||||
useEffect(() => {
|
||||
if (!open) {
|
||||
setNewName('');
|
||||
setNewPoints(null);
|
||||
setEditTarget(null);
|
||||
}
|
||||
}, [open]);
|
||||
|
||||
const create = async () => {
|
||||
const name = newName.trim();
|
||||
if (!name) {
|
||||
message.warning('请先输入礼包名');
|
||||
return;
|
||||
}
|
||||
if (newPoints === null) {
|
||||
message.warning('请填写礼包所需积分');
|
||||
return;
|
||||
}
|
||||
setBusy(true);
|
||||
try {
|
||||
await douyuCollabApi.createGift({ name, points: newPoints });
|
||||
message.success(`已添加礼包「${name}」`);
|
||||
setNewName('');
|
||||
setNewPoints(null);
|
||||
onChanged();
|
||||
} catch (error) {
|
||||
message.error(getErrorMessage(error));
|
||||
} finally {
|
||||
setBusy(false);
|
||||
}
|
||||
};
|
||||
|
||||
const patch = async (
|
||||
gift: DouyuCollabGift,
|
||||
payload: { sort_order?: number; is_active?: boolean; remark?: string },
|
||||
) => {
|
||||
setBusy(true);
|
||||
try {
|
||||
await douyuCollabApi.updateGift(gift.id, payload);
|
||||
onChanged();
|
||||
} catch (error) {
|
||||
message.error(getErrorMessage(error));
|
||||
onChanged();
|
||||
} finally {
|
||||
setBusy(false);
|
||||
}
|
||||
};
|
||||
|
||||
const openEdit = (gift: DouyuCollabGift) => {
|
||||
setEditTarget(gift);
|
||||
setEditName(gift.name);
|
||||
setEditPoints(gift.points);
|
||||
setEditRemark(gift.remark || '');
|
||||
};
|
||||
|
||||
const submitEdit = async () => {
|
||||
if (!editTarget) return;
|
||||
const name = editName.trim();
|
||||
if (!name) {
|
||||
message.warning('礼包名不能为空');
|
||||
return;
|
||||
}
|
||||
if (editPoints === null) {
|
||||
message.warning('请填写礼包所需积分');
|
||||
return;
|
||||
}
|
||||
setBusy(true);
|
||||
try {
|
||||
await douyuCollabApi.updateGift(editTarget.id, {
|
||||
name,
|
||||
points: editPoints,
|
||||
remark: editRemark.trim(),
|
||||
});
|
||||
message.success(`已保存礼包「${name}」`);
|
||||
setEditTarget(null);
|
||||
onChanged();
|
||||
} catch (error) {
|
||||
message.error(getErrorMessage(error));
|
||||
} finally {
|
||||
setBusy(false);
|
||||
}
|
||||
};
|
||||
|
||||
const remove = async (gift: DouyuCollabGift) => {
|
||||
setBusy(true);
|
||||
try {
|
||||
await douyuCollabApi.deleteGift(gift.id);
|
||||
message.success(`已删除礼包「${gift.name}」`);
|
||||
onChanged();
|
||||
} catch (error) {
|
||||
message.error(getErrorMessage(error));
|
||||
} finally {
|
||||
setBusy(false);
|
||||
}
|
||||
};
|
||||
|
||||
const columns: TableProps<DouyuCollabGift>['columns'] = [
|
||||
{
|
||||
title: '礼包名',
|
||||
dataIndex: 'name',
|
||||
width: 260,
|
||||
render: (value: string, row) => (
|
||||
<Space size={4}>
|
||||
<Text strong>{value}</Text>
|
||||
{!row.is_active && <Tag>已停用</Tag>}
|
||||
{canManage && (
|
||||
<Tooltip title="编辑名称、积分和备注">
|
||||
<Button
|
||||
size="small"
|
||||
type="text"
|
||||
icon={<EditOutlined />}
|
||||
disabled={busy}
|
||||
onClick={() => openEdit(row)}
|
||||
/>
|
||||
</Tooltip>
|
||||
)}
|
||||
</Space>
|
||||
),
|
||||
},
|
||||
{
|
||||
title: '所需积分',
|
||||
dataIndex: 'points',
|
||||
width: 110,
|
||||
render: (value: number) => <Text strong>{value}</Text>,
|
||||
},
|
||||
{
|
||||
title: '排序',
|
||||
dataIndex: 'sort_order',
|
||||
width: 100,
|
||||
render: (value: number, row) => (
|
||||
<InputNumber
|
||||
size="small"
|
||||
value={value}
|
||||
disabled={!canManage || busy}
|
||||
onChange={(next) => {
|
||||
if (next === null || next === value) return;
|
||||
void patch(row, { sort_order: Number(next) });
|
||||
}}
|
||||
/>
|
||||
),
|
||||
},
|
||||
{
|
||||
title: '新建时可选',
|
||||
dataIndex: 'is_active',
|
||||
width: 120,
|
||||
align: 'center',
|
||||
render: (value: boolean, row) => (
|
||||
<Switch
|
||||
size="small"
|
||||
checked={value}
|
||||
disabled={!canManage || busy}
|
||||
checkedChildren="启用"
|
||||
unCheckedChildren="停用"
|
||||
onChange={(checked) => void patch(row, { is_active: checked })}
|
||||
/>
|
||||
),
|
||||
},
|
||||
{
|
||||
title: '备注',
|
||||
dataIndex: 'remark',
|
||||
render: (value: string, row) => (
|
||||
<Input
|
||||
size="small"
|
||||
defaultValue={value}
|
||||
disabled={!canManage || busy}
|
||||
placeholder="备注(失焦保存)"
|
||||
onBlur={(event) => {
|
||||
const next = event.target.value.trim();
|
||||
if (next !== value) void patch(row, { remark: next });
|
||||
}}
|
||||
/>
|
||||
),
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
width: 80,
|
||||
align: 'center',
|
||||
render: (_, row) =>
|
||||
canManage ? (
|
||||
<Popconfirm
|
||||
title={`删除礼包「${row.name}」?`}
|
||||
description="仍有协作单使用该礼包时会被拒绝,可改用停用"
|
||||
onConfirm={() => void remove(row)}
|
||||
disabled={busy}
|
||||
>
|
||||
<Button size="small" danger type="text" icon={<DeleteOutlined />} disabled={busy} />
|
||||
</Popconfirm>
|
||||
) : (
|
||||
<Text type="secondary">-</Text>
|
||||
),
|
||||
},
|
||||
];
|
||||
|
||||
return (
|
||||
<>
|
||||
<Modal
|
||||
title="礼包管理"
|
||||
open={open}
|
||||
onCancel={onClose}
|
||||
footer={<Button onClick={onClose}>关闭</Button>}
|
||||
width={900}
|
||||
destroyOnHidden
|
||||
>
|
||||
<Space direction="vertical" size={10} style={{ width: '100%' }}>
|
||||
<Text type="secondary">
|
||||
先在这里维护标准礼包名和所需积分,新建协作单时直接选择。礼包名请按兑换记录里的名称填写;
|
||||
停用只是不再出现在新建选择里,历史订单不受影响;改名会同步已有订单,改积分只影响之后新建的单。
|
||||
</Text>
|
||||
{canManage && (
|
||||
<Row gutter={8}>
|
||||
<Col flex="auto">
|
||||
<Input
|
||||
placeholder="礼包名(按兑换记录标准名填写),回车添加"
|
||||
value={newName}
|
||||
maxLength={128}
|
||||
onChange={(event) => setNewName(event.target.value)}
|
||||
onPressEnter={() => void create()}
|
||||
/>
|
||||
</Col>
|
||||
<Col>
|
||||
<InputNumber
|
||||
style={{ width: 140 }}
|
||||
min={0}
|
||||
precision={0}
|
||||
placeholder="所需积分"
|
||||
value={newPoints}
|
||||
onChange={(value) => setNewPoints(value ?? null)}
|
||||
/>
|
||||
</Col>
|
||||
<Col>
|
||||
<Button type="primary" icon={<PlusOutlined />} loading={busy} onClick={() => void create()}>
|
||||
添加
|
||||
</Button>
|
||||
</Col>
|
||||
</Row>
|
||||
)}
|
||||
<Table<DouyuCollabGift>
|
||||
rowKey="id"
|
||||
size="small"
|
||||
columns={columns}
|
||||
dataSource={gifts}
|
||||
pagination={false}
|
||||
scroll={{ y: 340 }}
|
||||
locale={{
|
||||
emptyText: <Empty image={Empty.PRESENTED_IMAGE_SIMPLE} description="还没有礼包,先加一个" />,
|
||||
}}
|
||||
/>
|
||||
</Space>
|
||||
</Modal>
|
||||
|
||||
<Modal
|
||||
title={editTarget ? `编辑礼包「${editTarget.name}」` : '编辑礼包'}
|
||||
open={!!editTarget}
|
||||
onCancel={() => setEditTarget(null)}
|
||||
onOk={() => void submitEdit()}
|
||||
confirmLoading={busy}
|
||||
okText="保存"
|
||||
destroyOnHidden
|
||||
>
|
||||
<Space direction="vertical" size={10} style={{ width: '100%' }}>
|
||||
<Input
|
||||
value={editName}
|
||||
maxLength={128}
|
||||
autoFocus
|
||||
placeholder="礼包名"
|
||||
onChange={(event) => setEditName(event.target.value)}
|
||||
onPressEnter={() => void submitEdit()}
|
||||
/>
|
||||
<InputNumber
|
||||
style={{ width: '100%' }}
|
||||
min={0}
|
||||
precision={0}
|
||||
value={editPoints}
|
||||
placeholder="所需积分"
|
||||
onChange={(value) => setEditPoints(value ?? null)}
|
||||
/>
|
||||
<Input
|
||||
value={editRemark}
|
||||
maxLength={255}
|
||||
placeholder="备注(可选)"
|
||||
onChange={(event) => setEditRemark(event.target.value)}
|
||||
/>
|
||||
<Text type="secondary">
|
||||
改名会同步已有协作单上的礼包名;修改积分只影响之后新建的协作单,不会改变历史订单。
|
||||
</Text>
|
||||
</Space>
|
||||
</Modal>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -3,7 +3,7 @@ import { useEffect, useRef, useState } from 'react';
|
||||
export interface CollabRealtimeEvent {
|
||||
type: 'collab.ready' | 'collab.ping' | 'collab.invalidate';
|
||||
revision: number;
|
||||
scope?: 'orders' | 'shops' | 'all';
|
||||
scope?: 'orders' | 'shops' | 'gifts' | 'all';
|
||||
action?: string;
|
||||
actor_id?: number | null;
|
||||
at?: string;
|
||||
|
||||
@@ -3,6 +3,7 @@ import { useNavigate } from 'react-router-dom';
|
||||
import {
|
||||
Alert,
|
||||
App,
|
||||
AutoComplete,
|
||||
Badge,
|
||||
Button,
|
||||
Card,
|
||||
@@ -34,6 +35,7 @@ import {
|
||||
DeleteOutlined,
|
||||
EditOutlined,
|
||||
FormOutlined,
|
||||
GiftOutlined,
|
||||
InboxOutlined,
|
||||
LinkOutlined,
|
||||
PlusOutlined,
|
||||
@@ -47,12 +49,14 @@ import {
|
||||
UserOutlined,
|
||||
} from '@ant-design/icons';
|
||||
import HuyaCollabHomeImageUploader from '../components/HuyaCollabHomeImageUploader';
|
||||
import DouyuCollabGiftModal from '../components/DouyuCollabGiftModal';
|
||||
import DouyuCollabShopModal from '../components/DouyuCollabShopModal';
|
||||
import DouyuCollabShopPicker from '../components/DouyuCollabShopPicker';
|
||||
import { douyuCollabApi } from '../api/modules';
|
||||
import type {
|
||||
DouyuCollabAccountLookup,
|
||||
DouyuCollabCkExportResult,
|
||||
DouyuCollabGift,
|
||||
DouyuCollabGoods,
|
||||
DouyuCollabMetric,
|
||||
DouyuCollabOrder,
|
||||
@@ -213,6 +217,7 @@ export default function DouyuCollabPage() {
|
||||
});
|
||||
const [owners, setOwners] = useState<Array<{ id: number; username: string }>>([]);
|
||||
const [shopRecords, setShopRecords] = useState<DouyuCollabShop[]>([]);
|
||||
const [giftRecords, setGiftRecords] = useState<DouyuCollabGift[]>([]);
|
||||
const [gifts, setGifts] = useState<string[]>([]);
|
||||
const [goods, setGoods] = useState<DouyuCollabGoods[]>([]);
|
||||
const [loading, setLoading] = useState(false);
|
||||
@@ -233,6 +238,7 @@ export default function DouyuCollabPage() {
|
||||
const [archiveScope, setArchiveScope] = useState<'active' | 'archived' | 'all'>('active');
|
||||
const [includeVoid, setIncludeVoid] = useState(false);
|
||||
const [shopModalOpen, setShopModalOpen] = useState(false);
|
||||
const [giftModalOpen, setGiftModalOpen] = useState(false);
|
||||
const [realtimePending, setRealtimePending] = useState(false);
|
||||
const [realtimePaused, setRealtimePaused] = useState(readRealtimePaused);
|
||||
|
||||
@@ -323,15 +329,17 @@ export default function DouyuCollabPage() {
|
||||
|
||||
const loadMeta = useCallback(async () => {
|
||||
try {
|
||||
const [ownerRows, giftRows, goodsRows, records] = await Promise.all([
|
||||
const [ownerRows, giftRows, goodsRows, giftRecordRows, records] = await Promise.all([
|
||||
douyuCollabApi.owners(),
|
||||
douyuCollabApi.gifts(),
|
||||
douyuCollabApi.goods(),
|
||||
douyuCollabApi.giftRecords(),
|
||||
douyuCollabApi.shopRecords(),
|
||||
]);
|
||||
setOwners(ownerRows);
|
||||
setGifts(giftRows);
|
||||
setGoods(goodsRows);
|
||||
setGiftRecords(giftRecordRows);
|
||||
setShopRecords(records);
|
||||
} catch (error) {
|
||||
message.error(getErrorMessage(error));
|
||||
@@ -354,6 +362,7 @@ export default function DouyuCollabPage() {
|
||||
createOpen ||
|
||||
detailOpen ||
|
||||
shopModalOpen ||
|
||||
giftModalOpen ||
|
||||
batchStatusOpen ||
|
||||
statusTarget ||
|
||||
ckExportOpen ||
|
||||
@@ -561,16 +570,40 @@ export default function DouyuCollabPage() {
|
||||
return () => window.clearTimeout(timer);
|
||||
}, [createOpen, form.account_username, lookupUsername]);
|
||||
|
||||
const handleGiftChange = (commodityId: string) => {
|
||||
const handleGiftNameChange = (value: string) => {
|
||||
const name = value.trim();
|
||||
const pool = lookup?.goods?.length ? lookup.goods : goods;
|
||||
const item = pool.find((row) => row.commodity_id === commodityId);
|
||||
if (!item) return;
|
||||
setForm((previous) => ({
|
||||
...previous,
|
||||
commodity_id: item.commodity_id,
|
||||
gift_name: item.name,
|
||||
required_points: item.score,
|
||||
}));
|
||||
const catalog = giftRecords.find((row) => row.name === name);
|
||||
const item = pool.find((row) => row.name === name);
|
||||
setForm((previous) => {
|
||||
if (!name) {
|
||||
return { ...previous, gift_name: '', commodity_id: '', required_points: null };
|
||||
}
|
||||
if (item) {
|
||||
return {
|
||||
...previous,
|
||||
gift_name: item.name,
|
||||
commodity_id: item.commodity_id,
|
||||
required_points: item.score ?? catalog?.points ?? null,
|
||||
};
|
||||
}
|
||||
if (catalog) {
|
||||
return {
|
||||
...previous,
|
||||
gift_name: catalog.name,
|
||||
commodity_id: '',
|
||||
required_points: catalog.points,
|
||||
};
|
||||
}
|
||||
// 手动填写新礼包:清掉接口商品 ID;如果是从接口选项改成手填,积分也一并清掉,
|
||||
// 避免把上一个礼包的积分带过来。已经手填时保留积分,方便继续改数字。
|
||||
return {
|
||||
...previous,
|
||||
gift_name: name,
|
||||
commodity_id: '',
|
||||
required_points: previous.commodity_id ? null : previous.required_points,
|
||||
};
|
||||
});
|
||||
};
|
||||
|
||||
const submitCreate = async (draft: boolean) => {
|
||||
@@ -1328,21 +1361,43 @@ export default function DouyuCollabPage() {
|
||||
];
|
||||
|
||||
const goodsPool = lookup?.goods?.length ? lookup.goods : goods;
|
||||
const giftOptions = goodsOptions(goodsPool, Boolean(lookup?.goods?.length)).map((item) => ({
|
||||
value: item.value,
|
||||
label: item.label,
|
||||
disabled: item.disabled,
|
||||
}));
|
||||
if (
|
||||
form.commodity_id &&
|
||||
!giftOptions.some((item) => item.value === form.commodity_id)
|
||||
) {
|
||||
giftOptions.unshift({
|
||||
value: form.commodity_id,
|
||||
label: `${form.gift_name || form.commodity_id} · 当前已选`,
|
||||
disabled: false,
|
||||
});
|
||||
}
|
||||
const giftNameOptions = (() => {
|
||||
const options: Array<{ value: string; label: string; disabled: boolean }> = [];
|
||||
const seen = new Set<string>();
|
||||
for (const item of goodsOptions(goodsPool, Boolean(lookup?.goods?.length))) {
|
||||
if (!item.goods.name || seen.has(item.goods.name)) continue;
|
||||
seen.add(item.goods.name);
|
||||
options.push({
|
||||
value: item.goods.name,
|
||||
label: item.label,
|
||||
disabled: item.disabled,
|
||||
});
|
||||
}
|
||||
for (const gift of giftRecords) {
|
||||
if (!gift.is_active || !gift.name || seen.has(gift.name)) continue;
|
||||
seen.add(gift.name);
|
||||
options.push({
|
||||
value: gift.name,
|
||||
label: `${gift.name} · ${gift.points} 积分 · 已配置`,
|
||||
disabled: false,
|
||||
});
|
||||
}
|
||||
if (canManage) {
|
||||
for (const name of gifts) {
|
||||
if (!name || seen.has(name)) continue;
|
||||
seen.add(name);
|
||||
options.push({ value: name, label: `${name} · 历史手填`, disabled: false });
|
||||
}
|
||||
}
|
||||
if (!canManage && form.gift_name && !seen.has(form.gift_name)) {
|
||||
options.unshift({
|
||||
value: form.gift_name,
|
||||
label: `${form.gift_name} · 当前已选`,
|
||||
disabled: false,
|
||||
});
|
||||
}
|
||||
return options;
|
||||
})();
|
||||
|
||||
return (
|
||||
<Space direction="vertical" size={12} style={{ width: '100%' }}>
|
||||
@@ -1637,6 +1692,11 @@ export default function DouyuCollabPage() {
|
||||
刷新活动商品
|
||||
</Button>
|
||||
)}
|
||||
{canManage && (
|
||||
<Button icon={<GiftOutlined />} onClick={() => setGiftModalOpen(true)}>
|
||||
礼包管理
|
||||
</Button>
|
||||
)}
|
||||
{canEdit && (
|
||||
<Button icon={<ShopOutlined />} onClick={() => setShopModalOpen(true)}>
|
||||
店铺管理
|
||||
@@ -1689,6 +1749,14 @@ export default function DouyuCollabPage() {
|
||||
onChanged={refreshAll}
|
||||
/>
|
||||
|
||||
<DouyuCollabGiftModal
|
||||
open={giftModalOpen}
|
||||
gifts={giftRecords}
|
||||
canManage={canManage}
|
||||
onClose={() => setGiftModalOpen(false)}
|
||||
onChanged={refreshAll}
|
||||
/>
|
||||
|
||||
<Modal
|
||||
title={editing ? `编辑协作单 ${editing.order_no}` : '新建协作单'}
|
||||
open={createOpen}
|
||||
@@ -1814,19 +1882,40 @@ export default function DouyuCollabPage() {
|
||||
<Col span={14}>
|
||||
<div style={{ marginBottom: 12 }}>
|
||||
<Text strong>礼包</Text>
|
||||
<Select
|
||||
style={{ width: '100%', marginTop: 4 }}
|
||||
showSearch
|
||||
allowClear
|
||||
optionFilterProp="label"
|
||||
value={form.commodity_id || undefined}
|
||||
options={giftOptions}
|
||||
placeholder={goodsPool.length ? '选择 23返场 / 常驻礼包' : '商品缓存为空,点右上角刷新活动商品'}
|
||||
onChange={handleGiftChange}
|
||||
/>
|
||||
{canManage ? (
|
||||
<AutoComplete
|
||||
style={{ width: '100%', marginTop: 4 }}
|
||||
allowClear
|
||||
value={form.gift_name}
|
||||
options={giftNameOptions}
|
||||
placeholder={
|
||||
goodsPool.length || giftRecords.length
|
||||
? '输入礼包名称,或选择已有礼包'
|
||||
: '输入标准礼包名称(接口未返回商品时手动填写)'
|
||||
}
|
||||
onChange={handleGiftNameChange}
|
||||
/>
|
||||
) : (
|
||||
<Select
|
||||
style={{ width: '100%', marginTop: 4 }}
|
||||
allowClear
|
||||
showSearch
|
||||
optionFilterProp="label"
|
||||
value={form.gift_name || undefined}
|
||||
options={giftNameOptions}
|
||||
placeholder={
|
||||
giftNameOptions.length
|
||||
? '选择礼包(由管理员统一维护)'
|
||||
: '暂无可选礼包,请联系管理员配置'
|
||||
}
|
||||
notFoundContent="没有可选礼包,请联系管理员配置"
|
||||
onChange={handleGiftNameChange}
|
||||
/>
|
||||
)}
|
||||
{form.gift_name && (
|
||||
<Text type="secondary" style={{ fontSize: 12 }}>
|
||||
当前:{form.gift_name}
|
||||
名称请按兑换记录里的标准礼包名填写
|
||||
{form.commodity_id ? ` · 已关联接口商品 ${form.commodity_id}` : ' · 手动配置'}
|
||||
</Text>
|
||||
)}
|
||||
</div>
|
||||
@@ -1837,8 +1926,10 @@ export default function DouyuCollabPage() {
|
||||
<InputNumber
|
||||
style={{ width: '100%', marginTop: 4 }}
|
||||
min={0}
|
||||
precision={0}
|
||||
value={form.required_points}
|
||||
placeholder="选中礼包自动带出"
|
||||
disabled={!canManage}
|
||||
placeholder={canManage ? '手动填写;选择礼包后自动带出' : '由管理员统一配置'}
|
||||
onChange={(value) => updateForm('required_points', value ?? null)}
|
||||
/>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user