重构项目文件夹目录

This commit is contained in:
2026-06-15 15:53:55 +08:00
parent 8093e07190
commit 7cbe5b3de5
1098 changed files with 34 additions and 4441 deletions
File diff suppressed because it is too large Load Diff
+84
View File
@@ -0,0 +1,84 @@
/**
* Purpose: WEB_API_AUTH_FREE_PATHS supports auth-free-paths.ts by holding or executing the web api auth free paths page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
export const WEB_API_AUTH_FREE_PATHS = [
'/user/login',
'/user/register',
'/user/check/',
'/user/refresh-token',
'/user/send-verification-code',
'/user/phone-login',
'/user/wechat-mini/',
'/user/reset-password-by-phone',
'/legal-agreement/current',
'/api/legal-agreement/current',
'/product/get/',
'/product/list/',
'/comment/list/product/',
'/nail-artist/',
'/shop/get/',
'/shop/trust-profile/',
'/shop/list',
'/shop/list/public',
'/shop/list/simple',
'/tag/list/all',
'/tag/list/filter-options',
'/file/get-signed-url/',
'/admin/auth/login',
'/admin/auth/login-shops/',
'/admin/auth/refresh'
] as const
/**
* Purpose: ADMIN_API_AUTH_FREE_PATHS supports auth-free-paths.ts by holding or executing the admin api auth free paths page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
export const ADMIN_API_AUTH_FREE_PATHS = [
'/auth/login',
'/auth/login-shops/',
'/auth/refresh'
] as const
/**
* Purpose: normalizePathname supports auth-free-paths.ts by holding or executing the normalize pathname page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const normalizePathname = (url?: string) => {
const raw = String(url || '')
const withoutHash = raw.split('#')[0] || ''
const withoutQuery = withoutHash.split('?')[0] || ''
try {
return new URL(withoutQuery, 'http://yuminail.local').pathname
} catch {
return withoutQuery.startsWith('/') ? withoutQuery : `/${withoutQuery}`
}
}
/**
* Purpose: matchesAuthFreePath supports auth-free-paths.ts by holding or executing the matches auth free path page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const matchesAuthFreePath = (url: string | undefined, path: string) => {
const pathname = normalizePathname(url)
if (path.endsWith('/')) {
return pathname === path.slice(0, -1) || pathname.startsWith(path)
}
return pathname === path
}
/**
* Purpose: isApiAuthFreePath supports auth-free-paths.ts by holding or executing the is api auth free path page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
export const isApiAuthFreePath = (url?: string) => {
return WEB_API_AUTH_FREE_PATHS.some(path => matchesAuthFreePath(url, path))
}
/**
* Purpose: isAdminApiAuthFreePath supports auth-free-paths.ts by holding or executing the is admin api auth free path page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
export const isAdminApiAuthFreePath = (url?: string) => {
return ADMIN_API_AUTH_FREE_PATHS.some(path => matchesAuthFreePath(url, path))
}
+251
View File
@@ -0,0 +1,251 @@
/**
* Front-end API wrapper for this module.
* Call guide: import the named API object, then call the matching method from a Vue page or composable.
*/
import api from './index'
import type { IdType } from '@/utils/id'
/**
* Purpose: SendVerificationCodeRequest supports auth.ts by holding or executing the send verification code request 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 SendVerificationCodeRequest {
phone: string
sceneCode?: string
}
/**
* Purpose: LoginRequest supports auth.ts by holding or executing the login request 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 LoginRequest {
account: string
password: string
rememberMe?: boolean
shopId?: string | number
agreementAccepted?: boolean
agreementVersions?: Record<string, string>
clientType?: string
}
/**
* Purpose: PhoneLoginRequest supports auth.ts by holding or executing the phone login request 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 PhoneLoginRequest {
phone: string
verificationCode: string
shopId?: string | number
agreementAccepted?: boolean
agreementVersions?: Record<string, string>
clientType?: string
}
/**
* Purpose: RegisterRequest supports auth.ts by holding or executing the register request 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 RegisterRequest {
account: string
password: string
nickname: string
shopId?: string | number
inviteCode?: string
phone?: string
verificationCode?: string
agreementAccepted?: boolean
agreementVersions?: Record<string, string>
clientType?: string
}
/**
* Purpose: LegalAgreement supports auth.ts by holding or executing the legal agreement 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 LegalAgreement {
id: IdType
agreementType: 'USER_TERMS' | 'PRIVACY_POLICY'
agreementTypeName: string
title: string
version: string
content: string
status: number
statusText?: string
effectiveTime?: string
}
/**
* Purpose: LoginResponse supports auth.ts by holding or executing the login 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 LoginResponse {
accessToken: string
refreshToken: string
userInfo: UserInfo
}
/**
* Purpose: UserInfo supports auth.ts by holding or executing the user info 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 UserInfo {
id: IdType
account: string
nickname: string
avatar?: string
signature?: string
type?: number
shopId?: IdType
shopName?: string
shopAuthorizationExpireTime?: string
shopAuthorizationExpired?: boolean
shopIds?: IdType[]
shopNames?: string[]
createTime: string
updateTime?: string
}
/**
* Purpose: RefreshTokenRequest supports auth.ts by holding or executing the refresh token request 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 RefreshTokenRequest {
refreshToken: string
}
/**
* Purpose: RefreshTokenResponse supports auth.ts by holding or executing the refresh token 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 RefreshTokenResponse {
accessToken: string
refreshToken: string
}
/**
* Purpose: ResetPasswordRequest supports auth.ts by holding or executing the reset password request 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 ResetPasswordRequest {
phone: string
verificationCode: string
newPassword: string
}
/**
* Purpose: SwitchShopRequest supports auth.ts by holding or executing the switch shop request 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 SwitchShopRequest {
shopId?: string | number
}
/**
* authApi 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 authApi = {
/**
* `sendVerificationCode` 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 data: SendVerificationCodeRequest caller-supplied value for `data: SendVerificationCodeRequest`
*/
sendVerificationCode: (data: SendVerificationCodeRequest) => {
return api.post('/user/send-verification-code', data)
},
/**
* `login` 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 data: LoginRequest caller-supplied value for `data: LoginRequest`
*/
login: (data: LoginRequest) => {
return api.post<LoginResponse>('/user/login', data)
},
/**
* `phoneLogin` 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 data: PhoneLoginRequest caller-supplied value for `data: PhoneLoginRequest`
*/
phoneLogin: (data: PhoneLoginRequest) => {
return api.post<LoginResponse>('/user/phone-login', data)
},
/**
* `adminLogin` 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 data: LoginRequest caller-supplied value for `data: LoginRequest`
*/
adminLogin: (data: LoginRequest) => {
return api.post<LoginResponse>('/admin/auth/login', data)
},
/**
* `register` 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 data: RegisterRequest caller-supplied value for `data: RegisterRequest`
*/
register: (data: RegisterRequest) => {
return api.post('/user/register', data)
},
/**
* `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.
* @param data: RefreshTokenRequest caller-supplied value for `data: RefreshTokenRequest`
*/
refreshToken: (data: RefreshTokenRequest) => {
return api.post<RefreshTokenResponse>('/user/refresh-token', data)
},
/**
* `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.
*/
logout: () => {
return api.post('/user/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 data: SwitchShopRequest caller-supplied value for `data: SwitchShopRequest`
*/
switchShop: (data: SwitchShopRequest) => {
return api.post<LoginResponse>('/user/switch-shop', data)
},
/**
* `getUserInfo` 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.
*/
getUserInfo: () => {
return api.get<UserInfo>('/user/info')
},
/**
* `resetPasswordByPhone` 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 data: ResetPasswordRequest caller-supplied value for `data: ResetPasswordRequest`
*/
resetPasswordByPhone: (data: ResetPasswordRequest) => {
return api.post('/user/reset-password-by-phone', data)
}
}
/**
* Purpose: legalAgreementApi supports auth.ts by holding or executing the legal agreement api page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
export const legalAgreementApi = {
listCurrent: () => {
return api.get<LegalAgreement[]>('/legal-agreement/current')
},
getCurrent: (type: 'USER_TERMS' | 'PRIVACY_POLICY') => {
return api.get<LegalAgreement>(`/legal-agreement/current/${type}`)
},
getMyConsent: () => {
return api.get<{ consentVersions: Record<string, string> }>('/user/agreement-consent/me')
}
}
+79
View File
@@ -0,0 +1,79 @@
/**
* Front-end API wrapper for this module.
* Call guide: import the named API object, then call the matching method from a Vue page or composable.
*/
import api from './index'
import type { IdType } from '@/utils/id'
/**
* Purpose: CartItem supports cart.ts by holding or executing the cart item 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.
*/
interface CartItem {
productId: IdType
quantity: number
}
/**
* cartApi 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 cartApi = {
// 添加作品到购物车
/**
* `addToCart` 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 item: CartItem caller-supplied value for `item: CartItem`
*/
addToCart: (item: CartItem) => {
return api.post('/cart/add', item)
},
// 从购物车移除作品
/**
* `removeFromCart` 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 productId: IdType caller-supplied value for `productId: IdType`
*/
removeFromCart: (productId: IdType) => {
return api.delete(`/cart/remove/${productId}`)
},
// 批量从购物车移除作品
/**
* `batchRemoveFromCart` 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 cartItemIds: IdType[] caller-supplied value for `cartItemIds: IdType[]`
*/
batchRemoveFromCart: (cartItemIds: IdType[]) => {
return api.post('/cart/batch-remove', cartItemIds)
},
// 更新购物车作品数量
/**
* `updateCartQuantity` 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 item: CartItem caller-supplied value for `item: CartItem`
*/
updateCartQuantity: (item: CartItem) => {
return api.put('/cart/update', item)
},
// 获取购物车列表
/**
* `getCartList` 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.
*/
getCartList: () => {
return api.get('/cart/list')
},
// 清空购物车
/**
* `clearCart` 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.
*/
clearCart: () => {
return api.delete('/cart/clear')
}
}
+86
View File
@@ -0,0 +1,86 @@
/**
* Front-end API wrapper for this module.
* Call guide: import the named API object, then call the matching method from a Vue page or composable.
*/
import api from './index'
import type { IdType } from '@/utils/id'
/**
* Purpose: CommentVO supports comment.ts by holding or executing the comment 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 CommentVO {
id: IdType
userId: IdType
userNickname?: string
shopId?: IdType
shopName?: string
productId?: IdType
productTitle?: string
commentContent: string
parentCommentId?: IdType
parentCommentContent?: string
likeCount?: number
ratingScore?: number
imageFileIds?: IdType[]
imageUrls?: string[]
createTime?: string
updateTime?: string
replies?: CommentVO[]
}
export interface CommentCreateRequest {
productId: IdType
shopId?: IdType | null
parentCommentId?: IdType | null
commentContent: string
ratingScore?: number
imageFileIds?: IdType[]
}
export interface CommentImageFileVO {
id: IdType
fileName?: string
fileUrl?: string
createTime?: string
}
/**
* commentApi 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 commentApi = {
/**
* `listByProduct` 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 productId: IdType caller-supplied value for `productId: IdType`
*/
listByProduct: (productId: IdType) => {
return api.get<CommentVO[]>(`/comment/list/product/${productId}`) as unknown as Promise<CommentVO[]>
},
/**
* `create` 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 data: { productId: IdType; shopId?: IdType | null; parentCommentId?: IdType | null; commentContent: string } caller-supplied value for `data: { productId: IdType; shopId?: IdType | null; parentCommentId?: IdType | null; commentContent: string }`
*/
create: (data: CommentCreateRequest) => {
return api.post<IdType>('/comment/create', data) as unknown as Promise<IdType>
},
uploadImage: (file: File) => {
const formData = new FormData()
formData.append('file', file)
return api.post<CommentImageFileVO>('/comment/upload-image', formData, {
headers: {
'Content-Type': 'multipart/form-data'
}
}) as unknown as Promise<CommentImageFileVO>
},
/**
* `delete` 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 id: IdType caller-supplied value for `id: IdType`
*/
delete: (id: IdType) => {
return api.delete<boolean>(`/comment/delete/${id}`) as unknown as Promise<boolean>
}
}
+221
View File
@@ -0,0 +1,221 @@
/**
* Front-end API wrapper for this module.
* Call guide: import the named API object, then call the matching method from a Vue page or composable.
*/
import request from './index'
import type { IdType } from '@/utils/id'
/**
* Purpose: Coupon supports coupon.ts by holding or executing the coupon 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 Coupon {
id: IdType
couponCode: string
couponName: string
couponType: number
couponTypeName: string
discountValue?: number
minAmount?: number
reduceAmount?: number
totalCount: number
usedCount: number
remainingCount: number
startTime: string
endTime: string
status: number
statusName: string
shopId?: IdType
couponScene?: string
requiredVipLevel?: string
autoMatch?: number
availableTags: Tag[]
unavailableTags: Tag[]
}
/**
* Purpose: Tag supports coupon.ts by holding or executing the tag 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 Tag {
id: IdType
tagName?: string
}
/**
* Purpose: UserCoupon supports coupon.ts by holding or executing the user coupon 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 UserCoupon {
id: IdType
couponId: IdType
couponName: string
couponType: number
couponTypeName: string
discountValue: string
minAmount: string
reduceAmount: string
startTime: string
endTime: string
status: number
statusName: string
obtainTime: string
useTime: string
sourceType?: string
requiredVipLevel?: string
autoMatched?: boolean
}
/**
* Purpose: CreateCouponRequest supports coupon.ts by holding or executing the create coupon request 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 CreateCouponRequest {
couponCode: string
couponName: string
couponType: number
discountValue?: number
minAmount?: number
reduceAmount?: number
totalCount: number
startTime: string
endTime: string
couponScene?: string
requiredVipLevel?: string
autoMatch?: number
availableTagIds: IdType[]
unavailableTagIds: IdType[]
}
/**
* Purpose: CouponListResponse supports coupon.ts by holding or executing the coupon list 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 CouponListResponse {
list: Coupon[]
total: number
page: number
size: number
}
/**
* couponApi 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 couponApi = {
// 创建优惠券
/**
* `createCoupon` 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 data: CreateCouponRequest caller-supplied value for `data: CreateCouponRequest`
*/
createCoupon: (data: CreateCouponRequest) => {
return request({
url: '/coupon/create',
method: 'post',
data
})
},
// 更新优惠券
/**
* `updateCoupon` 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 id: IdType caller-supplied value for `id: IdType`
* @param data: CreateCouponRequest caller-supplied value for `data: CreateCouponRequest`
*/
updateCoupon: (id: IdType, data: CreateCouponRequest) => {
return request({
url: `/coupon/update/${id}`,
method: 'put',
data
})
},
// 删除优惠券
/**
* `deleteCoupon` 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 id: IdType caller-supplied value for `id: IdType`
*/
deleteCoupon: (id: IdType) => {
return request({
url: `/coupon/delete/${id}`,
method: 'delete'
})
},
// 获取优惠券详情
/**
* `getCouponById` 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 id: IdType caller-supplied value for `id: IdType`
*/
getCouponById: (id: IdType) => {
return request({
url: `/coupon/detail/${id}`,
method: 'get'
})
},
// 获取优惠券列表
/**
* `listCoupons` 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 params: { page: number; size: number; shopId?: IdType } caller-supplied value for `params: { page: number; size: number; shopId?: IdType }`
*/
listCoupons: (params: { page: number; size: number; shopId?: IdType }) => {
return request({
url: '/coupon/list',
method: 'get',
params
})
},
// 为用户分配优惠券
/**
* `assignCouponToUser` 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 userId: IdType caller-supplied value for `userId: IdType`
* @param couponId: IdType caller-supplied value for `couponId: IdType`
*/
assignCouponToUser: (userId: IdType, couponId: IdType) => {
return request({
url: '/coupon/assign',
method: 'post',
params: { userId, couponId }
})
},
// 获取用户优惠券列表
listUserCoupons: async (status?: number): Promise<UserCoupon[]> => {
return await request({
url: '/coupon/user/list',
method: 'get',
params: { status }
}) as UserCoupon[]
},
// 使用优惠券
/**
* `useCoupon` 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 userCouponId: IdType caller-supplied value for `userCouponId: IdType`
*/
useCoupon: (userCouponId: IdType) => {
return request({
url: '/coupon/use',
method: 'post',
params: { userCouponId }
})
},
// 获取作品可用的优惠券
getAvailableCoupons: async (productTags: string, productPrice: number, shopId?: IdType): Promise<UserCoupon[]> => {
return await request({
url: '/coupon/available',
method: 'get',
params: { productTags, productPrice, shopId }
}) as UserCoupon[]
}
}
+133
View File
@@ -0,0 +1,133 @@
/**
* Front-end API wrapper for this module.
* Call guide: import the named API object, then call the matching method from a Vue page or composable.
*/
import type { AxiosProgressEvent } from 'axios'
import api from './index'
import type { IdType } from '@/utils/id'
/**
* Purpose: ChunkUploadInitRequest supports file.ts by holding or executing the chunk upload init request 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 ChunkUploadInitRequest {
fileName: string
fileSize: number
contentType: string
fileFingerprint: string
scene: string
}
/**
* Purpose: ChunkUploadSessionVO supports file.ts by holding or executing the chunk upload session 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 ChunkUploadSessionVO {
uploadId: string
chunkSize: number
totalChunks: number
uploadedChunks: number[]
}
/**
* fileApi 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 fileApi = {
/**
* `uploadAvatar` 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 file: File caller-supplied value for `file: File`
*/
uploadAvatar: (file: File) => {
const formData = new FormData()
formData.append('file', file)
return api.post<string>('/user/upload-avatar', formData, {
headers: {
'Content-Type': 'multipart/form-data'
}
})
},
uploadProfileImage: (file: File) => {
const formData = new FormData()
formData.append('file', file)
return api.post<string>('/user/upload-profile-image', formData, {
headers: {
'Content-Type': 'multipart/form-data'
}
}) as unknown as Promise<string>
},
/**
* `initAvatarChunkUpload` 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 data: ChunkUploadInitRequest caller-supplied value for `data: ChunkUploadInitRequest`
*/
initAvatarChunkUpload: (data: ChunkUploadInitRequest) => {
return api.post<ChunkUploadSessionVO>('/user/upload-avatar/init', data) as unknown as Promise<ChunkUploadSessionVO>
},
uploadAvatarChunk: (
/**
* Purpose: data supports file.ts by holding or executing the data page or API role.
* Usage: import, call, read, or update this page-data from the owning page/module while preserving the surrounding loading and permission flow.
*/
data: { uploadId: string; chunkIndex: number; totalChunks: number; chunk: Blob },
config?: { signal?: AbortSignal; onUploadProgress?: (event: AxiosProgressEvent) => void }
) => {
const formData = new FormData()
formData.append('uploadId', data.uploadId)
formData.append('chunkIndex', String(data.chunkIndex))
formData.append('totalChunks', String(data.totalChunks))
formData.append('chunk', data.chunk)
return api.post<boolean>('/user/upload-avatar/chunk', formData, {
/**
* Purpose: headers supports file.ts by holding or executing the headers page or API role.
* Usage: import, call, read, or update this page-data-field from the owning page/module while preserving the surrounding loading and permission flow.
*/
headers: {
'Content-Type': 'multipart/form-data'
},
/**
* Purpose: signal supports file.ts by holding or executing the signal page or API role.
* Usage: import, call, read, or update this page-data-field from the owning page/module while preserving the surrounding loading and permission flow.
*/
signal: config?.signal,
/**
* Purpose: onUploadProgress supports file.ts by holding or executing the on upload progress page or API role.
* Usage: import, call, read, or update this page-data-field from the owning page/module while preserving the surrounding loading and permission flow.
*/
onUploadProgress: config?.onUploadProgress
})
},
/**
* `completeAvatarChunkUpload` 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 uploadId: string caller-supplied value for `uploadId: string`
*/
completeAvatarChunkUpload: (uploadId: string) => {
return api.post<string>('/user/upload-avatar/complete', { uploadId }) as unknown as Promise<string>
},
/**
* `cancelAvatarChunkUpload` 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 uploadId: string caller-supplied value for `uploadId: string`
*/
cancelAvatarChunkUpload: (uploadId: string) => {
return api.delete<boolean>(`/user/upload-avatar/${uploadId}`)
},
/**
* `getSignedUrl` 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 fileId: IdType caller-supplied value for `fileId: IdType`
* @param expiryTimeInMinutes?: number caller-supplied value for `expiryTimeInMinutes?: number`
*/
getSignedUrl: (fileId: IdType, expiryTimeInMinutes?: number) => {
return api.get<string>(`/file/get-signed-url/${fileId}`, {
/**
* Purpose: params supports file.ts by holding or executing the params page or API role.
* Usage: import, call, read, or update this page-data-field from the owning page/module while preserving the surrounding loading and permission flow.
*/
params: { expiryTimeInMinutes }
})
}
}
+349
View File
@@ -0,0 +1,349 @@
/**
* Front-end API wrapper for this module.
* Call guide: import the named API object, then call the matching method from a Vue page or composable.
*/
import axios, { AxiosError } from 'axios'
import { authApi } from './auth'
import { adminAuthApi } from './admin'
import { wishlistApi } from './wishlist'
import { message } from 'ant-design-vue'
import { API_BASE_URL } from '../config/api'
import type { IdType } from '@/utils/id'
import { clearAdminSessionStorage } from '@/utils/admin-session'
import { attachRequestSignature } from '@/utils/request-signature'
import { isApiAuthFreePath } from './auth-free-paths'
// 防重复提示标志
let lastErrorTime = 0
/**
* Purpose: lastErrorMessage supports index.ts by holding or executing the last error message page or API role.
* Usage: import, call, read, or update this let from the owning page/module while preserving the surrounding loading and permission flow.
*/
let lastErrorMessage = ''
/**
* Purpose: ERROR_DEBOUNCE_TIME supports index.ts by holding or executing the error debounce time page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const ERROR_DEBOUNCE_TIME = 1000 // 1秒内不重复显示相同错误
/**
* Purpose: api supports index.ts by holding or executing the api page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const api = axios.create({
baseURL: API_BASE_URL,
timeout: 60000,
headers: {
'Content-Type': 'application/json'
}
})
/**
* Purpose: isRefreshing supports index.ts by holding or executing the is refreshing page or API role.
* Usage: import, call, read, or update this let from the owning page/module while preserving the surrounding loading and permission flow.
*/
let isRefreshing = false
let failedQueue: Array<{
resolve: (value?: any) => void
reject: (reason?: any) => void
}> = []
/**
* Purpose: getStoredAccessToken supports index.ts by holding or executing the get stored access token page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const getStoredAccessToken = (isAdmin = false) => {
return isAdmin
? (localStorage.getItem('adminAccessToken') || sessionStorage.getItem('adminAccessToken'))
: (localStorage.getItem('accessToken') || sessionStorage.getItem('accessToken'))
}
/**
* Purpose: getStoredRefreshToken supports index.ts by holding or executing the get stored refresh token page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const getStoredRefreshToken = (isAdmin = false) => {
return isAdmin
? (localStorage.getItem('adminRefreshToken') || sessionStorage.getItem('adminRefreshToken'))
: (localStorage.getItem('refreshToken') || sessionStorage.getItem('refreshToken'))
}
/**
* Purpose: getRequestToken supports index.ts by holding or executing the get request token page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const getRequestToken = (request: any) => {
if (request?._authToken) {
return request._authToken as string
}
const authHeader = request?.headers?.Authorization || request?.headers?.authorization
if (typeof authHeader !== 'string') {
return null
}
return authHeader.startsWith('Bearer ') ? authHeader.slice('Bearer '.length) : null
}
/**
* Purpose: isCurrentStoredToken supports index.ts by holding or executing the is current stored token page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const isCurrentStoredToken = (token: string | null, isAdmin = false) => {
return Boolean(token && token === getStoredAccessToken(isAdmin))
}
/**
* Purpose: getResponseMessage supports index.ts by holding or executing the get response message page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const getResponseMessage = (error: AxiosError) => {
return (error.response?.data as any)?.message || error.message || '请求失败'
}
/**
* Purpose: isTokenExpiredResponse supports index.ts by holding or executing the is token expired response page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const isTokenExpiredResponse = (error: AxiosError, requestToken: string | null) => {
const messageText = getResponseMessage(error)
return Boolean(
requestToken
&& (
messageText.includes('Token')
|| messageText.includes('token')
|| messageText.includes('登录态')
|| messageText.includes('登录已过期')
|| messageText.includes('未登录')
|| messageText.includes('认证')
|| messageText.includes('重新登录')
)
)
}
/**
* Purpose: processQueue supports index.ts by holding or executing the process queue page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const processQueue = (error: any, token: string | null = null) => {
failedQueue.forEach(prom => {
if (error) {
prom.reject(error)
} else {
prom.resolve(token)
}
})
failedQueue = []
}
// 防抖处理错误提示
const showError = (msg: string) => {
const now = Date.now()
if (now - lastErrorTime > ERROR_DEBOUNCE_TIME || msg !== lastErrorMessage) {
lastErrorTime = now
lastErrorMessage = msg
message.error(msg)
}
}
/**
* Purpose: isAuthFreePath supports index.ts by holding or executing the is auth free path page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const isAuthFreePath = (url?: string) => {
return isApiAuthFreePath(url)
}
/**
* Purpose: handleTokenExpired supports index.ts by holding or executing the handle token expired page or API role.
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
*/
const handleTokenExpired = (isAdmin = false, failedToken: string | null = null) => {
if (!isCurrentStoredToken(failedToken, isAdmin)) {
return
}
// 清理token和用户信息
if (isAdmin) {
// 清理后台管理的token
clearAdminSessionStorage()
} else {
// 清理前台的token
localStorage.removeItem('accessToken')
localStorage.removeItem('refreshToken')
localStorage.removeItem('userInfo')
sessionStorage.removeItem('accessToken')
sessionStorage.removeItem('refreshToken')
}
// 显示错误提示
if (Date.now() - lastErrorTime > ERROR_DEBOUNCE_TIME || lastErrorMessage !== '登录已过期,请重新登录') {
showError('登录已过期,请重新登录')
}
// 执行跳转,确保无论如何都会跳转
setTimeout(() => {
if (isAdmin) {
window.location.href = '/admin/login'
} else {
window.location.href = '/'
}
}, 500) // 延迟执行,确保错误提示先显示
}
api.interceptors.request.use(
async config => {
const isAdminRequest = config.url?.includes('/admin/') || config.url?.includes('/order/admin/')
let token = isAdminRequest
? (localStorage.getItem('adminAccessToken') || sessionStorage.getItem('adminAccessToken'))
: (localStorage.getItem('accessToken') || sessionStorage.getItem('accessToken'))
// 检查是否是后台管理的API请求
if (!token && (config.url?.includes('/admin/') || config.url?.includes('/order/admin/'))) {
token = localStorage.getItem('adminAccessToken')
if (!token) {
token = sessionStorage.getItem('adminAccessToken')
}
}
if (token) {
config.headers.Authorization = `Bearer ${token}`
}
;(config as any)._authToken = token || null
return attachRequestSignature(config, token, {
authFree: isAuthFreePath(config.url)
})
},
error => {
return Promise.reject(error)
}
)
api.interceptors.response.use(
response => {
const res = response.data
if (res.code !== 200) {
const errorMsg = res.message || '请求失败'
if (!errorMsg.includes('权限') && !errorMsg.includes('permission')) {
showError(errorMsg)
}
return Promise.reject(new Error(errorMsg))
}
return res.data as any
},
async (error: AxiosError) => {
const originalRequest = error.config as any
const isWhitelistedPath = (url: string) => {
return isApiAuthFreePath(url)
}
if (error.response?.status === 401) {
// 检查是否是后台管理的API请求
const isAdminRequest = originalRequest.url?.includes('/admin/') || originalRequest.url?.includes('/order/admin/')
const requestToken = getRequestToken(originalRequest)
const isRealTokenExpired = isTokenExpiredResponse(error, requestToken)
if (!isRealTokenExpired) {
showError(getResponseMessage(error))
return Promise.reject(error)
}
if (!isCurrentStoredToken(requestToken, isAdminRequest)) {
return Promise.reject(error)
}
if (!originalRequest._retry && !isWhitelistedPath(originalRequest.url)) {
if (isRefreshing) {
return new Promise((resolve, reject) => {
failedQueue.push({ resolve, reject })
}).then(token => {
if (token) {
originalRequest.headers.Authorization = `Bearer ${token}`
originalRequest._authToken = token
}
return api(originalRequest)
}).catch(err => {
return Promise.reject(err)
})
}
originalRequest._retry = true
isRefreshing = true
try {
let refreshToken
if (isAdminRequest) {
refreshToken = getStoredRefreshToken(true)
} else {
refreshToken = getStoredRefreshToken(false)
}
if (!refreshToken) {
throw new Error('No refresh token available')
}
// 这里需要根据是否是后台请求调用不同的refreshToken API
// 暂时使用同一个API,实际项目中可能需要分开
const response = isAdminRequest
? await adminAuthApi.refreshToken(refreshToken)
: await authApi.refreshToken({ refreshToken })
const newToken = (response as any).accessToken
const newRefreshToken = (response as any).refreshToken
if (isAdminRequest) {
localStorage.setItem('adminAccessToken', newToken)
localStorage.setItem('adminRefreshToken', newRefreshToken)
sessionStorage.setItem('adminAccessToken', newToken)
} else {
localStorage.setItem('accessToken', newToken)
localStorage.setItem('refreshToken', newRefreshToken)
sessionStorage.setItem('accessToken', newToken)
sessionStorage.setItem('refreshToken', newRefreshToken)
}
processQueue(null, newToken)
originalRequest.headers.Authorization = `Bearer ${newToken}`
originalRequest._authToken = newToken
return api(originalRequest)
} catch (refreshError) {
processQueue(refreshError, null)
handleTokenExpired(isAdminRequest, requestToken)
return Promise.reject(refreshError)
} finally {
isRefreshing = false
}
} else {
handleTokenExpired(isAdminRequest, requestToken)
return Promise.reject(error)
}
} else if (error.response?.status !== 403) { // 403权限不足不提示
const errorMsg = (error.response?.data as any)?.message || error.message || '请求失败'
showError(errorMsg)
}
return Promise.reject(error)
}
)
/**
* fileApi 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 fileApi = {
/**
* `getSignedUrl` 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 fileId: IdType caller-supplied value for `fileId: IdType`
* @param expiryTimeInMinutes?: number caller-supplied value for `expiryTimeInMinutes?: number`
*/
getSignedUrl: (fileId: IdType, expiryTimeInMinutes?: number) => {
return api.get<string>(`/file/get-signed-url/${fileId}`, {
params: { expiryTimeInMinutes }
})
}
}
export { wishlistApi }
export default api
+92
View File
@@ -0,0 +1,92 @@
import api from './index'
import type { IdType } from '@/utils/id'
export interface NailArtistAvailabilityVO {
startTime: string
endTime: string
dateText: string
timeText: string
available: boolean
}
export interface NailArtistWorkVO {
id: IdType
title?: string
description?: string
price?: number | string
coverImageUrl?: string
imageUrls?: string[]
tags?: string[]
likeCount?: number
collectCount?: number
}
export interface NailArtistReviewVO {
id: IdType
artistId: IdType
customerId?: IdType
customerName?: string
customerAvatar?: string
productId?: IdType
productTitle?: string
rating?: number | string
content?: string
imageFileIds?: IdType[]
imageUrls?: string[]
submittedAt?: string
}
export interface NailArtistListItemVO {
id?: IdType
userId?: IdType
identity?: string
experience?: number
skills?: string
rating?: number | string
status?: number
participateProduction?: number
workStartTime?: string
workEndTime?: string
userType?: number
userTypeName?: string
portfolio?: string
nickname?: string
shopId?: IdType
shopName?: string
signature?: string
}
export interface NailArtistProfileVO {
artistId: IdType
artistName?: string
avatar?: string
identity?: string
signature?: string
experience?: number
status?: number
shopId?: IdType
shopName?: string
rating?: number | string
serviceCount?: number | string
workStartTime?: string
workEndTime?: string
styleTags?: string[]
works?: NailArtistWorkVO[]
reviews?: NailArtistReviewVO[]
availability?: NailArtistAvailabilityVO[]
}
export const nailArtistApi = {
getPublicProfile: async (artistId: IdType): Promise<NailArtistProfileVO> => {
return await api.get<NailArtistProfileVO>(`/nail-artist/profile/${artistId}`) as unknown as NailArtistProfileVO
},
getAvailability: async (artistId: IdType): Promise<NailArtistAvailabilityVO[]> => {
return await api.get<NailArtistAvailabilityVO[]>(`/nail-artist/${artistId}/availability`) as unknown as NailArtistAvailabilityVO[]
},
listReviews: async (artistId: IdType): Promise<NailArtistReviewVO[]> => {
return await api.get<NailArtistReviewVO[]>(`/nail-artist/${artistId}/reviews`) as unknown as NailArtistReviewVO[]
},
listByShopId: async (shopId: IdType): Promise<NailArtistListItemVO[]> => {
return await api.get<NailArtistListItemVO[]>(`/nail-artist/list/shop/${shopId}`) as unknown as NailArtistListItemVO[]
}
}
+476
View File
@@ -0,0 +1,476 @@
/**
* Front-end API wrapper for this module.
* Call guide: import the named API object, then call the matching method from a Vue page or composable.
*/
import api from './index'
import type { IdType } from '@/utils/id'
/**
* Purpose: OrderItem supports order.ts by holding or executing the order item 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 OrderItem {
productId: IdType
quantity: number
artistId?: IdType
appointmentTime?: string
}
/**
* Purpose: CreateOrderRequest supports order.ts by holding or executing the create order request 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 CreateOrderRequest {
couponId?: IdType
couponSourceType?: string
remark?: string
clientRequestId?: string
items: OrderItem[]
}
export type CheckoutPreviewRequest = CreateOrderRequest
export interface CheckoutCouponPreview {
id: IdType
couponId?: IdType
userCouponId?: IdType
sourceType?: string
couponName: string
couponType: number
couponTypeName?: string
discountValue?: number
minAmount?: number
reduceAmount?: number
discountAmount?: number
available?: boolean
best?: boolean
vipAuto?: boolean
displayText?: string
savingText?: string
unavailableReason?: string
startTime?: string
endTime?: string
}
export interface CheckoutIssue {
code: string
message: string
itemId?: IdType
productId?: IdType
productTitle?: string
}
export interface CheckoutPreview {
subtotalAmount: number
savedAmount: number
payableAmount: number
bestCoupon?: CheckoutCouponPreview
availableCoupons: CheckoutCouponPreview[]
unavailableCoupons: CheckoutCouponPreview[]
bookingAvailable?: boolean
bookingIssues?: CheckoutIssue[]
vipTip?: string
summaryText?: string
}
export interface PaymentOrderVO {
id: IdType
payNo?: string
orderId: IdType
orderNo?: string
userId?: IdType
shopId?: IdType
channel?: string
status?: string
payAmount?: number
paidAmount?: number
payTime?: string
expireTime?: string
remark?: string
}
export interface OrderQuoteItem {
orderItemId: IdType
quotedPrice?: number
}
export interface OrderQuoteSubmitRequest {
remark?: string
items: OrderQuoteItem[]
}
export interface OrderQuoteReplyRequest {
remark?: string
}
export interface OrderQuoteMessage {
id: IdType
orderId: IdType
actorId?: IdType
actorType?: string
actorTypeText?: string
action?: string
actionText?: string
remark?: string
items?: any[]
createTime?: string
}
export interface AfterSaleApplyRequest {
orderId: IdType
orderItemId?: IdType
type: string
reason: string
refundAmount?: number
}
export interface AfterSaleVO {
id: IdType
afterSaleNo?: string
orderId: IdType
orderItemId?: IdType
userId?: IdType
shopId?: IdType
type?: string
reason?: string
refundAmount?: number
status?: string
auditReason?: string
auditTime?: string
createTime?: string
}
export interface PageResult<T> {
list: T[]
total: number
page: number
size: number
}
export interface GrowthSummaryVO {
userId?: IdType
growthValue?: number
levelName?: string
appointmentCount?: number
reviewCount?: number
}
export const paymentApi = {
prepareOrderPayment: async (orderId: IdType): Promise<PaymentOrderVO> => {
return await api.post<PaymentOrderVO>(`/payment/order/${orderId}/prepare`) as unknown as PaymentOrderVO
},
mockSuccess: async (orderId: IdType): Promise<PaymentOrderVO> => {
return await api.post<PaymentOrderVO>(`/payment/order/${orderId}/mock-success`) as unknown as PaymentOrderVO
}
}
export const afterSaleApi = {
apply: async (data: AfterSaleApplyRequest): Promise<AfterSaleVO> => {
return await api.post<AfterSaleVO>('/after-sale/apply', data) as unknown as AfterSaleVO
},
listMy: async (params: { page: number; size: number }): Promise<PageResult<AfterSaleVO>> => {
return await api.get<PageResult<AfterSaleVO>>('/after-sale/my', { params }) as unknown as PageResult<AfterSaleVO>
}
}
export const growthApi = {
getSummary: async (): Promise<GrowthSummaryVO> => {
return await api.get<GrowthSummaryVO>('/growth/summary') as unknown as GrowthSummaryVO
}
}
/**
* Purpose: ArtistCalendarAppointment supports order.ts by holding or executing the artist calendar appointment 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 ArtistCalendarAppointment {
orderId: IdType
orderNo: string
totalAmount?: number
actualAmount?: number
orderStatus: number
orderStatusText: string
orderItemId: IdType
productId: IdType
productTitle: string
artistId: IdType
artistName?: string
customerNickname?: string
customerPhoneMasked?: string
shopId?: IdType
shopName?: string
appointmentStartTime: string
appointmentEndTime: string
quantity: number
durationMinutes: number
}
/**
* Purpose: OrderArtistReviewVO supports order.ts by holding or executing the order artist review 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 OrderArtistReviewVO {
id: IdType
orderId: IdType
orderItemId: IdType
productId?: IdType
productTitle?: string
artistId?: IdType
artistName?: string
artistAvatar?: string
userId?: IdType
rating?: number
content?: string
imageFileIds?: IdType[]
status?: number
statusText?: string
submitTime?: string
reviewTime?: string
createTime?: string
}
/**
* Purpose: OrderArtistReviewSubmitRequest supports order.ts by holding or executing the order artist review submit request 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 OrderArtistReviewSubmitRequest {
rating: number
content?: string
imageFileIds: IdType[]
}
/**
* Purpose: OrderArtistChangeOptionsVO supports order.ts by holding or executing the order artist change options 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 OrderArtistChangeOptionsVO {
orderId: IdType
orderItemId: IdType
currentArtistId?: IdType
currentArtistName?: string
artists: Array<{
artistId: IdType
artistName: string
artistAvatar?: string
userType?: number
participateProduction?: boolean
}>
}
/**
* Purpose: OrderArtistChangeRequestVO supports order.ts by holding or executing the order artist change request 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 OrderArtistChangeRequestVO {
id: IdType
orderId: IdType
orderItemId: IdType
productId?: IdType
productTitle?: string
shopId?: IdType
userId?: IdType
customerId?: IdType
originalArtistId?: IdType
originalArtistName?: string
requestedArtistId?: IdType
requestedArtistName?: string
fromArtistId?: IdType
fromArtistName?: string
toArtistId?: IdType
toArtistName?: string
requesterId?: IdType
requesterName?: string
status?: string
statusText?: string
reason?: string
rejectReason?: string
appointmentTime?: string
timeAffected?: boolean
timeImpactText?: string
originalPrice?: number | string
newPrice?: number | string
priceAffected?: boolean
priceImpactText?: string
reviewerId?: IdType
messageId?: IdType
reviewTime?: string
approvedTime?: string
rejectedTime?: string
expireTime?: string
createTime?: string
}
/**
* Purpose: OrderArtistChangeRequestSubmitRequest supports order.ts by holding or executing the order artist change request submit request 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 OrderArtistChangeRequestSubmitRequest {
orderId: IdType
orderItemId: IdType
requestedArtistId: IdType
reason: string
}
/**
* Purpose: OrderArtistChangeRejectRequest supports order.ts by holding or executing the order artist change reject request 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 OrderArtistChangeRejectRequest {
rejectReason?: string
}
/**
* orderApi 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 orderApi = {
// 创建订单
/**
* `createOrder` 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 data: CreateOrderRequest caller-supplied value for `data: CreateOrderRequest`
*/
createOrder: (data: CreateOrderRequest) => {
return api.post('/order/create', data)
},
createInquiryAppointment: (data: CreateOrderRequest) => {
return api.post('/order/create', data)
},
checkoutPreview: async (data: CheckoutPreviewRequest): Promise<CheckoutPreview> => {
return await api.post<CheckoutPreview>('/order/checkout-preview', data) as unknown as CheckoutPreview
},
replyQuote: async (orderId: IdType, data?: OrderQuoteReplyRequest): Promise<any> => {
return await api.post(`/order/${orderId}/quote/reply`, data || {}) as unknown as any
},
confirmUserQuote: async (orderId: IdType): Promise<any> => {
return await api.put(`/order/${orderId}/quote/confirm`) as unknown as any
},
submitShopQuote: async (orderId: IdType, data: OrderQuoteSubmitRequest): Promise<any> => {
return await api.post(`/order/${orderId}/quote/shop`, data) as unknown as any
},
confirmShopQuote: async (orderId: IdType): Promise<any> => {
return await api.put(`/order/${orderId}/quote/shop/confirm`) as unknown as any
},
// 获取订单列表
getOrderList: async (): Promise<any[]> => {
return await api.get<any[]>('/order/list') as unknown as any[]
},
getMyPendingReviews: async (): Promise<OrderArtistReviewVO[]> => {
return await api.get<OrderArtistReviewVO[]>('/order/review/my-pending') as unknown as OrderArtistReviewVO[]
},
getOrderReviews: async (orderId: IdType): Promise<OrderArtistReviewVO[]> => {
return await api.get<OrderArtistReviewVO[]>(`/order/${orderId}/reviews`) as unknown as OrderArtistReviewVO[]
},
submitArtistReview: async (reviewId: IdType, data: OrderArtistReviewSubmitRequest): Promise<OrderArtistReviewVO> => {
return await api.post<OrderArtistReviewVO>(`/order/review/${reviewId}/submit`, data) as unknown as OrderArtistReviewVO
},
getArtistChangeOptions: async (orderId: IdType, orderItemId: IdType): Promise<OrderArtistChangeOptionsVO> => {
return await api.get<OrderArtistChangeOptionsVO>(`/order/${orderId}/artist-change/options`, {
params: { orderItemId }
}) as unknown as OrderArtistChangeOptionsVO
},
requestArtistChange: async (data: OrderArtistChangeRequestSubmitRequest): Promise<OrderArtistChangeRequestVO> => {
return await api.post<OrderArtistChangeRequestVO>('/order/artist-change/request', data) as unknown as OrderArtistChangeRequestVO
},
getMyPendingArtistChangeRequests: async (): Promise<OrderArtistChangeRequestVO[]> => {
return await api.get<OrderArtistChangeRequestVO[]>('/order/artist-change/my-pending') as unknown as OrderArtistChangeRequestVO[]
},
getOrderArtistChangeRequests: async (orderId: IdType): Promise<OrderArtistChangeRequestVO[]> => {
return await api.get<OrderArtistChangeRequestVO[]>(`/order/${orderId}/artist-change/requests`) as unknown as OrderArtistChangeRequestVO[]
},
approveArtistChange: async (requestId: IdType): Promise<OrderArtistChangeRequestVO> => {
return await api.put<OrderArtistChangeRequestVO>(`/order/artist-change/${requestId}/approve`) as unknown as OrderArtistChangeRequestVO
},
rejectArtistChange: async (requestId: IdType, data?: OrderArtistChangeRejectRequest): Promise<OrderArtistChangeRequestVO> => {
return await api.put<OrderArtistChangeRequestVO>(`/order/artist-change/${requestId}/reject`, data || {}) as unknown as OrderArtistChangeRequestVO
},
// 获取订单详情
/**
* `getOrderDetail` 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 orderId: IdType caller-supplied value for `orderId: IdType`
*/
getOrderDetail: (orderId: IdType) => {
return api.get(`/order/detail/${orderId}`)
},
// 取消订单
/**
* `cancelOrder` 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 orderId: IdType caller-supplied value for `orderId: IdType`
*/
cancelOrder: (orderId: IdType) => {
return api.put(`/order/cancel/${orderId}`)
},
// 后台获取所有订单
/**
* `getAllOrders` 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.
*/
getAllOrders: () => {
return api.get('/order/admin/list')
},
// 后台处理订单
/**
* `processOrder` 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 orderId: IdType caller-supplied value for `orderId: IdType`
* @param status: number caller-supplied value for `status: number`
*/
processOrder: (orderId: IdType, status: number) => {
return api.put(`/order/admin/process/${orderId}`, {}, {
params: { status }
})
},
// 美甲师查看自己的订单
/**
* `getArtistOrders` 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.
*/
getArtistOrders: () => {
return api.get('/order/artist/list')
},
// 预约日历:recent 取未来 7 天概览,day 传 yyyy-MM-dd 查某天明细。
/**
* `completeArtistOrder` 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 orderId: IdType caller-supplied value for `orderId: IdType`
*/
completeArtistOrder: (orderId: IdType) => {
return api.put(`/order/artist/complete/${orderId}`)
},
getArtistCalendarRecent: async (days = 7): Promise<ArtistCalendarAppointment[]> => {
return await api.get<ArtistCalendarAppointment[]>('/order/artist/calendar/recent', {
params: { days }
}) as unknown as ArtistCalendarAppointment[]
},
getArtistCalendarDay: async (date: string): Promise<ArtistCalendarAppointment[]> => {
return await api.get<ArtistCalendarAppointment[]>('/order/artist/calendar/day', {
params: { date }
}) as unknown as ArtistCalendarAppointment[]
}
}
+115
View File
@@ -0,0 +1,115 @@
/**
* Front-end API wrapper for this module.
* Call guide: import the named API object, then call the matching method from a Vue page or composable.
*/
import { adminApi } from './admin'
import type { IdType } from '@/utils/id'
/**
* Purpose: PermissionVO supports permission.ts by holding or executing the permission 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 PermissionVO {
id: IdType
permissionCode: string
permissionName: string
permissionGroup: string
description: string
createTime: string
updateTime: string
}
/**
* Purpose: CreatePermissionRequest supports permission.ts by holding or executing the create permission request 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 CreatePermissionRequest {
permissionCode: string
permissionName: string
permissionGroup: string
description: string
}
/**
* Purpose: UpdatePermissionRequest supports permission.ts by holding or executing the update permission request 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 UpdatePermissionRequest {
permissionCode?: string
permissionName?: string
permissionGroup?: string
description?: string
}
/**
* permissionApi 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 permissionApi = {
/**
* `getUserPermissions` 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 userId?: IdType caller-supplied value for `userId?: IdType`
*/
getUserPermissions: (userId?: IdType) => {
if (userId) {
return adminApi.get<PermissionVO[]>(`/permission/user/${userId}`)
}
return adminApi.get<PermissionVO[]>('/permission/user/current')
},
/**
* `getAssignablePermissionIds` 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 userId: IdType caller-supplied value for `userId: IdType`
*/
getAssignablePermissionIds: (userId: IdType) => {
return adminApi.get<IdType[]>(`/permission/assignable/${userId}`)
},
/**
* `listAllPermissions` 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.
*/
listAllPermissions: () => {
return adminApi.get<PermissionVO[]>('/permission/list/all')
},
/**
* `createPermission` 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 data: CreatePermissionRequest caller-supplied value for `data: CreatePermissionRequest`
*/
createPermission: (data: CreatePermissionRequest) => {
return adminApi.post('/permission/create', data)
},
/**
* `updatePermission` 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 id: IdType caller-supplied value for `id: IdType`
* @param data: UpdatePermissionRequest caller-supplied value for `data: UpdatePermissionRequest`
*/
updatePermission: (id: IdType, data: UpdatePermissionRequest) => {
return adminApi.put(`/permission/update/${id}`, data)
},
/**
* `deletePermission` 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 id: IdType caller-supplied value for `id: IdType`
*/
deletePermission: (id: IdType) => {
return adminApi.delete(`/permission/delete/${id}`)
},
/**
* `assignUserPermissions` 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 userId: IdType caller-supplied value for `userId: IdType`
* @param permissionIds: IdType[] caller-supplied value for `permissionIds: IdType[]`
*/
assignUserPermissions: (userId: IdType, permissionIds: IdType[]) => {
return adminApi.post(`/permission/assign/${userId}`, { permissionIds })
}
}
+133
View File
@@ -0,0 +1,133 @@
/**
* Front-end API wrapper for this module.
* Call guide: import the named API object, then call the matching method from a Vue page or composable.
*/
import api from './index'
import type { IdType } from '@/utils/id'
/**
* Purpose: ProductVO supports product.ts by holding or executing the 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 ProductVO {
id: IdType
shopId: IdType | null
shopName?: string
name: string
title?: string
description: string
targetAudience?: string
precautions?: string
image: string
imageFileIds?: string
imageUrls?: string[]
price: number
estimatedTime: number
approximateDuration?: string
serviceDurationMinutes?: number
bookableArtists?: string
availableBookableArtistCount?: number
bookableArtistRestricted?: boolean
availableCoupons?: string
category: string
tags?: string
tagList?: string[]
tagInfos?: TagInfo[]
status: number
likeCount?: number
collectCount?: number
createTime: string
updateTime: string
}
/**
* Purpose: TagInfo supports product.ts by holding or executing the tag info 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 TagInfo {
id: IdType
tagName: string
textColor?: string
bgColor?: string
borderColor?: string
}
/**
* Purpose: ListProductsParams supports product.ts by holding or executing the list products params 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 ListProductsParams {
page: number
size: number
keyword?: string
tag?: string
tagIds?: string
}
/**
* Purpose: CreateProductRequest supports product.ts by holding or executing the create product request 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 CreateProductRequest {
name: string
description: string
image: string
price: number
estimatedTime: number
category: string
status: number
shopId: IdType | null
}
/**
* Purpose: UpdateProductRequest supports product.ts by holding or executing the update product request 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 UpdateProductRequest {
name?: string
description?: string
image?: string
price?: number
estimatedTime?: number
category?: string
status?: number
shopId?: IdType | null
}
/**
* productApi 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 productApi = {
getAllProducts: async (): Promise<ProductVO[]> => {
return await api.get<ProductVO[]>('/product/list/all') as unknown as ProductVO[]
},
getProductById: async (id: IdType): Promise<ProductVO> => {
return await api.get<ProductVO>(`/product/get/${id}`) as unknown as ProductVO
},
getProductsByTag: async (tag: string): Promise<ProductVO[]> => {
return await api.get<ProductVO[]>(`/product/list/tag/${tag}`) as unknown as ProductVO[]
},
likeProduct: async (productId: IdType): Promise<boolean> => {
return await api.post<boolean>(`/product-like/like/${productId}`) as unknown as boolean
},
unlikeProduct: async (productId: IdType): Promise<boolean> => {
return await api.post<boolean>(`/product-like/unlike/${productId}`) as unknown as boolean
},
searchProducts: async (keyword: string): Promise<ProductVO[]> => {
return await api.get<ProductVO[]>('/product/list/search', {
params: {
keyword: keyword
}
}) as unknown as ProductVO[]
},
getProductPage: async (params: ListProductsParams): Promise<{ list: ProductVO[]; total: number; page: number; size: number }> => {
return await api.get('/product/list/page', { params }) as unknown as { list: ProductVO[]; total: number; page: number; size: number }
}
}
+51
View File
@@ -0,0 +1,51 @@
/**
* Front-end API wrapper for this module.
* Call guide: import the named API object, then call the matching method from a Vue page or composable.
*/
import api from './index'
import type { IdType } from '@/utils/id'
/**
* productLikeApi 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 productLikeApi = {
/**
* 点赞作品
* @param productId 作品ID
*/
/**
* `likeProduct` 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 productId: IdType caller-supplied value for `productId: IdType`
*/
likeProduct: (productId: IdType) => {
return api.post<boolean>(`/product-like/like/${productId}`)
},
/**
* 取消点赞作品
* @param productId 作品ID
*/
/**
* `unlikeProduct` 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 productId: IdType caller-supplied value for `productId: IdType`
*/
unlikeProduct: (productId: IdType) => {
return api.post<boolean>(`/product-like/unlike/${productId}`)
},
/**
* 检查用户是否已点赞作品
* @param productId 作品ID
*/
/**
* `checkLikeStatus` 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 productId: IdType caller-supplied value for `productId: IdType`
*/
checkLikeStatus: (productId: IdType) => {
return api.get<boolean>(`/product-like/check/${productId}`)
}
}
+184
View File
@@ -0,0 +1,184 @@
/**
* Front-end API wrapper for this module.
* Call guide: import the named API object, then call the matching method from a Vue page or composable.
*/
import api from './index'
import type { IdType } from '@/utils/id'
/**
* Purpose: ShopVO supports shop.ts by holding or executing the shop 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 ShopVO {
id: IdType
shopName: string
description: string
address: string
mapProvider?: string
longitude?: number | string
latitude?: number | string
navigationUrls?: Record<string, string>
businessHours: string
status?: number
authorizationStartDate?: string
authorizationDays?: number
authorizationExpireTime?: string
authorizationExpired?: boolean
authorizationStatusText?: string
coverImageFileId?: string
coverImageUrls?: string[]
imageFileIds: string
imageUrls?: string[]
themePrimaryColor?: string
themeSecondaryColor?: string
themeAccentColor?: string
themePageBgColor?: string
themeCardBgColor?: string
themeBackgroundImageFileId?: string
createTime: string
updateTime: string
}
/**
* Purpose: ShopSimpleVO supports shop.ts by holding or executing the shop simple 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 ShopSimpleVO {
id: string | number
shopName?: string
name?: string
}
/**
* Purpose: ShopTrustProfileVO carries public trust signals for a shop detail page.
* Usage: fetch it with getTrustProfile and render ratings, recent reviews, environment images, and booking hints.
*/
export interface ShopTrustProfileVO {
shopId: IdType
shopName?: string
businessHoursText?: string
businessStatusText?: string
locationAvailable?: boolean
distanceCapabilityText?: string
navigationAvailable?: boolean
stats?: {
averageRating?: number
reviewCount?: number
productCount?: number
artistCount?: number
recentReviewCount?: number
}
environmentImages?: string[]
featuredProducts?: Array<{
id: IdType
title?: string
imageUrl?: string
imageFileIds?: string
price?: number
likeCount?: number
collectCount?: number
availableBookableArtistCount?: number
bookingHint?: string
}>
recentReviews?: Array<{
id: IdType
productId?: IdType
productTitle?: string
ratingScore?: number
content?: string
imageUrls?: string[]
submittedAt?: string
}>
availabilitySummary?: {
available?: boolean
summaryText?: string
nextSlots?: string[]
}
contactSummary?: {
actionText?: string
phoneExposed?: boolean
phone?: string
}
}
/**
* Purpose: ListShopsParams supports shop.ts by holding or executing the list shops params 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 ListShopsParams {
page: number
size: number
keyword?: string
}
/**
* Purpose: CreateShopRequest supports shop.ts by holding or executing the create shop request 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 CreateShopRequest {
name: string
description: string
image: string
phone: string
address: string
businessHours: string
status: number
authorizationStartDate?: string
authorizationDays?: number
authorizationExpireTime?: string
themePrimaryColor?: string
themeSecondaryColor?: string
themeAccentColor?: string
themePageBgColor?: string
themeCardBgColor?: string
themeBackgroundImageFileId?: string
}
/**
* Purpose: UpdateShopRequest supports shop.ts by holding or executing the update shop request 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 UpdateShopRequest {
name?: string
description?: string
image?: string
phone?: string
address?: string
businessHours?: string
status?: number
authorizationStartDate?: string
authorizationDays?: number
authorizationExpireTime?: string
themePrimaryColor?: string
themeSecondaryColor?: string
themeAccentColor?: string
themePageBgColor?: string
themeCardBgColor?: string
themeBackgroundImageFileId?: string
}
/**
* shopApi 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 shopApi = {
getAllShops: async (): Promise<ShopVO[]> => {
return await api.get<ShopVO[]>('/shop/list/all') as unknown as ShopVO[]
},
getPublicShops: async (): Promise<ShopVO[]> => {
return await api.get<ShopVO[]>('/shop/list/public') as unknown as ShopVO[]
},
getShopsSimple: async (): Promise<ShopSimpleVO[]> => {
return await api.get<ShopSimpleVO[]>('/shop/list/simple') as unknown as ShopSimpleVO[]
},
getShopById: async (id: IdType): Promise<ShopVO> => {
return await api.get<ShopVO>(`/shop/get/${id}`) as unknown as ShopVO
},
getTrustProfile: async (id: IdType): Promise<ShopTrustProfileVO> => {
return await api.get<ShopTrustProfileVO>(`/shop/trust-profile/${id}`) as unknown as ShopTrustProfileVO
}
}
+109
View File
@@ -0,0 +1,109 @@
/**
* Front-end API wrapper for this module.
* Call guide: import the named API object, then call the matching method from a Vue page or composable.
*/
import api from './index'
import type { IdType } from '@/utils/id'
/**
* Purpose: TagVO supports tag.ts by holding or executing the tag 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 TagVO {
id: IdType
tagName: string
textColor: string
bgColor: string
borderColor: string
sceneGroup?: string
displayName?: string
sortOrder?: number
frontVisible?: number
createTime: string
updateTime: string
}
/**
* Purpose: TagFilterGroupVO groups public tags for scene filters.
* Usage: render each group as one filter row and pass selected tag ids to product list APIs.
*/
export interface TagFilterGroupVO {
groupName: string
tags: TagVO[]
}
/**
* Purpose: TagDTO supports tag.ts by holding or executing the tag dto 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 TagDTO {
tagName: string
textColor: string
bgColor: string
borderColor: string
sceneGroup?: string
displayName?: string
sortOrder?: number
frontVisible?: number
}
/**
* tagApi 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 tagApi = {
/**
* `getAllTags` 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.
*/
getAllTags: () => {
return api.get<TagVO[]>('/tag/list/all')
},
/**
* `getFilterOptions` API call. Use this method to load customer-facing scene filters.
* Call guide: optionally pass shopId, await the grouped tags, then query products with tagIds.
*/
getFilterOptions: (shopId?: IdType | null) => {
return api.get<TagFilterGroupVO[]>('/tag/list/filter-options', {
params: shopId ? { shopId } : undefined
})
},
/**
* `getTagById` 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 id: IdType caller-supplied value for `id: IdType`
*/
getTagById: (id: IdType) => {
return api.get<TagVO>(`/tag/get/${id}`)
},
/**
* `createTag` 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 data: TagDTO caller-supplied value for `data: TagDTO`
*/
createTag: (data: TagDTO) => {
return api.post<TagVO>('/tag/add', data)
},
/**
* `updateTag` 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 id: IdType caller-supplied value for `id: IdType`
* @param data: TagDTO caller-supplied value for `data: TagDTO`
*/
updateTag: (id: IdType, data: TagDTO) => {
return api.put<TagVO>(`/tag/update/${id}`, data)
},
/**
* `deleteTag` 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 id: IdType caller-supplied value for `id: IdType`
*/
deleteTag: (id: IdType) => {
return api.delete(`/tag/delete/${id}`)
}
}
+469
View File
@@ -0,0 +1,469 @@
/**
* Front-end API wrapper for this module.
* Call guide: import the named API object, then call the matching method from a Vue page or composable.
*/
import api from './index'
import type { UserInfo } from './auth'
import type { IdType } from '@/utils/id'
/**
* Purpose: UserVO supports user.ts by holding or executing the user 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 UserVO extends UserInfo {
id: IdType
shopId?: IdType
shopName?: string
shopIds?: IdType[]
shopNames?: string[]
nickname: string
account: string
avatar: string
signature?: string
level?: string
type: number
vipId?: IdType
createTime: string
updateTime: string
status: number
phone?: string
contactPhone?: string
birthday?: string
wechatId?: string
wechatQrCode?: string
email?: string
maskedPhone?: string
maskedEmail?: string
shopRoleId?: IdType
shopRoleName?: string
parentUserId?: IdType
parentUserName?: string
parentUserTypeName?: string
relationSourceType?: string
}
/**
* Purpose: UpdateUserInfoRequest supports user.ts by holding or executing the update user info request 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 UpdateUserInfoRequest {
nickname?: string
avatar?: string
signature?: string
contactPhone?: string
birthday?: string
wechatId?: string
wechatQrCode?: string
}
/**
* Purpose: ListUsersParams supports user.ts by holding or executing the list users params 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 ListUsersParams {
page: number
size: number
keyword?: string
shopId?: IdType
status?: number
}
/**
* Purpose: CreateUserRequest supports user.ts by holding or executing the create user request 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 CreateUserRequest {
account: string
nickname: string
phone: string
contactPhone?: string
birthday?: string
wechatId?: string
wechatQrCode?: string
password: string
type: number
shopId?: IdType
shopIds?: IdType[]
}
/**
* Purpose: UpdateUserRequest supports user.ts by holding or executing the update user request 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 UpdateUserRequest {
account?: string
nickname?: string
phone?: string
contactPhone?: string
birthday?: string
wechatId?: string
wechatQrCode?: string
type?: number
shopId?: IdType
shopIds?: IdType[]
}
/**
* Purpose: UpdatePasswordRequest supports user.ts by holding or executing the update password request 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 UpdatePasswordRequest {
password: string
verificationCode: string
}
/**
* Purpose: BindPhoneRequest supports user.ts by holding or executing the bind phone request 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 BindPhoneRequest {
phone: string
verificationCode: string
}
/**
* Purpose: AvailabilityCheckResponse supports user.ts by holding or executing the availability check 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 AvailabilityCheckResponse {
available: boolean
message: string
}
/**
* Purpose: LoginAccountCheckResponse supports user.ts by holding or executing the login account check 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 LoginAccountCheckResponse {
exists: boolean
nickname?: string
message: string
}
/**
* Purpose: LoginShopSelectionResponse supports user.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: UserRelationVO supports user.ts by holding or executing the user relation 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 UserRelationVO {
userId: IdType
shopId?: IdType
shopName?: string
parentUserId?: IdType
parentUserName?: string
parentRoleType?: number
parentRoleTypeName?: string
sourceType?: string
sourceTypeName?: string
}
/**
* Purpose: NailArtistInfoVO supports user.ts by holding or executing the nail artist info 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 NailArtistInfoVO {
userId?: IdType
userType?: number
participateProduction?: number | boolean
status?: number
}
// 用户端常用接口约定:
// - relation 表示当前用户的门店和直属上级归属;
// - announcement 只用于首页滚动公告,不进入消息通知历史;
// - system-message 才是站内消息,popup/read 分开记录。
export interface InviteCodeVO {
id: IdType
inviteCode: string
ownerUserId?: IdType
ownerUserName?: string
shopId?: IdType
shopName?: string
status?: number
useCount?: number
expireTime?: string
createTime?: string
}
/**
* Purpose: UpdatePhoneRequest supports user.ts by holding or executing the update phone request 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 UpdatePhoneRequest {
oldPhone: string
newPhone: string
verificationCode: string
}
/**
* Purpose: UserAssetVO supports user.ts by holding or executing the user asset 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 UserAssetVO {
userId: IdType
nickname: string
balance: number
totalRechargeAmount: number
lastRechargeTime?: string
vipInfoId?: IdType
vipLevel: string
benefitId?: IdType
benefitInfo?: string
manualOverride?: boolean
vipStartTime?: string
vipExpireTime?: string
}
/**
* Purpose: BalanceHistoryItem supports user.ts by holding or executing the balance history item 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 BalanceHistoryItem {
id: IdType
userId: IdType
userNickname?: string
amount: number
type?: string
currentBalance?: number
beforeBalance?: number
afterBalance?: number
changeScene?: string
relatedOrderId?: IdType
relatedOrderNo?: string
externalOrderNo?: string
remark?: string
changeTime?: string
}
/**
* Purpose: SystemMessageVO supports user.ts by holding or executing the system message 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 SystemMessageVO {
id: IdType
title: string
content: string
imageFileId?: IdType
imageUrl?: string
publisherName?: string
targetType?: string
targetTypeName?: string
businessType?: string
businessId?: IdType
actionPath?: string
popupEnabled?: number
popupShown?: number
readStatus?: number
publishTime?: string
createTime?: string
}
/**
* Purpose: AnnouncementVO supports user.ts by holding or executing the announcement 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 AnnouncementVO {
id: IdType
title: string
content: string
publisherName?: string
targetType?: string
status?: number
sortOrder?: number
publishTime?: string
}
/**
* Purpose: VipRechargePlanVO supports user.ts by holding or executing the vip recharge plan 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 VipRechargePlanVO {
id: IdType
shopId: IdType
shopName?: string
title: string
rechargeAmount: number
giftAmount: number
vipLevel: string
description?: string
sortOrder?: number
status: number
}
/**
* Purpose: ContactInfoVO supports user.ts by holding or executing the contact info 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 ContactInfoVO {
contactUserId?: IdType
contactName?: string
roleLabel?: string
phone?: string
phoneAvailable?: boolean
wechatId?: string
wechatAvailable?: boolean
wechatQrCode?: string
platformContactAvailable?: boolean
platformContactText?: string
}
/**
* userApi 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 userApi = {
getUserInfo: async (): Promise<UserVO> => {
return await api.get<UserVO>('/user/info') as unknown as UserVO
},
/**
* `updateUserInfo` 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 data: UpdateUserInfoRequest caller-supplied value for `data: UpdateUserInfoRequest`
*/
updateUserInfo: (data: UpdateUserInfoRequest) => {
return api.put('/user/update', data)
},
/**
* `updatePassword` 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 data: UpdatePasswordRequest caller-supplied value for `data: UpdatePasswordRequest`
*/
updatePassword: (data: UpdatePasswordRequest) => {
return api.put('/user/password', data)
},
/**
* `bindPhone` 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 data: BindPhoneRequest caller-supplied value for `data: BindPhoneRequest`
*/
bindPhone: (data: BindPhoneRequest) => {
return api.post('/user/bind-phone', data)
},
/**
* `updatePhone` 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 data: UpdatePhoneRequest caller-supplied value for `data: UpdatePhoneRequest`
*/
updatePhone: (data: UpdatePhoneRequest) => {
return api.put('/user/phone', data)
},
getUserByAccount: async (account: string): Promise<UserVO> => {
return await api.get<UserVO>(`/user/get/account/${account}`) as unknown as UserVO
},
checkAccountAvailability: async (account: string): Promise<AvailabilityCheckResponse> => {
return await api.get<AvailabilityCheckResponse>(`/user/check/account/${encodeURIComponent(account)}`) as unknown as AvailabilityCheckResponse
},
checkLoginAccountAvailability: async (account: string): Promise<LoginAccountCheckResponse> => {
return await api.get<LoginAccountCheckResponse>(`/user/check/login-account/${encodeURIComponent(account)}`) as unknown as LoginAccountCheckResponse
},
getLoginShopsByAccount: async (account: string): Promise<LoginShopSelectionResponse> => {
return await api.get<LoginShopSelectionResponse>(`/user/check/login-shops/account/${encodeURIComponent(account)}`) as unknown as LoginShopSelectionResponse
},
getLoginShopsByPhone: async (phone: string): Promise<LoginShopSelectionResponse> => {
return await api.get<LoginShopSelectionResponse>(`/user/check/login-shops/phone/${encodeURIComponent(phone)}`) as unknown as LoginShopSelectionResponse
},
checkPhoneAvailability: async (phone: string): Promise<AvailabilityCheckResponse> => {
return await api.get<AvailabilityCheckResponse>(`/user/check/phone/${encodeURIComponent(phone)}`) as unknown as AvailabilityCheckResponse
},
listUsersByType: async (type: number): Promise<UserVO[]> => {
return await api.get<UserVO[]>(`/user/list/type/${type}`) as unknown as UserVO[]
},
/**
* `sendVerificationCode` 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 data: { phone: string; sceneCode?: string } caller-supplied value for `data: { phone: string; sceneCode?: string }`
*/
sendVerificationCode: (data: { phone: string; sceneCode?: string }) => {
return api.post('/user/send-verification-code', data)
},
/**
* `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?: string | number caller-supplied value for `shopId?: string | number`
*/
switchShop: (shopId?: string | number) => {
return api.post('/user/switch-shop', { shopId })
},
getMyAsset: async (): Promise<UserAssetVO> => {
return await api.get<UserAssetVO>('/user/asset/me') as unknown as UserAssetVO
},
getMyBalanceHistory: async (): Promise<BalanceHistoryItem[]> => {
return await api.get<BalanceHistoryItem[]>('/user/balance/history/me') as unknown as BalanceHistoryItem[]
},
listMyMessages: async (): Promise<SystemMessageVO[]> => {
return await api.get<SystemMessageVO[]>('/system-message/my/list') as unknown as SystemMessageVO[]
},
listMyPopupMessages: async (): Promise<SystemMessageVO[]> => {
return await api.get<SystemMessageVO[]>('/system-message/my/popup') as unknown as SystemMessageVO[]
},
getMyUnreadMessageCount: async (): Promise<{ unreadCount: number }> => {
return await api.get<{ unreadCount: number }>('/system-message/my/unread-count') as unknown as { unreadCount: number }
},
getMyMessage: async (id: IdType): Promise<SystemMessageVO> => {
return await api.get<SystemMessageVO>(`/system-message/my/${id}`) as unknown as SystemMessageVO
},
/**
* `markMessagePopupShown` 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 id: IdType caller-supplied value for `id: IdType`
*/
markMessagePopupShown: (id: IdType) => {
return api.put(`/system-message/my/${id}/popup-shown`, {})
},
/**
* `markMessageRead` 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 id: IdType caller-supplied value for `id: IdType`
*/
markMessageRead: (id: IdType) => {
return api.put(`/system-message/my/${id}/read`, {})
},
listMyAnnouncements: async (): Promise<AnnouncementVO[]> => {
return await api.get<AnnouncementVO[]>('/announcement/my/list') as unknown as AnnouncementVO[]
},
listMyVipRechargePlans: async (): Promise<VipRechargePlanVO[]> => {
return await api.get<VipRechargePlanVO[]>('/vip-recharge-plan/my/list') as unknown as VipRechargePlanVO[]
},
getMyRelation: async (): Promise<UserRelationVO> => {
return await api.get<UserRelationVO>('/user/relation/me') as unknown as UserRelationVO
},
getNailArtistInfo: async (userId: IdType): Promise<NailArtistInfoVO | null> => {
return await api.get<NailArtistInfoVO | null>(`/nail-artist/get/${userId}`) as unknown as NailArtistInfoVO | null
},
// 注册页输入邀请码时先解析,给用户展示“将归属到谁/哪个店铺”。
resolveInviteCode: async (code: string): Promise<InviteCodeVO> => {
return await api.get<InviteCodeVO>('/user/invite-code/resolve', { params: { code } }) as unknown as InviteCodeVO
},
getShopManagerContact: async (shopId: IdType): Promise<ContactInfoVO> => {
return await api.get<ContactInfoVO>(`/contact-info/shop/${shopId}/manager`) as unknown as ContactInfoVO
},
getProductArtistContact: async (productId: IdType, artistId: IdType): Promise<ContactInfoVO> => {
return await api.get<ContactInfoVO>(`/contact-info/product/${productId}/artist/${artistId}`) as unknown as ContactInfoVO
},
getOrderArtistContact: async (orderId: IdType, artistId?: IdType): Promise<ContactInfoVO> => {
const params = artistId ? { artistId } : {}
return await api.get<ContactInfoVO>(`/contact-info/order/${orderId}/artist`, { params }) as unknown as ContactInfoVO
},
getPlatformContact: async (): Promise<ContactInfoVO> => {
return await api.get<ContactInfoVO>('/contact-info/platform') as unknown as ContactInfoVO
},
/**
* `deactivateAccount` 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.
*/
deactivateAccount: () => {
return api.delete('/user/deactivate')
}
}
+123
View File
@@ -0,0 +1,123 @@
/**
* Front-end API wrapper for this module.
* Call guide: import the named API object, then call the matching method from a Vue page or composable.
*/
import api from './index'
import type { IdType } from '@/utils/id'
/**
* Purpose: WishlistItem supports wishlist.ts by holding or executing the wishlist item 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 WishlistItem {
id: IdType
userId: IdType
productId: IdType
groupId?: IdType | null
groupName?: string | null
note?: string | null
sortOrder?: number | null
product: {
id: IdType
shopId: IdType | null
shopName?: string
title: string
description: string
imageFileIds?: string
imageUrls?: string[]
price: number
tags?: string
tagList?: string[]
tagInfos?: any[]
likeCount?: number
collectCount?: number
approximateDuration?: string
bookableArtists?: string
availableCoupons?: string
createTime: string
updateTime: string
}
}
export interface WishlistGroup {
id: IdType
name: string
sortOrder: number
itemCount: number
items?: WishlistItem[]
}
export interface WishlistInspiration {
total: number
groups: WishlistGroup[]
}
export interface WishlistGroupPayload {
name: string
sortOrder?: number
}
export interface WishlistAddWithGroupPayload {
productId: IdType
groupId?: IdType | null
note?: string
sortOrder?: number
}
export interface WishlistMovePayload {
wishlistId?: IdType
productId?: IdType
groupId?: IdType | null
note?: string
sortOrder?: number
}
/**
* wishlistApi 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 wishlistApi = {
addToWishlist: async (productId: IdType): Promise<boolean> => {
return await api.post<boolean>('/wishlist/add', { productId }) as unknown as boolean
},
removeFromWishlist: async (productId: IdType): Promise<boolean> => {
return await api.post<boolean>('/wishlist/remove', { productId }) as unknown as boolean
},
checkWishlist: async (productId: IdType): Promise<boolean> => {
return await api.get<boolean>(`/wishlist/check?productId=${productId}`) as unknown as boolean
},
getWishlist: async (): Promise<WishlistItem[]> => {
return await api.get<WishlistItem[]>('/wishlist/list') as unknown as WishlistItem[]
},
getGroups: async (): Promise<WishlistGroup[]> => {
return await api.get<WishlistGroup[]>('/wishlist/groups') as unknown as WishlistGroup[]
},
createGroup: async (payload: WishlistGroupPayload): Promise<IdType> => {
return await api.post<IdType>('/wishlist/groups', payload) as unknown as IdType
},
updateGroup: async (id: IdType, payload: WishlistGroupPayload): Promise<boolean> => {
return await api.put<boolean>(`/wishlist/groups/${id}`, payload) as unknown as boolean
},
deleteGroup: async (id: IdType): Promise<boolean> => {
return await api.delete<boolean>(`/wishlist/groups/${id}`) as unknown as boolean
},
addWithGroup: async (payload: WishlistAddWithGroupPayload): Promise<boolean> => {
return await api.post<boolean>('/wishlist/add-with-group', payload) as unknown as boolean
},
moveWishlist: async (payload: WishlistMovePayload): Promise<boolean> => {
return await api.post<boolean>('/wishlist/move', payload) as unknown as boolean
},
getInspiration: async (): Promise<WishlistInspiration> => {
return await api.get<WishlistInspiration>('/wishlist/inspiration') as unknown as WishlistInspiration
}
}