功能:更新消息中心和 YumiNail 模块
This commit is contained in:
@@ -0,0 +1,96 @@
|
||||
import api from './index'
|
||||
import type { IdType } from '@/utils/id'
|
||||
|
||||
export interface ProductVO {
|
||||
id: IdType
|
||||
shopId: IdType | null
|
||||
shopName?: string
|
||||
name: string
|
||||
title?: string
|
||||
description: string
|
||||
image: string
|
||||
imageFileIds?: string
|
||||
imageUrls?: string[]
|
||||
price: number
|
||||
estimatedTime: number
|
||||
approximateDuration?: string
|
||||
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
|
||||
}
|
||||
|
||||
export interface TagInfo {
|
||||
id: IdType
|
||||
tagName: string
|
||||
textColor?: string
|
||||
bgColor?: string
|
||||
borderColor?: string
|
||||
}
|
||||
|
||||
export interface ListProductsParams {
|
||||
page: number
|
||||
size: number
|
||||
keyword?: string
|
||||
}
|
||||
|
||||
export interface CreateProductRequest {
|
||||
name: string
|
||||
description: string
|
||||
image: string
|
||||
price: number
|
||||
estimatedTime: number
|
||||
category: string
|
||||
status: number
|
||||
shopId: IdType | null
|
||||
}
|
||||
|
||||
export interface UpdateProductRequest {
|
||||
name?: string
|
||||
description?: string
|
||||
image?: string
|
||||
price?: number
|
||||
estimatedTime?: number
|
||||
category?: string
|
||||
status?: number
|
||||
shopId?: IdType | null
|
||||
}
|
||||
|
||||
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/${productId}`) as unknown as boolean
|
||||
},
|
||||
|
||||
unlikeProduct: async (productId: IdType): Promise<boolean> => {
|
||||
return await api.post<boolean>(`/product/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[]
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user