import request from '@/utils/request'

// 获得控货分页
export function getCargoControlOrderPage(params){
    return request({
      url:'ecw/order-cargo-control/cargo/control/order',
      method:'get',
      params
    })
}

// 发送手机验证码
export function sendSmsCode(data){
    return request({
      url: '/ecw/order-cargo-control/send-sms-code',
      method: 'post',
      data
    })
}

// 创建订单控货人信息
export function create(data){
    return request({
      url: '/ecw/order-cargo-control/create',
      method: 'post',
      data
    })
}

// 创建订单控货人放货记录
export function createPick(data){
  return request({
    url: '/ecw/order-cargo-control-pick/create',
    method: 'post',
    data
  })
}

//获得控货订单放货编辑详情
export function getReleaseInfo(orderId){
  return request({
    url:'/ecw/order-cargo-control/release/info/' + orderId,
    method:'get'
  })
}

// 获得控货订单放货详情
export function getPickRleaseInfo(orderId){
  return request({
    url:'/ecw/order-cargo-control-pick/release/info/' + orderId,
    method:'get'
  })
}

// 放货修改与反复核申请
export function updateApply(data){
  return request({
    url: '/ecw/order-cargo-control-pick/update/apply',
    method: 'put',
    data
  })
}

// 复核(放货复核)
export function review(id){
  return request({
    url: '/ecw/order-cargo-control-pick/review/' + id,
    method: 'put'
  })
}

// 取消放货
export function cancel(id){
  return request({
    url: '/ecw/order-cargo-control-pick/cancel/' + id,
    method: 'put'
  })
}

// 取消审批
export function cancelApproval(approvalId, params){
  return request({
    url: '/ecw/order-cargo-control-pick/cancel/approval/' + approvalId,
    method: 'get',
    params
  })
}

// 订单复核
export function orderReview(orderId){
  return request({
    url: '/ecw/order-cargo-control/review/' + orderId,
    method: 'put'
  })
}


// 根据订单id批量复合订单控货人放货
export function batchReview(data){
  return request({
    url: '/ecw/order-cargo-control-pick/review/',
    method: 'put',
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded'
    },
    data
  })
}

// 获得可调货的控货订单列表
export function seasoningCondimentsSelect(params){
  return request({
    url: '/ecw/order-cargo-control-pick/seasoning-condiments/cargo-control/order/select',
    method: 'get',
    params
  })
}

// 根据放货ID查询控货订单放货修改审核详情
export function getPickUpdateInfo(id){
  return request({
    url: '/ecw/order-cargo-control-pick/update/info/' + id,
    method: 'get'
  })
}

// 获得控货订单放货修改申请详情 {approveId: 1}
export function getPickUpdateApproveInfo(params){
  return request({
    url: '/ecw/order-cargo-control-pick/update/info',
    method: 'get',
    params
  })
}

export function getCondimentsIno(cargoControlPickId){
  return request({
    url: '/ecw/order-cargo-control-pick/seasoning/condiments/info/' + cargoControlPickId,
    method: 'get'
  })
}

// 参数搜索导出控货订单列表
export function exportCargoControl(params){
  return request({
    url: '/ecw/order/export/cargo/control/search',
    method: 'get',
    responseType: 'arraybuffer',
    params
  })
}

// 控货日志
export function getControlLogList(orderId){
  return request({
    url: '/order/order-control-log/list/' + orderId,
    method: 'get'
  })
}
