fix(finance): 待分类队列按内部中文 SKU 去重与分流

- 同一内部 SKU 的不同平台 SKU 合并为一行(显示平台 SKU 列表)
- 指定渠道按 internal_sku 批量更新,并生成 internal_sku 规则
- 渠道候选的 internal_sku 优先取中文 manual_sku_key/sku_name
This commit is contained in:
yml2213
2026-11-02 13:32:05 +08:00
parent fbd5f8f74e
commit 03566aee2b
4 changed files with 123 additions and 15 deletions
@@ -96,7 +96,7 @@ function PendingPanel() {
assignChannelBySku({
provider: row.provider,
shopId: row.shop_id,
skuCode: row.sku_code,
internalSku: row.internal_sku,
channel: selections[rowKey(row)] || '',
}),
onSuccess: (result) => {
@@ -118,7 +118,13 @@ function PendingPanel() {
const columns = [
{ title: '来源', dataIndex: 'provider', width: 120 },
{ title: '店铺', dataIndex: 'shop_id', width: 140 },
{ title: 'SKU', dataIndex: 'sku_code', width: 220 },
{ title: '内部SKU', dataIndex: 'internal_sku', width: 220 },
{
title: '平台SKU',
dataIndex: 'sku_codes',
width: 180,
render: (value: string[] | undefined) => (value?.length ? value.join(' / ') : '-'),
},
{ title: '商品名', dataIndex: 'sku_name', ellipsis: true },
{ title: '订单数', dataIndex: 'item_count', width: 90 },
{
@@ -510,5 +516,5 @@ function PipelinesPanel() {
}
function rowKey(row: PendingChannelGroup) {
return `${row.provider}|${row.shop_id}|${row.sku_code}`
return `${row.provider}|${row.shop_id}|${row.internal_sku}`
}
@@ -1,11 +1,12 @@
import { apiDelete, apiGet, apiPost } from '@/lib/http'
/** 待分类队列(按 SKU 聚合)。 */
/** 待分类队列(按内部 SKU 聚合)。 */
export type PendingChannelGroup = {
provider: string
shop_id: string
sku_code: string
internal_sku: string
sku_name: string
sku_codes: string[]
item_count: number
revenue_fen: number
first_seen_at: string
@@ -94,7 +95,7 @@ export function fetchChannelExceptions(
export function assignChannelBySku(payload: {
provider: string
shopId: string
skuCode: string
internalSku: string
channel: string
note?: string
}) {