From cfa6bd8e20efbc79e9dbe046949f2fa0cb0c59c9 Mon Sep 17 00:00:00 2001 From: wangfukang <15630117759@163.com> Date: Tue, 4 Jun 2024 16:51:09 +0800 Subject: [PATCH] =?UTF-8?q?=E6=AD=A3=E5=BC=8F=E7=89=88=EF=BC=8C=E6=B2=A1?= =?UTF-8?q?=E6=9C=89=E9=97=AE=E9=A2=98=E7=9A=84=E6=9C=80=E5=90=8E=E4=B8=80?= =?UTF-8?q?=E7=89=88=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/.DS_Store | Bin 10244 -> 10244 bytes pages/inventory/goodsList1.vue | 346 ++++++++++------------------ pages/inventory/inventoryDetail.vue | 2 +- 3 files changed, 118 insertions(+), 230 deletions(-) diff --git a/pages/.DS_Store b/pages/.DS_Store index 80e54b5a9067eeb0f87349bb5ba4f2f1214d7339..96d9923793ae36c52d50999dc04d4ccfb8a5f97e 100644 GIT binary patch delta 365 zcmZn(XbIS0D5$P5je&uIogs-KlOYEPGa2$2(sT1&T#|C~lYlZDT(dIb%h``jju4b* zhq5=<3Dz-c|5^c-a0Du1V@PJmXUGM@e1^Q-{1mumsG7~{!eNZeOvm?4ZV-`Tzr&mb zHgTbdv?`PhGK3XucM3x)Lq$P`VQ_MOZUIn~fq^+-^FtA9W~L7}Cd)}EvAgVm=q{8H zpByK_gTz;5G?=U_D!zH0gd?No$@^es5QB4o?n(z4kL)(6ip>&I<&4^HJlP;OK|E6g vbVCwDB0~v7DzXNsn$5eUiy1X1%E2|TG86-qCNiWkq#-MZs@NPRyN(M0*8OS5 delta 363 zcmZn(XbIS0D5x$~&%nUI&XB~A$&dqtnGAUh>ACqXE=f80NkAD6AZBpyJ32W+P@Wyi z-drbG$EeM~(6Iep_EATmAR9w6Lq0<;5au)F<>sd#X$Gs=tS%hJ$jtn8%H#$SDfSMl zV+jkc9i6;TL|PTf1{uN%wmXF(m7$^_!!S5GKeqs69|OyR%@0ManVC*)m@Fru#NPQP zxz+XI(aD7p;*;Yfc#!z2lXXNTHm{R#WYh$@O-is3>^4@Qr}7!nL58Eb45VVSgj6}m zD-4G7Ln^8Uu$s-gq>C9f|LvAJEO-TKelbvKB10NO8nSYzip^oN G>$m{Tc50pg diff --git a/pages/inventory/goodsList1.vue b/pages/inventory/goodsList1.vue index d08f572..2049b04 100644 --- a/pages/inventory/goodsList1.vue +++ b/pages/inventory/goodsList1.vue @@ -2457,7 +2457,8 @@ } } }, - showPrice() { + showPrice() { + let that = this; if (this.khName == '') { this.tui.toast('请选择客户!') return @@ -2496,7 +2497,19 @@ } else { this.tui.toast('请选择发货方式!') return - } + } + let printHeight = 800 + this.carList.forEach(function(value, key) { + printHeight += 30 + value.stockLogList.forEach(function(value1, key1) { + printHeight += 30 + }) + }) + this.printTotal = printHeight + that.bufferData = [] + let strCmd = this.getPrintData() + strCmd += blesdk.addCPCLPrint(); + that.bufferData.push(strCmd); this.$refs.showPopup.open() }, //点击底部开单按钮 @@ -2592,235 +2605,110 @@ // }); // }, //打印小票 - onPrint(opt) { - let that = this; - this.goSell('print') - let strCmd = '' - that.yNum = 150 - strCmd = blesdk.CreatCPCLPage(600, 1040, 1, 0); - strCmd += blesdk.addCPCLSETMAG(2, 2) - blesdk.addCPCLSETBOLD('bold') - strCmd += blesdk.addCPCLLocation(2); - strCmd += blesdk.addCPCLText('0', '30', '24', '0', 0, uni.getStorageSync('shopName')) - - strCmd += blesdk.addCPCLSETMAG(1, 1) - strCmd += blesdk.addCPCLLocation(0); - strCmd += blesdk.addCPCLText('0', '100', '24', '0', 0, '客户:' + this.khName.name) - // strCmd += blesdk.addCPCLText('280', '100', '24', '0', 0, this.sales.id) - strCmd += blesdk.addCPCLText('0', '130', '24', '0', 0, '销售:' + this.createByName) - strCmd += blesdk.addCPCLText('280', '130', '24', '0', 0, '日期:' + this.formatDate(new Date(), - 'YYYY-MM-DD')) //+ - strCmd += blesdk.addCPCLText('0', '150', '24', '0', 0, - '=========================================================') - - this.carList.forEach(function(value, key) { - if (that.countPrint() < that.printTotal) { - strCmd += blesdk.addCPCLText('0', that.yNum, '24', '0', 0, value.productName + '(' + - value.productSn + ')') - } else { - that.yNum = 0 - strCmd += blesdk.addCPCLPrint(); - that.bufferData.push(strCmd); - strCmd = blesdk.CreatCPCLPage(600, 1040, 1, 0); - strCmd += blesdk.addCPCLLocation(0); - strCmd += blesdk.addCPCLText('0', that.countPrint(), '24', '0', 0, value.productName + - '(' + - value.productSn + ')') - - } - value.stockLogList.forEach(function(value1, key1) { - if (that.countPrint() < that.printTotal) { - strCmd += blesdk.addCPCLText('0', that.yNum, '24', '0', 0, '□ ' + (that - .slicePrint( - key1)) + '*' + value1.productCount) - strCmd += blesdk.addCPCLText('240', that.yNum, '24', '0', 0, '单价:' + value - .discountAmount) - strCmd += blesdk.addCPCLText('400', that.yNum, '24', '0', 0, '总价:' + (value - .discountAmount * value1.productCount)) - } else { - that.yNum = 0 - strCmd += blesdk.addCPCLPrint(); - that.bufferData.push(strCmd); - strCmd = '' - strCmd = blesdk.CreatCPCLPage(600, 1040, 1, 0); - strCmd += blesdk.addCPCLLocation(0); - strCmd += blesdk.addCPCLText('0', (that.yNum += 30), '24', '0', 0, '□ ' + (that - .slicePrint(key1)) + '*' + value1.productCount) - strCmd += blesdk.addCPCLText('240', that.yNum, '24', '0', 0, '单价:' + value - .discountAmount) - strCmd += blesdk.addCPCLText('400', that.yNum, '24', '0', 0, '总价:' + (value - .discountAmount * value1.productCount)) - } - }) + async onPrint(opt) { + let that = this; + await this.goSell('print') + + this.$nextTick(() => { + uni.hideLoading(); + that.$refs.showPopup.close() + that.bufferData = [] + that.clearAll1() + uni.switchTab({ + url: '/pages/index/index' + }); }) - if (that.countPrint() < that.printTotal) { - strCmd += blesdk.addCPCLText('0', this.countPrint(), '24', '0', 0, - '===============================================================') - } else { - this.yNum = 0 - strCmd += blesdk.addCPCLPrint(); - this.bufferData.push(strCmd); - strCmd = '' - strCmd = blesdk.CreatCPCLPage(600, 1040, 1, 0); - strCmd += blesdk.addCPCLLocation(0); - strCmd += blesdk.addCPCLText('0', this.countPrint(), '24', '0', 0, - '===============================================================') - - } - if (that.countPrint() < that.printTotal) { - strCmd += blesdk.addCPCLText('0', this.countPrint(), '24', '0', 0, '总数量:' + this.totalAmount) - strCmd += blesdk.addCPCLText('200', this.yNum, '24', '0', 0, '总金额:' + this.shouldPay) - strCmd += blesdk.addCPCLText('400', this.yNum, '24', '0', 0, '应收:' + this.relPrice) - } else { - this.yNum = 0 - strCmd += blesdk.addCPCLPrint(); - this.bufferData.push(strCmd); - strCmd = '' - strCmd = blesdk.CreatCPCLPage(600, 1040, 1, 0); - strCmd += blesdk.addCPCLLocation(0); - strCmd += blesdk.addCPCLText('0', (this.yNum += 30), '24', '0', 0, '总数量:' + this.totalAmount) - strCmd += blesdk.addCPCLText('200', this.yNum, '24', '0', 0, '总金额:' + this.shouldPay) - strCmd += blesdk.addCPCLText('400', this.yNum, '24', '0', 0, '应收:' + this.relPrice) - - } - if (that.countPrint() < that.printTotal) { - strCmd += blesdk.addCPCLText('0', this.countPrint(), '24', '0', 0, '实收:' + this.priceOk) - strCmd += blesdk.addCPCLText('200', this.yNum, '24', '0', 0, '欠款:' + (this.relPrice - this.priceOk) - .toFixed(2)) - strCmd += blesdk.addCPCLText('400', this.yNum, '24', '0', 0, '其他费用:' + (this.otherExpense == '' ? 0 : - this.otherExpense)) - } else { - this.yNum = 0 - strCmd += blesdk.addCPCLPrint(); - this.bufferData.push(strCmd); - strCmd = '' - strCmd = blesdk.CreatCPCLPage(600, 1040, 1, 0); - strCmd += blesdk.addCPCLLocation(0); - strCmd += blesdk.addCPCLText('0', (this.yNum += 30), '24', '0', 0, '实收:' + this.priceOk) - strCmd += blesdk.addCPCLText('200', this.yNum, '24', '0', 0, '欠款:' + (this.relPrice - this.priceOk) - .toFixed(2)) - strCmd += blesdk.addCPCLText('400', this.yNum, '24', '0', 0, '其他费用:' + (this.otherExpense == '' ? 0 : - this.otherExpense)) - - } - if (Math.ceil(Number(this.remark.length) / 20) * 30 + this.yNum < that.printTotal) { - if (this.remark.length > 20) { - let position = 20; - let part1 = this.remark.substring(0, position); - let part2 = this.remark.substring(position); - strCmd += blesdk.addCPCLText('0', this.countPrint(), '24', '0', 0, '备注:' + part1) - strCmd += blesdk.addCPCLText('0', this.countPrint(), '24', '0', 0, part2) - } else { - strCmd += blesdk.addCPCLText('0', this.countPrint(), '24', '0', 0, '备注:' + this.remark) - } - - } else { - this.yNum = 0 - strCmd += blesdk.addCPCLLocation(0); - strCmd += blesdk.addCPCLPrint(); - this.bufferData.push(strCmd); - strCmd = '' - if (this.remark.length > 20) { - let position = 20; - let part1 = this.remark.substring(0, position); - let part2 = this.remark.substring(position); - strCmd = blesdk.CreatCPCLPage(600, 1040, 1, 0); - strCmd += blesdk.addCPCLLocation(0); - strCmd += blesdk.addCPCLText('0', this.countPrint(), '24', '0', 0, '备注:' + part1) - strCmd += blesdk.addCPCLText('0', this.countPrint(), '24', '0', 0, part2) - } else { - strCmd = blesdk.CreatCPCLPage(600, 1040, 1, 0); - strCmd += blesdk.addCPCLLocation(0); - strCmd += blesdk.addCPCLText('0', this.countPrint(), '24', '0', 0, '备注:' + this.remark) - } - } - if (that.countPrint() < that.printTotal) { - strCmd += blesdk.addCPCLText('0', this.countPrint(), '24', '0', 0, - '===============================================================') - } else { - this.yNum = 0 - strCmd += blesdk.addCPCLPrint(); - this.bufferData.push(strCmd); - strCmd = '' - strCmd = blesdk.CreatCPCLPage(600, 1040, 1, 0); - strCmd += blesdk.addCPCLLocation(0); - strCmd += blesdk.addCPCLText('0', this.countPrint(), '24', '0', 0, - '===============================================================') - - } - //店铺地址 - if (that.countPrint() < that.printTotal) { - strCmd += blesdk.addCPCLText('0', this.countPrint(), '24', '0', 0, '店铺地址:' + uni.getStorageSync( - 'shopAddress')) - } else { - this.yNum = 0 - strCmd += blesdk.addCPCLPrint(); - this.bufferData.push(strCmd); - strCmd = '' - strCmd = blesdk.CreatCPCLPage(600, 1040, 1, 0); - strCmd += blesdk.addCPCLLocation(0); - strCmd += blesdk.addCPCLText('0', (that.yNum += 30), '24', '0', 0, '店铺地址:' + uni.getStorageSync( - 'shopAddress')) - } - //店铺电话 - if (that.countPrint() < that.printTotal) { - strCmd += blesdk.addCPCLText('0', that.countPrint(), '24', '0', 0, '店铺电话:' + uni.getStorageSync( - 'username')) - } else { - that.yNum = 0 - strCmd += blesdk.addCPCLPrint(); - that.bufferData.push(strCmd); - strCmd = '' - strCmd = blesdk.CreatCPCLPage(600, 1040, 1, 0); - strCmd += blesdk.addCPCLLocation(0); - strCmd += blesdk.addCPCLText('0', (that.yNum += 30), '24', '0', 0, '店铺电话:' + uni.getStorageSync( - 'username')) + }, + getPrintData(){ + let that = this; + let strCmd = '' + that.yNum = 300 + strCmd = blesdk.CreatCPCLPage(1000, this.printTotal, 1, 0); + strCmd += blesdk.addCPCLSETMAG(2, 2) + blesdk.addCPCLSETBOLD('bold') + strCmd += blesdk.addCPCLLocation(2); + strCmd += blesdk.addCPCLText('0', '30', '24', '0', 0, '') + strCmd += blesdk.addCPCLSETMAG(2, 2) + blesdk.addCPCLSETBOLD('bold') + strCmd += blesdk.addCPCLLocation(2); + strCmd += blesdk.addCPCLText('0', '110', '24', '0', 0, uni.getStorageSync('shopName')) + + strCmd += blesdk.addCPCLSETMAG(1, 1) + strCmd += blesdk.addCPCLLocation(0); + blesdk.addCPCLSETBOLD('bold') + strCmd += blesdk.addCPCLText('0', '190', '24', '0', 0, '客户:' + that.khName.name) + strCmd += blesdk.addCPCLSETMAG(1, 1) + strCmd += blesdk.addCPCLLocation(0); + strCmd += blesdk.addCPCLText('0', '240', '24', '0', 0, '销售员:' + that.createByName) + strCmd += blesdk.addCPCLText('500', '240', '24', '0', 0, '日期:' + that.formatDate(new Date(), + 'YYYY-MM-DD')) //+ + strCmd += blesdk.addCPCLText('0', '300', '24', '0', 0, + '=====================================================================================') + + that.carList.forEach(function(value, key) { + strCmd += blesdk.addCPCLText('0', that.yNum += 30, '24', '0', 0, value.productName + '(' + + value.productSn + ')') + value.stockLogList.forEach(function(value1, key1) { + strCmd += blesdk.addCPCLText('0', that.yNum += 30, '24', '0', 0, '□ ' + (that + .slicePrint(key1))) + strCmd += blesdk.addCPCLText('220', that.yNum, '24', '0', 0, '数量:'+ value1.productCount) + strCmd += blesdk.addCPCLText('400', that.yNum, '24', '0', 0, '单价:' + value + .discountAmount) + strCmd += blesdk.addCPCLText('650', that.yNum, '24', '0', 0, '总价:' + (value + .discountAmount * value1.productCount)) + }) + }) + strCmd += blesdk.addCPCLText('0', that.countPrint(), '24', '0', 0, + '==========================================================================================') + strCmd += blesdk.addCPCLText('0', that.countPrint(), '24', '0', 0, '总数量:' + that.totalAmount) + strCmd += blesdk.addCPCLText('300', that.yNum, '24', '0', 0, '总金额:' + that.shouldPay) + strCmd += blesdk.addCPCLText('630', that.yNum, '24', '0', 0, '应收:' + that.relPrice) + strCmd += blesdk.addCPCLText('0', that.countPrint(), '24', '0', 0, '实收:' + that.priceOk) + strCmd += blesdk.addCPCLText('300', that.yNum, '24', '0', 0, '欠款:' + (that.relPrice - that.priceOk) + .toFixed(2)) + strCmd += blesdk.addCPCLText('630', that.yNum, '24', '0', 0, '其他费用:' + (that.otherExpense == '' ? 0 : + that.otherExpense)) + if(that.remark != ''){ + if (that.remark.length > 20) { + let position = 20; + let part1 = that.remark.substring(0, position); + let part2 = that.remark.substring(position); + strCmd += blesdk.addCPCLText('0', that.countPrint(), '24', '0', 0, '备注:' + part1) + strCmd += blesdk.addCPCLText('0', that.countPrint(), '24', '0', 0, part2) + } else { + strCmd += blesdk.addCPCLText('0', that.countPrint(), '24', '0', 0, '备注:' + that.remark) + } + } - if(this.qrArr.length != 0){ + + strCmd += blesdk.addCPCLText('0', that.countPrint(), '24', '0', 0, + '=========================================================================================') + //店铺地址 + + strCmd += blesdk.addCPCLSETMAG(1, 1) + strCmd += blesdk.addCPCLText('0', (that.yNum += 30), '24', '0', 0, '店铺地址:' + uni.getStorageSync( + 'shopAddress')) + + //店铺电话 + + strCmd += blesdk.addCPCLSETMAG(1, 1) + strCmd += blesdk.addCPCLText('0', that.countPrint(), '24', '0', 0, '店铺电话:' + uni.getStorageSync( + 'username')) + + if(that.qrArr.length != 0){ //店铺微信/微信收款/支付宝收款/收款码收款(店铺,微信,支付,收款) - for (let i = 0; i < this.qrArr.length; i++) { + for (let i = 0; i < that.qrArr.length; i++) { + //店铺二维码 - console.log(that.qrArr[i]) - console.log(that.yNum) - console.log(that.countWidth(i,600/that.qrArr.length)) - if ((that.yNum + 200) < that.printTotal) { - console.log('11111') - strCmd += blesdk.addCPCLQRCode(that.countWidth(i,600/that.qrArr.length), (that.yNum + 50), that.qrArr[i].level, '2', 3, that.qrArr[i].path) //二维码 - strCmd += blesdk.addCPCLText(that.countWidth(i,600/that.qrArr.length), (that.yNum + 180), '24', '0', 0, that.qrArr[i].name) - strCmd += blesdk.addCPCLLocation(0); - if(this.qrArr.length == (i+1)){ - strCmd += blesdk.addCPCLPrint(); - that.bufferData.push(strCmd); - } - } else { - console.log('2222') - // that.yNum = 0 - strCmd += blesdk.addCPCLPrint(); - that.bufferData.push(strCmd); - strCmd = '' - strCmd = blesdk.CreatCPCLPage(600, 1040, 1, 0); - strCmd += blesdk.addCPCLLocation(0); - strCmd += blesdk.addCPCLQRCode(that.countWidth(i,600/that.qrArr.length) , 30, that.qrArr[i].level, '2', 3, that.qrArr[i].path) //二维码 - strCmd += blesdk.addCPCLText(that.countWidth(i,600/that.qrArr.length), 180, '24', '0', 0, that.qrArr[i].name) - strCmd += blesdk.addCPCLPrint(); - that.bufferData.push(strCmd); - } + console.log('11111') + strCmd += blesdk.addCPCLQRCode(that.countWidth(i,1000/that.qrArr.length), (that.yNum + 80), that.qrArr[i].level, '2', 4, that.qrArr[i].path) //二维码 + strCmd += blesdk.addCPCLSETMAG(1, 1) + strCmd += blesdk.addCPCLText(that.countWidth(i,1000/that.qrArr.length), (that.yNum + 240), '24', '0', 0, that.qrArr[i].name) + strCmd += blesdk.addCPCLLocation(0); + } - }else{ - strCmd += blesdk.addCPCLPrint(); - that.bufferData.push(strCmd); } - - uni.hideLoading(); - this.$nextTick(() => { - console.log('bufferData',that.bufferData) - that.$refs.showPopup.close() - that.bufferData = [] - that.clearAll1() - uni.switchTab({ - url: '/pages/index/index' - }); - }) + return strCmd; }, countWidth(num,len){ // if(num == 0){ @@ -2831,11 +2719,11 @@ }, //计算打印机当前行高度 countPrint() { - if ((this.yNum + 50) >= 1040) { - return this.yNum += 50 - } else { + // if ((this.yNum + 50) >= 1040) { + // return this.yNum += 50 + // } else { return this.yNum += 30 - } + // } }, //截取 slicePrint(val) { diff --git a/pages/inventory/inventoryDetail.vue b/pages/inventory/inventoryDetail.vue index 706cdd7..397a636 100644 --- a/pages/inventory/inventoryDetail.vue +++ b/pages/inventory/inventoryDetail.vue @@ -157,7 +157,7 @@ @confirm="changePrice"> - +