import http from "@/util/http.js";

//店铺订单
export function shops(params) {
  return http({
    url: "/api/count/orders/num",
    method: "get",
    params,
  });
}

// 商品管理列表
export function goods(params) {
  return http({
    url: "/api/goods_skus",
    method: "get",
    params,
  });
}
// 新建商品
export function addGoods(data) {
  return http({
    url: "/api/goods",
    method: "post",
    data,
  });
}
// 查看商品
export function checkGoods(id) {
  return http({
    url: `/api/goods_skus/${id}`,
    method: "get",
  });
}
// 商品列表
export function goodsList(params) {
  return http({
    url: "/api/goods",
    method: "get",
    params,
  });
}
// 更新商品
export function updateGoods(id, data) {
  return http({
    url: `/api/goods_skus/${id}`,
    method: "patch",
    data,
  });
}

// 上新/库存盘点/库存
export function update(data) {
  return http({
    url: "/api/batch/goods_skus",
    method: "patch",
    data,
  });
}

// 单个字段更新
export function singleUpdate(id, data) {
  return http({
    url: `/api/single/goods_skus/${id}`,
    method: "patch",
    data,
  });
}

// 图片上传
export function imgUpload(data, item) {
  return http({
    url: "/api/upload",
    Headers: item,
    method: "post",
    data,
  });
}
