后台管理页面初版
This commit is contained in:
+40
-26
@@ -2,34 +2,44 @@ import api from './index'
|
||||
|
||||
export interface ProductVO {
|
||||
id: number
|
||||
shopId: number
|
||||
shopName: string
|
||||
title: string
|
||||
shopId: number | null
|
||||
name: string
|
||||
description: string
|
||||
imageFileIds: string
|
||||
imageUrls: string[]
|
||||
image: string
|
||||
price: number
|
||||
tags: string
|
||||
tagList: string[]
|
||||
likeCount: number
|
||||
collectCount: number
|
||||
approximateDuration: string
|
||||
bookableArtists: string
|
||||
availableCoupons: string
|
||||
estimatedTime: number
|
||||
category: string
|
||||
status: number
|
||||
createTime: string
|
||||
updateTime: string
|
||||
}
|
||||
|
||||
export interface ProductDTO {
|
||||
shopId: number
|
||||
title: string
|
||||
export interface ListProductsParams {
|
||||
page: number
|
||||
size: number
|
||||
keyword?: string
|
||||
}
|
||||
|
||||
export interface CreateProductRequest {
|
||||
name: string
|
||||
description: string
|
||||
imageFileIds: string
|
||||
image: string
|
||||
price: number
|
||||
tags: string
|
||||
approximateDuration: string
|
||||
bookableArtists: string
|
||||
availableCoupons: string
|
||||
estimatedTime: number
|
||||
category: string
|
||||
status: number
|
||||
shopId: number | null
|
||||
}
|
||||
|
||||
export interface UpdateProductRequest {
|
||||
name?: string
|
||||
description?: string
|
||||
image?: string
|
||||
price?: number
|
||||
estimatedTime?: number
|
||||
category?: string
|
||||
status?: number
|
||||
shopId?: number | null
|
||||
}
|
||||
|
||||
export const productApi = {
|
||||
@@ -45,15 +55,19 @@ export const productApi = {
|
||||
return api.get<ProductVO[]>(`/product/list/tag/${tag}`)
|
||||
},
|
||||
|
||||
createProduct: (data: ProductDTO) => {
|
||||
return api.post<ProductVO>('/product/add', data)
|
||||
listProducts: (params: ListProductsParams) => {
|
||||
return api.get<any>('/admin/product/list', { params })
|
||||
},
|
||||
|
||||
updateProduct: (id: number, data: ProductDTO) => {
|
||||
return api.put<ProductVO>(`/product/update/${id}`, data)
|
||||
createProduct: (data: CreateProductRequest) => {
|
||||
return api.post('/admin/product/create', data)
|
||||
},
|
||||
|
||||
updateProduct: (id: number, data: UpdateProductRequest) => {
|
||||
return api.put(`/admin/product/update/${id}`, data)
|
||||
},
|
||||
|
||||
deleteProduct: (id: number) => {
|
||||
return api.delete(`/product/delete/${id}`)
|
||||
return api.delete(`/admin/product/delete/${id}`)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user