From efa9bfe98ba906e4c9b8f49c89f5da162a46bb0f Mon Sep 17 00:00:00 2001 From: 陶杰 <1378534974@qq.com> Date: 星期一, 13 一月 2025 10:21:24 +0800 Subject: [PATCH] 1.微信一键登录:新增“同意用户协议”之后才可登录 --- sub_pages/supplier/print/print-list.vue | 178 +++++++++++++++++++++++++++++++++++----------------------- 1 files changed, 107 insertions(+), 71 deletions(-) diff --git a/sub_pages/supplier/print/print-list.vue b/sub_pages/supplier/print/print-list.vue index c35c8dd..fbb4ddb 100644 --- a/sub_pages/supplier/print/print-list.vue +++ b/sub_pages/supplier/print/print-list.vue @@ -69,7 +69,8 @@ </view> <view class="print-container m-t-12"> - <button class="btn" type="primary" @click="startSearch" :loading="isScanning"> 开始搜索 </button> + <button class="btn" type="primary" @click="startSearch" :loading="isScanning"> + 开始搜索({{buffs&&buffs.length || 0}}个) </button> <button class="btn m-t-12" type="default" @click="breakPrint=true"> 中断打印 </button> <view v-for="(device,index) of list" :key="device.deviceId" @click="bindViewTap(device)"> <view class="item"> @@ -106,11 +107,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,65 +129,87 @@ * 生命周期函数--监听页面初次渲染完成 */ 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() { + async onLoad(options) { var t = this.$storage.getItem('cache_delivery_order_print') || '' if (t) { this.items = JSON.parse(t) - var apitype = '' + var requrl = '' // #ifdef PUB_SUPPLIER - apitype = '/supplier' - // #endif - // #ifdef PUB_PARTNER // apitype = '/supplier' + if (options.source == 'detail') { + requrl = `/api/supplier/delivery/list/items/views` + + } else { + requrl = `/api/supplier/delivery/list/items/views/new` + + } + // #endif + // #ifndef PUB_SUPPLIER + requrl = `/api/delivery/list/items/views` // #endif //获取详情接口 var ids = [] for (var item of this.items) { - ids.push(item.id) + if (item.id) + ids.push(item.id) } - this.$message.showLoading() - // const { - // code, - // data - // } = await this.$http.request('get', `/api${apitype}/delivery/list/items/view`, { - // params: { - // id: this.item.id, - // ids: ids - // } - // }) - const { - code, - data - } = await this.$http.request('post', `/api${apitype}/delivery/list/items/views`, { - data: { - // id: this.item.id, - ids: ids + if (ids.length > 0) { + + + this.$message.showLoading() + // const { + // code, + // data + // } = await this.$http.request('get', `/api${apitype}/delivery/list/items/view`, { + // params: { + // id: this.item.id, + // ids: ids + // } + // }) + const { + code, + data + } = await this.$http.request('post', requrl, { + data: { + // id: this.item.id, + ids: ids + } + }) + this.$message.hideLoading() + if (code == 0 && data && data.length > 0) { + // this.item = { + // ...this.item, + // ...data + // } + var tarr = [] + for (var t of data) { + if (t) { + tarr.push(t) + } + } + if (tarr.length > 0) + this.items = tarr || [] + console.log('items len:', this.items.length) } - }) - this.$message.hideLoading() - if (code == 0 && data) { - // this.item = { - // ...this.item, - // ...data - // } - this.items = data || [] - console.log('items len:', this.items.length) } } else { this.$message.showToast('获取详情失败') @@ -559,8 +582,8 @@ } } command.setText(30, 40, "TSS24.BF2", 1, 1, "" + (each.supplierName || '-')) - command.setText(200, 40, "TSS24.BF2", 1, 1, "" + (each.warehouseName || '待分配')) - var flowerCategory = each.flowerCategory + command.setText(200, 40, "TSS24.BF2", 2, 1, "" + (each.warehouseName || '待分配')) + var flowerCategory = each.flowerCategory || '' if (flowerCategory) { //只取二级分类 var tarr = flowerCategory.split("/") @@ -568,23 +591,28 @@ flowerCategory = tarr[tarr.length - 1] } } + command.setText(30, 80, "TSS24.BF2", 1, 1, "" + (flowerCategory || '')) - command.setText(200, 80, "TSS24.BF2", 1, 1, "库位:" + (each.warehouseLocationCode || '')) + // 盲写库位大小 + // command.setText(200, 80, "TSS24.BF2", 1, 1, "库位:" + (each.warehouseLocationCode || '')) + command.setText(200, 80+10, "TSS24.BF2", 1, 1, "库位:" ) + command.setText(270, 80, "TSS24.BF2", 2, 2, (each.warehouseLocationCode || '')) - command.setText(30, 120, "TSS24.BF2", 1, 1, "等级:" + (each.flowerLevelStr || '')) - command.setText(200, 120, "TSS24.BF2", 1, 1, "" + (each.flowerColor || '')) + // command.setText(30, 120, "TSS24.BF2", 1, 1, "等级:" + (each.flowerLevelStr || '')) + command.setText(30, 120, "TSS24.BF2", 2, 2, ""+ (each.flowerLevelStr || '')) + command.setText(200, 120+10, "TSS24.BF2", 1, 1, "" + (each.flowerColor || '')) // 规格: - command.setText(30, 160, "TSS24.BF2", 1, 1, "" + (each.flowerUnit || '-')) + command.setText(30, 160+20, "TSS24.BF2", 1, 1, "" + (each.flowerUnit || '-')) // 成熟度: - command.setText(200, 160, "TSS24.BF2", 1, 1, "" + (paramsmap['成熟度'] || '-')) + command.setText(200, 160+20, "TSS24.BF2", 1, 1, "" + (paramsmap['成熟度'] || '-')) // 枝长: - command.setText(30, 200, "TSS24.BF2", 1, 1, "" + (paramsmap['枝长'] || '-')) - command.setText(200, 200, "TSS24.BF2", 1, 1, that.$util.toDate(new Date())) + command.setText(30, 200+20, "TSS24.BF2", 1, 1, "" + (paramsmap['枝长'] || '-')) + command.setText(200, 200+20, "TSS24.BF2", 1, 1, that.$util.toDate(new Date())) - command.setText(60, 230, "TSS24.BF2", 1, 1, "————————————") + command.setText(60, 230+20, "TSS24.BF2", 1, 1, "————————————") - command.setText(30, 260, "TSS24.BF2", 1, 1, "花满芫") - command.setText(200, 260, "TSS24.BF2", 1, 1, `数目: ${i+1}/${each.num||1}`) + command.setText(30, 260+20, "TSS24.BF2", 1, 1, "花满芫") + command.setText(200, 260+20, "TSS24.BF2", 1, 1, `数目: ${i+1}/${each.num||1}`) // command.setText(20, 40, "TSS24.BF2", 1, 1, "" + (that.item.warehouseName || '待分配')) // // 库位: @@ -679,8 +707,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) { @@ -696,7 +724,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, @@ -745,10 +774,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]) + + + }, 800) + } // } else { -- Gitblit v1.9.3