import request from '@/utils/request'

// 创建集运包裹主
export function createCons(data) {
  return request({
    url: '/ecw/cons/create',
    method: 'post',
    data: data
  })
}
// 创建集运包裹主
export function createConsRetiredWarehouseApplication(data) {
  return request({
    url: '/ecw/cons/createConsRetiredWarehouseApplication',
    method: 'post',
    data: data
  })
}
export function createConsExitApplication(data) {
  return request({
    url: '/ecw/cons/createConsExitApplication',
    method: 'post',
    data: data
  })
}
export function editAndUpdateConsRetiredWarehouseDeal(data) {
  return request({
    url: '/ecw/cons/editAndUpdateConsRetiredWarehouseDeal',
    method: 'post',
    data: data
  })
}

// 更新集运包裹主
export function updateCons(data) {
  return request({
    url: '/ecw/cons/update',
    method: 'put',
    data: data
  })
}
export function updateInspect(data) {
  return request({
    url: '/ecw/cons/updateInspect',
    method: 'put',
    data: data
  })
}
//批量签收
export function updateConsBatchSignOff(data) {
  return request({
    url: '/ecw/cons/updateConsBatchSignOff',
    method: 'put',
    data: data
  })
}
//批量修改
export function updateConsBatch(data) {
  return request({
    url: '/ecw/cons/updateConsBatch',
    method: 'put',
    data: data
  })
}

// 删除集运包裹主
export function deleteCons(id) {
  return request({
    url: '/ecw/cons/delete?id=' + id,
    method: 'delete'
  })
}

// 获得集运包裹主
export function getCons(id) {
  return request({
    url: '/ecw/cons/get?id=' + id,
    method: 'get'
  })
}

export function cancelApplyAndUpdate(id) {
  return request({
    url: '/ecw/cons-approval/cancelApplyAndUpdate?id=' + id,
    method: 'get'
  })
}

// 获得集运包裹转运临时order
export function getTempOrderByConsIds(params){
  return request({
    url: '/ecw/cons/getTempOrderByConsIds',
    method: 'get',
    params
  })
}

// 获得集运包裹主分页
export function getConsPage(query) {
  return request({
    url: '/ecw/cons/page',
    method: 'get',
    params: query
  })
}

// 导出集运包裹主 Excel
export function exportConsExcel(query) {
  return request({
    url: '/ecw/cons/export-excel',
    method: 'get',
    params: query,
    responseType: 'blob'
  })
}

// 获取快递单号
export function getConsCourierNumber(params) {
  return request({
    url: "/ecw/cons/courier/number",
    method: "get",
    params
  })
}
