feat(platform): 增加履约分类映射管理并锁定迁移
This commit is contained in:
@@ -7,6 +7,20 @@ import type {
|
||||
PlatformFulfillmentSettings,
|
||||
} from './types';
|
||||
|
||||
export interface PlatformFulfillmentMappingWrite {
|
||||
internal_sku_key: string;
|
||||
campaign_key: string;
|
||||
campaign_name: string;
|
||||
commodity_id: string;
|
||||
goods_name?: string;
|
||||
required_points?: number | null;
|
||||
sale_mode: 'presale' | 'direct' | 'manual' | 'unknown';
|
||||
available_from?: string | null;
|
||||
available_until?: string | null;
|
||||
released_at?: string | null;
|
||||
enabled: boolean;
|
||||
}
|
||||
|
||||
export const platformFulfillmentApi = {
|
||||
getSettings: () =>
|
||||
api.get<PlatformFulfillmentSettings, PlatformFulfillmentSettings>(
|
||||
@@ -25,6 +39,8 @@ export const platformFulfillmentApi = {
|
||||
),
|
||||
listTasks: (params: {
|
||||
status?: string;
|
||||
queue_bucket?: string;
|
||||
sale_mode?: string;
|
||||
keyword?: string;
|
||||
page?: number;
|
||||
page_size?: number;
|
||||
@@ -48,22 +64,46 @@ export const platformFulfillmentApi = {
|
||||
api.get<PlatformFulfillmentDetail, PlatformFulfillmentDetail>(
|
||||
`/platform-fulfillment/tasks/${taskId}`,
|
||||
),
|
||||
listMappings: (keyword = '') =>
|
||||
listMappings: (params: {
|
||||
keyword?: string;
|
||||
sale_mode?: string;
|
||||
enabled?: boolean;
|
||||
include_archived?: boolean;
|
||||
} = {}) =>
|
||||
api.get<PlatformFulfillmentMapping[], PlatformFulfillmentMapping[]>(
|
||||
'/platform-fulfillment/mappings',
|
||||
{ params: { keyword } },
|
||||
{ params },
|
||||
),
|
||||
upsertMapping: (data: {
|
||||
internal_sku_key: string;
|
||||
commodity_id: string;
|
||||
goods_name?: string;
|
||||
required_points?: number | null;
|
||||
enabled: boolean;
|
||||
}) =>
|
||||
api.put<PlatformFulfillmentMapping, PlatformFulfillmentMapping>(
|
||||
createMapping: (data: PlatformFulfillmentMappingWrite) =>
|
||||
api.post<PlatformFulfillmentMapping, PlatformFulfillmentMapping>(
|
||||
'/platform-fulfillment/mappings',
|
||||
data,
|
||||
),
|
||||
updateMapping: (mappingId: number, data: PlatformFulfillmentMappingWrite) =>
|
||||
api.patch<PlatformFulfillmentMapping, PlatformFulfillmentMapping>(
|
||||
`/platform-fulfillment/mappings/${mappingId}`,
|
||||
data,
|
||||
),
|
||||
deleteMapping: (mappingId: number) =>
|
||||
api.delete<{ success: boolean }, { success: boolean }>(
|
||||
`/platform-fulfillment/mappings/${mappingId}`,
|
||||
),
|
||||
mappingAction: (mappingId: number, action: 'enable' | 'disable' | 'archive' | 'restore') =>
|
||||
api.post<PlatformFulfillmentMapping, PlatformFulfillmentMapping>(
|
||||
`/platform-fulfillment/mappings/${mappingId}/${action}`,
|
||||
),
|
||||
mappingImpact: (mappingId: number) =>
|
||||
api.get<{
|
||||
mappingId: number;
|
||||
internalSkuKey: string;
|
||||
affectedTasks: number;
|
||||
groups: Array<{ executionStatus: string; saleMode: string; count: number }>;
|
||||
}, {
|
||||
mappingId: number;
|
||||
internalSkuKey: string;
|
||||
affectedTasks: number;
|
||||
groups: Array<{ executionStatus: string; saleMode: string; count: number }>;
|
||||
}>(`/platform-fulfillment/mappings/${mappingId}/impact`),
|
||||
allocate: (taskId: number) =>
|
||||
api.post<PlatformFulfillmentDetail, PlatformFulfillmentDetail>(
|
||||
`/platform-fulfillment/tasks/${taskId}/allocate`,
|
||||
|
||||
Reference in New Issue
Block a user