Compare commits
5 Commits
0676f51f3c
...
8190dc92eb
| Author | SHA1 | Date |
|---|---|---|
|
|
8190dc92eb | |
|
|
9429df1db7 | |
|
|
128677e9ac | |
|
|
4c23fba5de | |
|
|
84b8097949 |
|
|
@ -16,7 +16,7 @@ interface SyncFormProps {
|
|||
tableRef: React.MutableRefObject<ActionType | undefined>;
|
||||
onFinish: (values: any) => Promise<void>;
|
||||
siteId?: string;
|
||||
dateRange?: [dayjs.Dayjs, dayjs.Dayjs];
|
||||
initialValues?: any;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -28,7 +28,10 @@ const SyncForm: React.FC<SyncFormProps> = ({
|
|||
tableRef,
|
||||
onFinish,
|
||||
siteId,
|
||||
dateRange,
|
||||
initialValues = {
|
||||
// 默认一星期
|
||||
dateRange: [dayjs().subtract(1, 'week'), dayjs()],
|
||||
},
|
||||
}) => {
|
||||
// 使用 antd 的 App 组件提供的 message API
|
||||
const [loading, setLoading] = React.useState(false);
|
||||
|
|
@ -57,9 +60,7 @@ const SyncForm: React.FC<SyncFormProps> = ({
|
|||
// 返回一个抽屉表单
|
||||
return (
|
||||
<DrawerForm<API.ordercontrollerSyncorderParams>
|
||||
initialValues={{
|
||||
dateRange: [dayjs().subtract(1, 'week'), dayjs()],
|
||||
}}
|
||||
initialValues={initialValues}
|
||||
title="同步订单"
|
||||
// 表单的触发器,一个带图标的按钮
|
||||
trigger={
|
||||
|
|
@ -75,9 +76,20 @@ const SyncForm: React.FC<SyncFormProps> = ({
|
|||
destroyOnHidden: true,
|
||||
}}
|
||||
// 表单提交成功后的回调
|
||||
onFinish={onFinish}
|
||||
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);
|
||||
}}
|
||||
>
|
||||
<ProForm.Group>
|
||||
|
||||
{/* 站点选择框 */}
|
||||
<ProFormSelect
|
||||
name="siteId"
|
||||
|
|
@ -99,17 +111,10 @@ const SyncForm: React.FC<SyncFormProps> = ({
|
|||
name="dateRange"
|
||||
label="同步日期范围"
|
||||
placeholder={['开始日期', '结束日期']}
|
||||
transform={(value) => {
|
||||
return {
|
||||
dateRange: value,
|
||||
};
|
||||
}}
|
||||
fieldProps={{
|
||||
showTime: false,
|
||||
style: { width: '100%' },
|
||||
}}
|
||||
/>
|
||||
</ProForm.Group>
|
||||
</DrawerForm>
|
||||
);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -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?.billing.phone || record?.shipping.phone,
|
||||
render: (_, record) => record.phone ?? record?.billing?.phone ?? record?.shipping?.phone ?? '-',
|
||||
},
|
||||
{
|
||||
title: '账单地址',
|
||||
|
|
|
|||
|
|
@ -617,8 +617,8 @@ const ListPage: React.FC = () => {
|
|||
message: errMsg,
|
||||
data,
|
||||
} = await ordercontrollerSyncorders(values, {
|
||||
after: values.dateRange?.[0] + 'T00:00:00Z',
|
||||
before: values.dateRange?.[1] + 'T23:59:59Z',
|
||||
after: values.dateRange?.[0],
|
||||
before: values.dateRange?.[1],
|
||||
});
|
||||
if (!success) {
|
||||
throw new Error(errMsg);
|
||||
|
|
@ -1386,6 +1386,7 @@ const Shipping: React.FC<{
|
|||
{ label: 'tms.freightwaves', value: 'freightwaves' },
|
||||
]);
|
||||
const [courierCompany, setCourierCompany] = useState([
|
||||
{ label: '最佳物流', value: '' },
|
||||
{ label: 'UNIUNI', value: 'UNIUNI' },
|
||||
{ label: 'PuroYYZ', value: 'PuroYYZ' },
|
||||
{ label: 'CPYYZ', value: 'CPYYZ' },
|
||||
|
|
@ -1444,7 +1445,7 @@ const Shipping: React.FC<{
|
|||
if (shipmentInfo) shipmentInfo = JSON.parse(shipmentInfo);
|
||||
const a = {
|
||||
shipmentPlatform: 'uniuni',
|
||||
courierCompany: 'UNIUNI',
|
||||
courierCompany: '',
|
||||
...data,
|
||||
// payment_method_id: shipmentInfo?.payment_method_id,
|
||||
stockPointId: shipmentInfo?.stockPointId,
|
||||
|
|
@ -1515,7 +1516,7 @@ const Shipping: React.FC<{
|
|||
...data
|
||||
}) => {
|
||||
details.origin.email_addresses =
|
||||
details.origin.email_addresses.split(',');
|
||||
details.origin.email_addresses;
|
||||
details.destination.email_addresses =
|
||||
details.destination.email_addresses.split(',');
|
||||
details.destination.phone_number.number =
|
||||
|
|
@ -2165,7 +2166,7 @@ const Shipping: React.FC<{
|
|||
const originEmail = details.origin.email_addresses;
|
||||
const destinationEmail = details.destination.email_addresses;
|
||||
details.origin.email_addresses =
|
||||
details.origin.email_addresses.split(',');
|
||||
details.origin.email_addresses;
|
||||
details.destination.email_addresses =
|
||||
details.destination.email_addresses.split(',');
|
||||
details.destination.phone_number.number =
|
||||
|
|
|
|||
|
|
@ -467,7 +467,9 @@ const List: React.FC = () => {
|
|||
批量修改
|
||||
</Button>,
|
||||
// 批量创建 bundle 产品按钮
|
||||
<Button onClick={() => setBatchCreateBundleModalVisible(true)}>
|
||||
<Button
|
||||
disabled={selectedRows.length <= 0}
|
||||
onClick={() => setBatchCreateBundleModalVisible(true)}>
|
||||
批量创建套装
|
||||
</Button>,
|
||||
// 批量同步按钮
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ import * as order from './order';
|
|||
import * as product from './product';
|
||||
import * as site from './site';
|
||||
import * as siteApi from './siteApi';
|
||||
import * as siteProduct from './siteProduct';
|
||||
import * as statistics from './statistics';
|
||||
import * as stock from './stock';
|
||||
import * as subscription from './subscription';
|
||||
|
|
@ -28,6 +29,7 @@ export default {
|
|||
order,
|
||||
product,
|
||||
siteApi,
|
||||
siteProduct,
|
||||
site,
|
||||
statistics,
|
||||
stock,
|
||||
|
|
|
|||
|
|
@ -0,0 +1,33 @@
|
|||
// @ts-ignore
|
||||
/* eslint-disable */
|
||||
import { request } from 'umi';
|
||||
|
||||
/** 此处后端没有提供注释 GET /site-product/list */
|
||||
export async function siteproductcontrollerGetsiteproductlist(
|
||||
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
|
||||
params: API.siteproductcontrollerGetsiteproductlistParams,
|
||||
options?: { [key: string]: any },
|
||||
) {
|
||||
return request<any>('/site-product/list', {
|
||||
method: 'GET',
|
||||
params: {
|
||||
...params,
|
||||
},
|
||||
...(options || {}),
|
||||
});
|
||||
}
|
||||
|
||||
/** 此处后端没有提供注释 POST /site-product/sync */
|
||||
export async function siteproductcontrollerSyncsiteproducts(
|
||||
body: number,
|
||||
options?: { [key: string]: any },
|
||||
) {
|
||||
return request<any>('/site-product/sync', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'text/plain',
|
||||
},
|
||||
data: body,
|
||||
...(options || {}),
|
||||
});
|
||||
}
|
||||
|
|
@ -1103,8 +1103,8 @@ declare namespace API {
|
|||
categoryId?: number;
|
||||
/** 库存组成 */
|
||||
components?: ProductStockComponent[];
|
||||
/** 站点 SKU 列表 */
|
||||
siteSkus?: string[];
|
||||
/** 站点 SKU关联 */
|
||||
siteSkus?: SiteSku[];
|
||||
/** 来源 */
|
||||
source?: number;
|
||||
/** 创建时间 */
|
||||
|
|
@ -1630,10 +1630,12 @@ declare namespace API {
|
|||
stockPointId?: number;
|
||||
orderIds?: number[];
|
||||
shipmentPlatform?: string;
|
||||
courierCompany?: string;
|
||||
};
|
||||
|
||||
type ShipmentFeeBookDTO = {
|
||||
shipmentPlatform?: string;
|
||||
courierCompany?: string;
|
||||
stockPointId?: number;
|
||||
sender?: string;
|
||||
startPhone?: Record<string, any>;
|
||||
|
|
@ -2221,6 +2223,23 @@ declare namespace API {
|
|||
id: string;
|
||||
};
|
||||
|
||||
type siteproductcontrollerGetsiteproductlistParams = {
|
||||
sku?: string;
|
||||
name?: string;
|
||||
siteId?: number;
|
||||
pageSize?: number;
|
||||
current?: number;
|
||||
};
|
||||
|
||||
type SiteSku = {
|
||||
/** sku */
|
||||
sku?: string;
|
||||
/** 商品ID */
|
||||
productId?: number;
|
||||
/** 是否旧版数据 */
|
||||
isOld?: boolean;
|
||||
};
|
||||
|
||||
type SitesResponse = {
|
||||
/** 状态码 */
|
||||
code?: number;
|
||||
|
|
|
|||
Loading…
Reference in New Issue