From f19ce5b2f707011b28d684bca25f925e31c70fdb Mon Sep 17 00:00:00 2001 From: wangfukang <15630117759@163.com> Date: Wed, 29 Nov 2023 19:48:40 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BC=80=E5=8D=95=E5=85=A5=E5=BA=93=E9=80=BB?= =?UTF-8?q?=E8=BE=91=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/index/addHangOrder.vue | 14 +- pages/index/index.vue | 9 +- pages/index/shareStyle.vue | 3 +- pages/inventory/addGoods.vue | 2 +- pages/inventory/addinventory.vue | 113 +++++++++------- pages/inventory/goodsList1.vue | 215 ++++++++++++++++++------------ pages/staff/addStaff/addStaff.vue | 2 +- 7 files changed, 211 insertions(+), 147 deletions(-) diff --git a/pages/index/addHangOrder.vue b/pages/index/addHangOrder.vue index fcd7e8c..fe9ab01 100644 --- a/pages/index/addHangOrder.vue +++ b/pages/index/addHangOrder.vue @@ -81,7 +81,7 @@ - + {{goodsDetail.productName}} @@ -618,16 +618,21 @@ }, //带参数跳转到开单页 goSaleGoods(item) { + console.log(item) if(item){ let dataList = [] for (let i = 0; i < item.saleDetailDTOList.length; i++) { - let obj = {} obj.saleDetailQueryDTO = item.saleDetailDTOList[i].stockLogList1 + obj.num = 0 + // for(let m = 0; m < obj.saleDetailQueryDTO.length; m++){ + // obj.num += obj.saleDetailQueryDTO[m].productCount + // } obj.id = item.saleDetailDTOList[i].productId + obj.price = 0 obj.lsprice = item.saleDetailDTOList[i].price - obj.num = item.saleDetailDTOList[i].productCount - obj.price = item.saleDetailDTOList[i].discountAmount + obj.zPrice = item.saleDetailDTOList[i].discountAmount + obj.unitPrice = item.saleDetailDTOList[i].realPrice / item.saleDetailDTOList[i].num obj.productName = item.saleDetailDTOList[i].productName obj.productPicture = item.saleDetailDTOList[i].productPicture+'?time='+new Date().getTime() obj.productSn = item.saleDetailDTOList[i].productSn @@ -638,6 +643,7 @@ obj.createByName = item.createByName dataList.push(obj) } + console.log(dataList) uni.setStorageSync('carList1', JSON.stringify(dataList)) uni.setStorageSync('khName', '') } diff --git a/pages/index/index.vue b/pages/index/index.vue index 416bc02..54c441f 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -3,10 +3,6 @@ - 待退货 @@ -81,7 +77,10 @@
  • - {{ item.createByName == null ?'暂无':item.createByName}} - {{ item.createTime }} + {{ item.createByName == null ?'暂无':item.createByName}} - {{ item.createTime }} + + 订单状态:{{item.status == 0 ?'待抢单' :item.status == 1 ?'待取货' :item.status == 3 ?'待送达' :item.status == 4 ?'已完成' :item.status == 5 ?'下游客户待退货' :item.status == 00 ?'退货待抢单' :item.status == 01 ?'退货待取货' :item.status == 03 ?'退货待送达' :item.status == 04 ?'待确认退货' :item.status == 6 ?'待配货' :'挂单'}} +
  • diff --git a/pages/index/shareStyle.vue b/pages/index/shareStyle.vue index 312b5bb..c1cbf4f 100644 --- a/pages/index/shareStyle.vue +++ b/pages/index/shareStyle.vue @@ -72,8 +72,7 @@ - + {{item.productName}} diff --git a/pages/inventory/addGoods.vue b/pages/inventory/addGoods.vue index 15d52e2..6cfa827 100644 --- a/pages/inventory/addGoods.vue +++ b/pages/inventory/addGoods.vue @@ -29,7 +29,7 @@ - + diff --git a/pages/inventory/addinventory.vue b/pages/inventory/addinventory.vue index acd6268..31e8be3 100644 --- a/pages/inventory/addinventory.vue +++ b/pages/inventory/addinventory.vue @@ -32,14 +32,14 @@ - 品名:{{value[1].productName}} - 货号:{{value[1].productSn}} - 总价:{{value[1].price}} 数量:{{value[1].productCount}} + 品名:{{value[1].productName}} ({{value[1].productSn}}) + 单价:{{value[1].purchasePrice || 0}} 数量:{{value[1].productCount}} + 总价:{{value[1].price}} - + @@ -64,13 +64,13 @@ 应付金额 - + 已付金额 - + @@ -183,11 +183,11 @@ khName: [], carList: new Map(), remark: '', - otherPay: 0, + otherPay: '', noPay: 0, - alreadyPay: 0, + alreadyPay: '', realAmount: 0, - shouldPay: 0, + shouldPay: '', totalAmount: 0, index: '', index1: '', @@ -214,13 +214,12 @@ onShow() { let that = this; this.khName = JSON.parse(JSON.stringify(this.khName)) || '' - this.totalAmount = 0; if (this.carList.size == 0) { //当前页没有数据 for (let i = 0; i < this.carList1.length; i++) { let obj = { purchasePrice: "", //进货价 price: 0, - productCount: this.carList1[i].num, + productCount: 0, productId: this.carList1[i].id, productName: this.carList1[i].productName, productPicture: this.carList1[i].productPicture, @@ -230,7 +229,8 @@ } for (let m = 0; m < this.carList1[i].saleDetailQueryDTO.length; m++) { obj.stockLogList.set(this.carList1[i].saleDetailQueryDTO[m].attributeList, this.carList1[i] - .saleDetailQueryDTO[m].productCount) + .saleDetailQueryDTO[m].productCount) + obj.productCount += this.carList1[i].saleDetailQueryDTO[m].productCount } this.carList.set(this.carList1[i].id, obj) } @@ -244,17 +244,21 @@ this.carList.get(this.carList1[i].id).stockLogList.set(this.carList1[i].saleDetailQueryDTO[ m].attributeList, this.carList.get(this.carList1[i].id).stockLogList.get(this .carList1[i].saleDetailQueryDTO[m].attributeList) + this.carList1[i] - .saleDetailQueryDTO[m].productCount) + .saleDetailQueryDTO[m].productCount) + } else { //规格不同 this.carList.get(this.carList1[i].id).stockLogList.set(this.carList1[i].saleDetailQueryDTO[ - m].attributeList, this.carList1[i].saleDetailQueryDTO[m].productCount) - } + m].attributeList, this.carList1[i].saleDetailQueryDTO[m].productCount) + + } + this.carList.get(this.carList1[i].id).productCount += this.carList1[i].saleDetailQueryDTO[ + m].productCount } } else { //商品不同 let obj = { purchasePrice: "", //进货价 price: 0, - productCount: this.carList1[i].num, + productCount: 0, productId: this.carList1[i].id, productName: this.carList1[i].productName, productPicture: this.carList1[i].productPicture, @@ -266,18 +270,17 @@ for (let m = 0; m < this.carList1[i].saleDetailQueryDTO.length; m++) { obj.stockLogList.set(this.carList1[i].saleDetailQueryDTO[m].attributeList, this.carList1[i] .saleDetailQueryDTO[m].productCount) - obj.name = this.carList1[i].saleDetailQueryDTO[m].name + obj.name = this.carList1[i].saleDetailQueryDTO[m].name + obj.productCount += this.carList1[i].saleDetailQueryDTO[m].productCount } this.carList.set(this.carList1[i].id, obj) - } + } + + this.carList.get(this.carList1[i].id).price = this.carList.get(this.carList1[i].id).purchasePrice * this.carList.get(this.carList1[i].id).productCount; } this.carList1 = [] } - this.carList.forEach(function(value, key) { - that.totalAmount += value.productCount - }) - this.noPay = this.shouldPay - + this.getAllPrice() }, onLoad() { this.storageType = uni.getStorageSync('type') @@ -446,13 +449,12 @@ this.goodsDetail.attributeList[i].value[m].isChecked = false } } - this.totalAmount = 0; if (this.carList.size == 0) { //当前页没有数据 for (let i = 0; i < carList1.length; i++) { let obj = { purchasePrice: "", //进货价 price: 0, - productCount: carList1[i].num, + productCount: 0, productId: carList1[i].id, productName: carList1[i].productName, productPicture: carList1[i].productPicture, @@ -462,7 +464,8 @@ } for (let m = 0; m < carList1[i].saleDetailQueryDTO.length; m++) { obj.stockLogList.set(carList1[i].saleDetailQueryDTO[m].attributeList, carList1[i] - .saleDetailQueryDTO[m].productCount) + .saleDetailQueryDTO[m].productCount) + obj.productCount += carList1[i].saleDetailQueryDTO[m].productCount } this.carList.set(carList1[i].id, obj) } @@ -478,18 +481,22 @@ .saleDetailQueryDTO[ m].attributeList, this.carList.get(carList1[i].id).stockLogList.get( carList1[i].saleDetailQueryDTO[m].attributeList) + carList1[i] - .saleDetailQueryDTO[m].productCount) + .saleDetailQueryDTO[m].productCount) + this.carList.get(carList1[i].id).productCount += carList1[i].saleDetailQueryDTO[ + m].productCount } else { //规格不同 this.carList.get(carList1[i].id).stockLogList.set(carList1[i] .saleDetailQueryDTO[ - m].attributeList, carList1[i].saleDetailQueryDTO[m].productCount) + m].attributeList, carList1[i].saleDetailQueryDTO[m].productCount) + this.carList.get(carList1[i].id).productCount += carList1[i].saleDetailQueryDTO[ + m].productCount } } } else { //商品不同 let obj = { purchasePrice: "", //进货价 price: 0, - productCount: carList1[i].num, + productCount: 0, productId: carList1[i].id, productName: carList1[i].productName, productPicture: carList1[i].productPicture, @@ -501,17 +508,15 @@ for (let m = 0; m < carList1[i].saleDetailQueryDTO.length; m++) { obj.stockLogList.set(carList1[i].saleDetailQueryDTO[m].attributeList, carList1[i] .saleDetailQueryDTO[m].productCount) - obj.name = carList1[i].saleDetailQueryDTO[m].name + obj.name = carList1[i].saleDetailQueryDTO[m].name + obj.productCount += carList1[i].saleDetailQueryDTO[m].productCount } this.carList.set(carList1[i].id, obj) } } carList1 = [] } - this.carList.forEach(function(value, key) { - that.totalAmount += value.productCount - }) - this.noPay = this.shouldPay + this.getAllPrice() this.$refs.shopPopup.close() }, @@ -536,6 +541,7 @@ if(that.carList.has(id) == true){ that.carList.delete(id) } + that.getAllPrice() that.$forceUpdate() } } @@ -550,10 +556,15 @@ content: "确定删除此条商品吗?", success: function(res) { if(res.confirm){ + console.log(that.carList.get(id)) + that.carList.get(id).productCount -= that.carList.get(id).stockLogList.get(name); that.carList.get(id).stockLogList.delete(name) + that.carList.get(id).price = that.carList.get(id).productCount * that.carList.get(id).purchasePrice if(that.carList.get(id).stockLogList.size == 0){ that.carList.delete(id) } + + that.getAllPrice() } that.$forceUpdate() } @@ -578,11 +589,12 @@ } let that = this; let purchase = { - alreadyPay: this.alreadyPay, //已付金额 - noPay: this.noPay, //欠款 + alreadyPay: this.alreadyPay == ''?0:this.alreadyPay, //已付金额 + noPay: this.noPay == ''?0:this.noPay, //欠款 shouldPay: this.shouldPay, //应付金额 totalAmount: this.totalAmount, //总数量 - remark: this.remark, + remark: this.remark, + otherPay:this.otherPay == ''?0:this.otherPay, supplierId: this.khName.id, //供应商id和姓名 supplierName: this.khName.consigneeName } @@ -620,18 +632,28 @@ //编辑每一个的单价 clickCollapse(index) { this.index = index - this.$refs.inputDialog.val = '' + this.$refs.inputClose.val = '' this.$refs.inputDialog.open() }, //计算价格 changePrice(val) { let that = this; - that.shouldPay = 0 that.carList.get(that.index).purchasePrice = val that.carList.get(that.index).price = val * that.carList.get(that.index).productCount; - that.carList.forEach(function(value, key) { - that.shouldPay += value.price - }) + this.getAllPrice() + + }, + //计算总金额和总数量 + getAllPrice(){ + let that = this; + this.shouldPay = 0 + this.totalAmount = 0 + this.carList.forEach(function(value, key) { + that.shouldPay = that.shouldPay + value.price + that.totalAmount = that.totalAmount + value.productCount + }) + this.alreadyPay = this.shouldPay + that.noPay = this.shouldPay - this.alreadyPay }, //修改已选规格的数量 GoodsNumChange(e,index,index1){ @@ -639,17 +661,12 @@ let that = this; this.carList.get(index).stockLogList.set(index1,e) this.carList.get(index).productCount = 0 - this.shouldPay = 0 - this.totalAmount = 0 this.carList.get(index).stockLogList.forEach(function(value, key) { console.log(that.carList.get(index)) that.carList.get(index).productCount = that.carList.get(index).productCount + value that.carList.get(index).price = that.carList.get(index).productCount * that.carList.get(index).purchasePrice }) - this.carList.forEach(function(value, key) { - that.shouldPay = that.shouldPay + value.price - that.totalAmount = that.totalAmount+ value.productCount - }) + this.getAllPrice(); } } } diff --git a/pages/inventory/goodsList1.vue b/pages/inventory/goodsList1.vue index 908bafe..1e31d76 100644 --- a/pages/inventory/goodsList1.vue +++ b/pages/inventory/goodsList1.vue @@ -75,7 +75,7 @@ style="width: 140rpx;height: 140rpx;margin: 30rpx 0 0 30rpx;"> 品名:{{value[1].productName}} ({{value[1].productSn}}) - 单价:{{value[1].unitPrice}} 数量:{{value[1].productCount}} 总价:{{value[1].price}} + 单价:{{value[1].discountAmount}} 数量:{{value[1].productCount}} 总价:{{value[1].price}} 供应商:{{value[1].supplierName}} 折扣(0-10) - 折后价 - + 数量 @@ -426,7 +426,8 @@ saleId: '', saleDetailList: [], yNum: 150, - clearMsg:'' + clearMsg:'', + priceType:'' } }, components: { @@ -450,7 +451,7 @@ } else { this.carList1 = this.carList1 } - if (this.carList1 == '' && this.clearMsg != '1') { + if (this.carList1 == '' && this.clearMsg != '1' && !uni.getStorageSync('saoma')) { this.carList.clear() this.remark = '' this.clearMsg = ''; @@ -458,9 +459,7 @@ this.xsyId = '' this.khName = [] this.saleId = '' - } - this.totalAmount = 0; - this.shouldPay = 0 + } for (let i = 0; i < this.carList1.length; i++) { if (this.carList.size == 0) { //当前页没有数据 @@ -537,6 +536,7 @@ } uni.removeStorageSync('carList1') uni.removeStorageSync('khName') + uni.removeStorageSync('saoma') this.carList1 = [] this.carList.forEach(function(value, key) { if (that.priceType == 0) { //零售 @@ -547,9 +547,9 @@ if (that.discountType == 1) { //整体折扣 value.price = value.unitPrice * 10000 * value.productCount * that.discountNum / 10 / 10000 } - that.totalAmount += value.productCount - that.shouldPay += value.price - }) + }) + this.getAllPrice() + this.getAmountAndWho() this.noPay = this.shouldPay }, filters: { @@ -562,13 +562,6 @@ } } return name; - }, - maxNum(val) { - if (val >= 10) { - return 10 - } else if (val < 0) { - return 0 - } } }, onLoad(option) { @@ -656,7 +649,8 @@ }, changessPrice(e) { - this.relPrice = e.target.value + this.relPrice = e.target.value + this.noPay = this.relPrice - this.priceOk; }, changePrice(e) { this.priceOk = e.target.value @@ -679,9 +673,11 @@ }, //扫一扫功能 scanCodeAdd() { - // this.clearMsg = '1' + // this.clearMsg = '1' + uni.setStorageSync('saoma','1') uni.scanCode({ - success: (res) => { + success: (res) => { + this.toggle('bottom', res.result); }, fail: (res) => { @@ -699,7 +695,58 @@ if (type == 'bottom') { this.getById(id); } - }, + }, + //整体选择是批发价还是零售价 + priceChange(e) { + let that = this; + // if(this.carList.size == 0){ + // this.tui.toast("请先选择商品") + // return + // } + this.priceType = e + this.carList.forEach(function(value, key) { + that.index = value.productId + if (e == 0) { //零售 + that.checkPay(value.lsprice) + } else { //批发 + that.checkPay(value.wholesalePrice) + } + }) + }, + //商品上选择是零售价还是批发价 + checkPay(price) { + let that = this; + this.carList.get(this.index).discountAmount = price + this.carList.get(this.index).unitPrice = price; + that.carList.get(that.index).price = price * that.carList.get(that.index).productCount; + this.$refs.inputDialog.close() + this.getAllPrice() + that.relPrice = that.shouldPay + }, + //整体选择时使用批发价、零售价,选择整体折扣的方法 + getAmountAndWho(){ + let that = this; + let price = 0 + this.carList.forEach(function(value, key) { + if(that.priceType == 0){ //零售 + price = value.lsprice + }else if(that.priceType == 1){ //批发 + price = value.wholesalePrice + } + value.unitPrice = price; + if (that.discountType == 1) { //整体折扣 + value.discountAmount = value.unitPrice * 10000 * that.discountNum / 10 / 10000 + value.price = value.discountAmount * value.productCount + } + }) + this.getAllPrice(); + if(this.relPrice == '' || this.relPrice == 0){ + that.noPay = that.shouldPay + }else if(this.relPrice != '' && this.priceOk != ''){ + that.noPay = this.relPrice - this.priceOk + } + }, + //通过商品id查询商品详细信息 getById(id) { this.tui.request("/app/product/getById/" + id, "POST", {}, false, true).then((res) => { @@ -792,9 +839,9 @@ this.discountNum = 0 }else{ this.discountNum = e.detail.value - } + } + this.getAmountAndWho() - this.shouldPay = this.price * 10000 * e / 10 / 10000 }, //点击发货方式按钮 radioChange(e) { @@ -854,8 +901,6 @@ this.goodsDetail.attributeList[i].value[m].isChecked = false } } - this.totalAmount = 0; - this.shouldPay = 0 if (this.carList.size == 0) { //当前页没有数据 for (let i = 0; i < carList1.length; i++) { let obj = { @@ -941,9 +986,9 @@ if (that.discountType == 1) { //整体折扣 value.price = value.unitPrice * 10000 * value.productCount * that.discountNum / 10 / 10000 } - that.totalAmount += value.productCount - that.shouldPay += value.price - }) + }) + this.getAllPrice() + this.getAmountAndWho(); this.noPay = this.shouldPay this.$refs.shopPopup.close() @@ -1007,10 +1052,10 @@ return } let obj = { - orderByWorker: this.lbgName.workerId, + orderByWorker: this.lbgName.workerId, + oldSaleId: this.saleId, sale: { - // relPrice:, - saleId: this.saleId, + // relPrice:, alreadyEarn: this.priceOk, //已付金额 realAmount: this.relPrice, //实收金额 noEarn: this.relPrice - this.priceOk, //欠款 @@ -1120,7 +1165,10 @@ strCmd += blesdk.addCPCLLocation(0); //对齐指令 0-左对齐 1-右对齐 2-居中 strCmd += blesdk.addCPCLPrint(); - this.bufferData = strCmd; + this.bufferData = strCmd; + uni.redirectTo({ + url: "/pages/index/order" + }) }, //截取 slicePrint(val) { @@ -1165,43 +1213,19 @@ //更改单品折扣 changeDis(e, id) { let that = this; - this.shouldPay = 0 - let carlist = this.carList.get(id) - carlist.discount = e.detail.value; - carlist.discountAmount = carlist.unitPrice * e.detail.value / 10 - carlist.price = carlist.unitPrice * e.detail.value / 10 * carlist.productCount - that.carList.forEach(function(value, key) { - that.shouldPay += value.price - }) - }, - //整体选择是批发价还是零售价 - priceChange(e) { - let that = this; - // if(this.carList.size == 0){ - // this.tui.toast("请先选择商品") - // return - // } - this.priceType = e - this.carList.forEach(function(value, key) { - that.index = value.productId - if (e == 0) { //零售 - that.checkPay(value.lsprice) - } else { //批发 - that.checkPay(value.wholesalePrice) - } - }) - }, - //商品上选择是零售价还是批发价 - checkPay(price) { - let that = this; - this.shouldPay = 0 - this.carList.get(this.index).discountAmount = price - this.carList.get(this.index).unitPrice = price; - that.carList.get(that.index).price = price * that.carList.get(that.index).productCount; - this.$refs.inputDialog.close() - that.carList.forEach(function(value, key) { - that.shouldPay += value.price - }) + let carlist = this.carList.get(id) + if(e.detail.value > 10){ + carlist.discount = 10; + }else if(e.detail.value < 0){ + carlist.discount = 0; + }else{ + carlist.discount = e.detail.value; + } + console.log(carlist.discount) + + carlist.discountAmount = carlist.unitPrice * carlist.discount / 10 + carlist.price = carlist.unitPrice * carlist.discount / 10 * carlist.productCount + this.getAllPrice() }, //删除整条商品 delShop(id) { @@ -1214,7 +1238,9 @@ if (that.carList.has(id) == true) { that.carList.delete(id) } - that.$forceUpdate() + that.$forceUpdate() + that.getAllPrice() + that.getAmountAndWho() } } }) @@ -1227,35 +1253,52 @@ title: "提示", content: "确定删除此条商品吗?", success: function(res) { - if (res.confirm) { - that.carList.get(id).stockLogList.delete(name) + if (res.confirm) { + console.log(that.carList.get(id)) + that.carList.get(id).productCount -= that.carList.get(id).stockLogList.get(name); + that.carList.get(id).stockLogList.delete(name); + that.carList.get(id).price = that.carList.get(id).productCount * that.carList.get(id).unitPrice if (that.carList.get(id).stockLogList.size == 0) { that.carList.delete(id) - } + } + that.getAllPrice() + that.getAmountAndWho() } that.$forceUpdate() } }) + }, + //计算总金额和总数量 + getAllPrice(){ + let that = this; + this.shouldPay = 0 + this.totalAmount = 0 + + this.carList.forEach(function(value, key) { + that.shouldPay = that.shouldPay + value.price + that.totalAmount = that.totalAmount + value.productCount + }) + this.relPrice = this.shouldPay + that.noPay = this.relPrice - this.priceOk }, //修改已选规格的数量 GoodsNumChange(e, index, index1) { - let that = this; this.carList.get(index).stockLogList.set(index1, e) this.carList.get(index).productCount = 0 - this.shouldPay = 0 - this.totalAmount = 0 this.carList.get(index).stockLogList.forEach(function(value, key) { - - that.carList.get(index).productCount = that.carList.get(index).productCount + value - that.carList.get(index).price = that.carList.get(index).productCount * that.carList.get(index) - .unitPrice - }) - this.carList.forEach(function(value, key) { - that.shouldPay = that.shouldPay + value.price - that.totalAmount = that.totalAmount + value.productCount + that.carList.get(index).productCount = that.carList.get(index).productCount + value + if (that.discountType == 0) { //单品折扣 + that.carList.get(index).price = that.carList.get(index).productCount * that.carList.get(index) + .unitPrice * that.carList.get(index).discount / 10 + }else{ + that.carList.get(index).price = that.carList.get(index).productCount * that.carList.get(index) + .unitPrice + } }) + that.getAllPrice() + that.getAmountAndWho(); }, //清空全部数据 clearAll() { @@ -1418,7 +1461,7 @@ } .discount-num { - width: 200rpx; + width: 160rpx; } .shop-productName { diff --git a/pages/staff/addStaff/addStaff.vue b/pages/staff/addStaff/addStaff.vue index 08d7682..1dca4d6 100644 --- a/pages/staff/addStaff/addStaff.vue +++ b/pages/staff/addStaff/addStaff.vue @@ -68,7 +68,7 @@ if (type === 'edit') { this.addForm.nickname = item.nickname this.addForm.mobile = item.mobile - this.addForm.type = item.type + this.addForm.type = Number(item.type) this.id = item.id } uni.setNavigationBarTitle({