import request from '@/utils/request';

//商品详情

export const getProductDetail = (id: any) => {
  return request({
    url: '/product/indexProduct/getProductDetail/' + id,
    method: 'get'
  });
};

//将商品添加到购物车
export const addProductShoppingCart = (params: any) => {
  return request({
    url: '/product/myProduct/addProductShoppingCart',
    method: 'post',
    data: params
  });
};

//查询购物车的商品

export const shoppingCartList = (query: any) => {
  return request({
    url: '/product/myProduct/getProductShoppingCartPage',
    method: 'get',
    params: query
  });
};

//删除购物车商品

export const deleteProductShoppingCart = (ids: any) => {
  return request({
    url: '/product/myProduct/deleteProductShoppingCart/' + ids,
    method: 'delete'
  });
};

//新增商品浏览记录

export const addProductBrowsingHistory = (id: any) => {
  return request({
    url: '/product/myProduct/addProductBrowsingHistory/' + id,
    method: 'post'
  });
};

//查询商品是否在默认收藏夹收藏

export const isProductInDefaultCollect = (id: any) => {
  return request({
    url: '/product/myProduct/isProductInDefaultCollect/' + id,
    method: 'get'
  });
};

//新增商品收藏夹

export const addProductCollect = (params: any) => {
  return request({
    url: '/product/myProduct/addProductCollect',
    method: 'post',
    data: params
  });
};

//查询商品收藏夹列表

export const favoritesList = (params: any) => {
  return request({
    url: '/product/favorites/list',
    method: 'get'
  });
};

//取消收藏

export const cancelProductCollect = (query: any) => {
  return request({
    url: '/product/myProduct/cancelProductCollect',
    method: 'delete',
    params: query
  });
};

//取消收藏

export const pcOrdersubmit = (params: any) => {
  return request({
    url: '/order/pcOrder/submit',
    method: 'post',
    data: params
  });
};
