/** * 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 => { return await api.get('/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 => { return await api.get(`/user/get/account/${account}`) as unknown as UserVO }, checkAccountAvailability: async (account: string): Promise => { return await api.get(`/user/check/account/${encodeURIComponent(account)}`) as unknown as AvailabilityCheckResponse }, checkLoginAccountAvailability: async (account: string): Promise => { return await api.get(`/user/check/login-account/${encodeURIComponent(account)}`) as unknown as LoginAccountCheckResponse }, getLoginShopsByAccount: async (account: string): Promise => { return await api.get(`/user/check/login-shops/account/${encodeURIComponent(account)}`) as unknown as LoginShopSelectionResponse }, getLoginShopsByPhone: async (phone: string): Promise => { return await api.get(`/user/check/login-shops/phone/${encodeURIComponent(phone)}`) as unknown as LoginShopSelectionResponse }, checkPhoneAvailability: async (phone: string): Promise => { return await api.get(`/user/check/phone/${encodeURIComponent(phone)}`) as unknown as AvailabilityCheckResponse }, listUsersByType: async (type: number): Promise => { return await api.get(`/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 => { return await api.get('/user/asset/me') as unknown as UserAssetVO }, getMyBalanceHistory: async (): Promise => { return await api.get('/user/balance/history/me') as unknown as BalanceHistoryItem[] }, listMyMessages: async (): Promise => { return await api.get('/system-message/my/list') as unknown as SystemMessageVO[] }, listMyPopupMessages: async (): Promise => { return await api.get('/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 => { return await api.get(`/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 => { return await api.get('/announcement/my/list') as unknown as AnnouncementVO[] }, listMyVipRechargePlans: async (): Promise => { return await api.get('/vip-recharge-plan/my/list') as unknown as VipRechargePlanVO[] }, getMyRelation: async (): Promise => { return await api.get('/user/relation/me') as unknown as UserRelationVO }, getNailArtistInfo: async (userId: IdType): Promise => { return await api.get(`/nail-artist/get/${userId}`) as unknown as NailArtistInfoVO | null }, // 注册页输入邀请码时先解析,给用户展示“将归属到谁/哪个店铺”。 resolveInviteCode: async (code: string): Promise => { return await api.get('/user/invite-code/resolve', { params: { code } }) as unknown as InviteCodeVO }, getShopManagerContact: async (shopId: IdType): Promise => { return await api.get(`/contact-info/shop/${shopId}/manager`) as unknown as ContactInfoVO }, getProductArtistContact: async (productId: IdType, artistId: IdType): Promise => { return await api.get(`/contact-info/product/${productId}/artist/${artistId}`) as unknown as ContactInfoVO }, getOrderArtistContact: async (orderId: IdType, artistId?: IdType): Promise => { const params = artistId ? { artistId } : {} return await api.get(`/contact-info/order/${orderId}/artist`, { params }) as unknown as ContactInfoVO }, getPlatformContact: async (): Promise => { return await api.get('/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') } }