uu
This commit is contained in:
parent
d7f1639d4a
commit
6c570f06c5
@ -4,7 +4,7 @@
|
|||||||
v-model:show="previewModel.show"
|
v-model:show="previewModel.show"
|
||||||
@onClose="handleCloseModal"
|
@onClose="handleCloseModal"
|
||||||
custom-style="width: 600rpx;padding: 10rpx;"
|
custom-style="width: 600rpx;padding: 10rpx;"
|
||||||
title="打印预览"
|
title="预览"
|
||||||
>
|
>
|
||||||
<view style="height: calc(75vh);">
|
<view style="height: calc(75vh);">
|
||||||
<tpx-layout>
|
<tpx-layout>
|
||||||
@ -18,7 +18,7 @@
|
|||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
<template v-slot:footer>
|
<template v-slot:footer>
|
||||||
<view class="blcok-white-noradius">
|
<view v-if="showPrint" class="blcok-white-noradius">
|
||||||
<u-row>
|
<u-row>
|
||||||
<u-button @click="confirmPrint" type="primary" size="large" shape="square"
|
<u-button @click="confirmPrint" type="primary" size="large" shape="square"
|
||||||
custom-style="height:80rpx;font-size: 30rpx;border-radius: 14rpx;margin: 0 10rpx;">确认打印</u-button>
|
custom-style="height:80rpx;font-size: 30rpx;border-radius: 14rpx;margin: 0 10rpx;">确认打印</u-button>
|
||||||
@ -37,7 +37,11 @@ import { promiseTimeout } from "@/common/untool"
|
|||||||
|
|
||||||
export default {
|
export default {
|
||||||
props:{
|
props:{
|
||||||
|
showPrint: {
|
||||||
|
default () {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
},
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
},
|
},
|
||||||
@ -66,7 +70,7 @@ export default {
|
|||||||
current:index
|
current:index
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
async startPrint({ imageUrl } = {}) {
|
async showPreview({ imageUrl } = {}) {
|
||||||
this.imageUrl = [] // 每次打印前,清空历史数据
|
this.imageUrl = [] // 每次打印前,清空历史数据
|
||||||
// 默认先做预览
|
// 默认先做预览
|
||||||
if(imageUrl.length > 0) {
|
if(imageUrl.length > 0) {
|
||||||
@ -77,13 +81,14 @@ export default {
|
|||||||
this.previewModel.show = true
|
this.previewModel.show = true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
async confirmPrint(){
|
async confirmPrint(imgs){
|
||||||
if(this.imageUrl.length == 0) {
|
imgs = imgs || this.imageUrl
|
||||||
|
if(imgs.length == 0) {
|
||||||
this.showToast('缺少预览内容')
|
this.showToast('缺少预览内容')
|
||||||
} else {
|
} else {
|
||||||
this.goto(`print/bluetoothPrinter?imageUrl=${this.imageUrl.join(",")}`)
|
this.goto(`print/bluetoothPrinter?imageUrl=${imgs.join(",")}`)
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@ -86,6 +86,7 @@ export default {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
async startPrint({ imageUrl, paperWidth } = {}, preview = true) {
|
async startPrint({ imageUrl, paperWidth } = {}, preview = true) {
|
||||||
|
|
||||||
this.imageUrl = [] // 每次打印前,清空历史数据
|
this.imageUrl = [] // 每次打印前,清空历史数据
|
||||||
this.allImgRes = []
|
this.allImgRes = []
|
||||||
// 默认先做预览
|
// 默认先做预览
|
||||||
@ -112,9 +113,11 @@ export default {
|
|||||||
url = `${url}?t=${new Date().valueOf()}`
|
url = `${url}?t=${new Date().valueOf()}`
|
||||||
return this.$refs[`curCanvas${index}`][0].renderCanvasImg(url, this.paperWidth)
|
return this.$refs[`curCanvas${index}`][0].renderCanvasImg(url, this.paperWidth)
|
||||||
})
|
})
|
||||||
|
this.showLoading()
|
||||||
return Promise.all(allRes).then((imgsRes)=> {
|
return Promise.all(allRes).then((imgsRes)=> {
|
||||||
that.allImgRes = imgsRes
|
that.allImgRes = imgsRes
|
||||||
console.log("setAllImgRes len======", imgsRes.length)
|
console.log("setAllImgRes len======", imgsRes.length)
|
||||||
|
that.hideLoading()
|
||||||
return imgsRes
|
return imgsRes
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|||||||
@ -526,9 +526,7 @@
|
|||||||
}
|
}
|
||||||
let prtRes = await apiService.getRealGetWaybillPrintData({ ...param, _loading: true })
|
let prtRes = await apiService.getRealGetWaybillPrintData({ ...param, _loading: true })
|
||||||
let imgUrls = prtRes?.data?.map(t=> t.imageUrl) || []
|
let imgUrls = prtRes?.data?.map(t=> t.imageUrl) || []
|
||||||
this.$refs.curPrint.startPrint({
|
this.$refs.curPrint.confirmPrint(imgUrls.filter(v=> !!v))
|
||||||
imageUrl: imgUrls.filter(v=> !!v),
|
|
||||||
})
|
|
||||||
this.resetForm()
|
this.resetForm()
|
||||||
},
|
},
|
||||||
async saveSuccessBack(){
|
async saveSuccessBack(){
|
||||||
|
|||||||
@ -38,6 +38,9 @@
|
|||||||
|
|
||||||
<u-row justify="between" custom-style="padding-top:20rpx;">
|
<u-row justify="between" custom-style="padding-top:20rpx;">
|
||||||
<view class="com-section">打印配置</view>
|
<view class="com-section">打印配置</view>
|
||||||
|
<view style="width: 160rpx;">
|
||||||
|
<u-button @click="handlePreview" custom-style="height: 60rpx;">预览</u-button>
|
||||||
|
</view>
|
||||||
</u-row>
|
</u-row>
|
||||||
<view class="clr-prm mt-20">注意:当打印出来寄件分拨或未端分拨返回为空时,请等待5分钟后再补 打印</view>
|
<view class="clr-prm mt-20">注意:当打印出来寄件分拨或未端分拨返回为空时,请等待5分钟后再补 打印</view>
|
||||||
|
|
||||||
@ -118,7 +121,7 @@
|
|||||||
<template v-slot:footer>
|
<template v-slot:footer>
|
||||||
<view class="blcok-white-noradius">
|
<view class="blcok-white-noradius">
|
||||||
<u-row>
|
<u-row>
|
||||||
<u-button @click="handleSubmit()" type="primary" size="large" shape="square"
|
<u-button @click="handleSubmitPrint()" type="primary" size="large" shape="square"
|
||||||
custom-style="height:80rpx;font-size: 30rpx;border-radius: 14rpx;margin: 0 10rpx;">打印</u-button>
|
custom-style="height:80rpx;font-size: 30rpx;border-radius: 14rpx;margin: 0 10rpx;">打印</u-button>
|
||||||
</u-row>
|
</u-row>
|
||||||
</view>
|
</view>
|
||||||
@ -211,11 +214,9 @@
|
|||||||
handleSearch(){
|
handleSearch(){
|
||||||
this.triggerListReload()
|
this.triggerListReload()
|
||||||
},
|
},
|
||||||
async handleSubmit() {
|
async handleSubmitPrint() {
|
||||||
const imgUrls = await this.getPrintImages()
|
const imgUrls = await this.getPrintImages()
|
||||||
this.$refs.curPrint.startPrint({
|
this.$refs.curPrint.confirmPrint(imgUrls.filter(v=> !!v))
|
||||||
imageUrl: imgUrls.filter(v=> !!v),
|
|
||||||
})
|
|
||||||
},
|
},
|
||||||
handleSelAll() {
|
handleSelAll() {
|
||||||
if(this.submitParam.billCode.length == this.resData.list.length) {
|
if(this.submitParam.billCode.length == this.resData.list.length) {
|
||||||
@ -238,7 +239,13 @@
|
|||||||
let res = await this.getRealGetWaybillPrintData()
|
let res = await this.getRealGetWaybillPrintData()
|
||||||
const imgUrls = res?.data?.map(t=> t.imageUrl) || []
|
const imgUrls = res?.data?.map(t=> t.imageUrl) || []
|
||||||
return imgUrls
|
return imgUrls
|
||||||
}
|
},
|
||||||
|
async handlePreview(){
|
||||||
|
const imgUrls = await this.getPrintImages()
|
||||||
|
this.$refs.curPrint.showPreview({
|
||||||
|
imageUrl: imgUrls.filter(v=> !!v)
|
||||||
|
})
|
||||||
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@ -23,12 +23,12 @@
|
|||||||
|
|
||||||
<view class="mt-40">
|
<view class="mt-40">
|
||||||
<u-row justify="between">
|
<u-row justify="between">
|
||||||
<view style="width: 200rpx;" @click="handleSave">
|
<view style="flex:1;" @click="handleSave">
|
||||||
<u-button type="primary" custom-style="border-radius: 10rpx;">保存到本地</u-button>
|
<u-button type="primary" custom-style="border-radius: 10rpx;">保存到本地</u-button>
|
||||||
</view>
|
</view>
|
||||||
<view style="width: 200rpx;" @click="handlePrint">
|
<!-- <view style="width: 200rpx;" @click="handlePrint">
|
||||||
<u-button type="primary" plain="true" custom-style="border-radius: 10rpx;">打印</u-button>
|
<u-button type="primary" plain="true" custom-style="border-radius: 10rpx;">打印</u-button>
|
||||||
</view>
|
</view> -->
|
||||||
</u-row>
|
</u-row>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user