From 4f4ced97f248d6d3b13e48b88a807be7cbd9afd1 Mon Sep 17 00:00:00 2001 From: wangfukang <15630117759@163.com> Date: Thu, 28 Nov 2024 11:47:05 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E7=89=A9=E6=B5=81=E6=80=BB?= =?UTF-8?q?=E4=BB=B6=E6=95=B0=E5=92=8C=E5=BA=97=E9=93=BA=E5=BC=80=E5=8D=95?= =?UTF-8?q?bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/inventory/goodsList1.vue | 146 ++++++++++++++++++++++++--------- pages/staff/staff.vue | 4 +- 2 files changed, 111 insertions(+), 39 deletions(-) diff --git a/pages/inventory/goodsList1.vue b/pages/inventory/goodsList1.vue index 4962729..d2ff597 100644 --- a/pages/inventory/goodsList1.vue +++ b/pages/inventory/goodsList1.vue @@ -96,7 +96,7 @@ style="height: 55rpx;border-bottom: 1px solid #eee;color:#777;width: 318rpx;padding-left: 20rpx;"> - 货号: @@ -1296,6 +1296,7 @@ return { attrList: [], zeroArr:[], + newProductId:'', productPictures: [], oneData: {}, moreData: [], @@ -1942,6 +1943,9 @@ this.mapnumReturnChange(Number(this.keyboardNum), this.keyboardIndex[0], this.keyboardIndex[1]) } } else if (this.keyboard == 'danjia') { + if(this.newProductId !=''){ + this.keyboardIndex = this.newProductId + } this.clickCollapse(Number(this.keyboardNum), this.keyboardIndex) } else if (this.keyboard == 'priceOk') { this.changePrice(Number(this.keyboardNum)) @@ -2218,11 +2222,13 @@ .saleDetailQueryDTO[m].stockCount } - obj.stockLogList.set(this.carList1[i].saleDetailQueryDTO[m].attributeList, data1) + if (this.carList1[i].saleDetailQueryDTO[m].productCount < 0) { //退货数量 obj.returnCount += Math.abs(this.carList1[i].saleDetailQueryDTO[m].productCount) + obj.returnList.set(this.carList1[i].saleDetailQueryDTO[m].attributeList, data1) } else { obj.productCount += Number(this.carList1[i].saleDetailQueryDTO[m].productCount) + obj.stockLogList.set(this.carList1[i].saleDetailQueryDTO[m].attributeList, data1) } } @@ -2251,25 +2257,41 @@ for (let m = 0; m < this.carList1[i].saleDetailQueryDTO.length; m++) { if (this.carList.get(this.carList1[i].id).stockLogList.has(this.carList1[i] - .saleDetailQueryDTO[m].attributeList) == true) { //规格相同 - - var data1 = { - productCount: Number(this.carList.get(this.carList1[i].id).stockLogList.get(this - .carList1[i].saleDetailQueryDTO[m].attributeList).productCount) + - Number(this.carList1[i].saleDetailQueryDTO[m].productCount), - name: this.carList1[i].saleDetailQueryDTO[m].name, - productNum: this.carList1[i].saleDetailQueryDTO[m].productNum != - undefined ? this.carList1[i].saleDetailQueryDTO[m].productNum : this - .carList1[i].saleDetailQueryDTO[m].stockCount + .saleDetailQueryDTO[m].attributeList) == true) { //规格相同1 + if(uni.getStorageSync('hangOrder')){ + var data1 = { + productCount: Number(this.carList1[i].saleDetailQueryDTO[m].productCount), + name: this.carList1[i].saleDetailQueryDTO[m].name, + productNum: this.carList1[i].saleDetailQueryDTO[m].productNum != + undefined ? this.carList1[i].saleDetailQueryDTO[m].productNum : this + .carList1[i].saleDetailQueryDTO[m].stockCount + } + + }else{ + var data1 = { + productCount: Number(this.carList.get(this.carList1[i].id).stockLogList.get(this + .carList1[i].saleDetailQueryDTO[m].attributeList).productCount) + + Number(this.carList1[i].saleDetailQueryDTO[m].productCount), + name: this.carList1[i].saleDetailQueryDTO[m].name, + productNum: this.carList1[i].saleDetailQueryDTO[m].productNum != + undefined ? this.carList1[i].saleDetailQueryDTO[m].productNum : this + .carList1[i].saleDetailQueryDTO[m].stockCount + } } + // if(data1.productCount >= 0){ // this.carList.get(this.carList1[i].id).productCount += data1.productCount // }else if(data1.productCount < 0){ // this.carList.get(this.carList1[i].id).returnCount += Math.abs(data1.productCount) // } + if(data1.productCount >= 0){ + this.carList.get(this.carList1[i].id).stockLogList.set(this.carList1[i] + .saleDetailQueryDTO[m].attributeList, data1) + }else if(data1.productCount < 0){ + this.carList.get(this.carList1[i].id).returnList.set(this.carList1[i] + .saleDetailQueryDTO[m].attributeList, data1) + } - this.carList.get(this.carList1[i].id).stockLogList.set(this.carList1[i] - .saleDetailQueryDTO[m].attributeList, data1) } else { //规格不同 var data1 = { @@ -2284,9 +2306,14 @@ // }else if(data1.productCount < 0){ // this.carList.get(this.carList1[i].id).returnCount += Math.abs(data1.productCount) // } - this.carList.get(this.carList1[i].id).stockLogList.set(this.carList1[i] - .saleDetailQueryDTO[ - m].attributeList, data1) + if(data1.productCount >= 0){ + this.carList.get(this.carList1[i].id).stockLogList.set(this.carList1[i] + .saleDetailQueryDTO[m].attributeList, data1) + }else if(data1.productCount < 0){ + this.carList.get(this.carList1[i].id).returnList.set(this.carList1[i] + .saleDetailQueryDTO[m].attributeList, data1) + } + } } this.carList.get(this.carList1[i].id).returnList.forEach(function(value, key) { @@ -2388,13 +2415,15 @@ this.carList1[i].saleDetailQueryDTO[m].productNum : this.carList1[i] .saleDetailQueryDTO[m].stockCount } - obj.stockLogList.set(this.carList1[i].saleDetailQueryDTO[m].attributeList, data1) + obj.name = this.carList1[i].saleDetailQueryDTO[m].name if (this.carList1[i].saleDetailQueryDTO[m].productCount < 0) { //退货数量 obj.returnCount += Math.abs(this.carList1[i].saleDetailQueryDTO[m].productCount) + obj.returnList.set(this.carList1[i].saleDetailQueryDTO[m].attributeList, data1) } else { obj.productCount += Number(this.carList1[i].saleDetailQueryDTO[m].productCount) + obj.stockLogList.set(this.carList1[i].saleDetailQueryDTO[m].attributeList, data1) } } this.carList.set(this.carList1[i].id, obj) @@ -3854,6 +3883,7 @@ } else if (type == 'danjia') { this.showPrice = true this.keyboard = 'danjia' + console.log('num',num) this.keyboardIndex = num } else if (type == 'mapdanjishu') { this.showFu = true @@ -3983,14 +4013,19 @@ } }, mapMinusReturnNum(index) { + uni.showLoading({ + title: '加载中...', + mask:true + }) this.temporaryReturnList[index].productCount-- if(this.temporaryReturnList[index].productCount < 0 && this.khName.name!='散客'){ this.checkCanReturn(this.goodsReturnDetail.productSn,this.goodsReturnDetail.id,this.temporaryReturnList[index].attributeList,this.khName.id,this.temporaryReturnList[index].productCount) } setTimeout(res => { if(this.checkCanBuy.length > 0){ - this.seeCustomCategory() - } + this.seeCustomCategory() + } + uni.hideLoading() }, 500) this.temporaryReturnChange() }, @@ -4024,8 +4059,11 @@ } this.checkCanBuy.push(obj) } + uni.hideLoading() } - }).catch((res) => {}) + }).catch((res) => { + uni.hideLoading() + }) }, async oneMinusNum(index, index1) { let that = this; @@ -4288,6 +4326,9 @@ } let convertedStr = this.trimWhitespace(this.voiceText); convertedStr = this.convertChineseToArabic(convertedStr); + if (convertedStr.indexOf('退') != -1 && convertedStr.indexOf('数量') == -1) { + convertedStr = convertedStr.replace(/退/g, '数量:-') + } if(convertedStr.indexOf('数量') == -1 && convertedStr.indexOf('名称') == -1 &&convertedStr.indexOf('单价') == -1 &&convertedStr.indexOf('批发价') == -1){ convertedStr = convertedStr + ',' } @@ -4795,6 +4836,9 @@ } let convertedStr = this.trimWhitespace(this.voiceText); convertedStr = this.convertChineseToArabic(convertedStr); + if (convertedStr.indexOf('退') != -1 && convertedStr.indexOf('数量') == -1) { + convertedStr = convertedStr.replace(/退/g, '数量:-') + } if(convertedStr.indexOf('数量') == -1 && convertedStr.indexOf('名称') == -1 &&convertedStr.indexOf('单价') == -1 &&convertedStr.indexOf('批发价') == -1){ convertedStr = convertedStr + ',' } @@ -4885,11 +4929,10 @@ } this.getMsg = convertedStr let regexCount = /-?\d+/g; - if (convertedStr.indexOf('色') == -1 && convertedStr - .indexOf('码') == -1) { - if (!convertedStr.startsWith("货号")) { - convertedStr = "货号" + convertedStr; - } + if (convertedStr.indexOf('色') == -1 && convertedStr.indexOf('码') == -1) { + if (!convertedStr.startsWith("货号")) { + convertedStr = "货号" + convertedStr; + } try { const regex = /货号.*?(?=货号|$)/g; convertedStr = convertedStr.match(regex); @@ -4901,6 +4944,7 @@ if (voiceData.productCount) { voiceData.productCount = voiceData.productCount.match(regexCount); } + console.log('负数',voiceData.productCount) if (voiceData.wholesalePrice) { voiceData.wholesalePrice = this.replaceCharAfterNumber(voiceData.wholesalePrice, '块', '.') @@ -5671,7 +5715,7 @@ this.voiceText1 = '' this.$refs.popup.close() if (voiceData.productCount) { - let regexZCount = /\d+/g; + let regexZCount = /-?\d+/g; voiceData.productCount = voiceData.productCount[0].match( regexZCount); } @@ -5695,7 +5739,8 @@ } let data = { id: voiceData.productSn, - productCount: Number(voiceData.productCount) || 0, + productCount: Number(voiceData.productCount)>=0?Number(voiceData.productCount):0, + returnCount: Number(voiceData.productCount)<0?Math.abs(Number(voiceData.productCount)):0, productName: voiceData.productName, productSn: voiceData.productSn, customerCategoryList:null, @@ -5705,6 +5750,7 @@ unitPrice: voiceData.wholesalePrice || 0, discountAmount: voiceData.wholesalePrice || 0, wholesalePrice: voiceData.wholesalePrice || 0, + returnPrice: voiceData.wholesalePrice || 0, stockLogList1: [{ attributeList: '{"颜色":"均色","尺码":"均码"}', productCount: Number(voiceData.productCount) || oldProduCount, @@ -5790,8 +5836,14 @@ .stockLogList1[i]) } } - this.carList.get(id).productCount += Number(purchaseDetails[j] - .stockLogList1[i].productCount) + if(Number(purchaseDetails[j].stockLogList1[i].productCount) >=0){ + this.carList.get(id).productCount += Number(purchaseDetails[j] + .stockLogList1[i].productCount) + }else{ + this.carList.get(id).returnCount += Math.abs(Number(purchaseDetails[j] + .stockLogList1[i].productCount)) + } + } } if (this.carList.get(id).stockLogList.get( @@ -5944,9 +5996,16 @@ .stockLogList1[i]) } } - this.carList.get(id).productCount += - Number(purchaseDetails[j].stockLogList1[i] - .productCount) + if(Number(purchaseDetails[j].stockLogList1[i] + .productCount) >=0){ + this.carList.get(id).productCount += + Number(purchaseDetails[j].stockLogList1[i] + .productCount) + }else{ + this.carList.get(id).returnCount += + Math.abs(Number(purchaseDetails[j].stockLogList1[i] + .productCount)) + } } } this.carList.get(id).price = Number(this.carList.get(id) @@ -6732,7 +6791,7 @@ this.voiceText1 = '' this.$refs.popup.close() if (voiceData.productCount) { - let regexZCount = /\d+/g; + let regexZCount = /-?\d+/g; voiceData.productCount = voiceData.productCount[0].match( regexZCount); } @@ -7177,6 +7236,7 @@ this.carList.get(id).wholesalePrice = purchaseDetails[0].purchasePrice this.carList.get(id).unitPrice = purchaseDetails[0].purchasePrice this.carList.get(id).discountAmount = purchaseDetails[0].purchasePrice + this.carList.get(id).returnPrice = purchaseDetails[0].purchasePrice } } @@ -7402,6 +7462,7 @@ this.carList.get(id).wholesalePrice = purchaseDetails[0].purchasePrice this.carList.get(id).unitPrice = purchaseDetails[0].purchasePrice this.carList.get(id).discountAmount = purchaseDetails[0].purchasePrice + this.carList.get(id).returnPrice = purchaseDetails[0].purchasePrice } } @@ -8406,7 +8467,7 @@ this.voiceText1 = '' this.$refs.popup.close() if (voiceData.productCount) { - let regexZCount = /\d+/g; + let regexZCount = /-?\d+/g; voiceData.productCount = voiceData.productCount[0].match( regexZCount); } @@ -8820,6 +8881,8 @@ }, //编辑每一个的单价 clickCollapse(e, id) { + this.newProductId ='' + console.log('id',this.carList) this.carList.get(id).discountAmount = Number(e) this.carList.get(id).unitPrice = Number(e) this.carList.get(id).returnPrice = this.carList.get(id).discountAmount @@ -9443,6 +9506,7 @@ this.carList.get(id).productName = e.detail.value }, sninput(e, id) { + this.newProductId = e.detail.value this.carList.get(id).productSn = e.detail.value this.$forceUpdate() }, @@ -9484,7 +9548,6 @@ } }) - this.$nextTick(() => { if (isTrue == false) { if (that.carList.get(id).productId) { @@ -11277,6 +11340,11 @@ } } + if(that.carList.get(carList1[i].id).returnList.size > 0){ + that.carList.get(carList1[i].id).returnList.forEach(function(value, key) { + that.carList.get(carList1[i].id).returnCount += Math.abs(value.productCount) + }) + } } else { //商品不同 let obj = { attrId:carList1[i].attrId, @@ -11969,6 +12037,7 @@ //删除商品下的某一个规格 delShopSpec(id, name) { var that = this; + console.log('carList',that.carList) uni.showModal({ title: "提示", content: "确定删除此条规格吗?", @@ -11985,7 +12054,7 @@ that.carList.get(id).price = Number(that.carList.get(id).productCount) * that.carList.get( id).unitPrice - if (that.carList.get(id).stockLogList.size == 0) { + if (that.carList.get(id).stockLogList.size == 0 && that.carList.get(id).returnList.size == 0) { that.carList.delete(id) } // that.getAllPrice() @@ -12010,6 +12079,9 @@ that.carList.get(id).returnList.delete(name); that.carList.get(id).returtnPay = Number(that.carList.get(id).productCount) * that.carList.get( id).returnPrice + if (that.carList.get(id).stockLogList.size == 0 && that.carList.get(id).returnList.size == 0) { + that.carList.delete(id) + } that.getAmountAndWho() } that.$forceUpdate() diff --git a/pages/staff/staff.vue b/pages/staff/staff.vue index 0b76481..cf0e549 100644 --- a/pages/staff/staff.vue +++ b/pages/staff/staff.vue @@ -88,12 +88,12 @@ }) }, gotoPerformancePage() { - if(this.type == 0){ + if(this.type == 0 && (uni.getStorageSync('shopOwnerPhone') == uni.getStorageSync('username'))){ uni.navigateTo({ url: '/package1/staff/performance' }) }else{ - this.tui.toast("暂无添加权限") + this.tui.toast("暂无查看权限") } },