forked from yoone/WEB
1
0
Fork 0

feat(订单): 添加订单导出功能并更新相关类型定义

添加订单导出API接口及前端实现
调整订单列表页面的IP字段显示
更新订单相关类型定义,包括物流信息和状态字段
This commit is contained in:
tikkhun 2026-01-06 10:33:44 +08:00
parent ce12e55adc
commit bb907fa47c
3 changed files with 50 additions and 28 deletions

View File

@ -288,7 +288,6 @@ const ListPage: React.FC = () => {
{
title: 'IP',
dataIndex: 'customer_ip_address',
hideInSearch: true,
},
{
title: '设备',
@ -504,31 +503,24 @@ const ListPage: React.FC = () => {
}}
tableRef={actionRef}
/>,
// <Button
// type="primary"
// disabled={selectedRowKeys.length === 0}
// onClick={handleBatchExport}
// >
// 批量导出
// </Button>,
<Popconfirm
title="批量导出"
description="确认导出选中的订单吗?"
onConfirm={async () => {
console.log(selectedRowKeys);
try {
const res = await request('/order/order/export', {
method: 'GET',
params: {
const res = await request('/order/export', {
method: 'POST',
data: {
ids: selectedRowKeys,
}
});
if (res?.success && res?.data?.csv) {
const blob = new Blob([res.data.csv], { type: 'text/csv;charset=utf-8;' });
if (res?.success && res.data) {
const blob = new Blob([res.data], { type: 'text/csv;charset=utf-8;' });
const url = URL.createObjectURL(blob);
const a = document.createElement('a');
a.href = url;
a.download = 'customers.csv';
a.download = 'orders.csv';
a.click();
URL.revokeObjectURL(url);
} else {

View File

@ -59,6 +59,21 @@ export async function ordercontrollerCreatenote(
});
}
/** 此处后端没有提供注释 POST /order/export */
export async function ordercontrollerExportorder(
body: Record<string, any>,
options?: { [key: string]: any },
) {
return request<any>('/order/export', {
method: 'POST',
headers: {
'Content-Type': 'text/plain',
},
data: body,
...(options || {}),
});
}
/** 此处后端没有提供注释 POST /order/getOrderByNumber */
export async function ordercontrollerGetorderbynumber(
body: string,
@ -251,11 +266,14 @@ export async function ordercontrollerSyncorderbyid(
options?: { [key: string]: any },
) {
const { orderId: param0, siteId: param1, ...queryParams } = params;
return request<API.BooleanRes>(`/order/syncOrder/${param1}/order/${param0}`, {
return request<API.SyncOperationResult>(
`/order/syncOrder/${param1}/order/${param0}`,
{
method: 'POST',
params: { ...queryParams },
...(options || {}),
});
},
);
}
/** 此处后端没有提供注释 POST /order/updateOrderItems/${param0} */

View File

@ -456,6 +456,10 @@ declare namespace API {
shipping_provider?: string;
/** 发货方式 */
shipping_method?: string;
/** 状态 */
status?: string;
/** 创建时间 */
date_created?: string;
/** 发货商品项 */
items?: FulfillmentItemDTO[];
};
@ -2406,6 +2410,8 @@ declare namespace API {
params?: UnifiedSearchParamsDTO;
};
type SyncOperationResult = {};
type SyncOperationResultDTO = {
/** 总处理数量 */
total?: number;
@ -2641,6 +2647,8 @@ declare namespace API {
number?: string;
/** 订单状态 */
status?: string;
/** 财务状态 */
financial_status?: string;
/** 货币 */
currency?: string;
/** 货币符号 */
@ -2683,8 +2691,6 @@ declare namespace API {
fee_lines?: UnifiedFeeLineDTO[];
/** 优惠券项 */
coupon_lines?: UnifiedCouponLineDTO[];
/** 物流追踪信息 */
tracking?: UnifiedOrderTrackingDTO[];
/** 支付时间 */
date_paid?: string;
/** 客户IP地址 */
@ -2695,6 +2701,10 @@ declare namespace API {
device_type?: string;
/** 来源类型 */
source_type?: string;
/** 订单状态 */
fulfillment_status?: number;
/** 物流信息 */
fulfillments?: FulfillmentDTO[];
};
type UnifiedOrderLineItemDTO = {
@ -2739,14 +2749,16 @@ declare namespace API {
type UnifiedOrderTrackingDTO = {
/** 订单ID */
order_id?: string;
/** 快递公司 */
tracking_provider?: string;
/** 运单跟踪号 */
/** 物流单号 */
tracking_number?: string;
/** 发货日期 */
date_shipped?: string;
/** 发货状态 */
status_shipped?: string;
/** 物流公司 */
shipping_provider?: string;
/** 发货方式 */
shipping_method?: string;
/** 状态 */
status?: string;
/** 创建时间 */
date_created?: string;
};
type UnifiedPaginationDTO = {