import request, {
  Method
} from '@/plugins/request.js';

// 商品列表
export function goodsList (params) {
  return request({
    url: '/buyer/goods/es',
    method: Method.GET,
    needToken: false,
    params
  });
}

// 商品分类 筛选条件  品牌， 尺寸等
export function filterList (params) {
  return request({
    url: '/buyer/goods/es/related',
    method: Method.GET,
    needToken: false,
    params
  });
}

// id获取商品详情
export function goodsDetail (goodsId) {
  return request({
    url: `/buyer/goods/get/${goodsId}`,
    method: Method.GET,
    needToken: false
  });
}

// id获取商品Sku详情
export function goodsSkuDetail (params) {
  return request({
    url: `/buyer/goods/sku/${params.goodsId}/${params.skuId}`,
    method: Method.GET,
    needToken: true,
    params
  });
}

// 获取所有商品分类
export function getCategory (parentId) {
  return request({
    url: `/buyer/category/get/${parentId}`,
    method: Method.GET,
    needToken: false
  });
}

// 当前拼团活动未成团会员
export function pintuanMembers (pintuanId) {
  return request({
    url: `/buyer/promotion/pintuan/${pintuanId}/members`,
    method: Method.GET,
    needToken: false
  });
}

/**
 * @param {Number} start 搜索起始下标
 * @param {Number} end 搜索结束下标
 */
export function hotWords (params) {
  return request({
    url: `/buyer/goods/hot-words`,
    method: Method.GET,
    needToken: false,
    params
  });
}
