import request from '@/utils/request'

export function getSaleOrderTree(data) {
    return request({
        url: '/sales-order/lineMarketCustomer',
        method: 'get',
        params: data
    })
}

export function getSaleOrderPage(data) {
    return request({
        url: '/sales-order/page',
        method: 'get',
        params: data
    })
}

/**
 * 销售订单分页列表（与 getSaleOrderPage 同源，供销货转入等弹框查询）
 * @param {Object} params 查询参数（含 pageNum、pageSize、日期区间等）
 */
export function getSaleOrderList(data) {
    return request({
        url: '/sales-order/list',
        method: 'post',
        data: data
    })
}

export function addSaleOrder(data) {
    return request({
        url: '/sales-order/add',
        method: 'post',
        data: data
    })
}

export function editSaleOrder(data) {
    return request({
        url: '/sales-order/edit',
        method: 'post',
        data: data
    })
}

export function delSaleOrder(data) {
    return request({
        url: '/sales-order/delete',
        method: 'post',
        data: data
    })
}

export function getSaleOrderById(data) {
    return request({
        url: '/sales-order/listById',
        method: 'post',
        data: data
    })
}

// 根据货品编号客户编号，单据日期查询 价格
export function getGoodsPriceInfo(data) {
    return request({
        url: '/sales-order/getGoodsPriceInfo',
        method: 'post',
        data: data
    })
}

// 根据当天的订单拿到物流线市场客户等树状
export function getLineMarketCustomerStats(data) {
    return request({
        url: '/sales-order/lineMarketCustomerStats',
        method: 'get',
        params: data
    })
}

// 白条分配平台(订单信息汇总)
export function getSaleOrderGoodsDetailList(data) {
    return request({
        url: '/sales-order/goodsDetailList',
        method: 'post',
        data: data
    })
}

//  白条分配平台 上方
export function getUnallocNum(data) {
    return request({
      url: '/sales-order/allocationStatsByVarietyGrade',
      method: 'post',
      data: data
    })
  }


// 副产品分配树
export function getSegmentedTree(data) {
  return request({
    url: '/sales-order/segmentedProductsCustomerTree',
    method: 'post',
    data: data
  })
}

// 副产品搜索详情
export function getSegmentedDetail(data) {
  return request({
    url: '/sales-order/segmentedProductGoodsDetailList',
    method: 'post',
    data: data
  })
}