feat(订单): 增加订单导出功能并扩展API类型定义
扩展订单列表API的类型定义,增加时间范围查询参数和分组选项 修改订单导出功能,直接返回CSV文件流供下载 为订单详情添加更多字段类型定义,包括支付时间、客户IP等
This commit is contained in:
parent
6f35c2aee5
commit
6d97ecbcc7
|
|
@ -76,6 +76,7 @@ import {
|
|||
} from 'antd';
|
||||
import React, { useMemo, useRef, useState } from 'react';
|
||||
import RelatedOrders from '../../Subscription/Orders/RelatedOrders';
|
||||
import { request } from '@umijs/max';
|
||||
|
||||
const ListPage: React.FC = () => {
|
||||
const actionRef = useRef<ActionType>();
|
||||
|
|
@ -504,15 +505,25 @@ const ListPage: React.FC = () => {
|
|||
title="批量导出"
|
||||
description="确认导出选中的订单吗?"
|
||||
onConfirm={async () => {
|
||||
console.log(selectedRowKeys);
|
||||
try {
|
||||
const { success, message: errMsg } =
|
||||
await ordercontrollerExportorder({
|
||||
const res = await request('/order/order/export', {
|
||||
method: 'GET',
|
||||
params: {
|
||||
ids: selectedRowKeys,
|
||||
});
|
||||
if (!success) {
|
||||
throw new Error(errMsg);
|
||||
}
|
||||
message.success('导出成功');
|
||||
});
|
||||
if (res?.success && res?.data?.csv) {
|
||||
const blob = new Blob([res.data.csv], { type: 'text/csv;charset=utf-8;' });
|
||||
const url = URL.createObjectURL(blob);
|
||||
const a = document.createElement('a');
|
||||
a.href = url;
|
||||
a.download = 'customers.csv';
|
||||
a.click();
|
||||
URL.revokeObjectURL(url);
|
||||
} else {
|
||||
message.error(res.message || '导出失败');
|
||||
}
|
||||
actionRef.current?.reload();
|
||||
setSelectedRowKeys([]);
|
||||
} catch (error: any) {
|
||||
|
|
|
|||
|
|
@ -452,7 +452,7 @@ declare namespace API {
|
|||
/** 站点ID */
|
||||
site_id?: number;
|
||||
/** 原始ID */
|
||||
origin_id?: number;
|
||||
origin_id?: string;
|
||||
/** 站点创建时间 */
|
||||
site_created_at?: string;
|
||||
/** 站点更新时间 */
|
||||
|
|
@ -988,6 +988,7 @@ declare namespace API {
|
|||
purchaseType?: 'all' | 'first_purchase' | 'repeat_purchase';
|
||||
orderType?: 'all' | 'cpc' | 'non_cpc';
|
||||
brand?: 'all' | 'zyn' | 'yoone' | 'zolt';
|
||||
grouping?: 'day' | 'week' | 'month';
|
||||
};
|
||||
|
||||
type OrderStatusCountDTO = {
|
||||
|
|
@ -1156,6 +1157,10 @@ declare namespace API {
|
|||
page?: number;
|
||||
/** 每页数量 */
|
||||
per_page?: number;
|
||||
/** 查询时间范围开始 */
|
||||
after?: string;
|
||||
/** 查询时间范围结束 */
|
||||
before?: string;
|
||||
/** 搜索关键词 */
|
||||
search?: string;
|
||||
/** 过滤条件对象 */
|
||||
|
|
@ -1669,6 +1674,10 @@ declare namespace API {
|
|||
page?: number;
|
||||
/** 每页数量 */
|
||||
per_page?: number;
|
||||
/** 查询时间范围开始 */
|
||||
after?: string;
|
||||
/** 查询时间范围结束 */
|
||||
before?: string;
|
||||
/** 搜索关键词 */
|
||||
search?: string;
|
||||
/** 过滤条件对象 */
|
||||
|
|
@ -1683,6 +1692,10 @@ declare namespace API {
|
|||
page?: number;
|
||||
/** 每页数量 */
|
||||
per_page?: number;
|
||||
/** 查询时间范围开始 */
|
||||
after?: string;
|
||||
/** 查询时间范围结束 */
|
||||
before?: string;
|
||||
/** 搜索关键词 */
|
||||
search?: string;
|
||||
/** 过滤条件对象 */
|
||||
|
|
@ -1697,6 +1710,10 @@ declare namespace API {
|
|||
page?: number;
|
||||
/** 每页数量 */
|
||||
per_page?: number;
|
||||
/** 查询时间范围开始 */
|
||||
after?: string;
|
||||
/** 查询时间范围结束 */
|
||||
before?: string;
|
||||
/** 搜索关键词 */
|
||||
search?: string;
|
||||
/** 过滤条件对象 */
|
||||
|
|
@ -1711,6 +1728,10 @@ declare namespace API {
|
|||
page?: number;
|
||||
/** 每页数量 */
|
||||
per_page?: number;
|
||||
/** 查询时间范围开始 */
|
||||
after?: string;
|
||||
/** 查询时间范围结束 */
|
||||
before?: string;
|
||||
/** 搜索关键词 */
|
||||
search?: string;
|
||||
/** 过滤条件对象 */
|
||||
|
|
@ -1725,6 +1746,10 @@ declare namespace API {
|
|||
page?: number;
|
||||
/** 每页数量 */
|
||||
per_page?: number;
|
||||
/** 查询时间范围开始 */
|
||||
after?: string;
|
||||
/** 查询时间范围结束 */
|
||||
before?: string;
|
||||
/** 搜索关键词 */
|
||||
search?: string;
|
||||
/** 过滤条件对象 */
|
||||
|
|
@ -1739,6 +1764,10 @@ declare namespace API {
|
|||
page?: number;
|
||||
/** 每页数量 */
|
||||
per_page?: number;
|
||||
/** 查询时间范围开始 */
|
||||
after?: string;
|
||||
/** 查询时间范围结束 */
|
||||
before?: string;
|
||||
/** 搜索关键词 */
|
||||
search?: string;
|
||||
/** 过滤条件对象 */
|
||||
|
|
@ -1758,6 +1787,10 @@ declare namespace API {
|
|||
page?: number;
|
||||
/** 每页数量 */
|
||||
per_page?: number;
|
||||
/** 查询时间范围开始 */
|
||||
after?: string;
|
||||
/** 查询时间范围结束 */
|
||||
before?: string;
|
||||
/** 搜索关键词 */
|
||||
search?: string;
|
||||
/** 过滤条件对象 */
|
||||
|
|
@ -1778,6 +1811,10 @@ declare namespace API {
|
|||
page?: number;
|
||||
/** 每页数量 */
|
||||
per_page?: number;
|
||||
/** 查询时间范围开始 */
|
||||
after?: string;
|
||||
/** 查询时间范围结束 */
|
||||
before?: string;
|
||||
/** 搜索关键词 */
|
||||
search?: string;
|
||||
/** 过滤条件对象 */
|
||||
|
|
@ -1796,6 +1833,10 @@ declare namespace API {
|
|||
page?: number;
|
||||
/** 每页数量 */
|
||||
per_page?: number;
|
||||
/** 查询时间范围开始 */
|
||||
after?: string;
|
||||
/** 查询时间范围结束 */
|
||||
before?: string;
|
||||
/** 搜索关键词 */
|
||||
search?: string;
|
||||
/** 过滤条件对象 */
|
||||
|
|
@ -1820,6 +1861,10 @@ declare namespace API {
|
|||
page?: number;
|
||||
/** 每页数量 */
|
||||
per_page?: number;
|
||||
/** 查询时间范围开始 */
|
||||
after?: string;
|
||||
/** 查询时间范围结束 */
|
||||
before?: string;
|
||||
/** 搜索关键词 */
|
||||
search?: string;
|
||||
/** 过滤条件对象 */
|
||||
|
|
@ -1844,6 +1889,10 @@ declare namespace API {
|
|||
page?: number;
|
||||
/** 每页数量 */
|
||||
per_page?: number;
|
||||
/** 查询时间范围开始 */
|
||||
after?: string;
|
||||
/** 查询时间范围结束 */
|
||||
before?: string;
|
||||
/** 搜索关键词 */
|
||||
search?: string;
|
||||
/** 过滤条件对象 */
|
||||
|
|
@ -1858,6 +1907,10 @@ declare namespace API {
|
|||
page?: number;
|
||||
/** 每页数量 */
|
||||
per_page?: number;
|
||||
/** 查询时间范围开始 */
|
||||
after?: string;
|
||||
/** 查询时间范围结束 */
|
||||
before?: string;
|
||||
/** 搜索关键词 */
|
||||
search?: string;
|
||||
/** 过滤条件对象 */
|
||||
|
|
@ -1872,6 +1925,10 @@ declare namespace API {
|
|||
page?: number;
|
||||
/** 每页数量 */
|
||||
per_page?: number;
|
||||
/** 查询时间范围开始 */
|
||||
after?: string;
|
||||
/** 查询时间范围结束 */
|
||||
before?: string;
|
||||
/** 搜索关键词 */
|
||||
search?: string;
|
||||
/** 过滤条件对象 */
|
||||
|
|
@ -1891,6 +1948,10 @@ declare namespace API {
|
|||
page?: number;
|
||||
/** 每页数量 */
|
||||
per_page?: number;
|
||||
/** 查询时间范围开始 */
|
||||
after?: string;
|
||||
/** 查询时间范围结束 */
|
||||
before?: string;
|
||||
/** 搜索关键词 */
|
||||
search?: string;
|
||||
/** 过滤条件对象 */
|
||||
|
|
@ -2398,6 +2459,8 @@ declare namespace API {
|
|||
email?: string;
|
||||
/** 电话 */
|
||||
phone?: string;
|
||||
/** 配送方式 */
|
||||
method_title?: string;
|
||||
};
|
||||
|
||||
type UnifiedCategoryDTO = {
|
||||
|
|
@ -2535,6 +2598,8 @@ declare namespace API {
|
|||
status?: string;
|
||||
/** 货币 */
|
||||
currency?: string;
|
||||
/** 货币符号 */
|
||||
currency_symbol?: string;
|
||||
/** 总金额 */
|
||||
total?: string;
|
||||
/** 客户ID */
|
||||
|
|
@ -2543,6 +2608,8 @@ declare namespace API {
|
|||
customer_name?: string;
|
||||
/** 客户邮箱 */
|
||||
email?: string;
|
||||
/** 客户邮箱 */
|
||||
customer_email?: string;
|
||||
/** 订单项(具体的商品) */
|
||||
line_items?: UnifiedOrderLineItemDTO[];
|
||||
/** 销售项(兼容前端) */
|
||||
|
|
@ -2573,6 +2640,16 @@ declare namespace API {
|
|||
coupon_lines?: UnifiedCouponLineDTO[];
|
||||
/** 物流追踪信息 */
|
||||
tracking?: UnifiedOrderTrackingDTO[];
|
||||
/** 支付时间 */
|
||||
date_paid?: string;
|
||||
/** 客户IP地址 */
|
||||
customer_ip_address?: string;
|
||||
/** UTM来源 */
|
||||
utm_source?: string;
|
||||
/** 设备类型 */
|
||||
device_type?: string;
|
||||
/** 来源类型 */
|
||||
source_type?: string;
|
||||
};
|
||||
|
||||
type UnifiedOrderLineItemDTO = {
|
||||
|
|
@ -2801,6 +2878,10 @@ declare namespace API {
|
|||
page?: number;
|
||||
/** 每页数量 */
|
||||
per_page?: number;
|
||||
/** 查询时间范围开始 */
|
||||
after?: string;
|
||||
/** 查询时间范围结束 */
|
||||
before?: string;
|
||||
/** 搜索关键词 */
|
||||
search?: string;
|
||||
/** 过滤条件对象 */
|
||||
|
|
@ -2916,7 +2997,7 @@ declare namespace API {
|
|||
/** 站点ID */
|
||||
site_id?: number;
|
||||
/** 原始ID */
|
||||
origin_id?: number;
|
||||
origin_id?: string;
|
||||
/** 邮箱 */
|
||||
email?: string;
|
||||
/** 名字 */
|
||||
|
|
|
|||
Loading…
Reference in New Issue