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
  })
}
// 获得新订单异常分页
export function getExceptionPage(query) {
  return request({
    url: '/ecw/order-exception/exceptionPage',
    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-async',
    method: 'get',
    timeout: 30*60*1000,
    params,
    // timeout: 3*60*1000,
    responseType: 'arraybuffer'
  })
}
// 根据订ID获取订单异常结果
export function getOrderExcptionResult(query) {
  return request({
    url: '/ecw/order-exception-result/page',
    method: 'get',
    params: query
  })
}

// 根据订单ID,异常ID获取价格
export function getOrderExceptionChannelPriceList(data) {
  return request({
    url: '/order/exception-channel-price/getOrderExceptionChannelPriceList',
    method: 'post',
    data: data
  })
}

// 根据工作流中传的业务ID,获取不可出渠道异常详细信息
export function getExceptionDetailByBusinessId(query) {
  return request({
    url: '/ecw/order-exception/getExceptionDetailByBusinessId',
    method: 'get',
    params: query
  })
}

// 参数查询获得订单统计
export function getStatistics(query) {
  return request({
    url: '/ecw/order-exception/statistics',
    method: 'get',
    params: query
  })
}
