| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- /**
- * 订单管理相关API
- */
- import { get, post } from '@/utils/request';
- export interface OrderQueryParams {
- page?: number;
- pageSize?: number;
- orderNo?: string;
- deviceId?: string;
- payStatus?: string;
- status?: number;
- statusList?: number[];
- startDate?: string;
- endDate?: string;
- }
- export interface OrderListResponse {
- list: any[];
- total: number;
- page: number;
- pageSize: number;
- }
- /**
- * 获取订单列表
- */
- export async function getOrderList(params: OrderQueryParams = {}): Promise<OrderListResponse> {
- const query = { ...params };
- if (query.status === -1) {
- delete (query as any).status;
- }
- return get('/order/list', query);
- }
- /**
- * 获取订单详情
- */
- export async function getOrderDetail(orderId: string): Promise<any> {
- return get(`/order/${orderId}`);
- }
- /**
- * 获取订单统计
- */
- export async function getOrderStats(params?: { startDate?: string; endDate?: string }): Promise<any> {
- return get('/order/statistics', params || {});
- }
- /**
- * 处理退款(支持部分退款、自定义金额、全额退款)
- */
- export async function handleRefund(
- orderId: string,
- reason: string,
- data?: { products?: { productId: string; productName: string; quantity: number; price: number }[]; refundAmount?: number }
- ): Promise<any> {
- const body: any = { reason };
- if (data?.products?.length) body.products = data.products;
- if (data?.refundAmount) body.refundAmount = data.refundAmount;
- return post(`/order/${orderId}/refund`, body);
- }
|