forked from Qi/Oroqen-Vue
47 lines
1.1 KiB
TypeScript
47 lines
1.1 KiB
TypeScript
|
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}`)
|
||
|
}
|
||
|
}
|