import { get, post } from '@/utils';
import { CategoryBean, GoodsBean } from '@/api/goods/types';

enum URL {
  categoryList = '/ext/goods/category_list',
  goodsList = '/ext/goods/query',
  goodsDetail = '/ext/goods/info',
  orderCreate = '/sales/wx_order_create',
  orderList = '/sales/wx_query',
}

export const getCategoryList = () => get<CategoryBean[]>({ url: URL.categoryList });

export const getGoodsList = (params: any) => get<GoodsBean[]>({ url: URL.goodsList, data: params });

export const getGoodsDetail = (goodsId: string) => get<GoodsBean>({ url: URL.goodsDetail + `?goodsId=${goodsId}` });

export const orderCreate = (data: any) => post({ url: URL.orderCreate, data });

export const getOrderList = (data: {
  pageNum: number,
  pageSize: number,
  obj: {
    payStatus: number
  }
}) => post({ url: URL.orderList, data });

