From 05bd41aab8c9dba2cf7afcd78493415761f11d9d Mon Sep 17 00:00:00 2001
From: xuxueyang <xuxy@fengyuntec.com>
Date: 星期四, 26 九月 2024 08:54:08 +0800
Subject: [PATCH] update 供应商刷新问题
---
sub_pages/supplier/print/print-list.vue | 83 ++++++++++++++++++++++++-----------------
1 files changed, 48 insertions(+), 35 deletions(-)
diff --git a/sub_pages/supplier/print/print-list.vue b/sub_pages/supplier/print/print-list.vue
index 20c3a50..a4e73c9 100644
--- a/sub_pages/supplier/print/print-list.vue
+++ b/sub_pages/supplier/print/print-list.vue
@@ -106,11 +106,11 @@
returnResult: "",
canvasWidth: 80,
canvasHeight: 80,
- buffSize: [],
- buffIndex: 0,
- printNum: [],
- printNumIndex: 0,
- printerNum: 1,
+ // buffSize: [],
+ // buffIndex: 0,
+ // printNum: [],
+ // printNumIndex: 0,
+ // printerNum: 1,
currentPrint: 1,
isReceiptSend: false,
isLabelSend: false,
@@ -128,21 +128,24 @@
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function() {
- var list = []
- var numList = []
- var j = 0
- for (var i = 20; i < 200; i += 10) {
- list[j] = i;
- j++
- }
- for (var i = 1; i < 10; i++) {
- numList[i - 1] = i
- }
+ // var list = []
+ // var numList = []
+ // var j = 0
+ // for (var i = 20; i < 400; i += 10) {
+ // list[j] = i;
+ // j++
+ // }
+
+ // for (var i = 1; i < 10; i++) {
+ // numList[i - 1] = i
+ // }
let that = this
- that.buffSize = list
- that.oneTimeData = list[0]
- that.printNum = numList
- that.printerNum = numList[0]
+ // that.buffSize = list
+ // that.oneTimeData = list[0]
+ that.oneTimeData = 20
+ // that.printNum = numList
+ // that.printerNum = numList[0]
+
},
async onLoad() {
var t = this.$storage.getItem('cache_delivery_order_print') || ''
@@ -186,6 +189,7 @@
// ...data
// }
this.items = data || []
+ console.log('items len:', this.items.length)
}
} else {
this.$message.showToast('获取详情失败')
@@ -514,15 +518,16 @@
},
async openControl() {
//打印
+ // console.log('openControl start')
+ let that = this;
- var that = this;
- if (that.items.num <= 0) {
- that.$message.showToast('打印数目不能小于0')
- return
- }
var totalnum = 0
for (var each of that.items) {
- totalnum += each.num
+ totalnum += each.num || 1
+ }
+ if (totalnum <= 0) {
+ that.$message.showToast('打印数目不能小于0')
+ return
}
if (totalnum > 3) {
await that.$message.confirm(`打印数目为${totalnum}张,确定打印吗`)
@@ -534,7 +539,7 @@
that.buffs = []
for (var each of that.items) {
- for (var i = 0; i < each.num; i++) {
+ for (var i = 0; i < (each.num || 1); i++) {
var command = tsc.jpPrinter.createNew()
//根据数目不同,打印不同数目
@@ -582,7 +587,7 @@
command.setText(60, 230, "TSS24.BF2", 1, 1, "————————————")
command.setText(30, 260, "TSS24.BF2", 1, 1, "花满芫")
- command.setText(200, 260, "TSS24.BF2", 1, 1, `数目: ${i+1}/${each.num}`)
+ command.setText(200, 260, "TSS24.BF2", 1, 1, `数目: ${i+1}/${each.num||1}`)
// command.setText(20, 40, "TSS24.BF2", 1, 1, "" + (that.item.warehouseName || '待分配'))
// // 库位:
@@ -634,7 +639,7 @@
// command.setBar(170, 180, "EAN8", 64, 1, 3, 3, "1234567")
command.setPagePrint()
-
+ // console.log('that.buffs', that.buffs.length)
that.buffs.push(command.getData())
}
@@ -677,8 +682,8 @@
var loopTime = that.looptime
var lastData = that.lastData
var onTimeData = that.oneTimeData
- var printNum = that.printerNum
- var currentPrint = that.currentPrint
+ // var printNum = that.printerNum
+ let currentPrint = that.currentPrint
var buf
var dataView
if (currentTime < loopTime) {
@@ -694,7 +699,8 @@
dataView.setUint8(i, buff[(currentTime - 1) * onTimeData + i])
}
}
- console.log("第" + currentTime + "次发送数据大小为:" + buf.byteLength)
+
+ console.log("第" + currentTime + "次发送数据大小为:" + buf.byteLength, that.$util.toDateTime(new Date()))
wx.writeBLECharacteristicValue({
deviceId: that.deviceId,
serviceId: that.writeServiceId,
@@ -743,10 +749,17 @@
}
} else {
- currentPrint++
- that.currentPrint = currentPrint
- that.currentTime = 1
- that.Send(that.buffs[that.currentPrint - 1])
+ console.log('已打印第' + currentPrint + '张')
+ setTimeout(() => {
+ currentPrint++
+ that.currentPrint = currentPrint
+ that.currentTime = 1
+ // that.Send(that.buffs[that.currentPrint - 1])
+ that.prepareSend(that.buffs[that.currentPrint - 1])
+
+
+ }, 500)
+
}
// } else {
--
Gitblit v1.9.3