import request from '@/utils/request'

// 创建订单异常
export function createOrderException(data) {
  return request({
    url: '/ecw/order-exception/create',
    method: 'post',
    data: data
  })
}

// 更新订单异常
export function updateOrderException(data) {
  return request({
    url: '/ecw/order-exception/update',
    method: 'put',
    data: data
  })
}

// 删除订单异常
export function deleteOrderException(id) {
  return request({
    url: '/ecw/order-exception/delete?id=' + id,
    method: 'delete'
  })
}
// 获得订单异常
export function getExceptionById(id){
  return request({
    url: '/ecw/order-exception/getExceptionById?id=' + id,
    method: 'get'
  })
}
// 获得订单异常
export function getOrderException(id) {
  return request({
    url: '/ecw/order-exception/get?id=' + id,
    method: 'get'
  })
}

// 根据订单ID获取所有的订单异常列表
export function getExceptionListByOrderId(id) {
  return request({
    url: '/ecw/order-exception/getExceptionListByOrderId?orderId=' + id,
    method: 'get'
  })
}

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

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

//根据异常ID进行异常处理
export function handlerExceptionByExceptionId(data){
  return request({
    url: '/ecw/order-exception/handlerExceptionByExceptionId',
    method: 'post',
    data: data
  })
}

// 根据商品ID获取商品详情
export function getOrderItemById(id) {
  return request({
    url: '/ecw/order-exception/getOrderItemById?id=' + id,
    method: 'get'
  })
}

// 根据订ID获取所有费用及比例
export function getOrderFeeById(query) {
  return request({
    url: '/ecw/order-exception/getOrderFeeById',
    method: 'get',
    params: query
  })
}

// 根据工作流中传的业务ID,获取异常审核详情
export function getBmpDetailByBusinessId(businessId) {
  return request({
    url: '/ecw/order-exception/getBmpDetailByBusinessId',
    method: 'get',
    params: {businessId}
  })
}

// 导出订单异常 Excel
export function exportExcel(params) {
  return request({
    url: '/ecw/order-exception/export-excel',
    method: 'get',
    params,
    responseType: 'arraybuffer'
  })
}