import request from '@/utils/request'
// 根据合并订单编号(或订单号)获得已合单列表和待合单列表
export function getMergeListByOrderNo(query){
  return request({
    url:'/order/merge/getMergeListByOrderNo',
    method: 'get',
    params: query,
  })
}
//创建订单合单申请
export function createMerge(data) {
  return request({
    url: '/order/merge/create',
    method: 'post',
    data: data
  })
}
// 取消订单拆单
export function cancelMerge(data) {
  return request({
    url: '/order/merge/cancel',
    method: 'delete',
    data:data
  })
}

//拆单申请提交
export function splitApply(data) {
  return request({
    url: '/order/split/apply',
    method: 'put',
    data: data
  })
}

// 创建订单拆单
export function createSplit(data) {
  return request({
    url: '/order/split/create',
    method: 'post',
    data: data
  })
}

// 更新订单拆单
export function updateSplit(data) {
  return request({
    url: '/order/split/update',
    method: 'put',
    data: data
  })
}

// 删除订单拆单
export function deleteSplit(id) {
  return request({
    url: '/order/split/delete?id=' + id,
    method: 'delete'
  })
}
//取消申请拆单

export function cancelApply(data) {
  return request({
    url: '/order/split/cancel-apply',
    method: 'put',
    data:data
  })
}

// 获得订单拆单
export function getSplit(id) {
  return request({
    url: '/order/split/get?id=' + id,
    method: 'get'
  })
}

// 获得订单拆单分页
export function getSplitPage(query) {
  return request({
    url: '/order/split/page',
    method: 'get',
    params: query
  })
}

// 导出订单拆单 Excel
export function exportSplitExcel(query) {
  return request({
    url: '/order/split/export-excel',
    method: 'get',
    params: query,
    responseType: 'blob'
  })
}
//通过订单号获取拆单列表和拆单项明细
export function getSplitList(query) {
  return request({
    url: '/order/split/list-by-order-id',
    method: 'get',
    params: query
  })
}

// 创建订单拆单项 - 放入
export function createSplitItem(data) {
  return request({
    url: '/order/split-item/create',
    method: 'post',
    data: data
  })
}

// 删除订单拆单项
export function deleteSplitItem(id) {
  return request({
    url: '/order/split-item/delete?id=' + id,
    method: 'delete'
  })
}
