120 lines
2.6 KiB
TypeScript
120 lines
2.6 KiB
TypeScript
import type {
|
|
ServiceType,
|
|
StoreAuditStatus,
|
|
StoreBusinessStatus,
|
|
} from '#/enums/storeEnum';
|
|
|
|
import { requestClient } from '#/api/request';
|
|
|
|
export * from '#/enums/storeEnum';
|
|
|
|
/** 门店列表项 */
|
|
export interface StoreListItemDto {
|
|
/** 门店ID */
|
|
id: string;
|
|
/** 门店名称 */
|
|
name: string;
|
|
/** 门店编码 */
|
|
code: string;
|
|
/** 联系电话 */
|
|
contactPhone: string;
|
|
/** 店长/负责人 */
|
|
managerName: string;
|
|
/** 门店地址 */
|
|
address: string;
|
|
/** 门店封面图 */
|
|
coverImage?: string;
|
|
/** 营业状态 */
|
|
businessStatus: StoreBusinessStatus;
|
|
/** 审核状态 */
|
|
auditStatus: StoreAuditStatus;
|
|
/** 服务方式 */
|
|
serviceTypes: ServiceType[];
|
|
/** 创建时间 */
|
|
createdAt: string;
|
|
}
|
|
|
|
/** 门店统计 */
|
|
export interface StoreStatsDto {
|
|
/** 门店总数 */
|
|
total: number;
|
|
/** 营业中 */
|
|
operating: number;
|
|
/** 休息中 */
|
|
resting: number;
|
|
/** 待审核 */
|
|
pendingAudit: number;
|
|
}
|
|
|
|
/** 门店列表查询参数 */
|
|
export interface StoreListQuery {
|
|
keyword?: string;
|
|
businessStatus?: StoreBusinessStatus;
|
|
auditStatus?: StoreAuditStatus;
|
|
serviceType?: ServiceType;
|
|
page: number;
|
|
pageSize: number;
|
|
}
|
|
|
|
/** 分页结果 */
|
|
export interface PaginatedResult<T> {
|
|
items: T[];
|
|
total: number;
|
|
page: number;
|
|
pageSize: number;
|
|
}
|
|
|
|
/** 创建/编辑门店参数 */
|
|
export interface SaveStoreDto {
|
|
id?: string;
|
|
name: string;
|
|
contactPhone: string;
|
|
managerName: string;
|
|
address: string;
|
|
coverImage?: string;
|
|
businessStatus?: StoreBusinessStatus;
|
|
serviceTypes?: ServiceType[];
|
|
}
|
|
|
|
/** 快速切换门店营业状态参数 */
|
|
export interface ToggleStoreBusinessStatusDto {
|
|
storeId: string;
|
|
businessStatus: StoreBusinessStatus;
|
|
closureReason?: number;
|
|
closureReasonText?: string;
|
|
}
|
|
|
|
/** 获取门店列表 */
|
|
export async function getStoreListApi(params: StoreListQuery) {
|
|
return requestClient.get<PaginatedResult<StoreListItemDto>>('/store/list', {
|
|
params,
|
|
});
|
|
}
|
|
|
|
/** 获取门店统计 */
|
|
export async function getStoreStatsApi() {
|
|
return requestClient.get<StoreStatsDto>('/store/stats');
|
|
}
|
|
|
|
/** 创建门店 */
|
|
export async function createStoreApi(data: SaveStoreDto) {
|
|
return requestClient.post('/store/create', data);
|
|
}
|
|
|
|
/** 更新门店 */
|
|
export async function updateStoreApi(data: SaveStoreDto) {
|
|
return requestClient.post('/store/update', data);
|
|
}
|
|
|
|
/** 删除门店 */
|
|
export async function deleteStoreApi(id: string) {
|
|
return requestClient.post('/store/delete', { id });
|
|
}
|
|
|
|
/** 快速切换门店营业状态 */
|
|
export async function toggleStoreBusinessStatusApi(
|
|
data: ToggleStoreBusinessStatusDto,
|
|
) {
|
|
return requestClient.post('/store/toggle-business-status', data);
|
|
}
|