From a927be36f203af3ead2bb7b1d01a85e62b0fd083 Mon Sep 17 00:00:00 2001 From: yml2213 Date: Sun, 8 Nov 2026 14:53:27 +0800 Subject: [PATCH] =?UTF-8?q?feat(weibo):=20=E4=BC=98=E5=8C=96=E5=A4=96?= =?UTF-8?q?=E9=83=A8=E5=8D=95=E5=8D=8F=E4=BD=9C=E5=BB=BA=E5=8D=95=E7=95=8C?= =?UTF-8?q?=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/HuyaCollabShopPicker.tsx | 3 +- web/frontend/src/pages/WeiboCollabPage.tsx | 248 ++++++++++++------ 2 files changed, 167 insertions(+), 84 deletions(-) diff --git a/web/frontend/src/components/HuyaCollabShopPicker.tsx b/web/frontend/src/components/HuyaCollabShopPicker.tsx index 710a255..6d72e52 100644 --- a/web/frontend/src/components/HuyaCollabShopPicker.tsx +++ b/web/frontend/src/components/HuyaCollabShopPicker.tsx @@ -4,6 +4,7 @@ import { PlusOutlined } from '@ant-design/icons'; import type { HuyaCollabShop } from '../api/modules'; const { Text } = Typography; +type ShopOption = Pick; /** * 店铺选择器:**一个店铺一个独立按钮**(中间留白),不做下拉。 @@ -27,7 +28,7 @@ export default function HuyaCollabShopPicker({ onChange, }: { value?: string | null; - shops: HuyaCollabShop[]; + shops: ShopOption[]; disabled?: boolean; includeInactive?: boolean; allowCustom?: boolean; diff --git a/web/frontend/src/pages/WeiboCollabPage.tsx b/web/frontend/src/pages/WeiboCollabPage.tsx index f04ae75..581dc1d 100644 --- a/web/frontend/src/pages/WeiboCollabPage.tsx +++ b/web/frontend/src/pages/WeiboCollabPage.tsx @@ -4,6 +4,7 @@ import { AutoComplete, Button, Checkbox, + Col, Descriptions, Drawer, Form, @@ -11,6 +12,7 @@ import { InputNumber, Modal, Popconfirm, + Row, Select, Space, Statistic, @@ -35,6 +37,7 @@ import { UndoOutlined, } from '@ant-design/icons'; import HuyaCollabHomeImageUploader from '../components/HuyaCollabHomeImageUploader'; +import HuyaCollabShopPicker from '../components/HuyaCollabShopPicker'; import { weiboCollabApi, type WeiboCollabAccountLookup, @@ -71,6 +74,12 @@ const STATUS_META: Record = void: { label: '已作废', color: 'default' }, }; +const ACCOUNT_CK_LABELS: Record = { + valid: '有效', + invalid: '失效', + error: '查询失败', +}; + const STATUS_ORDER: WeiboCollabStatus[] = [ 'incomplete', 'to_recharge', @@ -247,6 +256,7 @@ export default function WeiboCollabPage() { const accountOptions = accounts.map((item) => ({ value: item.id, label: `${item.nickname || item.uid} · UID ${item.uid}${item.game_role_name ? ` · ${item.game_role_name}` : ''}`, + title: item.nickname || `UID ${item.uid}`, })); const liveGoodsOptions = (lookup?.goods || []).map((item) => ({ @@ -263,7 +273,7 @@ export default function WeiboCollabPage() { .filter((item) => item.is_active) .map((item) => ({ value: item.name, - label: `${item.name} · ${item.price} 微豆(字典)`, + label: `${item.name} · ${item.price} 微豆(自定义)`, goods: { name: item.name, price: item.price, @@ -280,8 +290,8 @@ export default function WeiboCollabPage() { goods_id: number | null; goods_image: string; }; - }> = [...liveGoodsOptions]; - for (const option of catalogGoodsOptions) { + }> = [...catalogGoodsOptions]; + for (const option of liveGoodsOptions) { if (!goodsOptions.some((item) => item.value === option.value)) goodsOptions.push(option); } @@ -569,6 +579,14 @@ export default function WeiboCollabPage() { ); const columns: TableProps['columns'] = [ + { + title: '序号', + key: 'index', + width: 72, + align: 'center', + fixed: 'left', + render: (_, __, index) => (page - 1) * pageSize + index + 1, + }, { title: '订单编号', dataIndex: 'order_no', @@ -748,11 +766,6 @@ export default function WeiboCollabPage() { - {canEdit && ( - - )} @@ -877,6 +890,11 @@ export default function WeiboCollabPage() { + {canEdit && ( + + )} @@ -944,66 +962,82 @@ export default function WeiboCollabPage() { void saveOrder()} onCancel={() => setEditOpen(false)} + styles={{ body: { maxHeight: '78vh', overflowY: 'auto', paddingRight: 12 } }} destroyOnHidden >
- - - - - - ({ value: item.name }))} - placeholder="可输入新店铺" - filterOption - /> - - - void lookupAccount(value)} - /> - - - - - - - - + + + + + + + + + void lookupAccount(value)} + /> + + + + + + + + + + + + + @@ -1011,30 +1045,78 @@ export default function WeiboCollabPage() { {lookup && ( - 0 - ? `同账号已有 ${lookup.orders_using_account.length} 单:${lookup.orders_using_account - .map((item) => item.order_no) - .join('、')}` - : undefined - } - /> + <> + + {lookup.ok && ( + 0 + ? lookup.orders_using_account + .map( + (item) => + `${item.order_no}(${item.status_label || item.status})`, + ) + .join('、') + : '暂无', + }, + ]} + /> + )} + )} - - - - -