Browse Source

打印loading

hella_online_20240829
wangyufei 2 months ago
parent
commit
b6eeb59f2d
  1. 127
      src/pages/point/index.vue

127
src/pages/point/index.vue

@ -59,7 +59,7 @@
</view> </view>
</view> </view>
</view> </view>
<view class="" style="position: fixed;width: 100%;bottom: 0rpx;left: 0px;"> <view class="" style="position: fixed;width: 100%;bottom: 0rpx;left: 0px;" v-show="isLoadFinish">
<button @click="printImage" <button @click="printImage"
style='background:rgb(60, 156, 255) !important ;color: white;margin-top: 80rpx;'> 打印</button> style='background:rgb(60, 156, 255) !important ;color: white;margin-top: 80rpx;'> 打印</button>
</view> </view>
@ -81,13 +81,67 @@
name: 'point', name: 'point',
data() { data() {
return { return {
data: {}, timer:null,
originData:[],
data: [],
newHtmlContent: '', //html newHtmlContent: '', //html
isLoadFinish: false, isLoadFinish: false,
} }
}, },
methods: { methods: {
getListData(){
//
// 线 线
// this.data = [{
// itemCode:'065.051-01M', //
// itemName: 'PCCLARNATEA1225BLACK9999', //
// packName: '',//
// packageCode: 'PS0513-000003', //
// batch:'20240514',//
// parentNumber:'PS0513-000003',//
// itemType:'',//
// asnNumber:'123232',//ASN
// supplierCode: 'Fewewq', //
// qty: '100', //
// printTimes:'2019-09-09 09:09:00', //
// barcodeString: 'HMQ;V1.0;Dwork1-line1;F;R2024-04-03T08:28:41;B20240403;PPN0403-000005;I399.960-12;Q5.000000;UEA;',
// barcodeBase64: '',
// productionLineCode:''//线
// }]
let _this = this
this.$nextTick(async () => {
//
const el = _this.$refs['qrcodeRef']
let str = ''
el.forEach(async (item, index) => {
await item.canvasToTempFilePath({
success: async (res) => {
// base64
await pathToBase64(res.tempFilePath).then(base64 => {
_this.data[index].barcodeBase64 = base64
if (index == el.length - 1) {
_this.isLoadFinish = true
uni.hideLoading();
}
}).catch(err => {
console.log(err);
})
},
fail(err) {
console.log('err:::', err)
}
})
})
})
},
// #ifdef APP // #ifdef APP
// //
printImage() { printImage() {
@ -116,6 +170,7 @@
if (newVal == true) { if (newVal == true) {
// html // html
let str = '' let str = ''
// #ifdef APP
this.readFile(htmlFileUrl, (htmlContent) => { this.readFile(htmlFileUrl, (htmlContent) => {
this.newHtmlContent = htmlContent this.newHtmlContent = htmlContent
this.data.forEach(item => { this.data.forEach(item => {
@ -195,60 +250,34 @@
"mainBody", str); // "mainBody", str); //
console.log(this.newHtmlContent) console.log(this.newHtmlContent)
}); });
// #endif
} }
} }
}, },
onLoad(option) { onLoad(option) {
uni.showLoading({
title: '加载中...',
mask: true
});
if (option.points) { if (option.points) {
this.data = JSON.parse(option.points); this.originData = JSON.parse(option.points);
} }
}, },
async onShow() { unmounted() {
// if(this.timer){
// 线 线 clearTimeout(this.timer)
// this.data = [{ this.timer = null
// itemCode:'065.051-01M', // }
// itemName: 'PCCLARNATEA1225BLACK9999', // },
// packName: '',// onShow() {
// packageCode: 'PS0513-000003', // this.timer = setTimeout(()=>{
// batch:'20240514',// if(this.timer){
// parentNumber:'PS0513-000003',// clearTimeout(this.timer)
// itemType:'',// this.timer = null
// asnNumber:'123232',//ASN }
// supplierCode: 'Fewewq', // this.data = this.originData
// qty: '100', // this.getListData()
// printTimes:'2019-09-09 09:09:00', // },1000)
// barcodeString: 'HMQ;V1.0;Dwork1-line1;F;R2024-04-03T08:28:41;B20240403;PPN0403-000005;I399.960-12;Q5.000000;UEA;',
// barcodeBase64: '',
// productionLineCode:''//线
// }]
this.$nextTick(async () => {
//
const el = this.$refs['qrcodeRef']
let str = ''
el.forEach(async (item, index) => {
await item.canvasToTempFilePath({
success: async (res) => {
// base64
await pathToBase64(res.tempFilePath).then(base64 => {
this.data[index].barcodeBase64 = base64
if (index == el.length - 1) {
this.isLoadFinish = true
}
}).catch(err => {
console.log(err);
})
},
fail(err) {
console.log('err:::', err)
}
})
})
})
}, },
} }
</script> </script>

Loading…
Cancel
Save