feat: 优化店铺订单同步交互

This commit is contained in:
2026-08-10 17:16:13 +08:00
parent 2e5af7eec5
commit 64567d15d8
25 changed files with 715 additions and 1403 deletions
@@ -46,6 +46,44 @@ export async function getPddFullSyncTaskApi(taskId: number) {
);
}
/**
* 查询店铺最新全量同步任务(进行中优先)
*/
export async function getPddLatestFullSyncTaskApi(shopId: number) {
return requestClient.get<null | PddOrderSyncVO.FullTask>(
'/channel/pdd/order/sync/full-task/latest',
{ params: { shopId } },
);
}
/**
* 取消全量同步任务
*/
export async function cancelPddFullSyncTaskApi(taskId: number) {
return requestClient.post<PddOrderSyncVO.FullTask>(
`/channel/pdd/order/sync/full-task/${taskId}/cancel`,
);
}
/**
* 续跑失败的全量同步任务
*/
export async function resumePddFullSyncTaskApi(taskId: number) {
return requestClient.post<PddOrderSyncVO.FullTask>(
`/channel/pdd/order/sync/full-task/${taskId}/resume`,
);
}
/**
* 批量查询店铺同步状态摘要
*/
export async function batchPddOrderSyncStatusApi(shopIds: number[]) {
return requestClient.post<PddOrderSyncVO.ShopStatus[]>(
'/channel/pdd/order/sync/status/batch',
{ shopIds },
);
}
/**
* 增量同步开关
*/
@@ -26,10 +26,23 @@ export namespace PddOrderSyncVO {
finishTime?: string;
}
/** OFF / OK / LAGGING / PAUSED */
export type IncHealth = 'OFF' | 'OK' | 'LAGGING' | 'PAUSED';
export interface IncrementalStatus {
shopId: number;
enabled: boolean;
cursorStatus?: number;
lastError?: string;
lastCursorAt?: string;
lastSuccessTime?: string;
overlapSeconds?: number;
health?: IncHealth;
}
export interface ShopStatus {
shopId: number;
fullTask?: null | FullTask;
incremental?: IncrementalStatus;
}
}
@@ -62,18 +62,6 @@ export async function getShopProductPageApi(
);
}
/**
* 获取店铺概览统计数据
*/
export async function getShopOverviewStatisticsApi(
params: ShopDTO.OverviewQuery,
) {
return requestClient.post<ShopVO.OverviewStatistics>(
'/ec/shop/overview',
params,
);
}
/**
* 店铺数据统计-按商品汇总(Excel)
*/
@@ -99,10 +87,3 @@ export async function exportCompanyOverviewApi(params: {
responseType: 'blob',
});
}
/**
* 获取店铺详情看板数据
*/
export async function getShopDetailsApi(params: ShopDTO.DetailQuery) {
return requestClient.post<ShopVO.Dashboard>('/ec/shop/details', params);
}
@@ -36,24 +36,4 @@ export namespace ShopDTO {
/** 店铺ID */
shopId: number;
}
/** 店铺概览查询参数 */
export interface OverviewQuery {
/** 店铺ID */
shopId: number;
/** 日期范围数组(第一个是开始日期,第二个是结束日期,只有一个日期则返回当天数据) */
dateRange: string[];
/** 税率(默认0.04,即4%) */
taxRate?: number;
}
/** 店铺详情看板查询参数 */
export interface DetailQuery {
/** 店铺ID */
shopId: number;
/** 开始日期(不传默认为当月1号) */
startDate?: string;
/** 结束日期(不传默认为今天) */
endDate?: string;
}
}
@@ -253,72 +253,4 @@ export namespace ShopVO {
/** 各品类汇总列表 */
categories: CategorySummary[];
}
// ========== 店铺详情看板 ==========
/** 店铺基本信息 */
export interface ShopInfo {
id: number;
name: string;
logo?: string;
platformName?: string;
}
/** 月度目标KPI */
export interface MonthlyTargetKpi {
/** 年度目标总额 */
totalTargetAmount: number;
/** 目标单量合计 */
totalOrderCount: number;
/** 本月目标销售额 */
thisMonthTargetAmount: number;
/** 本月目标单量 */
thisMonthTargetOrderCount: number;
/** 当前达成率(百分比) */
achievementRate: number;
}
/** 推广费KPI */
export interface PromotionFeeKpi {
/** 累计推广费 */
totalFeeAmount: number;
/** 本月推广费 */
thisMonthFee: number;
/** 日均推广费 */
avgDailyFee: number;
}
/** 刷单费KPI */
export interface BrushOrderKpi {
/** 累计刷单费 */
totalBrushAmount: number;
/** 本月刷单次数 */
thisMonthCount: number;
/** 平均刷单金额 */
avgAmount: number;
}
/** 店铺订单KPI */
export interface ShopOrderKpi {
/** 累计实收金额 */
totalReceivedAmount: number;
/** 累计佣金 */
totalCommission: number;
/** 累计订单数 */
totalOrderCount: number;
}
/** 店铺详情看板数据 */
export interface Dashboard {
/** 店铺基本信息 */
shopInfo: ShopInfo;
/** 月度目标看板数据 */
monthlyTarget: MonthlyTargetKpi;
/** 推广费看板数据 */
promotionFee: PromotionFeeKpi;
/** 刷单费看板数据 */
brushOrder: BrushOrderKpi;
/** 店铺订单看板数据 */
shopOrder: ShopOrderKpi;
}
}