Oroqen-Vue/src/api/product.ts

47 lines
1.1 KiB
TypeScript
Raw Normal View History

2025-08-10 20:42:49 +08:00
import api from './index'
// 产品接口
export const productApi = {
// 获取产品列表
getProductList: (params: any) => {
return api.get('/oroqen/product/list', { params })
},
// 获取产品详情
getProductById: (id: string | number) => {
return api.get('/oroqen/product/queryById', { params: { id: id.toString() } })
},
// 获取推荐产品
getFeaturedProducts: () => {
return api.get('/oroqen/product/featured')
},
// 获取热销产品
getHotProducts: () => {
return api.get('/oroqen/product/hot')
},
// 根据分类获取产品
getProductsByCategory: (categoryId: string, params: any) => {
return api.get(`/oroqen/product/category/${categoryId}`, { params })
}
}
// 产品分类接口
export const productCategoryApi = {
// 获取分类树
getCategoryTree: () => {
return api.get('/oroqen/productCategory/tree')
},
// 获取分类列表
getCategoryList: (params: any) => {
return api.get('/oroqen/productCategory/list', { params })
},
// 获取子分类
getChildCategories: (parentId: string) => {
return api.get(`/oroqen/productCategory/children/${parentId}`)
}
}