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

Compare commits

...

4 Commits

Author SHA1 Message Date
tikkhun fba6e4f83a refactor(Customer/StatisticList): 替换客户列表接口为统计列表接口并调整排序参数格式 2026-01-30 16:44:13 +08:00
tikkhun a9c0a8728f fix(SyncForm): 修正日期格式化中的秒数显示问题 2026-01-30 16:17:02 +08:00
tikkhun 079f397adf fix: 移除订单列表页中的调试日志 2026-01-30 11:56:54 +08:00
tikkhun 80dcfffbe1 fix(Product): 禁用批量创建套装按钮当未选择行时
fix(Order): 调整同步订单日期范围格式并添加调试日志

fix(Customer): 优化客户信息显示逻辑和空值处理

refactor(SyncForm): 重构同步表单初始值和日期处理逻辑
2026-01-30 10:28:39 +08:00
4 changed files with 31 additions and 24 deletions

View File

@ -16,7 +16,7 @@ interface SyncFormProps {
tableRef: React.MutableRefObject<ActionType | undefined>; tableRef: React.MutableRefObject<ActionType | undefined>;
onFinish: (values: any) => Promise<void>; onFinish: (values: any) => Promise<void>;
siteId?: string; siteId?: string;
dateRange?: [dayjs.Dayjs, dayjs.Dayjs]; initialValues?: any;
} }
/** /**
@ -28,7 +28,10 @@ const SyncForm: React.FC<SyncFormProps> = ({
tableRef, tableRef,
onFinish, onFinish,
siteId, siteId,
dateRange, initialValues = {
// 默认一星期
dateRange: [dayjs().subtract(1, 'week'), dayjs()],
},
}) => { }) => {
// 使用 antd 的 App 组件提供的 message API // 使用 antd 的 App 组件提供的 message API
const [loading, setLoading] = React.useState(false); const [loading, setLoading] = React.useState(false);
@ -57,9 +60,7 @@ const SyncForm: React.FC<SyncFormProps> = ({
// 返回一个抽屉表单 // 返回一个抽屉表单
return ( return (
<DrawerForm<API.ordercontrollerSyncorderParams> <DrawerForm<API.ordercontrollerSyncorderParams>
initialValues={{ initialValues={initialValues}
dateRange: [dayjs().subtract(1, 'week'), dayjs()],
}}
title="同步订单" title="同步订单"
// 表单的触发器,一个带图标的按钮 // 表单的触发器,一个带图标的按钮
trigger={ trigger={
@ -75,9 +76,20 @@ const SyncForm: React.FC<SyncFormProps> = ({
destroyOnHidden: true, destroyOnHidden: true,
}} }}
// 表单提交成功后的回调 // 表单提交成功后的回调
onFinish={onFinish} onFinish={async (values) => {
const normalValues = {
...values,
dateRange: values.dateRange
? [
dayjs(values.dateRange[0]).format('YYYY-MM-DDTHH:mm:ss[Z]'),
dayjs(values.dateRange[1]).add(1, 'day').format('YYYY-MM-DDTHH:mm:ss[Z]'),
]
: [],
};
await onFinish(normalValues);
}}
> >
<ProForm.Group>
{/* 站点选择框 */} {/* 站点选择框 */}
<ProFormSelect <ProFormSelect
name="siteId" name="siteId"
@ -99,17 +111,10 @@ const SyncForm: React.FC<SyncFormProps> = ({
name="dateRange" name="dateRange"
label="同步日期范围" label="同步日期范围"
placeholder={['开始日期', '结束日期']} placeholder={['开始日期', '结束日期']}
transform={(value) => {
return {
dateRange: value,
};
}}
fieldProps={{ fieldProps={{
showTime: false, showTime: false,
style: { width: '100%' },
}} }}
/> />
</ProForm.Group>
</DrawerForm> </DrawerForm>
); );
}; };

View File

@ -2,7 +2,7 @@ import { HistoryOrder } from '@/pages/Statistics/Order';
import { import {
customercontrollerAddtag, customercontrollerAddtag,
customercontrollerDeltag, customercontrollerDeltag,
customercontrollerGetcustomerlist, customercontrollerGetcustomerstatisticlist,
customercontrollerGettags, customercontrollerGettags,
customercontrollerSetrate, customercontrollerSetrate,
} from '@/servers/api/customer'; } from '@/servers/api/customer';
@ -27,9 +27,9 @@ const ListPage: React.FC = () => {
dataIndex: 'username', dataIndex: 'username',
hideInSearch: true, hideInSearch: true,
render: (_, record) => { render: (_, record) => {
if (record.billing.first_name || record.billing.last_name) if (record.billing?.first_name || record.billing?.last_name)
return record.billing.first_name + ' ' + record.billing.last_name; return record.billing?.first_name + ' ' + record.billing?.last_name;
return record.shipping.first_name + ' ' + record.shipping.last_name; return record.shipping?.first_name + ' ' + record.shipping?.last_name;
}, },
}, },
{ {
@ -132,7 +132,7 @@ const ListPage: React.FC = () => {
title: '联系电话', title: '联系电话',
dataIndex: 'phone', dataIndex: 'phone',
hideInSearch: true, hideInSearch: true,
render: (_, record) => record?.billing.phone || record?.shipping.phone, render: (_, record) => record.phone ?? record?.billing?.phone ?? record?.shipping?.phone ?? '-',
}, },
{ {
title: '账单地址', title: '账单地址',
@ -200,9 +200,9 @@ const ListPage: React.FC = () => {
rowKey="id" rowKey="id"
request={async (params, sorter) => { request={async (params, sorter) => {
const key = Object.keys(sorter)[0]; const key = Object.keys(sorter)[0];
const { data, success } = await customercontrollerGetcustomerlist({ const { data, success } = await customercontrollerGetcustomerstatisticlist({
...params, ...params,
...(key ? { sorterKey: key, sorterValue: sorter[key] } : {}), ...(key ? { orderBy: `${key}:${sorter[key]}` } : {}),
}); });
return { return {

View File

@ -617,8 +617,8 @@ const ListPage: React.FC = () => {
message: errMsg, message: errMsg,
data, data,
} = await ordercontrollerSyncorders(values, { } = await ordercontrollerSyncorders(values, {
after: values.dateRange?.[0] + 'T00:00:00Z', after: values.dateRange?.[0],
before: values.dateRange?.[1] + 'T23:59:59Z', before: values.dateRange?.[1],
}); });
if (!success) { if (!success) {
throw new Error(errMsg); throw new Error(errMsg);

View File

@ -467,7 +467,9 @@ const List: React.FC = () => {
</Button>, </Button>,
// 批量创建 bundle 产品按钮 // 批量创建 bundle 产品按钮
<Button onClick={() => setBatchCreateBundleModalVisible(true)}> <Button
disabled={selectedRows.length <= 0}
onClick={() => setBatchCreateBundleModalVisible(true)}>
</Button>, </Button>,
// 批量同步按钮 // 批量同步按钮