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`,
|
||||
|
||||
@@ -2225,6 +2225,15 @@ export interface PlatformFulfillmentTask {
|
||||
commodityMappingId: number | null;
|
||||
commodityId: string;
|
||||
requiredPoints: number | null;
|
||||
saleMode: 'presale' | 'direct' | 'manual' | 'unknown';
|
||||
campaignKey: string;
|
||||
campaignName: string;
|
||||
offerAvailableFrom: string | null;
|
||||
offerAvailableUntil: string | null;
|
||||
availabilityState: 'waiting_release' | 'available' | 'sold_out' | 'ended' | 'unknown';
|
||||
queueBucket: 'pending_mapping' | 'presale_waiting' | 'ready_for_fulfillment' | 'needs_action' | 'completed' | 'cancelled';
|
||||
manualReason: string;
|
||||
classificationSource: string;
|
||||
bindingStatus: string;
|
||||
executionStatus: string;
|
||||
exchangeStatus: string;
|
||||
@@ -2273,11 +2282,22 @@ export interface PlatformFulfillmentMapping {
|
||||
id: number;
|
||||
targetPlatform: string;
|
||||
internalSkuKey: string;
|
||||
campaignKey: string;
|
||||
campaignName: string;
|
||||
commodityId: string;
|
||||
goodsName: string;
|
||||
requiredPoints: number | null;
|
||||
scope: string;
|
||||
saleMode: 'presale' | 'direct' | 'manual' | 'unknown';
|
||||
availableFrom: string | null;
|
||||
availableUntil: string | null;
|
||||
releasedAt: string | null;
|
||||
goodsStatus: string;
|
||||
availabilityState: 'waiting_release' | 'available' | 'sold_out' | 'ended' | 'unknown';
|
||||
enabled: boolean;
|
||||
version: number;
|
||||
archivedAt: string | null;
|
||||
affectedTasks: number;
|
||||
updatedAt: string;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user