mirror of
https://gitee.com/qqtt-ah/ecom-dmb.git
synced 2026-11-24 07:49:19 +08:00
feat: 新增浏览器插件
This commit is contained in:
@@ -0,0 +1,55 @@
|
||||
import type { AdvertisingCostBatch } from '@/types/advertisingCost';
|
||||
|
||||
import { openApiRequest } from '@/api/client';
|
||||
import { OPEN_API_PATHS } from '@/shared/constants';
|
||||
|
||||
export interface BatchImportPddGoodsAdFeeItem {
|
||||
channelShopId: number;
|
||||
feeDate: string;
|
||||
goodsId: string;
|
||||
feeAmount: number;
|
||||
}
|
||||
|
||||
export interface BatchImportPddGoodsAdFeeRequest {
|
||||
items: BatchImportPddGoodsAdFeeItem[];
|
||||
}
|
||||
|
||||
export interface BatchImportPddGoodsAdFeeResult {
|
||||
totalCount: number;
|
||||
successCount: number;
|
||||
failureCount: number;
|
||||
successIds?: number[];
|
||||
failureRecords?: Array<{
|
||||
rowNumber?: number;
|
||||
channelShopId?: number;
|
||||
goodsId?: string;
|
||||
failureReason?: string;
|
||||
}>;
|
||||
}
|
||||
|
||||
/** 插件统一模型 → 后端 batch-import 入参 */
|
||||
export function toBatchImportRequest(
|
||||
batch: AdvertisingCostBatch,
|
||||
): BatchImportPddGoodsAdFeeRequest {
|
||||
return {
|
||||
items: batch.items.map((item) => ({
|
||||
channelShopId: batch.channelShopId,
|
||||
feeDate: batch.feeDate,
|
||||
goodsId: item.goodsId,
|
||||
feeAmount: item.feeAmount,
|
||||
})),
|
||||
};
|
||||
}
|
||||
|
||||
export async function batchImportPddGoodsAdFee(
|
||||
batch: AdvertisingCostBatch,
|
||||
): Promise<BatchImportPddGoodsAdFeeResult> {
|
||||
const body = toBatchImportRequest(batch);
|
||||
return openApiRequest<BatchImportPddGoodsAdFeeResult>(
|
||||
OPEN_API_PATHS.pddGoodsAdFeeBatchImport,
|
||||
{
|
||||
method: 'POST',
|
||||
body: JSON.stringify(body),
|
||||
},
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user