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