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'
  })
}
