style: 修复代码格式问题

- 调整 typings.d.ts 中的枚举值缩进
- 修复 package.json 文件末尾换行符
- 统一 Order/List 组件中的代码缩进和格式
This commit is contained in:
tikkhun 2025-12-19 17:18:56 +08:00
parent 3a547922cd
commit 10bd5d8d5c
3 changed files with 306 additions and 306 deletions

View File

@ -437,7 +437,7 @@ const ListPage: React.FC = () => {
},
},
];
const [selectedRowKeys, setSelectedRowKeys] = useState([]);
const [selectedRowKeys, setSelectedRowKeys] = useState([]);
return (
<PageContainer ghost>
@ -449,7 +449,7 @@ const ListPage: React.FC = () => {
actionRef={actionRef}
rowKey="id"
columns={columns}
rowSelection={{
rowSelection={{
selectedRowKeys,
onChange: (keys) => setSelectedRowKeys(keys),
}}
@ -482,41 +482,41 @@ const ListPage: React.FC = () => {
}}
tableRef={actionRef}
/>,
// <Button
// type="primary"
// disabled={selectedRowKeys.length === 0}
// onClick={handleBatchExport}
// >
// 批量导出
// </Button>,
<Popconfirm
title="批量导出"
description="确认导出选中的订单吗?"
onConfirm={async () => {
// <Button
// type="primary"
// disabled={selectedRowKeys.length === 0}
// onClick={handleBatchExport}
// >
// 批量导出
// </Button>,
<Popconfirm
title="批量导出"
description="确认导出选中的订单吗?"
onConfirm={async () => {
try {
const { success, message: errMsg } =
await ordercontrollerExportorder({
ids: selectedRowKeys,
});
if (!success) {
throw new Error(errMsg);
}
message.success('导出成功');
actionRef.current?.reload();
setSelectedRowKeys([]);
} catch (error: any) {
message.error(error?.message || '导出失败');
}
try {
const { success, message: errMsg } =
await ordercontrollerExportorder({
ids: selectedRowKeys,
});
if (!success) {
throw new Error(errMsg);
}
message.success('导出成功');
actionRef.current?.reload();
setSelectedRowKeys([]);
} catch (error: any) {
message.error(error?.message || '导出失败');
}
}}
>
<Button type="primary" disabled={selectedRowKeys.length === 0} ghost>
</Button>
</Popconfirm>
}}
>
<Button type="primary" disabled={selectedRowKeys.length === 0} ghost>
</Button>
</Popconfirm>
]}
request={async ({ date, ...param }: any) => {
if (param.status === 'all') {
@ -605,33 +605,33 @@ const Detail: React.FC<{
)
? []
: [
<Divider type="vertical" />,
<Button
type="primary"
onClick={async () => {
try {
if (!record.siteId || !record.externalOrderId) {
message.error('站点ID或外部订单ID不存在');
return;
}
const { success, message: errMsg } =
await ordercontrollerSyncorderbyid({
siteId: record.siteId,
orderId: record.externalOrderId,
});
if (!success) {
throw new Error(errMsg);
}
message.success('同步成功');
tableRef.current?.reload();
} catch (error: any) {
message.error(error?.message || '同步失败');
<Divider type="vertical" />,
<Button
type="primary"
onClick={async () => {
try {
if (!record.siteId || !record.externalOrderId) {
message.error('站点ID或外部订单ID不存在');
return;
}
}}
>
</Button>,
]),
const { success, message: errMsg } =
await ordercontrollerSyncorderbyid({
siteId: record.siteId,
orderId: record.externalOrderId,
});
if (!success) {
throw new Error(errMsg);
}
message.success('同步成功');
tableRef.current?.reload();
} catch (error: any) {
message.error(error?.message || '同步失败');
}
}}
>
</Button>,
]),
// ...(['processing', 'pending_reshipment'].includes(record.orderStatus)
// ? [
// <Divider type="vertical" />,
@ -650,152 +650,152 @@ const Detail: React.FC<{
'pending_refund',
].includes(record.orderStatus)
? [
<Divider type="vertical" />,
<Popconfirm
title="转至售后"
description="确认转至售后?"
onConfirm={async () => {
try {
if (!record.id) {
message.error('订单ID不存在');
return;
}
const { success, message: errMsg } =
await ordercontrollerChangestatus(
{
id: record.id,
},
{
status: 'after_sale_pending',
},
);
if (!success) {
throw new Error(errMsg);
}
tableRef.current?.reload();
} catch (error: any) {
message.error(error.message);
<Divider type="vertical" />,
<Popconfirm
title="转至售后"
description="确认转至售后?"
onConfirm={async () => {
try {
if (!record.id) {
message.error('订单ID不存在');
return;
}
}}
>
<Button type="primary" ghost>
</Button>
</Popconfirm>,
]
const { success, message: errMsg } =
await ordercontrollerChangestatus(
{
id: record.id,
},
{
status: 'after_sale_pending',
},
);
if (!success) {
throw new Error(errMsg);
}
tableRef.current?.reload();
} catch (error: any) {
message.error(error.message);
}
}}
>
<Button type="primary" ghost>
</Button>
</Popconfirm>,
]
: []),
...(record.orderStatus === 'after_sale_pending'
? [
<Divider type="vertical" />,
<Popconfirm
title="转至取消"
description="确认转至取消?"
onConfirm={async () => {
try {
if (!record.id) {
message.error('订单ID不存在');
return;
}
const { success, message: errMsg } =
await ordercontrollerCancelorder({
<Divider type="vertical" />,
<Popconfirm
title="转至取消"
description="确认转至取消?"
onConfirm={async () => {
try {
if (!record.id) {
message.error('订单ID不存在');
return;
}
const { success, message: errMsg } =
await ordercontrollerCancelorder({
id: record.id,
});
if (!success) {
throw new Error(errMsg);
}
tableRef.current?.reload();
} catch (error: any) {
message.error(error.message);
}
}}
>
<Button type="primary" ghost>
</Button>
</Popconfirm>,
<Divider type="vertical" />,
<Popconfirm
title="转至退款"
description="确认转至退款?"
onConfirm={async () => {
try {
if (!record.id) {
message.error('订单ID不存在');
return;
}
const { success, message: errMsg } =
await ordercontrollerRefundorder({
id: record.id,
});
if (!success) {
throw new Error(errMsg);
}
tableRef.current?.reload();
} catch (error: any) {
message.error(error.message);
}
}}
>
<Button type="primary" ghost>
退
</Button>
</Popconfirm>,
<Divider type="vertical" />,
<Popconfirm
title="转至完成"
description="确认转至完成?"
onConfirm={async () => {
try {
if (!record.id) {
message.error('订单ID不存在');
return;
}
const { success, message: errMsg } =
await ordercontrollerCompletedorder({
id: record.id,
});
if (!success) {
throw new Error(errMsg);
}
tableRef.current?.reload();
} catch (error: any) {
message.error(error.message);
}
}}
>
<Button type="primary" ghost>
</Button>
</Popconfirm>,
<Divider type="vertical" />,
<Popconfirm
title="转至待补发"
description="确认转至待补发?"
onConfirm={async () => {
try {
const { success, message: errMsg } =
await ordercontrollerChangestatus(
{
id: record.id,
});
if (!success) {
throw new Error(errMsg);
}
tableRef.current?.reload();
} catch (error: any) {
message.error(error.message);
},
{
status: 'pending_reshipment',
},
);
if (!success) {
throw new Error(errMsg);
}
}}
>
<Button type="primary" ghost>
</Button>
</Popconfirm>,
<Divider type="vertical" />,
<Popconfirm
title="转至退款"
description="确认转至退款?"
onConfirm={async () => {
try {
if (!record.id) {
message.error('订单ID不存在');
return;
}
const { success, message: errMsg } =
await ordercontrollerRefundorder({
id: record.id,
});
if (!success) {
throw new Error(errMsg);
}
tableRef.current?.reload();
} catch (error: any) {
message.error(error.message);
}
}}
>
<Button type="primary" ghost>
退
</Button>
</Popconfirm>,
<Divider type="vertical" />,
<Popconfirm
title="转至完成"
description="确认转至完成?"
onConfirm={async () => {
try {
if (!record.id) {
message.error('订单ID不存在');
return;
}
const { success, message: errMsg } =
await ordercontrollerCompletedorder({
id: record.id,
});
if (!success) {
throw new Error(errMsg);
}
tableRef.current?.reload();
} catch (error: any) {
message.error(error.message);
}
}}
>
<Button type="primary" ghost>
</Button>
</Popconfirm>,
<Divider type="vertical" />,
<Popconfirm
title="转至待补发"
description="确认转至待补发?"
onConfirm={async () => {
try {
const { success, message: errMsg } =
await ordercontrollerChangestatus(
{
id: record.id,
},
{
status: 'pending_reshipment',
},
);
if (!success) {
throw new Error(errMsg);
}
tableRef.current?.reload();
} catch (error: any) {
message.error(error.message);
}
}}
>
<Button type="primary" ghost>
</Button>
</Popconfirm>,
]
tableRef.current?.reload();
} catch (error: any) {
message.error(error.message);
}
}}
>
<Button type="primary" ghost>
</Button>
</Popconfirm>,
]
: []),
]}
>
@ -1057,31 +1057,31 @@ const Detail: React.FC<{
}
actions={
v.state === 'waiting-for-scheduling' ||
v.state === 'waiting-for-transit'
v.state === 'waiting-for-transit'
? [
<Popconfirm
title="取消运单"
description="确认取消运单?"
onConfirm={async () => {
try {
const { success, message: errMsg } =
await logisticscontrollerDelshipment({
id: v.id,
});
if (!success) {
throw new Error(errMsg);
}
tableRef.current?.reload();
initRequest();
} catch (error: any) {
message.error(error.message);
<Popconfirm
title="取消运单"
description="确认取消运单?"
onConfirm={async () => {
try {
const { success, message: errMsg } =
await logisticscontrollerDelshipment({
id: v.id,
});
if (!success) {
throw new Error(errMsg);
}
}}
>
<DeleteFilled />
</Popconfirm>,
]
tableRef.current?.reload();
initRequest();
} catch (error: any) {
message.error(error.message);
}
}}
>
<DeleteFilled />
</Popconfirm>,
]
: []
}
>
@ -1469,16 +1469,16 @@ const Shipping: React.FC<{
<ProFormList
label="发货产品"
name="sales"
// rules={[
// {
// required: true,
// message: '至少需要一个商品',
// validator: (_, value) =>
// value && value.length > 0
// ? Promise.resolve()
// : Promise.reject('至少需要一个商品'),
// },
// ]}
// rules={[
// {
// required: true,
// message: '至少需要一个商品',
// validator: (_, value) =>
// value && value.length > 0
// ? Promise.resolve()
// : Promise.reject('至少需要一个商品'),
// },
// ]}
>
<ProForm.Group>
<ProFormSelect
@ -1903,7 +1903,7 @@ const Shipping: React.FC<{
name="description"
placeholder="请输入描述"
width="lg"
// rules={[{ required: true, message: '请输入描述' }]}
// rules={[{ required: true, message: '请输入描述' }]}
/>
</ProForm.Group>
</ProFormList>

View File

@ -85,14 +85,14 @@ declare namespace API {
tags?: string[];
/** 状态 */
status?:
| 'publish'
| 'draft'
| 'pending'
| 'private'
| 'trash'
| 'auto-draft'
| 'future'
| 'inherit';
| 'publish'
| 'draft'
| 'pending'
| 'private'
| 'trash'
| 'auto-draft'
| 'future'
| 'inherit';
};
type BatchUpdateTagsDTO = {
@ -488,7 +488,7 @@ declare namespace API {
orderId: number;
};
type ordercontrollerExportorderParams = {
type ordercontrollerExportorderParams = {
ids: number[];
};
@ -544,18 +544,18 @@ declare namespace API {
startDate?: string;
endDate?: string;
status?:
| 'pending'
| 'processing'
| 'completed'
| 'cancelled'
| 'refunded'
| 'failed'
| 'after_sale_pending'
| 'pending_reshipment'
| 'pending_refund'
| 'return-requested'
| 'return-approved'
| 'return-cancelled';
| 'pending'
| 'processing'
| 'completed'
| 'cancelled'
| 'refunded'
| 'failed'
| 'after_sale_pending'
| 'pending_reshipment'
| 'pending_refund'
| 'return-requested'
| 'return-approved'
| 'return-cancelled';
payment_method?: string;
/** 仅订阅订单(父订阅订单或包含订阅商品) */
isSubscriptionOnly?: boolean;
@ -1160,18 +1160,18 @@ declare namespace API {
startDate?: string;
endDate?: string;
status?:
| 'pending'
| 'processing'
| 'completed'
| 'cancelled'
| 'refunded'
| 'failed'
| 'after_sale_pending'
| 'pending_reshipment'
| 'pending_refund'
| 'return-requested'
| 'return-approved'
| 'return-cancelled';
| 'pending'
| 'processing'
| 'completed'
| 'cancelled'
| 'refunded'
| 'failed'
| 'after_sale_pending'
| 'pending_reshipment'
| 'pending_refund'
| 'return-requested'
| 'return-approved'
| 'return-cancelled';
payment_method?: string;
/** 仅订阅订单(父订阅订单或包含订阅商品) */
isSubscriptionOnly?: boolean;
@ -1282,12 +1282,12 @@ declare namespace API {
siteId?: string;
/** 订阅状态 */
status?:
| 'active'
| 'pending'
| 'on-hold'
| 'cancelled'
| 'expired'
| 'pending-cancel';
| 'active'
| 'pending'
| 'on-hold'
| 'cancelled'
| 'expired'
| 'pending-cancel';
/** 客户邮箱 */
customer_email?: string;
/** 关键字(订阅ID,邮箱等) */
@ -1305,14 +1305,14 @@ declare namespace API {
siteId?: string;
/** 产品状态 */
status?:
| 'publish'
| 'draft'
| 'pending'
| 'private'
| 'trash'
| 'auto-draft'
| 'future'
| 'inherit';
| 'publish'
| 'draft'
| 'pending'
| 'private'
| 'trash'
| 'auto-draft'
| 'future'
| 'inherit';
/** SKU列表 */
skus?: any[];
};
@ -2183,12 +2183,12 @@ declare namespace API {
siteId?: string;
/** 订阅状态 */
status?:
| 'active'
| 'pending'
| 'on-hold'
| 'cancelled'
| 'expired'
| 'pending-cancel';
| 'active'
| 'pending'
| 'on-hold'
| 'cancelled'
| 'expired'
| 'pending-cancel';
/** 客户邮箱 */
customer_email?: string;
/** 关键字(订阅ID,邮箱等) */
@ -2848,14 +2848,14 @@ declare namespace API {
siteId?: string;
/** 产品状态 */
status?:
| 'publish'
| 'draft'
| 'pending'
| 'private'
| 'trash'
| 'auto-draft'
| 'future'
| 'inherit';
| 'publish'
| 'draft'
| 'pending'
| 'private'
| 'trash'
| 'auto-draft'
| 'future'
| 'inherit';
/** SKU列表 */
skus?: any[];
};
@ -2906,14 +2906,14 @@ declare namespace API {
name: string;
/** 产品状态 */
status?:
| 'publish'
| 'draft'
| 'pending'
| 'private'
| 'trash'
| 'auto-draft'
| 'future'
| 'inherit';
| 'publish'
| 'draft'
| 'pending'
| 'private'
| 'trash'
| 'auto-draft'
| 'future'
| 'inherit';
/** 是否为特色产品 */
featured?: boolean;
/** 目录可见性 */