product.ts 803 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /**
  2. * 商品管理相关API
  3. */
  4. import { get } from '@/utils/request';
  5. export interface ProductQueryParams {
  6. page?: number;
  7. pageSize?: number;
  8. name?: string;
  9. barcode?: string;
  10. category?: string;
  11. syncStatus?: number;
  12. }
  13. export interface ProductListResponse {
  14. list: any[];
  15. total: number;
  16. page: number;
  17. pageSize: number;
  18. }
  19. /**
  20. * 获取商品列表
  21. */
  22. export async function getProductList(params: ProductQueryParams = {}): Promise<ProductListResponse> {
  23. return get('/products/list', params);
  24. }
  25. /**
  26. * 获取商品详情
  27. */
  28. export async function getProductDetail(productId: string): Promise<any> {
  29. return get(`/products/${productId}`);
  30. }
  31. /**
  32. * 获取商品统计数据
  33. */
  34. export async function getProductStatistics(): Promise<any> {
  35. return get('/products/statistics');
  36. }