import request from "@/utils/request.js";

/**
 * 查询分类信息
 * @param {*} params
 * @returns
 */
export function queryCategory(params) {
  return request({
    method: "get",
    url: "product/queryCategory",
    params,
  });
}

/**
 * 查询商品信息
 * @param {*} params
 * @returns
 */
export function productqueryCommodityInfo(params) {
  return request({
    method: "get",
    url: "product/queryCommodityInfo",
    params,
  });
}

/**
 * 查询商品信息
 * @param {*} params
 * @returns
 */
export function queryNewCommodityInfo(params) {
  return request({
    method: "get",
    url: "product/queryNewCommodityInfo",
    params,
  });
}

/**
 * 通过选中的商品规格查询价格
 * @param {*} params
 * @returns
 */
export function queryProductSku(params) {
  return request({
    method: "get",
    url: "product/queryProductSku",
    params,
  });
}

/**
 * 添加购物车
 * @param {*} params
 * @returns
 */
export function createCart(data) {
  return request({
    method: "post",
    url: "/order/createCart",
    data,
  });
}

/**
 * 获取购物车商品
 * @param {*} params
 * @returns
 */
export function queryCart(params) {
  return request({
    method: "get",
    url: "order/queryCart",
    params,
  });
}

/**
 * 获取取件码
 * @param {*} params
 * @returns
 */
export function createCode(params) {
  return request({
    method: "get",
    url: "/order/createCode",
    params,
  });
}

/**
 * 全部打包
 * @param {*} params
 * @returns
 */
export function packall(data) {
  return request({
    method: "post",
    url: "/order/packall",
    data,
  });
}

/**
 * 删除购物车
 * @param {*} params
 * @returns
 */
export function delCart(params) {
  return request({
    method: "get",
    url: "/order/delCart",
    params,
  });
}

/**
 * 挂单/j激活购物车
 * @param {*} params
 * @returns
 */
export function cartStatus(data) {
  return request({
    method: "post",
    url: "/order/cartStatus",
    data,
  });
}

/**
 * 获取挂起购物车列表
 * @param {*} params
 * @returns
 */
export function getCartList(params) {
  return request({
    method: "get",
    url: "/order/getCartList",
    params,
  });
}

/**
 * 清空购物车
 * @param {*} params
 * @returns
 */
export function clearCart(data) {
  return request({
    method: "post",
    url: "/order/clearCart",
    data,
  });
}

/**
 * 创建订单
 * @param {*} data
 * @returns
 */
export function createOrder(data) {
  return request({
    method: "post",
    url: "/order/createOrder",
    data,
  });
}

/**
 * 上下架售罄
 * @param {*} data
 * @returns
 */
export function productStatus(data) {
  return request({
    method: "PUT",
    url: "/product/productStatus",
    data,
  });
}

/**
 * 修改库存
 * @param {*} data
 * @returns
 */
export function productStock(data) {
  return request({
    method: "PUT",
    url: "/product/productStock",
    data,
  });
}

/**
 * 添加临时菜
 * @param {*} data
 * @returns
 */
export function temporaryDishes(data) {
  return request({
    method: "post",
    url: "/order/temporaryDishes",
    data,
  });
}

/**
 * 商品单位列表获取
 * @param {*} params
 * @returns
 */
export function getUnitList(params) {
  return request({
    method: "get",
    url: "/unit",
    params,
  });
}

/**
 * 单品改价
 * @param {*} data
 * @returns
 */
export function updatePrice(data) {
  return request({
    method: "PUT",
    url: "/order/updatePrice",
    data,
  });
}

/**
 * 免厨打印
 * @param {*} data
 * @returns
 */
export function orderPrint(data) {
  return request({
    method: "PUT",
    url: "/order/print",
    data,
  });
}

/**
 * 转台/并台
 * @param {*} data
 * @returns
 */
export function orderSwitcht(data) {
  return request({
    method: "PUT",
    url: "/order/switch",
    data,
  });
}
