chore(cost-center): 下线会与管道冲突的旧商品入口

- 移除自动发货商品同步、SKU 回填、按工单回填、人工商品归一等旧接口与按钮
- 商品目录只保留「从接单模板初始化」与手工新建
- 自动发货面板移除已失效的「重算成本快照」入口
This commit is contained in:
yml2213
2026-10-31 20:17:39 +08:00
parent d979ef50d6
commit 3f13b8a5f7
3 changed files with 7 additions and 326 deletions
@@ -28,12 +28,9 @@ import dayjs from 'dayjs'
import { useState } from 'react'
import {
backfillAdminAffiliateDashSkus,
fetchAdminProductCatalog,
importAdminAffiliateDashPricesBaseline,
setAdminAffiliateProductPrice,
syncAdminAffiliateDashCostSnapshots,
syncAdminAffiliateDashProducts,
updateAdminProductCatalog,
} from '@/services/admin'
import type { ProductCatalogItem } from '@/types/admin'
@@ -57,10 +54,7 @@ export function AffiliateSkuPanel() {
const [page, setPage] = useState(1)
const [pageSize, setPageSize] = useState(ADMIN_DEFAULT_PAGE_SIZE)
const [statusUpdatingId, setStatusUpdatingId] = useState<number | null>(null)
const [syncing, setSyncing] = useState(false)
const [backfilling, setBackfilling] = useState(false)
const [importingBaseline, setImportingBaseline] = useState(false)
const [syncingSnapshots, setSyncingSnapshots] = useState(false)
// 价格弹窗状态
const [priceModalOpen, setPriceModalOpen] = useState(false)
@@ -81,44 +75,6 @@ export function AffiliateSkuPanel() {
const products = productsQuery.data?.data.items || []
const total = productsQuery.data?.data.pagination.total || 0
async function syncProducts() {
setSyncing(true)
try {
const result = await syncAdminAffiliateDashProducts()
message.success(
`已同步 ${result.data.productCount} 个自动发货商品(新增 ${result.data.createdCount},更新 ${result.data.updatedCount})`,
)
refreshAll()
} catch (error) {
message.error(error instanceof Error ? error.message : '同步自动发货商品失败')
} finally {
setSyncing(false)
}
}
async function backfillSkus() {
setBackfilling(true)
try {
const response = await backfillAdminAffiliateDashSkus()
const result = response.data
const factsText = result.factsRebuild
? `;已重算 ${result.factsRebuild.fromDate} ~ ${result.factsRebuild.toDate} 的销售事实`
: ''
const remainingText =
result.remainingCount > 0
? `;仍有 ${result.remainingCount} 个订单项缺少可匹配的自动发货 SKU`
: ''
message.success(
`已回填 ${result.updatedCount} 个订单项,${result.skippedCount} 个已是归一状态${factsText}${remainingText}`,
)
refreshAll()
} catch (error) {
message.error(error instanceof Error ? error.message : '回填自动发货 SKU 失败')
} finally {
setBackfilling(false)
}
}
function handleImportBaseline() {
modal.confirm({
title: '导入上游采购成本基线',
@@ -143,31 +99,6 @@ export function AffiliateSkuPanel() {
})
}
function handleSyncSnapshots() {
modal.confirm({
title: '重算自动发货预估成本快照',
content:
'将为最近一个月的自动发货订单重新计算预估成本快照,自动消除因缺少采购价导致的 cost_missing 异常,并重算对应周期的销售事实。确定执行?',
okText: '确认重算',
cancelText: '取消',
onOk: async () => {
setSyncingSnapshots(true)
try {
const res = await syncAdminAffiliateDashCostSnapshots()
const snap = res.data.snapshotResult
message.success(
`重算完成!已生成成本快照 ${snap.createdCount} 条,已消除/解决异常 ${snap.resolvedExceptionCount} 条`,
)
refreshAll()
} catch (error) {
message.error(error instanceof Error ? error.message : '重算成本快照失败')
} finally {
setSyncingSnapshots(false)
}
},
})
}
function openPriceModal(product: ProductCatalogItem) {
setSelectedProduct(product)
const currentYuan =
@@ -255,23 +186,6 @@ export function AffiliateSkuPanel() {
>
导入基线价格
</Button>
<Button
icon={<SyncOutlined />}
loading={syncingSnapshots}
onClick={handleSyncSnapshots}
>
重算成本快照
</Button>
<Button icon={<SyncOutlined />} loading={syncing} onClick={() => void syncProducts()}>
同步自动发货商品
</Button>
<Button
icon={<SyncOutlined />}
loading={backfilling}
onClick={() => void backfillSkus()}
>
回填自动发货 SKU
</Button>
<Button
icon={<ReloadOutlined />}
loading={productsQuery.isFetching}
@@ -285,7 +199,7 @@ export function AffiliateSkuPanel() {
type="info"
showIcon
style={{ marginBottom: 12 }}
message="自动发货订单直接按 aff:<skuCode> 归一,不走渠道映射。点击右侧「配置成本」可录入采购单价;已配置的商品可通过「重算成本快照」消除历史缺失异常。"
message="自动发货订单直接按 aff:<skuCode> 归一,不走渠道映射。点击「配置成本」录入采购单价;缺少成本价时由成本快照管道自动标记并补齐。"
/>
<PercentTable
tableLayout="fixed"