// 存放路径: src/services/home.ts
import type { Result } from '@/types/global'

import { http } from "@/utils/http";

// 收库单分页查询
export const getOrderPage = (data: PageParams) => {
  return http<OrderPage<Order>>({
    method: "GET",
    url: "/api/orderIn/getOrderPage",
    data,
  });
};

// 获取收货单集合
export const getList = () => {
  return http<Result>({
    method: "GET",
    url: "/api/orderIn/getList"
  });
};

//根据id获取收货单详情
export const getDetailById = (data: {id: number}) => {
  return http<Order>({
    method: "GET",
    url: "/api/orderIn/getOne",
    data
  });
};

// 新增收货单
export const addOrderIn = (data: Order) => {
  return http({
    method: "POST",
    url: "/api/orderIn/addOrderIn",
    data,
  });
};
// 批量修改收货单
export const updateOrderIn = (data: any) => {
  return http<Result>({
    method: "POST",
    url: "/api/orderIn/updateOrderIn",
    data,
  });
};
// 用于过皮和零皮重
export const getTare = (data: any) => {
  return http<Result>({
    method: "POST",
    url: "/api/orderIn/getTare",
    data,
  });
};

// 用于单个或批量作废收货单
export const deleteOrder = (data: any) => {
  return http<Result>({
    method: "POST",
    url: "/api/orderIn/delete",
    data,
  });
};
// 统计首页的本月总收获以及总支出
// 收货类型

export const countOrderByMonth = () => {
  return http<ReceiveSummary>({
    method: "GET",
    url: "/api/orderIn/countOrderByMonth"
  });
};

// 更新定价详情
export const updateOne = (data: any) => {
  return http<Result>({
    method: "POST",
    url: "/api/orderIn/updateOne",
    data,
  });
};

// 收货汇总
export const OrderInReceipt = (data:any) => {
  return http<ReceiveSummaryCount>({
    method: "GET",
    url: "/api/orderIn/OrderInReceipt",
    data
  });
};

// 收货单排行榜
export const OrderInRanking = (data: any) => {
  return http({
    method: "GET",
    url: "/api/orderIn/OrderInRanking",
    data
  });
};

// 重新过皮
export const reTare = (data: any) => {
  return http({
    method: "POST",
    url: "/api/orderIn/skinning",
    data,
  });
};






