refactor(finance)!: 事实维度与接口字段统一改名 channel

- migration 114 将 sales_daily_facts.fulfillment_mode 重命名为 channel
- DTO/查询参数/前端类型从 fulfillmentMode 统一为 channel
- 成本中心类型 FulfillmentMode 更名为 FulfillmentChannel,并补齐卡券/待分类/归档取值
- 销售事实响应分组改为 byChannel
This commit is contained in:
yml2213
2026-10-31 20:26:15 +08:00
parent 657e49f324
commit 6cd6401eca
38 changed files with 220 additions and 208 deletions
@@ -71,7 +71,7 @@ export function ChannelMappingPanel() {
queryFn: () =>
fetchAdminChannelMappingDiagnostics({
carrierType: productSourceFilter,
fulfillmentMode: productSourceFilter,
channel: productSourceFilter,
}),
})
const diagnostics = diagnosticsQuery.data?.data
@@ -107,7 +107,7 @@ export function ChannelMappingPanel() {
],
queryFn: () =>
fetchAdminUnmappedMappingGroups({
fulfillmentMode: productSourceFilter,
channel: productSourceFilter,
provider: queueProvider || undefined,
keyword: queueKeyword || undefined,
page: queuePage,
@@ -62,7 +62,7 @@ export default function ChannelMappingQueue({
onCreateMapping,
}: Props) {
const isEmpty = !loading && groupTotal === 0
const hasManual = groups.some((row) => row.fulfillmentMode === 'manual')
const hasManual = groups.some((row) => row.channel === 'manual')
const columns: TableColumnsType<UnmappedMappingGroup> = [
{
@@ -97,7 +97,7 @@ export default function ChannelMappingQueue({
},
{
title: '履约方式',
dataIndex: 'fulfillmentMode',
dataIndex: 'channel',
width: 120,
render: (value: string) => (
<Tag color={FULFILLMENT_MODE_COLORS[value] || 'default'}>
@@ -199,7 +199,7 @@ export default function ChannelMappingQueue({
<PercentTable<UnmappedMappingGroup>
tableLayout="fixed"
rowKey={(row) => `${row.provider}-${row.shopId}-${row.fulfillmentMode}-${row.skuCode}`}
rowKey={(row) => `${row.provider}-${row.shopId}-${row.channel}-${row.skuCode}`}
size="small"
columns={columns}
dataSource={groups}
@@ -20,7 +20,7 @@ export type CostCenterContextValue = {
/** 商品/映射按 canonical_sku 前缀筛选。 */
productSourceFilter?: ProductSource
/** 成本项/版本/异常按履约方式筛选。 */
fulfillmentModeFilter?: 'affiliate_dash' | 'work_order' | 'third_party_voucher' | 'manual'
channelFilter?: 'affiliate_dash' | 'work_order' | 'third_party_voucher' | 'manual'
options?: {
providers: string[]
@@ -108,7 +108,7 @@ export default function CostCenterShell() {
const scopeLabel = SCOPES.find((item) => item.key === scope)?.label ?? '全部'
const scopeHint = SCOPES.find((item) => item.key === scope)?.hint ?? ''
const productSourceFilter = scope === 'all' ? undefined : scope
const fulfillmentModeFilter =
const channelFilter =
scope === 'all'
? undefined
: (scope as 'affiliate_dash' | 'work_order' | 'third_party_voucher' | 'manual')
@@ -122,7 +122,7 @@ export default function CostCenterShell() {
setScope,
scopeLabel,
productSourceFilter,
fulfillmentModeFilter,
channelFilter,
options,
refreshAll,
}}
@@ -30,7 +30,7 @@ import {
fetchAdminCostExceptions,
resolveAdminCostException,
} from '@/services/admin'
import type { CostException, FulfillmentMode } from '@/types/admin'
import type { CostException, FulfillmentChannel } from '@/types/admin'
import { ADMIN_DEFAULT_PAGE_SIZE, buildAdminTablePagination } from '@/utils/admin-pagination'
import { formatAdminDateTime } from '@/utils/admin-time'
@@ -69,7 +69,7 @@ const RANGE_OPTIONS = [
export function CostExceptionPanel() {
const { message } = App.useApp()
const { canConfig, fulfillmentModeFilter, refreshAll } = useCostCenter()
const { canConfig, channelFilter, refreshAll } = useCostCenter()
const [status, setStatus] = useState('open')
const [rangeDays, setRangeDays] = useState(1)
@@ -88,12 +88,12 @@ export function CostExceptionPanel() {
const summaryQuery = useQuery({
queryKey: [
'admin-cost-center-exceptions-summary',
fulfillmentModeFilter,
channelFilter,
rangeDays <= 0 ? 1 : rangeDays,
],
queryFn: () =>
fetchAdminCostExceptionSummary({
fulfillmentMode: fulfillmentModeFilter,
channel: channelFilter,
recentDays: rangeDays <= 0 ? 1 : rangeDays,
}),
})
@@ -102,7 +102,7 @@ export function CostExceptionPanel() {
const exceptionsQuery = useQuery({
queryKey: [
'admin-cost-center-exceptions',
fulfillmentModeFilter,
channelFilter,
status,
rangeDays,
reason,
@@ -112,7 +112,7 @@ export function CostExceptionPanel() {
queryFn: () =>
fetchAdminCostExceptions({
status: status || undefined,
fulfillmentMode: fulfillmentModeFilter,
channel: channelFilter,
reason,
since:
rangeDays > 0
@@ -177,9 +177,9 @@ export function CostExceptionPanel() {
},
{
title: '履约方式',
dataIndex: 'fulfillmentMode',
dataIndex: 'channel',
width: 120,
render: (value: FulfillmentMode | '') =>
render: (value: FulfillmentChannel | '') =>
value ? (
<Tag color={FULFILLMENT_MODE_TAG_COLORS[value] || 'default'}>
{FULFILLMENT_MODE_LABELS[value] || value}
@@ -121,8 +121,7 @@ export function CostPreviewModal({ open, orderItemId, onClose }: CostPreviewModa
{preview.context.skuCode} · {preview.context.skuName || '-'}
</Descriptions.Item>
<Descriptions.Item label="履约方式">
{FULFILLMENT_MODE_LABELS[preview.context.fulfillmentMode] ||
preview.context.fulfillmentMode}
{FULFILLMENT_MODE_LABELS[preview.context.channel] || preview.context.channel}
</Descriptions.Item>
<Descriptions.Item label="标准商品">
{preview.product
@@ -37,7 +37,7 @@ export function WorkOrderPricePanel() {
fetchAdminCostVersions({
keyword: keyword || undefined,
status: status || undefined,
fulfillmentMode: 'work_order',
channel: 'work_order',
page,
pageSize,
}),
@@ -2,7 +2,7 @@
* 成本中心前端共享层:类型、常量、标签与页面上下文。
*
* 口径(2026-10-23 重写):
* 1. 履约方式唯一真源是 order_items.fulfillment_mode,前端只读不改;
* 1. 履约渠道唯一真源是 order_items.fulfillment_channel + status,前端只读不改;
* 2. 商品来源由 canonical_sku 前缀推导,前端不再存「商品载体」字段;
* 3. 成本项用 cost_model 表达「成本怎么算」,没有「适用载体」这一列。
*/