forked from yoone/WEB
1
0
Fork 0

Compare commits

..

2 Commits

Author SHA1 Message Date
zhuotianyuan 0676f51f3c fix: 移除调试语句debugger 2026-01-28 20:14:37 +08:00
zhuotianyuan 49eeb7f47e feat(订单列表): 添加最佳物流选项并优化邮件地址处理
添加"最佳物流"到快递公司选项列表
将origin.email_addresses改为直接使用而不分割,保持与destination.email_addresses处理方式一致
2026-01-28 19:46:40 +08:00
4 changed files with 23 additions and 30 deletions

View File

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

View File

@ -27,9 +27,9 @@ const ListPage: React.FC = () => {
dataIndex: 'username',
hideInSearch: true,
render: (_, record) => {
if (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;
if (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;
},
},
{
@ -132,7 +132,7 @@ const ListPage: React.FC = () => {
title: '联系电话',
dataIndex: 'phone',
hideInSearch: true,
render: (_, record) => record.phone ?? record?.billing?.phone ?? record?.shipping?.phone ?? '-',
render: (_, record) => record?.billing.phone || record?.shipping.phone,
},
{
title: '账单地址',

View File

@ -617,8 +617,8 @@ const ListPage: React.FC = () => {
message: errMsg,
data,
} = await ordercontrollerSyncorders(values, {
after: values.dateRange?.[0],
before: values.dateRange?.[1],
after: values.dateRange?.[0] + 'T00:00:00Z',
before: values.dateRange?.[1] + 'T23:59:59Z',
});
if (!success) {
throw new Error(errMsg);
@ -1386,7 +1386,7 @@ const Shipping: React.FC<{
{ label: 'tms.freightwaves', value: 'freightwaves' },
]);
const [courierCompany, setCourierCompany] = useState([
{ label: '最佳物流', value: '' },
{ label: '最佳物流', value: '最优物流' },
{ label: 'UNIUNI', value: 'UNIUNI' },
{ label: 'PuroYYZ', value: 'PuroYYZ' },
{ label: 'CPYYZ', value: 'CPYYZ' },
@ -1445,7 +1445,7 @@ const Shipping: React.FC<{
if (shipmentInfo) shipmentInfo = JSON.parse(shipmentInfo);
const a = {
shipmentPlatform: 'uniuni',
courierCompany: '',
courierCompany: '最优物流',
...data,
// payment_method_id: shipmentInfo?.payment_method_id,
stockPointId: shipmentInfo?.stockPointId,

View File

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