import { request } from '@/utils/request'

// 交易管理
export const tradeApi = {
  // 订单管理
  getOrderList: (params: any) => request.get('/trade/order/list', params),
  getOrderDetail: (orderNo: string) => request.get(`/trade/order/${orderNo}`),
  cancelOrder: (orderNo: string) => request.put(`/trade/order/${orderNo}/cancel`),

  // 审核订单
  getAuditOrderList: (params: any) => request.get('/trade/order/audit/list', params),
  auditOrder: (orderNo: string, data: any) => request.put(`/trade/order/${orderNo}/audit`, data),

  // 售后服务
  getAfterSaleList: (params: any) => request.get('/trade/after-sale/list', params),
  applyAfterSale: (data: any) => request.post('/trade/after-sale/apply', data),
  getAfterSaleDetail: (id: number) => request.get(`/trade/after-sale/${id}`),

  // 批量下单
  batchOrder: (data: any) => request.post('/trade/order/batch', data),
  downloadTemplate: () => request.get('/trade/order/batch/template', {}, { responseType: 'blob' }),

  // 订单评价
  getEvaluationList: (params: any) => request.get('/trade/evaluation/list', params),
  submitEvaluation: (data: any) => request.post('/trade/evaluation', data)
}
