From df374c4b3571bf9ae1cd4c55b5ce2a4eb8f63030 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=84=E7=8F=91?= Date: Thu, 7 Aug 2025 20:03:15 +0800 Subject: [PATCH] Fix bug --- src/pages/Logistics/List/index.tsx | 15 ++++++--------- src/pages/Order/List/index.tsx | 3 +++ src/servers/api/logistics.ts | 12 ++++++++++++ src/servers/api/typings.d.ts | 6 +++++- src/utils/PDFDownloader.tsx | 0 src/utils/util.ts | 3 ++- 6 files changed, 28 insertions(+), 11 deletions(-) create mode 100644 src/utils/PDFDownloader.tsx diff --git a/src/pages/Logistics/List/index.tsx b/src/pages/Logistics/List/index.tsx index b4b5837..de05cd2 100644 --- a/src/pages/Logistics/List/index.tsx +++ b/src/pages/Logistics/List/index.tsx @@ -1,4 +1,4 @@ -import { logisticscontrollerGetlist } from '@/servers/api/logistics'; +import { logisticscontrollerGetlist, logisticscontrollerGetShipmentLabel } from '@/servers/api/logistics'; import { stockcontrollerGetallstockpoints } from '@/servers/api/stock'; import { formatShipmentState } from '@/utils/format'; import { printPDF } from '@/utils/util'; @@ -76,19 +76,16 @@ const ListPage: React.FC = () => { dataIndex: 'operation', hideInSearch: true, render(_, record) { - if (!record?.labels?.length) return null; return ( ); }, diff --git a/src/pages/Order/List/index.tsx b/src/pages/Order/List/index.tsx index 622f641..b04365b 100644 --- a/src/pages/Order/List/index.tsx +++ b/src/pages/Order/List/index.tsx @@ -877,6 +877,7 @@ const Detail: React.FC<{ label="物流信息" span={3} render={(_, record) => { + console.log('record', record); if (!record.shipment || record.shipment.length === 0) { return ; } @@ -1547,6 +1548,8 @@ const Shipping: React.FC<{ if (packaging_type === 'package') { return ( (`/logistics/getShipmentLabel/${shipmentId}`, { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + } + }); +} + /** 此处后端没有提供注释 POST /logistics/createShippingAddress */ export async function logisticscontrollerCreateshippingaddress( body: API.ShippingAddress, diff --git a/src/servers/api/typings.d.ts b/src/servers/api/typings.d.ts index 03947a3..7cc9827 100644 --- a/src/servers/api/typings.d.ts +++ b/src/servers/api/typings.d.ts @@ -184,6 +184,10 @@ declare namespace API { isActive?: boolean; }; + type logisticscontrollerGetshipmentlabelParams = { + shipmentId: string; + }; + type logisticscontrollerGettrackingnumberParams = { number?: string; }; @@ -1427,7 +1431,7 @@ declare namespace API { /** 是否促销中 */ on_sale?: boolean; /** 产品类型 */ - type?: 'simple' | 'variable'; + type?: 'simple' | 'variable' | 'woosb'; /** 创建时间 */ createdAt: string; /** 更新时间 */ diff --git a/src/utils/PDFDownloader.tsx b/src/utils/PDFDownloader.tsx new file mode 100644 index 0000000..e69de29 diff --git a/src/utils/util.ts b/src/utils/util.ts index c5ddf9d..5e7b0a2 100644 --- a/src/utils/util.ts +++ b/src/utils/util.ts @@ -6,6 +6,7 @@ export async function printPDF(urls: string[]) { function next() { if (index >= urls.length) return; printJS({ + base64: true, printable: urls[index], type: 'pdf', showModal: true, @@ -22,4 +23,4 @@ export async function printPDF(urls: string[]) { } next(); -} +} \ No newline at end of file