Fix bug
This commit is contained in:
parent
7e6de57924
commit
df374c4b35
|
|
@ -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 (
|
||||
<Button
|
||||
type="primary"
|
||||
onClick={() => {
|
||||
// printPDF([record.labels[record.labels.length - 1].url])
|
||||
window.open(
|
||||
record.labels[record.labels.length - 1].url,
|
||||
'_blank',
|
||||
);
|
||||
onClick={async () => {
|
||||
const { data } = await logisticscontrollerGetShipmentLabel(record.id);
|
||||
const content = data.content;
|
||||
printPDF([content]);
|
||||
}}
|
||||
>
|
||||
打印
|
||||
Label
|
||||
</Button>
|
||||
);
|
||||
},
|
||||
|
|
|
|||
|
|
@ -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 <Empty description="暂无物流信息" />;
|
||||
}
|
||||
|
|
@ -1547,6 +1548,8 @@ const Shipping: React.FC<{
|
|||
if (packaging_type === 'package') {
|
||||
return (
|
||||
<ProFormList
|
||||
min={1}
|
||||
max={1}
|
||||
label="纸箱尺寸"
|
||||
name={['details', 'packaging_properties', 'packages']}
|
||||
rules={[
|
||||
|
|
|
|||
|
|
@ -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 */
|
||||
export async function logisticscontrollerCreateshippingaddress(
|
||||
body: API.ShippingAddress,
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
/** 更新时间 */
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue