import request from '@/utils/request'
import {param} from "@/utils";

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

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

// 删除订单
export function deleteOrder(id) {
  return request({
    url: '/ecw/order/delete?id=' + id,
    method: 'delete'
  })
}

// 获得订单
export function getOrder(orderId) {
  return request({
    url: '/ecw/order/info/' + orderId,
    method: 'get'
  })
}

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

// 导出订单 Excel
export function exportOrderExcel(query) {
  return request({
    url: '/ecw/order/export-excel',
    method: 'get',
    params: query,
    responseType: 'blob'
  })
}

// 打印标签
export function printTag(id) {
  return request({
    url: '/order/print/orderTagPrint?orderId=' + id,
    method: 'get',
  })
}

//根据订单号获得订单费用申请列表
export function feeApplicationListByOrderId(query){
  return request({
    url:'/order/fee-application/listByOrderId',
    method: 'get',
    params: query,
  })
}
//费用申请提交
 export function feeApplicationCreate(data){
  return request({
    url:'order/fee-application/create',
    method:'post',
    data:data,
  })
 }
  //费用申请修改
 export function applicationUpdate(data){
  return request({
    url:'/order/fee-application/update',
    method:'put',
    data:data,
  })
 }
  export function ApplicationListByOrderId(params){
   return request({
     url:'order/fee-application/listByOrderId',
     method:'get',
     params:params

   })
  }
// 创建特殊
export  function specialNeedCreate(data){
  return request({
     url:'ecw/order-special-need/create',
    method:'post',
    data:data,
  })
}
// 删除特需
 export function orderSpecialNeed(params){
  return request({
    url:'/ecw/order-special-need/deleteByOrderId',
    method: 'delete',
    data:params
  })
 }

// 获得提单pdf
export function getLadingBill(query){
  return request({
    url:'ecw/order/billLading/template',
    method: 'get',
    responseType: 'arraybuffer',
    params: query,
  })
}
