
import { http } from '@/utils/http'

type ShipmentSummary = {
  totalShipment: number, // 总出货
  totalIncome: number, // 出货总收入
  toBeShipped: number, // 待出货
  roughWeight: number, // 待过毛重
  shipmentReview: number, // 出货结算
  toBeSettled: number, // 待结算
}
// 根据id查询出货单
export const getDetailById = (data: {id: string}) => {
  return http<Shipment>({
    method: "GET",
    url: "/api/orderOut/getOne",
    data
  });
};
// 根据条件查询出库单下拉列表
export const getList = () => {
  return http<Shipment>({
    method: "GET",
    url: "/api/orderOut/getList"
  });
};
type PageParams = {
  userId?: number; // 供应商id
  productId?: string; // 产品id
  cardId?: number;
  deviceId?:number;
  scaleStatus?: number; // 磅单状态：0：待出货1:待过毛2：待审核3：已审未付4：已审已付
  flag?: boolean; // true 皮重 false 毛重
  pageNumber: number;
  pageSize: number;
  startTime?: string; // 开始时间
  endTime?: string; // 结束时间
  isDeleted?: boolean;
  userName?: string;
  orderNumber?: string;
  
};
// 根据条件获取出库单，并且进行分页
export const getOrderPage = (data: PageParams) => {
  return http<OrderPage<Shipment>>({
    method: "GET",
    url: "/api/orderOut/getOrderPage",
    data
  });
};
// 统计首页的本月收入以及待出库
export const countOrderByMonth = () => {
  return http<ShipmentSummary>({
    method: "GET",
    url: "/api/orderOut/countOrderByMonth"
  });
};

// 出库分类统计
export const getOrderInReceipt = (data: any) => {
  return http<ShipmentSummaryCount>({
    method: "GET",
    url: "/api/orderOut/OrderInReceipt",
    data
  });
};
// 出货单排行榜
export const getOrderInRanking = (data:any) => {
  return http<Shipment>({
    method: "GET",
    url: "/api/orderOut/OrderInRanking",
    data
  });
};
// 单个或则批量作废
export const deleteOrder = (data: any) => {
  return http<Shipment>({
    method: "POST",
    url: "/api/orderOut/delete",
    data,
  });
};
// 新增出货单
export const addOrderOut = (data: any) => {
  return http<Shipment>({
    method: "POST",
    url: "/api/orderOut/addOrderOut",
    data,
  });
};
// 批量修改出货单
export const updateOrderIn = (data: any) => {
  return http<Shipment>({
    method: "POST",
    url: "/api/orderOut/updateOrderIn",
    data,
  });
};
// 重新过毛
export const reGrossWeight = (data: any) => {
  return http({
    method: "POST",
    url: "/api/orderOut/hairdressing",
    data,
  });
};

// 收货单概况
export const getOverview = (data: any) => {
  return http({
    method: "GET",
    url: "/api/orderOut/getOverview",
    data
  });
};

// 供应商对账
export const getReconciliation = (data: any) => {
  return http({
    method: "GET",
    url: "/api/orderOut/getReconciliation",
    data
  });
};




