From 183f3da1f4bbbe9ecb86cee0454a55d21a22327f Mon Sep 17 00:00:00 2001 From: wangfukang <15630117759@163.com> Date: Fri, 15 Mar 2024 15:26:36 +0800 Subject: [PATCH] 11 --- .../index/customAndSupplierProductDetail.vue | 2 +- pages/index/dataStatistics.vue | 49 +++- pages/index/index.vue | 4 +- pages/index/orderDetail.vue | 197 +++++++++++---- pages/index/peopleList.vue | 46 ++-- pages/inventory/addinventory.vue | 56 +++- pages/inventory/batchPrint.vue | 104 +++----- pages/inventory/goodsList1.vue | 239 +++++++++++++----- pages/inventory/inventory.vue | 2 +- 9 files changed, 469 insertions(+), 230 deletions(-) diff --git a/pages/index/customAndSupplierProductDetail.vue b/pages/index/customAndSupplierProductDetail.vue index 6982567..846dced 100644 --- a/pages/index/customAndSupplierProductDetail.vue +++ b/pages/index/customAndSupplierProductDetail.vue @@ -6,7 +6,7 @@ {{data.createTime}} - 采购价:{{data.customerBuyProductDetailLogVos[0].realPrice}} + 实际售价:{{data.customerBuyProductDetailLogVos[0].realPrice}} diff --git a/pages/index/dataStatistics.vue b/pages/index/dataStatistics.vue index fec37c0..08a016a 100644 --- a/pages/index/dataStatistics.vue +++ b/pages/index/dataStatistics.vue @@ -1,16 +1,15 @@ diff --git a/pages/inventory/goodsList1.vue b/pages/inventory/goodsList1.vue index 4baafd4..aaaa2c7 100644 --- a/pages/inventory/goodsList1.vue +++ b/pages/inventory/goodsList1.vue @@ -331,13 +331,16 @@ - + 上次拿货时间: {{historyList.createTime}} 上次拿货数:{{historyList.productCount}} 上次拿货价:{{historyList.discountAmount}} - + + 暂无拿货历史 + + 一键使用历史价格 @@ -386,7 +389,7 @@ keyList: [], temporaryList: [], zNum: 0, - bufferData: '', + bufferData: [], zPrice: 0, priceOk: '', //已收金额 value: 0, @@ -472,6 +475,7 @@ productId:'', productNum:0, historyList:{}, + printTotal:1040, afterPrice:0 //第二次选择商品的时候,先计算这个价格,实收金额= 已经存在的实收金额 + afterPrice } }, @@ -727,8 +731,8 @@ this.noPay = this.relPrice - this.priceOk; }, changePrice(e) { - this.priceOk = e.target.value - this.noPay = this.relPrice - e.target.value; + this.priceOk = e.target.value >this.relPrice ?this.relPrice :e.target.value + this.noPay = this.relPrice - this.priceOk; }, getImg(key) { return this.carList.get(key).productPicture @@ -762,25 +766,53 @@ scanCodeAdd() { uni.setStorageSync('saoma','1') uni.scanCode({ - // scanType: ['barCode'], - onlyFromCamera: true, success: (res) => { - // this.productId = res.result - // this.toggle('bottom', res.result); - let shopId = res.result.split(',')[1] - if(shopId == uni.getStorageSync('shopId')){ - this.productId = res.result.split(',')[0] - this.toggle('bottom', res.result.split(',')[0]); + if(res.scanType == "QR_CODE"){ //二维码 + + let shopId = res.result.split(',')[1] + if(shopId == uni.getStorageSync('shopId')){ + this.productId = res.result.split(',')[0] + this.toggle('bottom', res.result.split(',')[0]); + if (item.saleDetailDTOList) { + for (let i = 0; i < item.saleDetailDTOList.length; i++) { + this.carList.push(item.saleDetailDTOList[i]) + } + } + }else{ + this.tui.toast('您的店铺中暂无该商品!') + } }else{ - this.tui.toast('您的店铺中暂无该商品!') - } - }, - fail: (res) => { - uni.showToast({ - title: '扫描失败', - icon: 'none' - }) - } + this.productId = res.result + this.tui.request("/app/product/getByBarcode", "POST", { + barcode:res.result + }, false, true).then((res1) => { + if (res1.code == 200) { + if(res1.result == ''){ + this.tui.toast('您的店铺中暂无该商品!') + }else{ + this.toggle('bottom', res1.result[0].id); + if (item.saleDetailDTOList) { + for (let i = 0; i < item.saleDetailDTOList.length; i++) { + this.carList.push(item.saleDetailDTOList[i]) + } + } + } + + } else { + this.tui.toast(res.message) + } + }).catch((res) => { + this.tui.toast(res) + }) + } + + }, + fail: (res) => { + uni.showToast({ + title: '扫描失败', + icon: 'none' + }) + } }) }, //弹出商品规格选择 @@ -1228,14 +1260,8 @@ //打印小票 onPrint(opt) { let that = this; - that.yNum = 150 - let heightNum = 300 - heightNum += this.carList.size * 40 - this.carList.forEach(function(value, key) { - heightNum += value.stockLogList.size * 30 - - }) - let strCmd = blesdk.CreatCPCLPage(600, heightNum, 1, 0); + that.yNum = 150 + let strCmd = blesdk.CreatCPCLPage(600, 1040, 1, 0); strCmd += blesdk.addCPCLSETMAG(2, 2) blesdk.addCPCLSETBOLD('bold') strCmd += blesdk.addCPCLLocation(2); @@ -1250,38 +1276,127 @@ strCmd += blesdk.addCPCLText('0', '150', '24', '0', 0, '=========================================================') - this.carList.forEach(function(value, key) { - strCmd += blesdk.addCPCLText('0', that.countPrint(), '24', '0', 0, value.productName + '(' + - value.productSn + ')') - value.stockLogList.forEach(function(value1, key1) { - strCmd += blesdk.addCPCLText('0', that.countPrint(), '24', '0', 0, (that.slicePrint( - key1)) + '*' + value1) - strCmd += blesdk.addCPCLText('280', that.yNum, '24', '0', 0, '单价:' + value.discountAmount) - strCmd += blesdk.addCPCLText('440', that.yNum, '24', '0', 0, '总价:' + (value - .discountAmount * value1)) + 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) + strCmd += blesdk.addCPCLText('280', that.yNum, '24', '0', 0, '单价:' + value.discountAmount) + strCmd += blesdk.addCPCLText('440', that.yNum, '24', '0', 0, '总价:' + (value + .discountAmount * value1)) + }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) + strCmd += blesdk.addCPCLText('280', that.yNum, '24', '0', 0, '单价:' + value.discountAmount) + strCmd += blesdk.addCPCLText('440', that.yNum, '24', '0', 0, '总价:' + (value + .discountAmount * value1)) + } }) - }) - strCmd += blesdk.addCPCLText('0', this.countPrint(), '24', '0', 0, - '===============================================================') - 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) - strCmd += blesdk.addCPCLText('0', this.countPrint(), '24', '0', 0, '实收:' + this.priceOk) - strCmd += blesdk.addCPCLText('200', this.yNum, '24', '0', 0, '欠款:' + (this.relPrice - this.priceOk)) - strCmd += blesdk.addCPCLText('400', this.yNum, '24', '0', 0, '其他费用:' + (this.otherExpense == '' ? 0 : this.otherExpense)) - 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) + }) + if(that.countPrint() < this.printTotal){ + strCmd += blesdk.addCPCLText('0', this.countPrint(), '24', '0', 0, + '===============================================================') }else{ - strCmd += blesdk.addCPCLText('0', this.countPrint(), '24', '0', 0, '备注:' + this.remark) - } - strCmd += blesdk.addCPCLLocation(0); - strCmd += blesdk.addCPCLPrint(); + 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() < this.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() < this.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)) + 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)) + 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 < this.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) + } + strCmd += blesdk.addCPCLLocation(0); + strCmd += blesdk.addCPCLPrint(); + this.bufferData.push(strCmd); + }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) + } + strCmd += blesdk.addCPCLLocation(0); + strCmd += blesdk.addCPCLPrint(); + + this.bufferData.push(strCmd); + } + - this.bufferData = strCmd; this.$nextTick(()=>{ uni.redirectTo({ url: "/pages/index/order" @@ -1290,10 +1405,8 @@ }, //计算打印机当前行高度 countPrint(){ - if((this.yNum + 30) >= (1040 * this.multiple)){ - this.yNum = this.yNum + (1040 * this.multiple - this.yNum) + 50 - this.multiple ++ - return this.yNum + if((this.yNum + 50) >= 1040){ + return this.yNum +=50 }else{ return this.yNum += 30 } diff --git a/pages/inventory/inventory.vue b/pages/inventory/inventory.vue index dc39dc8..d56deb3 100644 --- a/pages/inventory/inventory.vue +++ b/pages/inventory/inventory.vue @@ -435,7 +435,7 @@ .uni-mt-10 { position: relative; - width: 74% !important; + width: 100% !important; float: left !important; }