import request from "@/benyun/utils/request";

//查询数据
export function query(params: any, data?: any) {
  return request({
    url: "/omsOrder/omsOrder/query",
    method: "POST",
    params: params,
    data: data,
  });
}
//查询超时数据
export function queryTimeOut(params: any, data?: any) {
  return request({
    url: "/omsOrder/omsOrder/queryByTimeout",
    method: "POST",
    params: params,
    data: data,
  });
}
//提示超时订单
export function tipOrderTimeOut(params: { pageSize: number; pageNum: number }) {
  return request({
    url: "/omsOrder/customOrder/queryTimeoutOrder",
    method: "GET",
    params,
  }) as Promise<{ code: number; msg: string; total: number }>;
}

//按条码查询数据
export function queryByBarCode(params: {
  businessType: string;
  barCode: string;
  pageNo: number;
  pageSize: number;
}) {
  return request({
    url: "/omsOrder/omsOrder/queryByBarCode",
    method: "POST",
    params: params,
  });
}

//获取地址
export function getProvince(data: any) {
  return request({
    url: "/omsOrder/omsArea/getByPid",
    method: "Get",
    params: data,
  });
}
//手工添加订单
export function addOrder(data: any) {
  return request({
    url: "/omsOrder/omsOrder/manual",
    method: "POST",
    data: data,
  });
}
//保存订单基本信息
export function saveBaseOrder(data: any) {
  return request({
    url: "/omsOrder/omsOrder/updateInfo",
    method: "POST",
    data: data,
  });
}
//提交
export function smt(data: any) {
  return request({
    url: "/omsOrder/omsOrder/submit",
    method: "POST",
    params: data,
  });
}
//反提交
export function unSmt(data: any) {
  return request({
    url: "/omsOrder/omsOrder/unSubmit",
    method: "POST",
    params: data,
  });
}
//获取单条订单
export function getSingleData(params: any) {
  return request({
    url: "/omsOrder/omsOrder/single/",
    params: params,
    method: "GET",
  });
}
//下载订单
export function pullOrder(data: any) {
  return request({
    url: "/omsOrder/omsOrder/pullOrder",
    method: "POST",
    data: data,
  });
}
//生成采购单之前获取可采购数量
export function purchaseQty(params: any) {
  return request({
    url: "/omsOrder/omsOrder/purchaseQty",
    method: "Get",
    params: params,
  });
}
//生成采购单
export function toPurchaseOrder(data: any) {
  return request({
    url: "/omsOrder/omsOrder/toPurchaseOrder",
    method: "POST",
    data: data,
  });
}
//合并订单
export function merge(params: any) {
  return request({
    url: "/omsOrder/omsOrder/merge",
    method: "POST",
    params: params,
  });
}
//已拆分数量
export function splitQtyQuery(params: any) {
  return request({
    url: "/omsOrder/omsOrder/splitQtyQuery",
    method: "Get",
    params: params,
  });
}
//拆分
export function split(data: any) {
  return request({
    url: "/omsOrder/omsOrder/split",
    method: "POST",
    data: data,
  });
}
//取消订单
export function cancelOrder(data: any) {
  return request({
    url: "/omsOrder/omsOrder/cancel",
    method: "POST",
    data: data,
  });
}
//反取消订单
export function unCancel(data: any) {
  return request({
    url: "/omsOrder/omsOrder/unCancel",
    method: "POST",
    params: data,
  });
}
//转异常
export function setQuestions(data: any) {
  return request({
    url: "/omsOrder/omsOrder/setQuestions",
    method: "POST",
    data: data,
  });
}
//转正常
export function resetQuestion(data: any) {
  return request({
    url: "/omsOrder/omsOrder/resetQuestion",
    method: "POST",
    data: data,
  });
}
//改卖家备注
export function updateRemark(data: any) {
  return request({
    url: "/omsOrder/omsOrder/updateRemark",
    method: "POST",
    data: data,
  });
}
//设置业务员
export function setCreateUser(data: any) {
  return request({
    url: "/omsOrder/omsOrder/setCreateUser",
    method: "POST",
    data: data,
  });
}
//设置标签
export function setLabels(data: any) {
  return request({
    url: "/omsOrder/omsOrder/setLabels",
    method: "POST",
    data: data,
  });
}
//批量添加赠品
export function addGift(data: any) {
  return request({
    url: "/omsOrder/omsOrder/addGift",
    method: "POST",
    data: data,
  });
}
//批量添加商品
export function addItem(data: any) {
  return request({
    url: "/omsOrder/omsOrder/addItem",
    method: "POST",
    data: data,
  });
}
//单条数据
export function single(data: any) {
  return request({
    url: "/omsOrder/omsOrder/single",
    method: "GET",
    params: data,
  });
}
//删除商品
export function delItem(data: any) {
  return request({
    url: "/omsOrder/omsOrder/delItem",
    method: "POST",
    params: data,
  });
}
//手工支付
export function addPay(data: any) {
  return request({
    url: "/omsOrder/omsOrder/addPay",
    method: "POST",
    data: data,
  });
}
//修改运费
export function editFreight(data: any) {
  return request({
    url: "/omsOrder/omsOrder/editFreight",
    method: "POST",
    data: data,
  });
}
//编辑商品
export const batchItem: any = (data: any) => {
  return request({
    url: "/omsOrder/omsOrder/batchItem",
    method: "POST",
    data: data,
  });
};
//修改支付状态
export const updateStatus: any = (data: any) => {
  return request({
    url: "/omsOrder/omsOrderPay/updateStatus",
    method: "POST",
    params: data,
  });
};
//归档
export const archive: any = (data: any) => {
  return request({
    url: "/omsOrder/omsOrder/archive",
    method: "POST",
    params: data,
  });
};

