feat: 商品详情超过10个SKU改为异步保存
All checks were successful
Build and Deploy TenantUI / build-and-deploy (push) Successful in 52s

This commit is contained in:
2026-02-25 09:25:32 +08:00
parent 2b485de5a8
commit a02369197c
4 changed files with 203 additions and 61 deletions

View File

@@ -16,6 +16,14 @@ export type ProductKind = 'combo' | 'single';
/** 沽清模式。 */
export type ProductSoldoutMode = 'permanent' | 'timed' | 'today';
/** SKU 异步保存任务状态。 */
export type ProductSkuSaveJobStatus =
| 'canceled'
| 'failed'
| 'queued'
| 'running'
| 'succeeded';
/** 分类展示渠道。 */
export type ProductCategoryChannel = 'dine_in' | 'pickup' | 'wm';
@@ -262,6 +270,45 @@ export interface SaveProductDto {
warningStock?: null | number;
}
/** 创建 SKU 异步保存任务参数。 */
export interface CreateProductSkuSaveJobDto {
productId: string;
skus: Array<{
attributes: Array<{
optionId: string;
templateId: string;
}>;
isEnabled: boolean;
originalPrice: null | number;
price: number;
skuCode?: string;
sortOrder: number;
stock: number;
}>;
specTemplateIds?: string[];
storeId: string;
}
/** 查询 SKU 异步保存任务参数。 */
export interface ProductSkuSaveJobQuery {
jobId: string;
storeId: string;
}
/** SKU 异步保存任务结果。 */
export interface ProductSkuSaveJobDto {
errorMessage: null | string;
failedCount: number;
finishedAt: null | string;
jobId: string;
productId: string;
progressProcessed: number;
progressTotal: number;
startedAt: null | string;
status: ProductSkuSaveJobStatus;
storeId: string;
}
/** 删除商品参数。 */
export interface DeleteProductDto {
productId: string;
@@ -680,6 +727,27 @@ export async function saveProductApi(data: SaveProductDto) {
return requestClient.post<ProductDetailDto>('/product/save', data);
}
/** 创建 SKU 异步保存任务。 */
export async function createProductSkuSaveJobApi(
data: CreateProductSkuSaveJobDto,
) {
return requestClient.post<ProductSkuSaveJobDto>(
'/product/sku-save-jobs',
data,
);
}
/** 查询 SKU 异步保存任务。 */
export async function getProductSkuSaveJobApi(params: ProductSkuSaveJobQuery) {
const { jobId, ...query } = params;
return requestClient.get<ProductSkuSaveJobDto>(
`/product/sku-save-jobs/${jobId}`,
{
params: query,
},
);
}
/** 删除商品。 */
export async function deleteProductApi(data: DeleteProductDto) {
return requestClient.post('/product/delete', data);