zksu
/
WEB
forked from yoone/WEB
1
0
Fork 0

fix(订单同步): 修复订单同步功能并添加日期范围选择

修复订单同步接口调用参数错误
在同步表单中添加日期范围选择器
调整订单来源统计接口名称拼写错误
This commit is contained in:
zhuotianyuan 2026-01-13 19:26:51 +08:00
parent d0097aec38
commit af1cebe29d
3 changed files with 40 additions and 15 deletions

View File

@ -5,8 +5,10 @@ import {
DrawerForm,
ProForm,
ProFormSelect,
ProFormDateRangePicker,
} from '@ant-design/pro-components';
import { Button } from 'antd';
import dayjs from 'dayjs';
import React from 'react';
// 定义SyncForm组件的props类型
@ -14,6 +16,7 @@ interface SyncFormProps {
tableRef: React.MutableRefObject<ActionType | undefined>;
onFinish: (values: any) => Promise<void>;
siteId?: string;
dateRange?: [dayjs.Dayjs, dayjs.Dayjs];
}
/**
@ -21,7 +24,7 @@ interface SyncFormProps {
* @param {SyncFormProps} props
* @returns {React.ReactElement}
*/
const SyncForm: React.FC<SyncFormProps> = ({ tableRef, onFinish, siteId }) => {
const SyncForm: React.FC<SyncFormProps> = ({ tableRef, onFinish, siteId, dateRange }) => {
// 使用 antd 的 App 组件提供的 message API
const [loading, setLoading] = React.useState(false);
@ -49,6 +52,10 @@ const SyncForm: React.FC<SyncFormProps> = ({ tableRef, onFinish, siteId }) => {
// 返回一个抽屉表单
return (
<DrawerForm<API.ordercontrollerSyncorderParams>
initialValues={{
dateRange: [dayjs().subtract(1, 'week'), dayjs()],
}}
title="同步订单"
// 表单的触发器,一个带图标的按钮
trigger={
@ -67,6 +74,7 @@ const SyncForm: React.FC<SyncFormProps> = ({ tableRef, onFinish, siteId }) => {
onFinish={onFinish}
>
<ProForm.Group>
{/* 站点选择框 */}
<ProFormSelect
name="siteId"
@ -83,6 +91,22 @@ const SyncForm: React.FC<SyncFormProps> = ({ tableRef, onFinish, siteId }) => {
}));
}}
/>
<ProFormDateRangePicker
name="dateRange"
label="同步日期范围"
placeholder={['开始日期', '结束日期']}
transform={(value) => {
return {
dateRange: value,
};
}}
fieldProps={{
showTime: false,
style: { width: '100%' },
}}
/>
</ProForm.Group>
</DrawerForm>
);

View File

@ -502,7 +502,7 @@ const ListPage: React.FC = () => {
success,
message: errMsg,
data,
} = await ordercontrollerSyncorders(values);
} = await ordercontrollerSyncorders(values,{after:values.dateRange?.[0]+'T00:00:00Z',before:values.dateRange?.[1]+'T23:59:59Z'});
if (!success) {
throw new Error(errMsg);
}
@ -997,6 +997,7 @@ const Detail: React.FC<{
);
}}
/>
{/* 显示 related order */}
<ProDescriptions.Item
label="关联"
@ -1512,7 +1513,7 @@ const Shipping: React.FC<{
// message: '至少需要一个商品',
// validator: (_, value) =>
// value && value.length > 0
// ? Promise.resolve()
//</Col> ? Promise.resolve()
// : Promise.reject('至少需要一个商品'),
// },
// ]}

View File

@ -2,7 +2,7 @@ import React, { useEffect, useMemo, useRef, useState } from 'react';
import {
statisticscontrollerGetinativeusersbymonth,
statisticscontrollerGetordersorce,
statisticscontrollerGetordersource,
} from '@/servers/api/statistics';
import {
ActionType,
@ -25,7 +25,7 @@ const ListPage: React.FC = () => {
country: ['CA'],
};
function handleSubmit(values: typeof initialValues) {
statisticscontrollerGetordersorce({params: values}).then(({ data, success }) => {
statisticscontrollerGetordersource({params: values}).then(({ data, success }) => {
if (success) setData(data);
});
}