import request from '@/config/axios'

export interface CategoryVO {
  id: number
  parentId: number
  name: string
  picUrl: string
  bigPicUrl: string
  sort: number
  status: number
}

// 查询商品分类列表
export const getCategoryPage = async (params) => {
  return await request.get({ url: `/member/category/page`, params })
}

// 查询商品分类详情
export const getCategory = async (id: number) => {
  return await request.get({ url: `/member/category/get?id=` + id })
}

// 新增商品分类
export const createCategory = async (data: CategoryVO) => {
  return await request.post({ url: `/member/category/create`, data })
}

// 修改商品分类
export const updateCategory = async (data: CategoryVO) => {
  return await request.put({ url: `/member/category/update`, data })
}

// 删除商品分类
export const deleteCategory = async (id: number) => {
  return await request.delete({ url: `/member/category/delete?id=` + id })
}

// 导出商品分类 Excel
export const exportCategory = async (params) => {
  return await request.download({ url: `/member/category/export-excel`, params })
}
