diff --git a/src/views/mall/trade/order/index.vue b/src/views/mall/trade/order/index.vue
index d1063e20..656736bf 100644
--- a/src/views/mall/trade/order/index.vue
+++ b/src/views/mall/trade/order/index.vue
@@ -151,9 +151,16 @@
{{ item.spuName }} × {{ item.count }}
-
暂无商品信息
+
+
+
+
+
@@ -275,12 +282,11 @@ const handleCommand = (command: string, row: TradeOrderApi.OrderVO) => {
deliveryFormRef.value?.open(row.id) // 直接传递id而不是整个row对象
break
case 'print':
- // 打印功能:在新窗口打开物流面单链接
+ // 打印功能:直接在新窗口打开物流面单
if (row.logisticsLabel) {
- // window.open(row.logisticsLabel, '_blank')
rowLogisticsLabel.value = row.logisticsLabel
currentOrderRow.value = row // 保存当前订单数据
- showLabelDialog.value = true // 打开对话框
+ openInNewWindow() // 直接打开新窗口,不显示对话框
} else {
ElMessage.warning('该订单暂无物流面单信息')
}
@@ -310,12 +316,126 @@ onMounted(async () => {
pickUpStoreList.value = await PickUpStoreApi.getSimpleDeliveryPickUpStoreList()
deliveryExpressList.value = await DeliveryExpressApi.getSimpleDeliveryExpressList()
})
+
+
+/** 在新窗口打开带文字的图片 */
+const openInNewWindow = () => {
+ if (!rowLogisticsLabel.value || !currentOrderRow.value) {
+ ElMessage.warning('图片信息不完整')
+ return
+ }
+
+ // 构建新页面的HTML内容
+ const imageUrl = rowLogisticsLabel.value
+ const orderItems = currentOrderRow.value.items || []
+
+ // 生成商品信息文本
+ const productText = orderItems.map(item => `${item.spuName} × ${item.count}`).join('
')
+
+ const htmlContent = `
+
+
+
+
+
+ 物流面单 - 订单${currentOrderRow.value.no}
+
+
+
+
+

+
+ ${productText}
+
+
+
+
+
+
+
+ `
+
+ // 在新窗口中打开
+ const newWindow = window.open('', '_blank', 'width=800,height=600,scrollbars=yes,resizable=yes')
+ if (newWindow) {
+ newWindow.document.write(htmlContent)
+ newWindow.document.close()
+ // 关闭当前弹窗
+ showLabelDialog.value = false
+ } else {
+ ElMessage.error('无法打开新窗口,请检查浏览器弹窗设置')
+ }
+}