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

@ -47,4 +47,4 @@
"prettier-plugin-packagejson": "^2.4.3", "prettier-plugin-packagejson": "^2.4.3",
"typescript": "^5.7.3" "typescript": "^5.7.3"
} }
} }

View File

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

View File

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