重构Salon后台单管理员与经营驾驶舱

This commit is contained in:
2026-10-26 01:19:23 +08:00
parent 17cf16db36
commit b8327146cb
35 changed files with 1087 additions and 4158 deletions
+37 -93
View File
@@ -247,7 +247,6 @@ adminApi.interceptors.response.use(
export interface AdminLoginRequest {
account: string
password: string
shopId?: IdType
}
/**
@@ -260,19 +259,15 @@ export interface AdminLoginResponse {
userInfo: any
}
export interface AdminPasswordChangeRequest {
currentPassword: string
newPassword: string
}
/**
* Purpose: LoginShopSelectionResponse supports admin.ts by holding or executing the login shop selection response page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
export interface LoginShopSelectionResponse {
allowShoplessLogin: boolean
message: string
shops: Array<{
id: IdType
shopName: string
}>
}
/**
* Purpose: LegalAgreementAdminVO supports admin.ts by holding or executing the legal agreement admin vo page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
@@ -315,14 +310,6 @@ export const adminAuthApi = {
login: (data: AdminLoginRequest) => {
return adminApi.post<AdminLoginResponse>('/auth/login', data)
},
/**
* `getLoginShops` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
* @param account: string caller-supplied value for `account: string`
*/
getLoginShops: (account: string) => {
return adminApi.get<LoginShopSelectionResponse>(`/auth/login-shops/${encodeURIComponent(account)}`)
},
/**
* `logout` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
@@ -330,14 +317,6 @@ export const adminAuthApi = {
logout: () => {
return adminApi.post<boolean>('/auth/logout')
},
/**
* `switchShop` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
* @param shopId?: IdType caller-supplied value for `shopId?: IdType`
*/
switchShop: (shopId?: IdType) => {
return adminApi.post<AdminLoginResponse>('/auth/switch-shop', { shopId })
},
/**
* `refreshToken` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
@@ -345,6 +324,9 @@ export const adminAuthApi = {
*/
refreshToken: (refreshToken: string) => {
return adminApi.post<{ accessToken: string; refreshToken: string }>('/auth/refresh', { refreshToken })
},
changePassword: (data: AdminPasswordChangeRequest) => {
return adminApi.post<boolean>('/auth/password', data)
}
}
@@ -1115,16 +1097,33 @@ export interface CampaignRequest {
sortOrder?: number
}
export interface OperationsAnalyticsVO {
viewCount?: number
favoriteCount?: number
cartCount?: number
orderCount?: number
paidOrderCount?: number
completedOrderCount?: number
reviewCount?: number
rebookCount?: number
totalAmount?: number
export interface SalonDashboardOverviewVO {
date: string
degraded?: boolean
degradedMessage?: string
platform: {
activeShopCount: number
activeManagerCount: number
activeStaffCount: number
customerCount: number
styleCount: number
}
today: {
appointmentCount: number
serviceInProgressCount: number
completedServiceCount: number
orderAmount: number
pendingOrderCount: number
}
attention: {
registrationReviewCount: number
contentReviewCount: number
afterSaleCount: number
artistChangeCount: number
lowStockCount: number
}
trend: Array<{ date: string; appointmentCount: number; completedCount: number; amount: number }>
shopRanking: Array<{ shopId: IdType; shopName: string; appointmentCount: number; completedCount: number; amount: number }>
}
export const adminArtistScheduleApi = {
@@ -1482,68 +1481,13 @@ export const adminOrderApi = {
}
}
/**
* Purpose: HotProductVO supports admin.ts by holding or executing the hot product vo page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
export interface HotProductVO {
id: IdType
title: string
price: number
likeCount: number
collectCount: number
}
/**
* Purpose: RecentActivityVO supports admin.ts by holding or executing the recent activity vo page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
export interface RecentActivityVO {
id: IdType
type: string
title?: string
description: string
time: string
color?: string
}
/**
* Purpose: DashboardStats supports admin.ts by holding or executing the dashboard stats page or API role.
* Usage: import, call, read, or update this interface from the owning page/module while preserving the surrounding loading and permission flow.
*/
export interface DashboardStats {
totalUsers: number
totalProducts: number
totalShops: number
todayOrders: number
totalOrderAmount?: number
todayOrderAmount?: number
weekOrderAmount?: number
totalCustomers?: number
totalArtists?: number
newCustomersToday?: number
newCustomers7Days?: number
newOrders7Days?: number
pendingOrders?: number
completedOrders?: number
hotProducts: HotProductVO[]
recentActivities: RecentActivityVO[]
}
/**
* adminDashboardApi groups all API calls for this page domain.
* Call guide: pass the typed payload or identifier into the method below, and use the returned Promise in the page script.
*/
export const adminDashboardApi = {
/**
* `getStats` API call. Use this method from the page script to invoke the backend endpoint tied to this feature.
* Call guide: supply the parameters below, await the returned Promise, and handle loading / error UI in the caller.
*/
getStats: () => {
return adminApi.get<DashboardStats>('/dashboard/stats')
},
getAnalytics: () => {
return adminApi.get<OperationsAnalyticsVO>('/dashboard/analytics') as unknown as Promise<OperationsAnalyticsVO>
getOverview: (params?: { date?: string; days?: 7 | 30 }) => {
return adminApi.get<SalonDashboardOverviewVO>('/dashboard/overview', { params }) as unknown as Promise<SalonDashboardOverviewVO>
}
}