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 deleteProductBrowsingHistory = (ids: any) => {
  return request({
    url: '/product/myProduct/deleteProductBrowsingHistory/' + ids,
    method: 'delete'
  });
};
//查看商品浏览记录列表
export const browsingHistoryList = (query: any) => {
  return request({
    url: '/product/myProduct/getProductBrowsingHistory',
    method: 'get',
    params: query
  });
};

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

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/myProduct/getProductFavoritesPage',
    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
  });
};
//查询商品收藏夹下的商品
export const favoritesProductList = (query: any) => {
  return request({
    url: '/product/myProduct/getFavoritesProductPage',
    method: 'get',
    params: query
  });
};

//查看协议供货商品列表
export const getAgreementSupplyProductList = (query: any) => {
  return request({
    url: '/product/myProduct/getAgreementSupplyProductPage',
    method: 'get',
    params: query
  });
};

//查看采购方案列表
export const getProcurementProgramProductList = (query: any) => {
  return request({
    url: '/product/myProduct/getProcurementProgramProductPage',
    method: 'get',
    params: query
  });
};

//收藏采购方案
export function addProcurementProgramCollect(data: any) {
  return request({
    url: '/product/myProduct/addProcurementProgramCollect',
    method: 'post',
    data: data
  });
}
//购物车
export const getProductShoppingCartCount = (query: any) => {
  return request({
    url: '/product/myProduct/getProductShoppingCartCount',
    method: 'get',
    params: query
  });
};
