Files
JayuCloud/Frontend/src/api/shop.ts
T

76 lines
1.4 KiB
TypeScript
Raw Normal View History

2026-02-24 09:59:22 +08:00
import api from './index'
export interface ShopVO {
id: number
2026-02-25 10:37:16 +08:00
name: string
2026-02-24 09:59:22 +08:00
description: string
2026-02-25 10:37:16 +08:00
image: string
phone: string
address: string
businessHours: string
status: number
2026-02-24 09:59:22 +08:00
createTime: string
updateTime: string
}
export interface ShopSimpleVO {
id: number
2026-02-25 10:37:16 +08:00
name: string
}
export interface ListShopsParams {
page: number
size: number
keyword?: string
}
export interface CreateShopRequest {
name: string
description: string
image: string
phone: string
address: string
businessHours: string
status: number
}
export interface UpdateShopRequest {
name?: string
description?: string
image?: string
phone?: string
address?: string
businessHours?: string
status?: number
2026-02-24 09:59:22 +08:00
}
export const shopApi = {
getAllShops: () => {
return api.get<ShopVO[]>('/shop/list/all')
},
getShopsSimple: () => {
return api.get<ShopSimpleVO[]>('/shop/list/simple')
},
getShopById: (id: number) => {
return api.get<ShopVO>(`/shop/get/${id}`)
2026-02-25 10:37:16 +08:00
},
listShops: (params: ListShopsParams) => {
return api.get<any>('/admin/shop/list', { params })
},
createShop: (data: CreateShopRequest) => {
return api.post('/admin/shop/create', data)
},
updateShop: (id: number, data: UpdateShopRequest) => {
return api.put(`/admin/shop/update/${id}`, data)
},
deleteShop: (id: number) => {
return api.delete(`/admin/shop/delete/${id}`)
2026-02-24 09:59:22 +08:00
}
2026-02-25 10:37:16 +08:00
}