refactor(finance): 清理 legacy_platform 的展示与死查询

- 未归一组统计默认渠道补上 third_party_voucher,移除已无数据的 legacy_platform
- 前端移除历史归档/历史平台的类型与标签
- 保留后端口径的 legacy_platform→archived 筛选别名,旧链接不报错
This commit is contained in:
yml2213
2026-11-01 17:32:18 +08:00
parent d80150ff04
commit eb5c18b5b5
8 changed files with 8 additions and 17 deletions
@@ -655,7 +655,9 @@ export async function getAdminChannelMappingDiagnostics(payload: JsonObject = {}
}
}
const modes = channel ? [channel] : ['work_order', 'affiliate_dash', 'legacy_platform', 'manual']
const modes = channel
? [channel]
: ['work_order', 'affiliate_dash', 'third_party_voucher', 'manual']
// 顺序跑:并行会同时扫 cost_exceptions,实测 4 路并发比串行更慢(I/O 争抢)。
const aggregates: Array<{ groupTotal: number; itemTotal: number }> = []
for (const mode of modes) {
@@ -705,7 +707,9 @@ export async function listAdminUnmappedMappingGroups(payload: JsonObject = {}) {
// 分组总数单独算:SQL 守卫禁止窗口函数分页(会在 LIMIT 前消费全部候选行)。
// 按履约方式拆开统计:命中索引,单模式约 90ms;「全部」时顺序跑四种模式。
const modes = channel ? [channel] : ['work_order', 'affiliate_dash', 'legacy_platform', 'manual']
const modes = channel
? [channel]
: ['work_order', 'affiliate_dash', 'third_party_voucher', 'manual']
const totals: Array<{ groupTotal: number; itemTotal: number }> = []
for (const mode of modes) {
const totalParams = [...params, mode]
@@ -48,7 +48,6 @@ const FULFILLMENT_MODE_LABEL: Record<string, string> = {
work_order: '接单平台',
affiliate_dash: '自动发货',
third_party_voucher: '第三方卡券',
legacy_platform: '历史归档',
manual: '人工客服',
archived: '历史归档',
unclassified: '未分类',
@@ -40,7 +40,6 @@ import { CostPreviewModal } from './CostPreviewModal'
const FULFILLMENT_MODE_TAG_COLORS: Record<string, string> = {
work_order: 'blue',
affiliate_dash: 'green',
legacy_platform: 'default',
manual: 'orange',
}
@@ -19,7 +19,6 @@ import { costModelLabel, providerLabel } from './shared'
const FULFILLMENT_MODE_LABELS: Record<string, string> = {
work_order: '接单平台',
affiliate_dash: '自动发货',
legacy_platform: '历史平台',
manual: '人工客服',
}
@@ -129,7 +129,6 @@ export const FULFILLMENT_MODE_LABELS: Record<string, string> = {
work_order: '接单平台',
affiliate_dash: '自动发货',
third_party_voucher: '第三方卡券',
legacy_platform: '历史归档',
manual: '人工客服',
archived: '历史归档',
unclassified: '未分类',
@@ -139,7 +138,6 @@ export const FULFILLMENT_MODE_COLORS: Record<string, string> = {
work_order: 'blue',
affiliate_dash: 'green',
third_party_voucher: 'cyan',
legacy_platform: 'default',
manual: 'orange',
archived: 'default',
unclassified: 'gold',
+2 -8
View File
@@ -1,13 +1,7 @@
/**
* 履约渠道:v2 唯一真源是 order_items.fulfillment_channel;
* legacy_platform 仅历史数据兜底显示。
* 履约渠道:唯一真源是 order_items.fulfillment_channel + fulfillment_status。
*/
export type FulfillmentChannel =
| 'work_order'
| 'affiliate_dash'
| 'third_party_voucher'
| 'legacy_platform'
| 'manual'
export type FulfillmentChannel = 'work_order' | 'affiliate_dash' | 'third_party_voucher' | 'manual'
/** 商品来源:由 canonical_sku 前缀推导,空串表示未分类。 */
export type ProductSource = 'affiliate_dash' | 'work_order' | 'third_party_voucher' | 'manual' | ''
-1
View File
@@ -12,7 +12,6 @@ export type AdminOrderItemFulfillmentMode =
| 'work_order'
| 'affiliate_dash'
| 'third_party_voucher'
| 'legacy_platform'
| 'manual'
| 'pending'
| 'archived'
-1
View File
@@ -223,7 +223,6 @@ export function resolveOrderFulfillmentMode(row: {
| 'work_order'
| 'affiliate_dash'
| 'third_party_voucher'
| 'legacy_platform'
| 'manual'
| 'pending'
| 'archived'