Commit bba1eb43 by wusiyi

fix: 打印物流面单优化

parent 61b4a0ba
......@@ -214,8 +214,8 @@
<ElSelect
v-model="sheetPrinter"
placeholder="请选择打印机"
@change="handlePrinterChange"
style="width: 200px; margin-right: 10px"
@change="handlePrinterChange"
>
<ElOption
v-for="item in printDeviceList"
......@@ -229,8 +229,20 @@
placeholder="请输入单号"
style="width: 300px; margin-right: 10px"
clearable
@keyup.enter="getLogistic"
/>
<el-button type="primary" @click="getLogistic">查 询</el-button>
<el-button type="success" @click="printLogistic">打印面单</el-button>
<div style="font-size: 20px; margin-top: 20px; color: #666666">
<div style="margin-bottom: 10px; display: flex; gap: 20px">
<div style="width: 400px">店铺单号: {{ shopNo }}</div>
<div>
包含产品数:
<span style="color: red">{{ productCount }}</span>
</div>
</div>
<div>物流跟踪号: {{ trackingNo }}</div>
</div>
</el-drawer>
</span>
</template>
......@@ -548,6 +560,11 @@ const handlePrinterChange = (value: string) => {
localStorage.setItem('sheetPrinter', JSON.stringify(value))
}
const trackingNo = ref('')
const shopNo = ref('')
const documentUrl = ref('')
const productCount = ref()
// 打印物流面单
const getLogistic = () => {
if (!content.value) {
......@@ -563,10 +580,15 @@ const getLogistic = () => {
}
// 获取第三个_后面的内容
const thirdPart = parts[3]
productCount.value = parts[2]
if (thirdPart.startsWith('USPSC')) {
// 美国物流
getLogisticUSApi(content.value).then((res) => {
if (res.code === 200) {
trackingNo.value = res.data.trackingNo
shopNo.value = res.data.shopNo
documentUrl.value = res.data.documentUrl
window.open(filePath + res.data.documentUrl, '_blank')
}
})
......@@ -574,6 +596,9 @@ const getLogistic = () => {
// 中国物流
getLogisticCNApi(content.value).then((res) => {
if (res.code === 200) {
trackingNo.value = res.data.trackingNo
shopNo.value = res.data.shopNo
documentUrl.value = res.data.documentUrl
window.open(FileCnPath + res.data.documentUrl, '_blank')
}
})
......@@ -582,6 +607,15 @@ const getLogistic = () => {
}
}
// 手动打印面单
const printLogistic = () => {
if (!documentUrl.value) {
ElMessage.warning('请先查询面单')
return
}
window.open(filePath + documentUrl.value, '_blank')
}
// 监听路由变化,自动添加标签
watch(
() => route.path,
......@@ -763,10 +797,10 @@ onUnmounted(() => {
}
::v-deep(.get-logistic-drawer.el-drawer.btt) {
height: 120px !important;
width: 700px !important;
top: calc(50% - 60px) !important;
left: calc(50% - 350px) !important;
height: 250px !important;
width: 750px !important;
top: calc(50% - 150px) !important;
left: calc(50% - 400px) !important;
}
.tool-item {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment