import request from "@/utils/request";

// 收款登记
export function listRecv(query) {
  return request({
    url: "/erp/arap/recv/list",
    method: "get",
    params: query,
  });
}

export function getRecv(id) {
  return request({
    url: `/erp/arap/recv/${id}`,
    method: "get",
  });
}

export function addRecv(data) {
  return request({
    url: "/erp/arap/recv",
    method: "post",
    data,
  });
}

export function editRecv(data) {
  return request({
    url: "/erp/arap/recv",
    method: "put",
    data,
  });
}

export function delRecv(id) {
  return request({
    url: `/erp/arap/recv/${id}`,
    method: "delete",
  });
}

// 客户退款登记
export function listRefund(query) {
  return request({
    url: "/erp/arap/refund/list",
    method: "get",
    params: query,
  });
}

export function getRefund(id) {
  return request({
    url: `/erp/arap/refund/${id}`,
    method: "get",
  });
}

export function addRefund(data) {
  return request({
    url: "/erp/arap/refund",
    method: "post",
    data,
  });
}

export function editRefund(data) {
  return request({
    url: "/erp/arap/refund",
    method: "put",
    data,
  });
}

export function delRefund(id) {
  return request({
    url: `/erp/arap/refund/${id}`,
    method: "delete",
  });
}

// 应收单扣款作业
export function listDeduct(query) {
  return request({
    url: "/erp/arap/deduct/list",
    method: "get",
    params: query,
  });
}

export function batchDeduct(data) {
  return request({
    url: "/erp/arap/deduct/batchDeduct",
    method: "post",
    data,
  });
}

export function batchUndeduct(data) {
  return request({
    url: "/erp/arap/deduct/batchUndeduct",
    method: "post",
    data,
  });
}

// 冲销/反冲销
export function listOffsetOpenPay(query) {
  return request({
    url: "/erp/arap/offset/openPay/list",
    method: "get",
    params: query,
  });
}

export function listOffsetOrders(query) {
  return request({
    url: "/erp/arap/offset/order/list",
    method: "get",
    params: query,
  });
}

export function saveOffset(data) {
  return request({
    url: "/erp/arap/offset/save",
    method: "post",
    data,
  });
}

export function listOffsetRecords(query) {
  return request({
    url: "/erp/arap/offset/record/list",
    method: "get",
    params: query,
  });
}

export function getOffset(id) {
  return request({
    url: `/erp/arap/offset/${id}`,
    method: "get",
  });
}

export function reverseOffset(data) {
  return request({
    url: "/erp/arap/offset/reverse",
    method: "post",
    data,
  });
}

