import request from "@/utils/request";

// 查询酒品二维码列表
export function listQrcode(query) {
  return request({
    url: "/brewery/qrcode/list",
    method: "get",
    params: query,
  });
}

// 查询酒品二维码详细
export function getQrcode(id) {
  return request({
    url: "/brewery/qrcode/" + id,
    method: "get",
  });
}

// 新增酒品二维码
export function addQrcode(data) {
  return request({
    url: "/brewery/qrcode",
    method: "post",
    data: data,
  });
}

// 修改酒品二维码
export function updateQrcode(data) {
  return request({
    url: "/brewery/qrcode",
    method: "put",
    data: data,
  });
}

// 删除酒品二维码
export function delQrcode(id) {
  return request({
    url: "/brewery/qrcode/" + id,
    method: "delete",
  });
}

//  批量生成二维码
export function generateQrcodeByBatch(batchId) {
  return request({
    url: "/brewery/qrcode/batch?batchId=" + batchId,
    method: "post",
  });
}

// 查询某个二维码扫码记录(无效和有效的)
export function qrcodeScanLogList(qrcodeId) {
  return request({
    url: "/brewery/qrcodeScanLog/qrcodeScanLogList?qrcodeId=" + qrcodeId,
    method: "get",
  });
}

// 撤销核销记录
export function cancelConsume(data) {
  return request({
    url: "/brewery/qrcodeScanLog/cancelConsume",
    method: "post",
    data,
  });
}
