feat: 重构商品批量工具页面并接入真实接口
All checks were successful
Build and Deploy TenantUI / build-and-deploy (push) Successful in 54s

This commit is contained in:
2026-02-26 12:09:26 +08:00
parent 75c15ec17b
commit 9e869e6788
20 changed files with 2302 additions and 492 deletions

View File

@@ -611,21 +611,48 @@ export interface ChangeProductScheduleStatusDto {
/** 批量范围。 */
export interface ProductBatchScopeDto {
categoryId?: string;
categoryIds?: string[];
productIds?: string[];
type: 'all' | 'category' | 'selected';
type: 'all' | 'category' | 'manual' | 'selected';
}
/** 批量调价预览参数。 */
export interface ProductBatchPriceAdjustPreviewDto {
amount: number;
amountType: 'fixed' | 'percent';
direction: 'down' | 'up';
scope: ProductBatchScopeDto;
storeId: string;
}
/** 批量调价参数。 */
export interface ProductBatchAdjustPriceDto {
export interface ProductBatchPriceAdjustDto {
amount: number;
mode: 'decrease' | 'increase' | 'set';
amountType: 'fixed' | 'percent';
direction: 'down' | 'up';
scope: ProductBatchScopeDto;
storeId: string;
}
/** 调价预览项。 */
export interface ProductBatchPricePreviewItemDto {
deltaPrice: number;
newPrice: number;
originalPrice: number;
productId: string;
productName: string;
}
/** 调价预览结果。 */
export interface ProductBatchPricePreviewDto {
items: ProductBatchPricePreviewItemDto[];
totalCount: number;
}
/** 批量移动分类参数。 */
export interface ProductBatchMoveCategoryDto {
scope: ProductBatchScopeDto;
sourceCategoryId?: string;
storeId: string;
targetCategoryId: string;
}
@@ -641,32 +668,53 @@ export interface ProductBatchSaleSwitchDto {
export interface ProductBatchSyncStoreDto {
productIds: string[];
sourceStoreId: string;
syncPrice?: boolean;
syncStatus?: boolean;
syncStock?: boolean;
targetStoreIds: string[];
}
/** 批量工具通用结果。 */
export interface ProductBatchToolResultDto {
failedCount: number;
skippedCount: number;
successCount: number;
totalCount: number;
}
/** 导入导出请求参数。 */
export interface ProductBatchImportExportDto {
/** 批量导出请求参数。 */
export interface ProductBatchExportDto {
scope: ProductBatchScopeDto;
storeId: string;
}
/** 导入导出回执。 */
export interface ProductBatchImportExportResultDto {
exportedCount?: number;
/** Excel 文件回执。 */
export interface ProductBatchExcelFileDto {
failedCount: number;
fileContentBase64: string;
fileName: string;
skippedCount?: number;
successCount: number;
totalCount: number;
}
/** 批量导入参数。 */
export interface ProductBatchImportDto {
file: File;
storeId: string;
}
/** 批量导入错误项。 */
export interface ProductBatchImportErrorItemDto {
message: string;
rowNo: number;
}
/** 批量导入回执。 */
export interface ProductBatchImportResultDto extends ProductBatchToolResultDto {
errors: ProductBatchImportErrorItemDto[];
fileName: string;
}
/** 获取商品分类(侧栏口径)。 */
export async function getProductCategoryListApi(storeId: string) {
return requestClient.get<ProductCategoryDto[]>('/product/category/list', {
@@ -911,9 +959,19 @@ export async function changeProductScheduleStatusApi(
return requestClient.post('/product/schedule/status', data);
}
/** 批量调价预览。 */
export async function batchPreviewProductPriceApi(
data: ProductBatchPriceAdjustPreviewDto,
) {
return requestClient.post<ProductBatchPricePreviewDto>(
'/product/batch/price-adjust/preview',
data,
);
}
/** 批量调价。 */
export async function batchAdjustProductPriceApi(
data: ProductBatchAdjustPriceDto,
data: ProductBatchPriceAdjustDto,
) {
return requestClient.post<ProductBatchToolResultDto>(
'/product/batch/price-adjust',
@@ -950,16 +1008,29 @@ export async function batchSyncProductStoreApi(data: ProductBatchSyncStoreDto) {
}
/** 批量导入。 */
export async function batchImportProductApi(data: ProductBatchImportExportDto) {
return requestClient.post<ProductBatchImportExportResultDto>(
export async function batchImportProductApi(data: ProductBatchImportDto) {
const formData = new FormData();
formData.append('storeId', data.storeId);
formData.append('file', data.file);
return requestClient.post<ProductBatchImportResultDto>(
'/product/batch/import',
data,
formData,
);
}
/** 下载导入模板。 */
export async function batchDownloadProductImportTemplateApi(storeId: string) {
return requestClient.get<ProductBatchExcelFileDto>(
'/product/batch/import/template',
{
params: { storeId },
},
);
}
/** 批量导出。 */
export async function batchExportProductApi(data: ProductBatchImportExportDto) {
return requestClient.post<ProductBatchImportExportResultDto>(
export async function batchExportProductApi(data: ProductBatchExportDto) {
return requestClient.post<ProductBatchExcelFileDto>(
'/product/batch/export',
data,
);