//根据第三方系统查询记录
export function queryBySys(params: any) {
  return request({
    url: "/omsOrder/omsPartner/queryBySys",
    params: params,
    method: "GET",
  });
}

//根据第三方系统查询记录
export function pullRecord(params: any) {
  return request({
    url: "/omsOrder/jstOrderJobLog/page",
    params: params,
    method: "GET",
  });
}

//Excel导入
export function importExc(data: any) {
  return request({
    url: "/omsOrder/omsOrder/import",
    method: "post",
    data: data,
    headers: {
      "Content-Type": "application/x-www-form-urlencoded",
    },
  });
}

//下单模版
export function loadDownModule() {
  return request({
    url: "/omsOrder/omsOrder/downTemplate",
    method: "get",
    responseType: "blob",
  });
}

//Excel导入B2C
export function importB2cOrder(data: any) {
  return request({
    url: "/omsOrder/omsOrder/importB2cOrder",
    method: "post",
    data: data,
    headers: {
      "Content-Type": "application/x-www-form-urlencoded",
    },
  });
}

//回调日志
export function dsCallbackLog(params: any) {
  return request({
    url: "/omsOrder/dsCallbackLog/page",
    params: params,
    method: "GET",
  });
}

//订单时间日志
export function orderTimeList(params: any) {
  return request({
    url: "/omsOrder/orderTimeLog/list",
    params: params,
    method: "GET",
  });
}

//wms电子面单
export function dswWaybill(params: any) {
  return request({
    url: "/omsOrder/dswWaybill/page",
    params: params,
    method: "GET",
  });
}

//智能审核
export function autoAudit(data: any) {
  return request({
    url: "/omsOrder/customJob/updateJob",
    method: "POST",
    data: data,
  });
}
//获得智能审核设置数据
export function autoAuditData() {
  return request({
    url: "/omsOrder/jobConfig/list",
    method: "GET",
  });
}

//获得聚水潭店铺列表
export function waterShop() {
  return request({
    url: "/omsOrder/waterShop/list",
    method: "GET",
  });
}

//同步订单
export function syncOrder(data: any) {
  return request({
    url: "/omsOrder/customOrder/querySaleOrder",
    method: "POST",
    data: data,
  });
}

//获得分销商订单
export function getDistributorOrder(params: any) {
  return request({
    url: "/omsOrder/orderDistributor/list",
    method: "GET",
    params,
  });
}

//同步分销商订单
export function syncDistributorOrder(data: any) {
  return request({
    url: "/omsOrder/customOrder/queryOutboundOrder",
    method: "POST",
    data: data,
  });
}

export interface IResponeData<T> {
  msg: string;
  code: number;
  rows: T;
  total: number;
}

export interface ICallbackLog {
  id: number;
  tenantId: string;
  createBy: string | null;
  createTime: string;
  updateBy: string | null;
  updateTime: string;
  deleteBy: string | null;
  deleteTime: string | null;
  isDeleted: number;
  extData: any; // 可以替换为具体的类型
  version: number;
  dsMethod: string;
  dsTag: string;
  dsSign: string;
  dsTimestamp: string;
  dsParams: string; // 实际是JSON字符串，可能需要定义更具体的接口
  dsBody: string; // 同上
  isProcess: number;
  respMsg: string;
  orderTime: string;
  getOrderTime: string;
  pushWarehouseTime: string;
  warehouseResponseTime: string;
  finishTime: string | null;
  orderNo: string | null;
}
