Some checks failed
CI / Test (ubuntu-latest) (push) Has been cancelled
CI / Test (windows-latest) (push) Has been cancelled
CI / Lint (ubuntu-latest) (push) Has been cancelled
CI / Lint (windows-latest) (push) Has been cancelled
CI / Check (ubuntu-latest) (push) Has been cancelled
CI / Check (windows-latest) (push) Has been cancelled
CodeQL / Analyze (javascript-typescript) (push) Has been cancelled
Deploy Website on push / Deploy Push Playground Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Docs Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Antd Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Element Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Naive Ftp (push) Has been cancelled
Release Drafter / update_release_draft (push) Has been cancelled
CI / CI OK (push) Has been cancelled
Deploy Website on push / Rerun on failure (push) Has been cancelled
Lock Threads / action (push) Has been cancelled
Issue Close Require / close-issues (push) Has been cancelled
Close stale issues / stale (push) Has been cancelled
61 lines
1.4 KiB
TypeScript
61 lines
1.4 KiB
TypeScript
import type { Recordable } from '@vben/types';
|
|
|
|
import { requestClient } from '#/api/request';
|
|
|
|
export namespace OrderApi {
|
|
export interface Order {
|
|
id: string;
|
|
order_no: string;
|
|
platform_order_id: string;
|
|
product_name: string;
|
|
payment_platform: 'alipay' | 'appleiap' | 'wechat';
|
|
payment_scene: 'app' | 'h5' | 'mini_program' | 'public_account';
|
|
amount: number;
|
|
status: 'closed' | 'failed' | 'paid' | 'pending' | 'refunded';
|
|
query_state: 'cleaned' | 'failed' | 'pending' | 'processing' | 'success';
|
|
create_time: string;
|
|
pay_time: null | string;
|
|
refund_time: null | string;
|
|
update_time: string;
|
|
}
|
|
|
|
export interface OrderList {
|
|
total: number;
|
|
items: Order[];
|
|
}
|
|
|
|
export interface RefundOrderRequest {
|
|
refund_amount: number;
|
|
refund_reason: string;
|
|
}
|
|
|
|
export interface RefundOrderResponse {
|
|
status: string;
|
|
refund_no: string;
|
|
amount: number;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* 获取订单列表数据
|
|
*/
|
|
async function getOrderList(params: Recordable<any>) {
|
|
return requestClient.get<OrderApi.OrderList>('/order/list', {
|
|
params,
|
|
});
|
|
}
|
|
|
|
/**
|
|
* 订单退款
|
|
* @param id 订单 ID
|
|
* @param data 退款请求数据
|
|
*/
|
|
async function refundOrder(id: string, data: OrderApi.RefundOrderRequest) {
|
|
return requestClient.post<OrderApi.RefundOrderResponse>(
|
|
`/order/refund/${id}`,
|
|
data,
|
|
);
|
|
}
|
|
|
|
export { getOrderList, refundOrder };
|