Fix bug #2

Merged
yoone merged 1 commits from longbot/WEB:Feature-add-shipment into main 2025-08-07 12:20:55 +00:00
6 changed files with 28 additions and 11 deletions

View File

@ -1,4 +1,4 @@
import { logisticscontrollerGetlist } from '@/servers/api/logistics'; import { logisticscontrollerGetlist, logisticscontrollerGetShipmentLabel } from '@/servers/api/logistics';
import { stockcontrollerGetallstockpoints } from '@/servers/api/stock'; import { stockcontrollerGetallstockpoints } from '@/servers/api/stock';
import { formatShipmentState } from '@/utils/format'; import { formatShipmentState } from '@/utils/format';
import { printPDF } from '@/utils/util'; import { printPDF } from '@/utils/util';
@ -76,19 +76,16 @@ const ListPage: React.FC = () => {
dataIndex: 'operation', dataIndex: 'operation',
hideInSearch: true, hideInSearch: true,
render(_, record) { render(_, record) {
if (!record?.labels?.length) return null;
return ( return (
<Button <Button
type="primary" type="primary"
onClick={() => { onClick={async () => {
// printPDF([record.labels[record.labels.length - 1].url]) const { data } = await logisticscontrollerGetShipmentLabel(record.id);
window.open( const content = data.content;
record.labels[record.labels.length - 1].url, printPDF([content]);
'_blank',
);
}} }}
> >
Label
</Button> </Button>
); );
}, },

View File

@ -877,6 +877,7 @@ const Detail: React.FC<{
label="物流信息" label="物流信息"
span={3} span={3}
render={(_, record) => { render={(_, record) => {
console.log('record', record);
if (!record.shipment || record.shipment.length === 0) { if (!record.shipment || record.shipment.length === 0) {
return <Empty description="暂无物流信息" />; return <Empty description="暂无物流信息" />;
} }
@ -1547,6 +1548,8 @@ const Shipping: React.FC<{
if (packaging_type === 'package') { if (packaging_type === 'package') {
return ( return (
<ProFormList <ProFormList
min={1}
max={1}
label="纸箱尺寸" label="纸箱尺寸"
name={['details', 'packaging_properties', 'packages']} name={['details', 'packaging_properties', 'packages']}
rules={[ rules={[

View File

@ -21,6 +21,18 @@ export async function logisticscontrollerCreateshipment(
}); });
} }
/** 此处后端没有提供注释 POST /logistics/getShipmentLabel/${param0} */
export async function logisticscontrollerGetShipmentLabel(
shipmentId: number
) {
return request<API.BooleanRes>(`/logistics/getShipmentLabel/${shipmentId}`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
}
});
}
/** 此处后端没有提供注释 POST /logistics/createShippingAddress */ /** 此处后端没有提供注释 POST /logistics/createShippingAddress */
export async function logisticscontrollerCreateshippingaddress( export async function logisticscontrollerCreateshippingaddress(
body: API.ShippingAddress, body: API.ShippingAddress,

View File

@ -184,6 +184,10 @@ declare namespace API {
isActive?: boolean; isActive?: boolean;
}; };
type logisticscontrollerGetshipmentlabelParams = {
shipmentId: string;
};
type logisticscontrollerGettrackingnumberParams = { type logisticscontrollerGettrackingnumberParams = {
number?: string; number?: string;
}; };
@ -1427,7 +1431,7 @@ declare namespace API {
/** 是否促销中 */ /** 是否促销中 */
on_sale?: boolean; on_sale?: boolean;
/** 产品类型 */ /** 产品类型 */
type?: 'simple' | 'variable'; type?: 'simple' | 'variable' | 'woosb';
/** 创建时间 */ /** 创建时间 */
createdAt: string; createdAt: string;
/** 更新时间 */ /** 更新时间 */

View File

View File

@ -6,6 +6,7 @@ export async function printPDF(urls: string[]) {
function next() { function next() {
if (index >= urls.length) return; if (index >= urls.length) return;
printJS({ printJS({
base64: true,
printable: urls[index], printable: urls[index],
type: 'pdf', type: 'pdf',
showModal: true, showModal: true,
@ -22,4 +23,4 @@ export async function printPDF(urls: string[]) {
} }
next(); next();
} }