From 0356c77bad1681069bd514142eedbf8e9ce799df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=84=E7=8F=91?= Date: Sat, 9 Aug 2025 19:08:22 +0800 Subject: [PATCH] =?UTF-8?q?Fix:=20=E5=A2=9E=E5=8A=A0=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E8=BF=90=E5=8D=95=E6=8C=89=E9=92=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/Logistics/List/index.tsx | 38 ++++++++++++++++++++---------- src/pages/Order/List/index.tsx | 10 +++++++- src/servers/api/logistics.ts | 14 +++++++++++ 3 files changed, 49 insertions(+), 13 deletions(-) diff --git a/src/pages/Logistics/List/index.tsx b/src/pages/Logistics/List/index.tsx index de05cd2..a3ba5da 100644 --- a/src/pages/Logistics/List/index.tsx +++ b/src/pages/Logistics/List/index.tsx @@ -1,4 +1,6 @@ -import { logisticscontrollerGetlist, logisticscontrollerGetShipmentLabel } from '@/servers/api/logistics'; +import { logisticscontrollerGetlist, logisticscontrollerGetShipmentLabel, + logisticscontrollerDeleteShipment + } from '@/servers/api/logistics'; import { stockcontrollerGetallstockpoints } from '@/servers/api/stock'; import { formatShipmentState } from '@/utils/format'; import { printPDF } from '@/utils/util'; @@ -9,7 +11,7 @@ import { ProColumns, ProTable, } from '@ant-design/pro-components'; -import { App, Button } from 'antd'; +import { App, Button, Divider } from 'antd'; import { useRef, useState } from 'react'; const ListPage: React.FC = () => { @@ -77,16 +79,28 @@ const ListPage: React.FC = () => { hideInSearch: true, render(_, record) { return ( - + <> + + + + ); }, }, diff --git a/src/pages/Order/List/index.tsx b/src/pages/Order/List/index.tsx index 1824fac..b2ffe98 100644 --- a/src/pages/Order/List/index.tsx +++ b/src/pages/Order/List/index.tsx @@ -8,6 +8,7 @@ import { logisticscontrollerGetpaymentmethods, logisticscontrollerGetratelist, logisticscontrollerGetshippingaddresslist, + logisticscontrollerGetShipmentLabel, } from '@/servers/api/logistics'; import { ordercontrollerCancelorder, @@ -75,6 +76,7 @@ import { import Item from 'antd/es/list/Item'; import dayjs from 'dayjs'; import React, { useMemo, useRef, useState } from 'react'; +import { printPDF } from '@/utils/util'; const ListPage: React.FC = () => { const actionRef = useRef(); @@ -1158,7 +1160,7 @@ const Shipping: React.FC<{ details.destination.phone_number.phone; details.origin.phone_number.number = details.origin.phone_number.phone; try { - const { success, message: errMsg } = + const { success, message: errMsg, ...resShipment } = await logisticscontrollerCreateshipment( { orderId: id }, { @@ -1183,6 +1185,12 @@ const Shipping: React.FC<{ phone_number: details.origin.phone_number, }), ); + + // todo, 直接打印label + // const { resLabel } = await logisticscontrollerGetShipmentLabel(resShipment.data.shipmentId); + // console.log('res', resShipment.data.shipmentId, resLabel); + // const labelContent = resLabel.content; + // printPDF([labelContent]); return true; } catch (error) { message.error(error?.message || '创建失败'); diff --git a/src/servers/api/logistics.ts b/src/servers/api/logistics.ts index a84f55e..b31782d 100644 --- a/src/servers/api/logistics.ts +++ b/src/servers/api/logistics.ts @@ -48,6 +48,20 @@ export async function logisticscontrollerGetShipmentLabel( } }); } +/** 此处后端没有提供注释 DEL /logistics/deleteShipment/${param0} */ +export async function logisticscontrollerDeleteShipment( + shipmentId: number +) { + return request(`/logistics/deleteShipment/${shipmentId}`, { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + } + }); +} + + + /** 此处后端没有提供注释 POST /logistics/createShippingAddress */ export async function logisticscontrollerCreateshippingaddress(