feat(project): align store delivery pages with live APIs and geocode status
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import type {
|
||||
ContractStatus,
|
||||
GeoLocationStatus,
|
||||
MerchantDocumentStatus,
|
||||
MerchantDocumentType,
|
||||
MerchantStatus,
|
||||
@@ -51,6 +52,22 @@ export interface MerchantDetailDto {
|
||||
legalRepresentative?: string;
|
||||
/** 注册地址 */
|
||||
registeredAddress?: string;
|
||||
/** 所在省份 */
|
||||
province?: string;
|
||||
/** 所在城市 */
|
||||
city?: string;
|
||||
/** 所在区县 */
|
||||
district?: string;
|
||||
/** 商户经度 */
|
||||
longitude?: null | number;
|
||||
/** 商户纬度 */
|
||||
latitude?: null | number;
|
||||
/** 地理定位状态 */
|
||||
geoStatus?: GeoLocationStatus;
|
||||
/** 地理定位失败原因 */
|
||||
geoFailReason?: string;
|
||||
/** 地理定位成功时间 */
|
||||
geoUpdatedAt?: null | string;
|
||||
/** 联系电话 */
|
||||
contactPhone?: string;
|
||||
/** 联系邮箱 */
|
||||
@@ -196,3 +213,8 @@ export interface UpdateMerchantDto {
|
||||
export async function updateMerchantInfoApi(data: UpdateMerchantDto) {
|
||||
return requestClient.post('/merchant/update', data);
|
||||
}
|
||||
|
||||
/** 手动重试当前商户地理定位 */
|
||||
export async function retryMerchantGeocodeApi() {
|
||||
return requestClient.post('/merchant/geocode/retry');
|
||||
}
|
||||
|
||||
194
apps/web-antd/src/api/product/index.ts
Normal file
194
apps/web-antd/src/api/product/index.ts
Normal file
@@ -0,0 +1,194 @@
|
||||
/**
|
||||
* 文件职责:商品管理模块 API 与 DTO 定义。
|
||||
* 1. 维护商品列表、分类、详情、批量操作契约。
|
||||
* 2. 提供商品查询、保存、状态变更、沽清与批量动作接口。
|
||||
*/
|
||||
import type { PaginatedResult } from '#/api/store';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
/** 商品状态。 */
|
||||
export type ProductStatus = 'off_shelf' | 'on_sale' | 'sold_out';
|
||||
|
||||
/** 商品类型。 */
|
||||
export type ProductKind = 'combo' | 'single';
|
||||
|
||||
/** 沽清模式。 */
|
||||
export type ProductSoldoutMode = 'permanent' | 'timed' | 'today';
|
||||
|
||||
/** 分类信息。 */
|
||||
export interface ProductCategoryDto {
|
||||
id: string;
|
||||
name: string;
|
||||
productCount: number;
|
||||
sort: number;
|
||||
}
|
||||
|
||||
/** 商品列表项。 */
|
||||
export interface ProductListItemDto {
|
||||
categoryId: string;
|
||||
categoryName: string;
|
||||
id: string;
|
||||
imageUrl: string;
|
||||
kind: ProductKind;
|
||||
name: string;
|
||||
originalPrice: null | number;
|
||||
price: number;
|
||||
salesMonthly: number;
|
||||
soldoutMode: null | ProductSoldoutMode;
|
||||
spuCode: string;
|
||||
status: ProductStatus;
|
||||
stock: number;
|
||||
subtitle: string;
|
||||
tags: string[];
|
||||
}
|
||||
|
||||
/** 商品详情。 */
|
||||
export interface ProductDetailDto extends ProductListItemDto {
|
||||
description: string;
|
||||
notifyManager: boolean;
|
||||
recoverAt: null | string;
|
||||
remainStock: number;
|
||||
soldoutReason: string;
|
||||
syncToPlatform: boolean;
|
||||
}
|
||||
|
||||
/** 商品列表查询参数。 */
|
||||
export interface ProductListQuery {
|
||||
categoryId?: string;
|
||||
kind?: ProductKind;
|
||||
keyword?: string;
|
||||
page: number;
|
||||
pageSize: number;
|
||||
status?: ProductStatus;
|
||||
storeId: string;
|
||||
}
|
||||
|
||||
/** 查询详情参数。 */
|
||||
export interface ProductDetailQuery {
|
||||
productId: string;
|
||||
storeId: string;
|
||||
}
|
||||
|
||||
/** 保存商品参数。 */
|
||||
export interface SaveProductDto {
|
||||
categoryId: string;
|
||||
description: string;
|
||||
id?: string;
|
||||
kind: ProductKind;
|
||||
name: string;
|
||||
originalPrice: null | number;
|
||||
price: number;
|
||||
shelfMode: 'draft' | 'now' | 'scheduled';
|
||||
spuCode?: string;
|
||||
status: ProductStatus;
|
||||
stock: number;
|
||||
storeId: string;
|
||||
subtitle: string;
|
||||
tags: string[];
|
||||
timedOnShelfAt?: string;
|
||||
}
|
||||
|
||||
/** 删除商品参数。 */
|
||||
export interface DeleteProductDto {
|
||||
productId: string;
|
||||
storeId: string;
|
||||
}
|
||||
|
||||
/** 修改商品状态参数。 */
|
||||
export interface ChangeProductStatusDto {
|
||||
productId: string;
|
||||
status: ProductStatus;
|
||||
storeId: string;
|
||||
}
|
||||
|
||||
/** 商品沽清参数。 */
|
||||
export interface SoldoutProductDto {
|
||||
mode: ProductSoldoutMode;
|
||||
notifyManager: boolean;
|
||||
productId: string;
|
||||
reason: string;
|
||||
recoverAt?: string;
|
||||
remainStock: number;
|
||||
storeId: string;
|
||||
syncToPlatform: boolean;
|
||||
}
|
||||
|
||||
/** 批量动作类型。 */
|
||||
export type BatchProductActionType =
|
||||
| 'batch_delete'
|
||||
| 'batch_off'
|
||||
| 'batch_on'
|
||||
| 'batch_soldout';
|
||||
|
||||
/** 批量商品操作参数。 */
|
||||
export interface BatchProductActionDto {
|
||||
action: BatchProductActionType;
|
||||
notifyManager?: boolean;
|
||||
productIds: string[];
|
||||
reason?: string;
|
||||
recoverAt?: string;
|
||||
remainStock?: number;
|
||||
storeId: string;
|
||||
syncToPlatform?: boolean;
|
||||
}
|
||||
|
||||
/** 批量操作返回。 */
|
||||
export interface BatchProductActionResultDto {
|
||||
action: BatchProductActionType;
|
||||
failedCount: number;
|
||||
successCount: number;
|
||||
totalCount: number;
|
||||
}
|
||||
|
||||
/** 获取商品分类。 */
|
||||
export async function getProductCategoryListApi(storeId: string) {
|
||||
return requestClient.get<ProductCategoryDto[]>('/product/category/list', {
|
||||
params: { storeId },
|
||||
});
|
||||
}
|
||||
|
||||
/** 获取商品列表。 */
|
||||
export async function getProductListApi(params: ProductListQuery) {
|
||||
return requestClient.get<PaginatedResult<ProductListItemDto>>(
|
||||
'/product/list',
|
||||
{
|
||||
params,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/** 获取商品详情。 */
|
||||
export async function getProductDetailApi(params: ProductDetailQuery) {
|
||||
return requestClient.get<ProductDetailDto>('/product/detail', {
|
||||
params,
|
||||
});
|
||||
}
|
||||
|
||||
/** 保存商品(新增/编辑)。 */
|
||||
export async function saveProductApi(data: SaveProductDto) {
|
||||
return requestClient.post<ProductDetailDto>('/product/save', data);
|
||||
}
|
||||
|
||||
/** 删除商品。 */
|
||||
export async function deleteProductApi(data: DeleteProductDto) {
|
||||
return requestClient.post('/product/delete', data);
|
||||
}
|
||||
|
||||
/** 修改商品状态。 */
|
||||
export async function changeProductStatusApi(data: ChangeProductStatusDto) {
|
||||
return requestClient.post('/product/status/change', data);
|
||||
}
|
||||
|
||||
/** 提交沽清。 */
|
||||
export async function soldoutProductApi(data: SoldoutProductDto) {
|
||||
return requestClient.post('/product/soldout', data);
|
||||
}
|
||||
|
||||
/** 批量商品操作。 */
|
||||
export async function batchProductActionApi(data: BatchProductActionDto) {
|
||||
return requestClient.post<BatchProductActionResultDto>(
|
||||
'/product/batch',
|
||||
data,
|
||||
);
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
import type {
|
||||
GeoLocationStatus,
|
||||
ServiceType,
|
||||
StoreAuditStatus,
|
||||
StoreBusinessStatus,
|
||||
@@ -22,6 +23,22 @@ export interface StoreListItemDto {
|
||||
managerName: string;
|
||||
/** 门店地址 */
|
||||
address: string;
|
||||
/** 所在省份 */
|
||||
province?: string;
|
||||
/** 所在城市 */
|
||||
city?: string;
|
||||
/** 所在区县 */
|
||||
district?: string;
|
||||
/** 门店经度 */
|
||||
longitude?: null | number;
|
||||
/** 门店纬度 */
|
||||
latitude?: null | number;
|
||||
/** 地理定位状态 */
|
||||
geoStatus?: GeoLocationStatus;
|
||||
/** 地理定位失败原因 */
|
||||
geoFailReason?: string;
|
||||
/** 地理定位成功时间 */
|
||||
geoUpdatedAt?: null | string;
|
||||
/** 门店封面图 */
|
||||
coverImage?: string;
|
||||
/** 营业状态 */
|
||||
@@ -117,3 +134,8 @@ export async function toggleStoreBusinessStatusApi(
|
||||
) {
|
||||
return requestClient.post('/store/toggle-business-status', data);
|
||||
}
|
||||
|
||||
/** 手动重试门店地理定位 */
|
||||
export async function retryStoreGeocodeApi(storeId: string) {
|
||||
return requestClient.post(`/store/${storeId}/geocode/retry`);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user