Browse Source

打印loading

hella_online_20240829
wangyufei 5 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 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"
style='background:rgb(60, 156, 255) !important ;color: white;margin-top: 80rpx;'> 打印</button>
</view>
@ -81,13 +81,67 @@
name: 'point',
data() {
return {
data: {},
timer:null,
originData:[],
data: [],
newHtmlContent: '', //html
isLoadFinish: false,
}
},
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
//
printImage() {
@ -116,6 +170,7 @@
if (newVal == true) {
// html
let str = ''
// #ifdef APP
this.readFile(htmlFileUrl, (htmlContent) => {
this.newHtmlContent = htmlContent
this.data.forEach(item => {
@ -195,60 +250,34 @@
"mainBody", str); //
console.log(this.newHtmlContent)
});
// #endif
}
}
},
onLoad(option) {
uni.showLoading({
title: '加载中...',
mask: true
});
if (option.points) {
this.data = JSON.parse(option.points);
this.originData = JSON.parse(option.points);
}
},
unmounted() {
if(this.timer){
clearTimeout(this.timer)
this.timer = null
}
},
async onShow() {
//
// 线 线
// 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:''//线
// }]
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)
}
})
})
})
onShow() {
this.timer = setTimeout(()=>{
if(this.timer){
clearTimeout(this.timer)
this.timer = null
}
this.data = this.originData
this.getListData()
},1000)
},
}
</script>

Loading…
Cancel
Save