import { useMyRequest } from '~/composables/useFetchRequest'

enum Api {
  CartList = '/client/cart/list/my',
  RemoveCart = '/client/cart/del',
  ChangeQuantity = '/client/cart/updateQuantity',
  CartBrandQuantityApi = '/client/cart/brandQuantity',
  CancelOrder = '/client/order/wish/cancel',
  SubmitOrder = '/client/order/wish/submitFromCart',
}
/**
 * 获取商品列表
 * @param params
 * @return
 */
export async function getCartListApi(params?: any) {
  return await useMyRequest().get(Api.CartList, params)
}
/**
 * 获取购物车中的品牌数量
 * @param params
 * @return
 */
export async function getCartBrandQuantityApi(params?: any) {
  return await useMyRequest().get(Api.CartBrandQuantityApi, params)
}

/**
 * 移除购物车
 * @param params
 * @return
 */
export async function removeCartApi(params: any) {
  return await useMyRequest().post(Api.RemoveCart, params)
}
/**
 * 更新购物车数量
 * @param params
 * @return
 */
export async function changeQuantityApi(params: any) {
  return await useMyRequest().post(Api.ChangeQuantity, params)
}

/**
 * 提交订单
 * @param params
 * @returns
 */
export async function submitOrderApi(params: any) {
  return await useMyRequest().post(Api.SubmitOrder, params)
}
