xuxueyang
2024-08-04 6e4b859a05e29eb75ff39c340e015265c3be85e9
sub_pages/supplier/print/print-list.vue
@@ -114,6 +114,7 @@
            notifyCharaterId: {},
            notifyServiceId: '',
            BserviceId: '',
            buffs: [],
         }
      },
      /**
@@ -476,33 +477,54 @@
               }
            })
         },
         openControl() {
         async openControl() {
            //打印
            var that = this;
            if (that.item.num < 0) {
               that.$message.showToast('打印数目不能小于0')
               return
            }
            if (that.item.num > 3) {
               await that.$message.confirm(`打印数目为${that.item.num}张,确定打印吗`)
            }
            that.buffs = []
            for (var i = 0; i < that.item.num; i++) {
            var command = tsc.jpPrinter.createNew()
               //根据数目不同,打印不同数目
            command.setSize(48, 60)
            command.setGap(0)
            command.setCls()
            // command.setText(0, 30, "TSS24.BF2", 1, 1, "图片")
            // command.setQR(40, 120, "L", 5, "A", "www.smarnet.cc佳博智汇")
            // command.setText(60, 20, "TSS24.BF2", 1, 1, "单号:" + (that.item.orderNo || '-'))
               // 仓库:
            if (that.item.warehouseName)
               command.setText(10, 20, "TSS24.BF2", 1, 1, "仓库: " + that.item.warehouseName)
                  command.setText(20, 20, "TSS24.BF2", 1, 1, "" + that.item.warehouseName)
               // 库位:
            if (that.item.warehouseLocationCode)
               command.setText(200, 20, "TSS24.BF2", 1, 1, "库位: " + that.item.warehouseLocationCode)
                  command.setText(200, 20, "TSS24.BF2", 1, 1, "" + that.item.warehouseLocationCode)
            // command.setText(170, 50, "TSS24.BF2", 1, 1, "小程序测试")
            // command.setText(170, 90, "TSS24.BF2", 1, 1, "测试数字12345678")
            // command.setText(170, 120, "TSS24.BF2", 1, 1, "测试英文abcdefg")
            // command.setText(170, 150, "TSS24.BF2", 1, 1, "测试符号/*-+!@#$")
            command.setText(10, 60, "TSS24.BF2", 1, 1, "供应商: " + (that.item.supplierName || '-'))
            command.setText(10, 100, "TSS24.BF2", 1, 1, "商品名称: " + (that.item.flowerName || '-'))
            command.setText(10, 140, "TSS24.BF2", 1, 1, "等级: " + (that.item.flowerLevelStr || '-'))
            command.setText(200, 140, "TSS24.BF2", 1, 1, "颜色: " + (that.item.flowerColor || '-'))
               // 供应商:
               command.setText(20, 60, "TSS24.BF2", 1, 1, "" + (that.item.supplierName || '-'))
               // 商品名称:
               command.setText(20, 100, "TSS24.BF2", 1, 1, "" + (that.item.flowerName || '-'))
               command.setText(20)
               // 颜色:
               command.setText(200, 140, "TSS24.BF2", 1, 1, "" + (that.item.flowerColor || '-'))
            // command.setText(10, 220, "TSS24.BF2", 1, 1, "价格: ¥ " + (that.item.price || '-'))
            command.setText(10, 180, "TSS24.BF2", 1, 1, "规格: " + (that.item.flowerUnit || '-'))
            command.setText(200, 180, "TSS24.BF2", 1, 1, "数目: x " + (that.item.num || '0'))
               command.setText(20, 180, "TSS24.BF2", 1, 1, "规格: " + (that.item.flowerUnit || '-'))
               command.setText(200, 180, "TSS24.BF2", 1, 1, `数目: ${i+1}/${that.item.num}`)
            // command.setText(10, 300, "TSS24.BF2", 1, 1, "花满芫")
            command.setText(100, 220, "TSS24.BF2", 1, 1, that.$util.toDateMin(new Date()))
            if (that.item.params) {
@@ -513,11 +535,11 @@
                     continue
                  }
                  if (p.value) {
                     var lef = 10
                        var lef = 20
                     if (addnum % 2 == 1) {
                        lef = 190
                     } else {
                        lef = 10
                           lef = 20
                        hlen += 40
                     }
                     command.setText(lef, hlen, "TSS24.BF2", 1, 1, "" + (p.name || '') + ':' + p.value)
@@ -535,8 +557,12 @@
            command.setPagePrint()
               that.buffs.push(command.getData())
            }
            that.isLabelSend = true
            that.prepareSend(command.getData())
            // that.prepareSend(command.getData())
            that.prepareSend(that.buffs[0])
            // wx.canvasGetImageData({
            //   canvasId: 'edit_area_canvas',
@@ -610,7 +636,8 @@
                     wx.showToast({
                        title: '已打印第' + currentPrint + '张',
                     })
                     // if (currentPrint == printNum) {
                     if (currentPrint == buffs.length) {
                     that.looptime = 0
                     that.lastData = 0
                     that.currentTime = 1
@@ -627,6 +654,12 @@
                     } catch (e) {
                     }
                     } else {
                        currentPrint++
                        that.currentPrint = currentPrint
                        that.currentTime = 1
                        that.Send(that.buffs[that.currentPrint - 1])
                     }
                     // } else {
                     //    currentPrint++