refactor(catalog): 废弃 LEWAN_ 镜像,统一英文 SKU 与积分价,商品图按 SKU 缓存

对外目录只保留英文主 sku;迁移硬删镜像并校准 1元=100积分;发货页/凭证优先使用 local {sku}.webp。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
yml2213
2026-09-14 20:00:26 +08:00
co-authored by Cursor
parent bf9614569e
commit df1a170d44
57 changed files with 1052 additions and 171 deletions
+72 -18
View File
@@ -63,15 +63,29 @@ export function ProductsTab({
loading,
products,
canManage,
filters,
onToggleProduct,
onDeleteProduct,
onFilterChange,
onLoadProducts,
}: {
loading: boolean
products: PageResult<MerchantProduct>
canManage: boolean
filters: { keyword: string; status: string }
onToggleProduct: (record: MerchantProduct) => void
onDeleteProduct: (record: MerchantProduct) => void
onFilterChange: (filters: { keyword: string; status: string }) => void
onLoadProducts: (page?: number, size?: number) => void
}) {
const [keyword, setKeyword] = useState(filters.keyword)
useEffect(() => {
setKeyword(filters.keyword)
}, [filters.keyword])
const submitKeyword = () => onFilterChange({ ...filters, keyword: keyword.trim() })
const productColumns: ColumnsType<MerchantProduct> = [
{
title: '商户 SKU',
@@ -128,19 +142,34 @@ export function ProductsTab({
{
title: '操作',
key: 'action',
width: 90,
width: 140,
fixed: 'right',
render: (_, record) => canManage ? (
<Popconfirm
title={record.status === 'active' ? '下架该商品?' : '上架该商品?'}
description={record.status === 'active' ? '下架后商户将无法再创建该商品订单' : '上架后商户可正常下单'}
okText="确认"
onConfirm={() => onToggleProduct(record)}
>
<Button type="link" size="small">
{record.status === 'active' ? '下架' : '上架'}
</Button>
</Popconfirm>
<Space size={0}>
<Popconfirm
title={record.status === 'active' ? '下架该商品?' : '上架该商品?'}
description={record.status === 'active' ? '下架后商户将无法再创建该商品订单' : '上架后商户可正常下单'}
okText="确认"
onConfirm={() => onToggleProduct(record)}
>
<Button type="link" size="small">
{record.status === 'active' ? '下架' : '上架'}
</Button>
</Popconfirm>
{record.status === 'inactive' && (
<Popconfirm
title="删除该商品?"
description="仅从商品列表移除(软删除),历史订单不受影响。删除后不可在此恢复。"
okText="删除"
okButtonProps={{ danger: true }}
onConfirm={() => onDeleteProduct(record)}
>
<Button type="link" size="small" danger>
删除
</Button>
</Popconfirm>
)}
</Space>
) : '-',
},
]
@@ -148,15 +177,40 @@ export function ProductsTab({
return (
<Space direction="vertical" style={{ width: '100%' }} size="middle">
<Card size="small" style={{ background: '#f8fafc', border: '1px solid #e2e8f0', borderRadius: 8 }}>
<div style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between' }}>
<div>
<span style={{ fontWeight: 600, color: '#0f172a', marginRight: 8 }}>商品上架与售卖管理</span>
<Typography.Text type="secondary" style={{ fontSize: 13 }}>
商户可自主上架/下架商品;下架后不可再创建该商品订单。
</Typography.Text>
</div>
<div>
<span style={{ fontWeight: 600, color: '#0f172a', marginRight: 8 }}>商品上架与售卖管理</span>
<Typography.Text type="secondary" style={{ fontSize: 13 }}>
可按状态与关键词筛选;已下架商品可删除。
</Typography.Text>
</div>
</Card>
<Space wrap>
<Input.Search
allowClear
placeholder="SKU / 商品名称"
value={keyword}
onChange={(e) => setKeyword(e.target.value)}
onSearch={submitKeyword}
style={{ width: 240 }}
/>
<Select
allowClear
placeholder="状态"
value={filters.status || undefined}
style={{ width: 120 }}
options={[
{ value: 'active', label: '已上架' },
{ value: 'inactive', label: '已下架' },
]}
onChange={(status) => onFilterChange({ ...filters, status: status || '' })}
/>
<Button onClick={() => {
setKeyword('')
onFilterChange({ keyword: '', status: '' })
}}>
重置
</Button>
</Space>
<Table
rowKey="id"
loading={loading}