import request from "@/utils/request";

// 查询兑换商品列表
export function listGoods(query) {
  return request({
    url: "/brewery/goods/list",
    method: "get",
    params: query,
  });
}

// 查询兑换商品详细
export function getGoods(id) {
  return request({
    url: "/brewery/goods/" + id,
    method: "get",
  });
}

// 新增兑换商品
export function addGoods(data) {
  return request({
    url: "/brewery/goods",
    method: "post",
    data: data,
  });
}

// 修改兑换商品
export function updateGoods(data) {
  return request({
    url: "/brewery/goods",
    method: "put",
    data: data,
  });
}

// 删除兑换商品
export function delGoods(id) {
  return request({
    url: "/brewery/goods/" + id,
    method: "delete",
  });
}
// 修改商品上架状态
export function updateGoodsSaleStatus(data) {
  return request({
    url: "/brewery/goods/onsale",
    method: "put",
    data: data,
  });
}
// 修改啤酒币数量
export function updateGoodsIcons(data) {
  return request({
    url: "/brewery/goods/icons",
    method: "put",
    data: data,
  });
}

// 修改库存数量
export function updateGoodsStockNum(data) {
  return request({
    url: "/brewery/goods/stock",
    method: "put",
    data: data,
  });
}

// 查询所有商品
export function allListGoods(query) {
  return request({
    url: "/brewery/goods/all",
    method: "get",
    params: query,
  });
}

// 查询某款兑换商品的返利活动
export function getGoodsActivityList(data) {
  return request({
    url: "/brewery/goods/activityList/" + data.goodsId,
    method: "get",
    params: {
      pageNum: data.pageNum,
      pageSize: data.pageSize,
    },
  });
}

// 查询某款兑换商品的兑换历史
export function getGoodsExchangeList(data) {
  return request({
    url: "/brewery/goods/exchangeList/" + data.goodsId,
    method: "get",
    params: {
      pageNum: data.pageNum,
      pageSize: data.pageSize,
    },
  });
}
