Merge remote-tracking branch 'remotes/origin/test-print'
This commit is contained in:
commit
9ac26c8576
@ -0,0 +1,93 @@
|
|||||||
|
<template>
|
||||||
|
<!-- 打印预览 -->
|
||||||
|
<tpx-dialog
|
||||||
|
v-model:show="previewModel.show"
|
||||||
|
@onClose="handleCloseModal"
|
||||||
|
custom-style="width: 600rpx;padding: 10rpx;"
|
||||||
|
title="打印预览"
|
||||||
|
>
|
||||||
|
<view style="height: calc(75vh);">
|
||||||
|
<tpx-layout>
|
||||||
|
<template v-slot:header></template>
|
||||||
|
<template v-slot:body>
|
||||||
|
<view v-for="(imgUrl, index) in imageUrl" class="mb-20">
|
||||||
|
<!-- canvas绘图后再显示预览图 -->
|
||||||
|
<u-row justify="center" @click="handlePreview(index)">
|
||||||
|
<image :src="imgUrl" mode="widthFix" style="max-width: 100%;"></image>
|
||||||
|
</u-row>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
<template v-slot:footer>
|
||||||
|
<view class="blcok-white-noradius">
|
||||||
|
<u-row>
|
||||||
|
<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>
|
||||||
|
</u-row>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
</tpx-layout>
|
||||||
|
</view>
|
||||||
|
</tpx-dialog>
|
||||||
|
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
|
||||||
|
import { promiseTimeout } from "@/common/untool"
|
||||||
|
|
||||||
|
export default {
|
||||||
|
props:{
|
||||||
|
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
},
|
||||||
|
components: {
|
||||||
|
|
||||||
|
},
|
||||||
|
data () {
|
||||||
|
return {
|
||||||
|
previewModel: { show: false },
|
||||||
|
imageUrl: []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
mounted () {
|
||||||
|
// Test
|
||||||
|
// this.startPrint({ imageUrl: 'https://image-c.weimobwmc.com/ol-6NoX9/ed4f6d5da41f4606811aa8018e2918da.jpg', paperWidth: this.paperWidth })
|
||||||
|
},
|
||||||
|
unmounted() {
|
||||||
|
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
handleCloseModal(){
|
||||||
|
},
|
||||||
|
handlePreview(index){
|
||||||
|
uni.previewImage({
|
||||||
|
urls: this.imageUrl,
|
||||||
|
current:index
|
||||||
|
})
|
||||||
|
},
|
||||||
|
async startPrint({ imageUrl } = {}) {
|
||||||
|
this.imageUrl = [] // 每次打印前,清空历史数据
|
||||||
|
// 默认先做预览
|
||||||
|
if(imageUrl.length > 0) {
|
||||||
|
if(!Array.isArray(imageUrl)){
|
||||||
|
imageUrl = [imageUrl]
|
||||||
|
}
|
||||||
|
this.imageUrl = imageUrl
|
||||||
|
this.previewModel.show = true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
async confirmPrint(){
|
||||||
|
if(this.imageUrl.length == 0) {
|
||||||
|
this.showToast('缺少预览内容')
|
||||||
|
} else {
|
||||||
|
this.goto(`print/bluetoothPrinter?imageUrl=${this.imageUrl.join(",")}`)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped lang="scss">
|
||||||
|
|
||||||
|
</style>
|
||||||
@ -285,7 +285,7 @@
|
|||||||
|
|
||||||
</buns-edit-sheet>
|
</buns-edit-sheet>
|
||||||
|
|
||||||
<tpx-bluetooth-print ref="curPrint"></tpx-bluetooth-print>
|
<tpx-bluetooth-print-preview ref="curPrint"></tpx-bluetooth-print-preview>
|
||||||
|
|
||||||
</tpx-page>
|
</tpx-page>
|
||||||
</template>
|
</template>
|
||||||
@ -299,6 +299,7 @@
|
|||||||
import BpeGoodphotoTmp from "@/components/buns-post-edit-templates/bpe-goodphoto-tmp"
|
import BpeGoodphotoTmp from "@/components/buns-post-edit-templates/bpe-goodphoto-tmp"
|
||||||
import BpeGoodKuaidiTmp from "@/components/buns-post-edit-templates/bpe-good-kuaidi-tmp"
|
import BpeGoodKuaidiTmp from "@/components/buns-post-edit-templates/bpe-good-kuaidi-tmp"
|
||||||
import BpeGoodsizeTmp from "@/components/buns-post-edit-templates/bpe-goodsize-tmp"
|
import BpeGoodsizeTmp from "@/components/buns-post-edit-templates/bpe-goodsize-tmp"
|
||||||
|
import TpxBluetoothPrintPreview from "@/components/tpx-bluetooth-print/tpx-bluetooth-print-preview"
|
||||||
import { debounce } from "@/common/util"
|
import { debounce } from "@/common/util"
|
||||||
import * as apiService from "@/common/api"
|
import * as apiService from "@/common/api"
|
||||||
import { getOrderModels } from "./model"
|
import { getOrderModels } from "./model"
|
||||||
@ -308,7 +309,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: { BpeAddressinfoTmp, BpeGoodstaticTmp, BpeCostTmp, BpeGooditemEditTmp, BpeGoodphotoTmp, BpeGoodKuaidiTmp, BpeGoodsizeTmp },
|
components: { BpeAddressinfoTmp, BpeGoodstaticTmp, BpeCostTmp, BpeGooditemEditTmp, BpeGoodphotoTmp, BpeGoodKuaidiTmp, BpeGoodsizeTmp, TpxBluetoothPrintPreview },
|
||||||
props: {
|
props: {
|
||||||
// hasLeftWin: {
|
// hasLeftWin: {
|
||||||
// type: Boolean
|
// type: Boolean
|
||||||
|
|||||||
@ -1,8 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<tpx-page>
|
<tpx-page>
|
||||||
<tpx-bluetooth-print show="!pageLoading"
|
<tpx-bluetooth-print ref="curPrint"></tpx-bluetooth-print>
|
||||||
:imageUrl="queryOption.imageUrl"
|
|
||||||
></tpx-bluetooth-print>
|
|
||||||
</tpx-page>
|
</tpx-page>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@ -22,18 +20,26 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted () {
|
mounted () {
|
||||||
|
// 保证ref节点加载
|
||||||
|
this.initData();
|
||||||
},
|
},
|
||||||
unmounted() {
|
unmounted() {
|
||||||
|
|
||||||
},
|
},
|
||||||
onLoad(option) {
|
onLoad(option) {
|
||||||
this.queryOption = option
|
this.queryOption = option
|
||||||
this.initData();
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
initData(){
|
initData(){
|
||||||
|
let urls = this.queryOption?.imageUrl?.split(",")
|
||||||
this.pageLoading = false
|
this.pageLoading = false
|
||||||
|
if(urls?.length > 0) {
|
||||||
|
this.$refs.curPrint.startPrint({
|
||||||
|
imageUrl: urls,
|
||||||
|
}, false)
|
||||||
|
} else {
|
||||||
|
this.showToast('缺少打印内容')
|
||||||
|
}
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -124,7 +124,7 @@
|
|||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
</tpx-layout>
|
</tpx-layout>
|
||||||
<tpx-bluetooth-print ref="curPrint"></tpx-bluetooth-print>
|
<tpx-bluetooth-print-preview ref="curPrint"></tpx-bluetooth-print-preview>
|
||||||
</tpx-page>
|
</tpx-page>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@ -133,7 +133,11 @@
|
|||||||
import dayjs from "dayjs"
|
import dayjs from "dayjs"
|
||||||
import * as apiService from "@/common/api"
|
import * as apiService from "@/common/api"
|
||||||
import { checkParams } from "@/common/validate"
|
import { checkParams } from "@/common/validate"
|
||||||
|
import TpxBluetoothPrintPreview from "@/components/tpx-bluetooth-print/tpx-bluetooth-print-preview"
|
||||||
export default {
|
export default {
|
||||||
|
components: {
|
||||||
|
TpxBluetoothPrintPreview,
|
||||||
|
},
|
||||||
props: {
|
props: {
|
||||||
// hasLeftWin: {
|
// hasLeftWin: {
|
||||||
// type: Boolean
|
// type: Boolean
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user