From 5965fbec9f2d04fb72f4d854c424cec1c6c561cd Mon Sep 17 00:00:00 2001 From: wangfukang <15630117759@163.com> Date: Tue, 1 Oct 2024 00:16:09 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E4=BA=86=E5=AE=A2=E6=88=B7?= =?UTF-8?q?=E5=88=86=E7=B1=BB=E5=8F=8A=E4=BF=AE=E6=94=B9=E4=BA=86=E4=B8=80?= =?UTF-8?q?=E4=BA=9Bbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package1/AI/AIHangOrderList.vue | 48 +- package1/AI/AiChangeGoods.vue | 89 +- package1/AI/voiceInventory.vue | 2525 +++++++++++++++++------ package1/index/order.vue | 52 +- package1/index/orderDetail.vue | 14 +- package1/index/peopleList.vue | 2 +- package1/inventory/addGoods.vue | 82 +- package1/inventory/inventoryConfirm.vue | 95 +- package1/stock/addStock.vue | 87 +- 9 files changed, 2291 insertions(+), 703 deletions(-) diff --git a/package1/AI/AIHangOrderList.vue b/package1/AI/AIHangOrderList.vue index fddf8ea..db37161 100644 --- a/package1/AI/AIHangOrderList.vue +++ b/package1/AI/AIHangOrderList.vue @@ -909,7 +909,26 @@ } } return name; - }, + }, + //把unitPrice变成折前价,用于去开单的时候切换折扣 + getUnitPrice(item,items){ + if(item.discount != 10){ + if(item.discount == null || item.discount == 0 || item.discount ==undefined){ + return items.discountAmount + }else{ + return ((items.discountAmount * 10000) / (item.discount * 100) / 10).toFixed(2) + } + }else if(items.discount!= 10){ + if(items.discount == null || items.discount == 0 || items.discount ==undefined){ + return items.discountAmount + }else{ + return ((items.discountAmount * 10000) / (items.discount * 100) / 10).toFixed(2) + } + }else{ + return items.discountAmount || items.wholesalePrice + } + }, + //带参数跳转到开单页 goSaleGoods(item) { let dataList = [] @@ -919,10 +938,10 @@ this.returnList.forEach(function(value, key) { item.saleDetailDTOList.push(value) }) - + item.discount = item.discount==null?10:item.discount if (item.saleDetailDTOList.length>0) { for (let i = 0; i < item.saleDetailDTOList.length; i++) { - + let obj = {} let attrMap = new Map() let newSaleDetailDTOList = [] @@ -944,14 +963,16 @@ } obj.attrId = item.saleDetailDTOList[i].attrId obj.saleDetailQueryDTO = newSaleDetailDTOList - obj.num = 0 + obj.num = 0 + obj.buyCount = item.saleDetailDTOList[i].buyCount + obj.customerCategoryRule = item.saleDetailDTOList[i].customerCategoryRule != null ?JSON.parse(item.saleDetailDTOList[i].customerCategoryRule):null + obj.discount = item.saleDetailDTOList[i].discount obj.id = item.saleDetailDTOList[i].productId obj.price = item.saleDetailDTOList[i].price obj.lsprice = item.saleDetailDTOList[i].price obj.categoryId = item.saleDetailDTOList[i].categoryId obj.zPrice = item.saleDetailDTOList[i].discountAmount - obj.unitPrice = item.saleDetailDTOList[i].discountAmount || item.saleDetailDTOList[i] - .wholesalePrice + obj.unitPrice = this.getUnitPrice(item,item.saleDetailDTOList[i]) obj.discountAmount = item.saleDetailDTOList[i].discountAmount obj.productName = item.saleDetailDTOList[i].productName obj.productPicture = item.saleDetailDTOList[i].productPicture + '?time=' + new Date().getTime() @@ -975,18 +996,17 @@ dataList.push(obj) } setTimeout(res11=>{ - this.tui.request("/app/customer/list", "post", { - notBuyDays: "", - pageNum: 1, - pageSize: 10, - searchStr: item.userName, - sort: "", - }, false, false).then((res) => { + this.tui.request("/app/debt/selectByUserId", "post", { + shopId:uni.getStorageSync('shopId'), + userId:item.userId + }, false, true).then((res) => { if (res.code == 200) { this.returnList = new Map() console.log('dataList',dataList) - uni.setStorageSync('khName', JSON.stringify(res.result.records[0])) + res.result.name = res.result.userName + uni.setStorageSync('khName', JSON.stringify(res.result)) uni.setStorageSync('carList1', JSON.stringify(dataList)) + uni.setStorageSync('discountAll', item.discount != null ?item.discount:10) uni.setStorageSync('hangOrder', true) uni.switchTab({ url: '/pages/inventory/goodsList1' diff --git a/package1/AI/AiChangeGoods.vue b/package1/AI/AiChangeGoods.vue index dac6173..23fb778 100644 --- a/package1/AI/AiChangeGoods.vue +++ b/package1/AI/AiChangeGoods.vue @@ -45,9 +45,12 @@ {{item.price}} 零售价 - - {{item.stockCount}} - 库存 + + {{item.stockCount + item.minusStockCount}} + + 库存 + + @@ -61,7 +64,7 @@ 暂无图片 - {{item.productName}} + {{item.productName == null ?'':item.productName}} {{item.productSn}} @@ -76,15 +79,52 @@ {{item.price}} 零售价 - - {{item.stockCount}} - 库存 + + {{item.stockCount + item.minusStockCount}} + + 库存 + + + + + + + 库存数 + + + + + 正数库存 + + + {{zheng}} + + + + + 负数库存 + + + {{fu}} + + + + + + 确认 + + + + @@ -95,7 +135,9 @@ return { indexList: [], pageNum: 1, //分页的页码 - shopList: [], + shopList: [], + zheng:'', + fu:'', shopList1: [], categoryId: '', //分类id searchName: '', //搜索框输入值 @@ -110,6 +152,11 @@ this.getGategoryList() }, methods: { + seeStockCount(zheng,fu){ + this.zheng = zheng; + this.fu = fu; + this.$refs.showPopup.open() + }, //初始化获取分类列表 getGategoryList() { this.tui.request("/app/productCategory/list", "get", { @@ -382,4 +429,30 @@ color: #777; background: #eee; } + .popup-pay-content { + align-items: center; + justify-content: center; + padding: 15px; + width: 500rpx; + height: auto; + background-color: #fff; + } + .popup-pay-title { + font-size: 36rpx; + font-weight: bold; + text-align: center; + position: relative; + } + + .popup-pay-container { + margin-top: 20rpx; + height: 100rpx; + border-radius: 10px; + background: #088FEB; + line-height: 100rpx; + text-align: center; + border-bottom: 1px solid #eee; + border-top: 1px solid #eee; + color: #fff; + } \ No newline at end of file diff --git a/package1/AI/voiceInventory.vue b/package1/AI/voiceInventory.vue index 9ad7a48..01bdf21 100644 --- a/package1/AI/voiceInventory.vue +++ b/package1/AI/voiceInventory.vue @@ -162,10 +162,10 @@ @focus="obtainPrice($event,'lingshou',value[0])" v-model="value[1].lsprice" style="height: 55rpx;border-bottom: 1px solid #eee;color:#777;width: 100rpx;padding-left: 20rpx;"> - + 语音录入 @@ -205,8 +205,13 @@ {{numData(values[0])[1]}} - - {{values[1].productNum == null ?'无库存':values[1].productNum}} + + 无库存 + + + {{values[1].productNum}} @@ -407,8 +412,15 @@ - {{item.name}} {{item.productNum==null?'无库存':item.productNum}} + {{item.name}} + + 无库存 + + + {{item.productNum}} + @@ -447,9 +459,11 @@ {{item.categoryName}} - + - + 确认 @@ -597,7 +611,8 @@ 请在下方输入框中输入新规格 - + @@ -781,14 +796,14 @@ otherPay: '', noPay: 0, promptImg: '', - customerCategoryList:[], - customerCategoryList1:[], //存放金额为空的客户分类,用于新增商品 + customerCategoryList: [], + customerCategoryList1: [], //存放金额为空的客户分类,用于新增商品 alreadyPay: '', realAmount: 0, shouldPay: '', userType: '', totalAmount: 0, - customTypeId:'', + customTypeId: '', index: '', index1: '', recordState: false, @@ -974,7 +989,8 @@ price1: 0, price: this.carList1[i].price, productCount: 0, - customerCategoryList:this.carList1[i].customerCategoryRule != null?this.carList1[i].customerCategoryRule: this.customerCategoryList1, + customerCategoryList: this.carList1[i].customerCategoryRule != null ? this.checkPriceRule(this.carList1[i] + .customerCategoryRule) : this.getNewProductRule(), id: this.carList1[i].productId != null ? this.carList1[i].productId : this.carList1[i].id, isNew: this.carList1[i].isNew, //是否是新商品 productId: this.carList1[i].productId == null ? '' : this.carList1[i].productId, @@ -1055,7 +1071,8 @@ price1: 0, price: this.carList1[i].price, productCount: 0, - customerCategoryList:this.carList1[i].customerCategoryRule != null?this.carList1[i].customerCategoryRule: this.customerCategoryList1, + customerCategoryList: this.carList1[i].customerCategoryRule != null ? this.checkPriceRule(this.carList1[i] + .customerCategoryRule) : this.getNewProductRule(), id: this.carList1[i].productId != null ? this.carList1[i].productId : this.carList1[i].id, productId: this.carList1[i].productId == null ? '' : this.carList1[i].productId, isNew: this.carList1[i].isNew, @@ -1253,28 +1270,26 @@ }).catch((res) => {}) }, //获取客户分类 - getCustomerCategoryList(){ + getCustomerCategoryList() { this.tui.request("/app/customerCategory/getCustomerCategoryListByShopId", "POST", { - shopId:uni.getStorageSync('shopId') + shopId: uni.getStorageSync('shopId') }, false, true).then((res) => { if (res.code == 200) { - if(res.result.length > 0){ - this.customerCategoryList = res.result - this.customerCategoryList1 = res.result - for(let i=0;i 0) { + for (let i = 0; i < res.result.length; i++) { let data = { - categoryName:this.customerCategoryList[i].categoryName, - categoryId:this.customerCategoryList[i].id, - categoryPrice:"" + categoryName: res.result[i].categoryName, + categoryId: res.result[i].id, + categoryPrice: "" } this.customerCategoryList[i] = data this.customerCategoryList1[i] = data } - }else{ + } else { this.customerCategoryList = null this.customerCategoryList1 = null } - + } else { this.tui.toast(res.message) } @@ -1414,7 +1429,8 @@ price1: 0, price: this.carList1[i].price, productCount: 0, - customerCategoryList:this.carList1[i].customerCategoryList != null?this.carList1[i].customerCategoryList: this.customerCategoryList1, + customerCategoryList: this.carList1[i].customerCategoryList != null ? this.carList1[i] + .customerCategoryList : this.getNewProductRule(), id: this.carList1[i].productId != null ? this.carList1[i].productId : this.carList1[i].id, isNew: this.carList1[i].isNew, //是否是新商品 productId: this.carList1[i].productId == null ? '' : this.carList1[i].productId, @@ -1451,7 +1467,7 @@ let productCount = Number(this.carList1[i].saleDetailQueryDTO[m].productCount) if (obj.stockLogList.has(this.carList1[i].saleDetailQueryDTO[m].attributeList) == true) { productCount += Number(obj.stockLogList.get(this.carList1[i].saleDetailQueryDTO[m] - .attributeList).productCount) + .attributeList).productCount) } var data1 = { productCount: productCount, @@ -1512,7 +1528,8 @@ price1: 0, price: this.carList1[i].price, productCount: 0, - customerCategoryList:this.carList1[i].customerCategoryList != null?this.carList1[i].customerCategoryList: this.customerCategoryList1, + customerCategoryList: this.carList1[i].customerCategoryList != null ? this.carList1[i] + .customerCategoryList : this.getNewProductRule(), id: this.carList1[i].productId != null ? this.carList1[i].productId : this.carList1[i] .id, productId: this.carList1[i].productId == null ? '' : this.carList1[i].productId, @@ -1733,11 +1750,17 @@ this.$refs.getaPopup.close() }) }, - updateCate(){ + updateCate() { + console.log('customTypeId',this.customTypeId) + console.log('customerCategoryList',this.customerCategoryList) + this.carList.get(this.customTypeId).customerCategoryList = this.customerCategoryList + this.$refs.customPopup.close() this.$forceUpdate() + + console.log('customerCategoryList1',this.customerCategoryList1) }, delDefaultCate(index, value, index1) { let data = this.goodsDetail.attributeList[index].value[index1] @@ -1770,9 +1793,10 @@ this.$refs.inputDialog.open('bottom') }, //弹出客户分类弹窗 - addCustomPrice(id){ + addCustomPrice(id) { this.customTypeId = id - console.log(this.carList.get(id)) + console.log(this.carList) + this.customerCategoryList = this.carList.get(id).customerCategoryList this.$refs.customPopup.open() }, @@ -1824,24 +1848,393 @@ let data = { attributeList: '{"颜色":"均色","尺码":"均码"}', productCount: Number(item.productCount) || 1, - productNum:item.defaultStockCount + productNum: item.defaultStockCount } item.productId = item.id item.saleDetailQueryDTO = [] item.saleDetailQueryDTO.push(data) - let purchaseDetails = item - + let purchaseDetails = [] + purchaseDetails.push(item) let id = this.oneGoodsId - console.log('purchaseDetails4827', purchaseDetails) - if (purchaseDetails) { - this.carList1.push(purchaseDetails) + if (this.oneGoodsId) { + if (this.carList.get(id).productSn != '') { + for (let j = 0; j < purchaseDetails.length; j++) { + for (let i = 0; i < purchaseDetails[j] + .stockLogList1.length; i++) { + if (this.carList.get(id) + .productName == '') { + this.carList.get(id) + .productName = + purchaseDetails[0] + .productName + } + if (this.carList.get(id).attrId == + '') { + this.carList.get(id).attrId = + purchaseDetails[0].attrId + } + if (this.carList.get(id) + .purchasePrice == '' || this + .carList.get(id) + .purchasePrice == null) { + if (voiceData.purchasePrice) { + this.carList.get(id) + .purchasePrice = + voiceData.purchasePrice + } else { + this.carList.get(id) + .purchasePrice = + purchaseDetails[0] + .purchasePrice + } + + } + if (this.carList.get(id) + .productPicture == '') { + this.carList.get(id) + .productPicture = + purchaseDetails[0] + .productPicture + } + console.log('但语音customerCategoryRule', this.carList) + this.carList.get(id) + .customerCategoryRule = + this.checkPriceRule(JSON.parse(purchaseDetails[0] + .customerCategoryRule)) + purchaseDetails[j].stockLogList1[i] + .name = this.sliceMsg( + purchaseDetails[j] + .stockLogList1[i] + .attributeList) + if (this.carList.get(id) + .stockLogList.size == 0) { + this.carList.get(id) + .stockLogList.set( + purchaseDetails[j] + .stockLogList1[i] + .attributeList, + purchaseDetails[j] + .stockLogList1[i]) + } else { + if (this.carList.get(id) + .stockLogList.has( + purchaseDetails[j] + .stockLogList1[i] + .attributeList) == true + ) { + this.carList.get(id) + .stockLogList.get( + purchaseDetails[j] + .stockLogList1[i] + .attributeList) + .productCount += + Number(purchaseDetails[ + j] + .stockLogList1[i] + .productCount) + } else { + this.carList.get(id) + .stockLogList.set( + purchaseDetails[j] + .stockLogList1[i] + .attributeList, + purchaseDetails[j] + .stockLogList1[i]) + } + } + this.carList.get(id) + .productCount += + Number(purchaseDetails[j] + .stockLogList1[i] + .productCount) + } + } + this.carList.get(id).stockLogList.get( + '{"颜色":"均色","尺码":"均码"}') + .productNum = purchaseDetails[0].defaultStockCount + if (this.carList.get(id).stockLogList.get( + '{"颜色":"均色","尺码":"均码"}') + .productCount == 0 && purchaseDetails[ + 0].stockLogList1.length > 0) { + this.carList.get(id).stockLogList + .delete('{"颜色":"均色","尺码":"均码"}') + } + this.carList.get(id).price1 = Number(this + .carList + .get(id).productCount) * this + .carList + .get(id).purchasePrice + } else { + + let isTrue = false + this.carList.forEach(function(value, key) { + if (value.productSn == + purchaseDetails[0] + .productSn) { + isTrue = true + that.tui.toast( + '该货号被页面其他商品占用,请重新输入!' + ) + that.carList.get(id) + .productSn = '' + setTimeout(res => { + that.$forceUpdate() + }, 1000) + throw Error('被占用') + } + }) + + this.$nextTick(() => { + if (this.carList.get(id) + .productName == '') { + this.carList.get(id) + .productName = + purchaseDetails[0] + .productName + } + this.carList.get(id) + .customerCategoryList = + purchaseDetails[0] + .customerCategoryRule != null ? + this.checkPriceRule(JSON.parse(purchaseDetails[0] + .customerCategoryRule)) : null + if (isTrue == false && this + .carList.get(id) + .productSn == '') { + this.carList.get(id) + .productSn = + purchaseDetails[0] + .productSn + } + if (isTrue == false) { + if (purchaseDetails[0] + .productId) { + this.carList.get(id) + .id = + purchaseDetails[0] + .productId + this.carList.get(id) + .productId = + purchaseDetails[0] + .productId + this.carList.get(id) + .isNew = false + id = purchaseDetails[0] + .productId + + } else if (purchaseDetails[ + 0].productSn == + '' || purchaseDetails[ + 0].productSn == + null) { + this.carList.get(id) + .id = + purchaseDetails[0] + .productName + id = purchaseDetails[0] + .productName + } else if (purchaseDetails[ + 0].productSn == + '货号') { + this.carList.get(id) + .productSn = + purchaseDetails[0] + .productName + this.carList.get(id) + .id = + purchaseDetails[0] + .productName + id = purchaseDetails[0] + .productName + } else if (purchaseDetails[ + 0].productSn) { + this.carList.get(id) + .id = + purchaseDetails[0] + .productSn + id = purchaseDetails[0] + .productSn + } + } + }) + if (this.carList.get(id).purchasePrice == + '' || this.carList.get(id) + .purchasePrice == null) { + if (this.carList.get(id).purchasePrice) { + this.carList.get(id) + .purchasePrice = purchaseDetails[0] + .purchasePrice + } else { + this.carList.get(id) + .purchasePrice = + purchaseDetails[0] + .purchasePrice + } + + } + this.carList.get(id).customerCategoryList = + purchaseDetails[0].customerCategoryRule != null ? this.checkPriceRule(JSON.parse(purchaseDetails[0] + .customerCategoryRule)) : this.getNewProductRule() + if (this.carList.get(id).productPicture == + '') { + this.carList.get(id).productPicture = + purchaseDetails[0].productPicture + } + if (purchaseDetails[0].productId) { + this.carList.get(id).attrId = + purchaseDetails[0].attrId + this.carList.get(id).wholesalePrice = + purchaseDetails[0].wholesalePrice + this.carList.get(id).lsPrice = + purchaseDetails[0].lsPrice + } + + let specMap = + new Map() //新的临时存放值那个更改过的值的map + this.$nextTick(() => { + this.carList.forEach(function( + value, key) { + if (key != value + .id) { + specMap.set( + value + .id, + value) + } else { + specMap.set( + key, + value) + } + }) + this.carList = specMap + }) + this.$nextTick(() => { + for (let j = 0; j < + purchaseDetails.length; j++ + ) { + for (let i = 0; i < + purchaseDetails[j] + .stockLogList1 + .length; i++) { + purchaseDetails[j] + .stockLogList1[i] + .name = this + .sliceMsg( + purchaseDetails[ + j] + .stockLogList1[ + i] + .attributeList) + if (this.carList.get( + id) + .stockLogList + .size == 0) { + this.carList.get( + id) + .stockLogList + .set( + purchaseDetails[ + j] + .stockLogList1[ + i] + .attributeList, + purchaseDetails[ + j] + .stockLogList1[ + i]) + } else { + if (this.carList + .get(id) + .stockLogList + .has( + purchaseDetails[ + j] + .stockLogList1[ + i] + .attributeList + ) == true + ) { + this.carList + .get(id) + .stockLogList + .get( + purchaseDetails[ + j] + .stockLogList1[ + i] + .attributeList + ) + .productCount += + Number( + purchaseDetails[ + j] + .stockLogList1[ + i] + .productCount + ) + } else { + this.carList + .get(id) + .stockLogList + .set( + purchaseDetails[ + j] + .stockLogList1[ + i] + .attributeList, + purchaseDetails[ + j] + .stockLogList1[ + i]) + } + } + this.carList.get(id) + .productCount += + Number( + purchaseDetails[ + j] + .stockLogList1[ + i] + .productCount) + } + } + this.carList.get(id).price1 = + Number(this.carList.get(id) + .productCount) * this + .carList.get(id) + .purchasePrice + if (this.carList.get(id) + .stockLogList.get( + '{"颜色":"均色","尺码":"均码"}' + ).productCount == 0 && + purchaseDetails[0] + .stockLogList1.length > 0 + ) { + this.carList.get(id) + .stockLogList.delete( + '{"颜色":"均色","尺码":"均码"}' + ) + } + }) + } + this.$nextTick(() => { - this.AiVoice() + this.getAllPrice() + this.oneGoodsId = '' }) - } else { - this.tui.toast("抱歉:小助手本次未识别到商品信息,请检查识别信息是否正确") + if (purchaseDetails) { + this.carList1.push(item) + this.$nextTick(() => { + this.AiVoice() + }) + + } else { + this.tui.toast("抱歉:小助手本次未识别到商品信息,请检查识别信息是否正确") + } } + console.log('purchaseDetails4827', purchaseDetails) + setTimeout(() => { this.showTan = true; // 再显示下一个弹出层 @@ -1855,26 +2248,397 @@ let data = { attributeList: '{"颜色":"均色","尺码":"均码"}', productCount: Number(item.productCount) || 1, - productNum:item.defaultStockCount + productNum: item.defaultStockCount } item.productId = item.id item.saleDetailQueryDTO = [] item.saleDetailQueryDTO.push(data) - let purchaseDetails = item - + let purchaseDetails = [] + + purchaseDetails.push(item) let id = this.oneGoodsId - if (purchaseDetails) { - this.moreData = [] - this.carList1.push(purchaseDetails) + if (this.oneGoodsId) { + if (this.carList.get(id).productSn != '') { + for (let j = 0; j < purchaseDetails.length; j++) { + for (let i = 0; i < purchaseDetails[j] + .stockLogList1.length; i++) { + if (this.carList.get(id) + .productName == '') { + this.carList.get(id) + .productName = + purchaseDetails[0] + .productName + } + if (this.carList.get(id).attrId == + '') { + this.carList.get(id).attrId = + purchaseDetails[0].attrId + } + if (this.carList.get(id) + .purchasePrice == '' || this + .carList.get(id) + .purchasePrice == null) { + if (voiceData.purchasePrice) { + this.carList.get(id) + .purchasePrice = + voiceData.purchasePrice + } else { + this.carList.get(id) + .purchasePrice = + purchaseDetails[0] + .purchasePrice + } + + } + if (this.carList.get(id) + .productPicture == '') { + this.carList.get(id) + .productPicture = + purchaseDetails[0] + .productPicture + } + console.log('但语音customerCategoryRule', this.carList) + this.carList.get(id) + .customerCategoryRule = + this.checkPriceRule(JSON.parse(purchaseDetails[0] + .customerCategoryRule)) + purchaseDetails[j].stockLogList1[i] + .name = this.sliceMsg( + purchaseDetails[j] + .stockLogList1[i] + .attributeList) + if (this.carList.get(id) + .stockLogList.size == 0) { + this.carList.get(id) + .stockLogList.set( + purchaseDetails[j] + .stockLogList1[i] + .attributeList, + purchaseDetails[j] + .stockLogList1[i]) + } else { + if (this.carList.get(id) + .stockLogList.has( + purchaseDetails[j] + .stockLogList1[i] + .attributeList) == true + ) { + this.carList.get(id) + .stockLogList.get( + purchaseDetails[j] + .stockLogList1[i] + .attributeList) + .productCount += + Number(purchaseDetails[ + j] + .stockLogList1[i] + .productCount) + } else { + this.carList.get(id) + .stockLogList.set( + purchaseDetails[j] + .stockLogList1[i] + .attributeList, + purchaseDetails[j] + .stockLogList1[i]) + } + } + this.carList.get(id) + .productCount += + Number(purchaseDetails[j] + .stockLogList1[i] + .productCount) + } + } + this.carList.get(id).stockLogList.get( + '{"颜色":"均色","尺码":"均码"}') + .productNum = purchaseDetails[0].defaultStockCount + if (this.carList.get(id).stockLogList.get( + '{"颜色":"均色","尺码":"均码"}') + .productCount == 0 && purchaseDetails[ + 0].stockLogList1.length > 0) { + this.carList.get(id).stockLogList + .delete('{"颜色":"均色","尺码":"均码"}') + } + this.carList.get(id).price1 = Number(this + .carList + .get(id).productCount) * this + .carList + .get(id).purchasePrice + } else { + + let isTrue = false + this.carList.forEach(function(value, key) { + if (value.productSn == purchaseDetails[0].productSn) { + isTrue = true + that.tui.toast( + '该货号被页面其他商品占用,请重新输入!' + ) + that.carList.get(id) + .productSn = '' + setTimeout(res => { + that.$forceUpdate() + }, 1000) + throw Error('被占用') + } + }) + + this.$nextTick(() => { + if (this.carList.get(id) + .productName == '') { + this.carList.get(id) + .productName = + purchaseDetails[0] + .productName + } + this.carList.get(id) + .customerCategoryList = + purchaseDetails[0] + .customerCategoryRule != null ? + this.checkPriceRule(JSON.parse(purchaseDetails[0] + .customerCategoryRule)) : null + if (isTrue == false && this + .carList.get(id) + .productSn == '') { + this.carList.get(id) + .productSn = + purchaseDetails[0] + .productSn + } + if (isTrue == false) { + if (purchaseDetails[0] + .productId) { + this.carList.get(id) + .id = + purchaseDetails[0] + .productId + this.carList.get(id) + .productId = + purchaseDetails[0] + .productId + this.carList.get(id) + .isNew = false + id = purchaseDetails[0] + .productId + + } else if (purchaseDetails[ + 0].productSn == + '' || purchaseDetails[ + 0].productSn == + null) { + this.carList.get(id) + .id = + purchaseDetails[0] + .productName + id = purchaseDetails[0] + .productName + } else if (purchaseDetails[ + 0].productSn == + '货号') { + this.carList.get(id) + .productSn = + purchaseDetails[0] + .productName + this.carList.get(id) + .id = + purchaseDetails[0] + .productName + id = purchaseDetails[0] + .productName + } else if (purchaseDetails[ + 0].productSn) { + this.carList.get(id) + .id = + purchaseDetails[0] + .productSn + id = purchaseDetails[0] + .productSn + } + } + }) + if (this.carList.get(id).purchasePrice == + '' || this.carList.get(id) + .purchasePrice == null) { + if (purchaseDetails[0].purchasePrice) { + this.carList.get(id) + .purchasePrice = purchaseDetails[0] + .purchasePrice + } else { + this.carList.get(id) + .purchasePrice = + purchaseDetails[0] + .purchasePrice + } + + } + this.carList.get(id).customerCategoryList = + purchaseDetails[0].customerCategoryRule != null ? this.checkPriceRule(JSON.parse(purchaseDetails[0] + .customerCategoryRule)) : this.getNewProductRule() + if (this.carList.get(id).productPicture == + '') { + this.carList.get(id).productPicture = + purchaseDetails[0].productPicture + } + if (purchaseDetails[0].productId) { + this.carList.get(id).attrId = + purchaseDetails[0].attrId + this.carList.get(id).wholesalePrice = + purchaseDetails[0].wholesalePrice + this.carList.get(id).lsPrice = + purchaseDetails[0].lsPrice + } + + let specMap = + new Map() //新的临时存放值那个更改过的值的map + this.$nextTick(() => { + this.carList.forEach(function( + value, key) { + if (key != value + .id) { + specMap.set( + value + .id, + value) + } else { + specMap.set( + key, + value) + } + }) + this.carList = specMap + }) + this.$nextTick(() => { + console.log('purchaseDetails',purchaseDetails) + for (let j = 0; j 0 + ) { + this.carList.get(id) + .stockLogList.delete( + '{"颜色":"均色","尺码":"均码"}' + ) + } + }) + } + this.$nextTick(() => { - this.AiVoice() + this.getAllPrice() + this.oneGoodsId = '' + this.moreData = [] }) - } else { - this.tui.toast("抱歉:小助手本次未识别到商品信息,请检查识别信息是否正确") + if (purchaseDetails) { + this.moreData = [] + this.carList1.push(item) + this.$nextTick(() => { + this.AiVoice() + }) + + } else { + this.tui.toast("抱歉:小助手本次未识别到商品信息,请检查识别信息是否正确") + } } + } }, //确认语音输入的内容 @@ -1977,8 +2741,11 @@ } this.getMsg = convertedStr let regexCount = /-?\d+/g; - if (this.isQuantityFollowsProductCode(convertedStr) || (convertedStr.indexOf('色') == -1 && convertedStr - .indexOf('码') == -1)) { + if (convertedStr.indexOf('色') == -1 && convertedStr + .indexOf('码') == -1) { + if (!convertedStr.startsWith("货号")) { + convertedStr = "货号" + convertedStr; + } try { console.log('convertedStr', convertedStr) const regex = /货号.*?(?=货号|$)/g; @@ -2065,518 +2832,896 @@ if (res1.code == 200) { let data = { attributeList: '{"颜色":"均色","尺码":"均码"}', - productCount: Number(voiceData.productCount) || + productCount: Number(voiceData + .productCount) || 1, stockCount: null } if (res1.result.stock.length > 0) { - for (let i = 0; i < res1.result.stock.length; i++) { - if (res1.result.stock[i].attributeList == + for (let i = 0; i < res1.result + .stock.length; i++) { + if (res1.result.stock[i] + .attributeList == '{"颜色":"均色","尺码":"均码"}') { - console.log('jinlaile') + console.log('jinlaile') data = { attributeList: '{"颜色":"均色","尺码":"均码"}', - productCount: Number(voiceData - .productCount) || 1, - stockCount: res1.result.stock[i] + productCount: Number( + voiceData + .productCount + ) || 1, + stockCount: res1 + .result.stock[ + i] .stockCount } } } } - if (voiceData.purchasePrice) { - voiceData.purchasePrice = this - .replaceCharAfterNumber(voiceData - .purchasePrice, '块', '.') - if (voiceData.purchasePrice.indexOf('元') != -1) { - voiceData.purchasePrice = voiceData - .purchasePrice.replace(/元/g, '') - } - voiceData.purchasePrice = voiceData.purchasePrice - .replace(/[^0-9.]/g, ""); - + if (voiceData.purchasePrice) { + voiceData.purchasePrice = this + .replaceCharAfterNumber( + voiceData + .purchasePrice, '块', '.') + if (voiceData.purchasePrice + .indexOf('元') != -1) { + voiceData.purchasePrice = + voiceData + .purchasePrice.replace( + /元/g, '') } - if (voiceData.wholesalePrice) { - voiceData.wholesalePrice = this - .replaceCharAfterNumber(voiceData - .wholesalePrice, '块', '.') - if (voiceData.wholesalePrice.indexOf('元') != -1) { - voiceData.wholesalePrice = voiceData - .wholesalePrice.replace(/元/g, '') - } - voiceData.wholesalePrice = voiceData.wholesalePrice - .replace( - /[^0-9.]/g, ""); + voiceData.purchasePrice = voiceData + .purchasePrice + .replace(/[^0-9.]/g, ""); + + } + if (voiceData.wholesalePrice) { + voiceData.wholesalePrice = this + .replaceCharAfterNumber( + voiceData + .wholesalePrice, '块', '.') + if (voiceData.wholesalePrice + .indexOf('元') != -1) { + voiceData.wholesalePrice = + voiceData + .wholesalePrice.replace( + /元/g, '') } - res.result[0].productId = res.result[0].id - res.result[0].stockLogList1 = [] - res.result[0].stockLogList1.push(data) - console.log(res.result) - let purchaseDetails = res.result - if (this.oneGoodsId) { - let id = this.oneGoodsId - if (purchaseDetails.length > 0) { - if (this.carList.get(id).productSn != '') { - for (let j = 0; j < purchaseDetails.length; j++) { - for (let i = 0; i < purchaseDetails[j] - .stockLogList1.length; i++) { - if (this.carList.get(id) - .productName == '') { - this.carList.get(id) - .productName = - purchaseDetails[0] - .productName - } - if (this.carList.get(id).attrId == - '') { - this.carList.get(id).attrId = - purchaseDetails[0].attrId - } - if (this.carList.get(id) - .purchasePrice == '' || this - .carList.get(id) - .purchasePrice == null) { - if (voiceData.purchasePrice) { - this.carList.get(id) - .purchasePrice = - voiceData.purchasePrice - } else { - this.carList.get(id) - .purchasePrice = - purchaseDetails[0] - .purchasePrice - } - - } - if (this.carList.get(id) - .productPicture == '') { - this.carList.get(id) - .productPicture = - purchaseDetails[0] - .productPicture + voiceData.wholesalePrice = + voiceData.wholesalePrice + .replace( + /[^0-9.]/g, ""); + } + res.result[0].productId = res.result[0] + .id + res.result[0].stockLogList1 = [] + res.result[0].stockLogList1.push(data) + console.log(res.result) + let purchaseDetails = res.result + if (this.oneGoodsId) { + let id = this.oneGoodsId + if (purchaseDetails.length > 0) { + if (this.carList.get(id) + .productSn != '') { + for (let j = 0; j < + purchaseDetails + .length; j++) { + for (let i = 0; i < + purchaseDetails[j] + .stockLogList1 + .length; i++) { + if (this.carList + .get(id) + .productName == + '') { + this.carList + .get(id) + .productName = + purchaseDetails[ + 0] + .productName + } + if (this.carList + .get(id) + .attrId == + '') { + this.carList + .get(id) + .attrId = + purchaseDetails[ + 0] + .attrId + } + if (this.carList + .get(id) + .purchasePrice == + '' || this + .carList.get( + id) + .purchasePrice == + null) { + if (voiceData + .purchasePrice + ) { + this.carList + .get( + id) + .purchasePrice = + voiceData + .purchasePrice + } else { + this.carList + .get( + id) + .purchasePrice = + purchaseDetails[ + 0] + .purchasePrice } - console.log('但语音customerCategoryRule',this.carList) - this.carList.get(id) - .customerCategoryRule = - JSON.parse(purchaseDetails[0] - .customerCategoryRule) - purchaseDetails[j].stockLogList1[i] - .name = this.sliceMsg( - purchaseDetails[j] - .stockLogList1[i] - .attributeList) - if (this.carList.get(id) - .stockLogList.size == 0) { - this.carList.get(id) - .stockLogList.set( - purchaseDetails[j] - .stockLogList1[i] - .attributeList, - purchaseDetails[j] - .stockLogList1[i]) + + } + if (this.carList + .get(id) + .productPicture == + '') { + this.carList + .get(id) + .productPicture = + purchaseDetails[ + 0] + .productPicture + } + console.log( + '但语音customerCategoryRule', + this + .carList) + this.carList.get( + id) + .customerCategoryRule = + this.checkPriceRule(JSON.parse(purchaseDetails[0].customerCategoryRule)) + purchaseDetails[j] + .stockLogList1[ + i] + .name = this + .sliceMsg( + purchaseDetails[ + j] + .stockLogList1[ + i] + .attributeList + ) + if (this.carList + .get(id) + .stockLogList + .size == 0) { + this.carList + .get(id) + .stockLogList + .set( + purchaseDetails[ + j] + .stockLogList1[ + i] + .attributeList, + purchaseDetails[ + j] + .stockLogList1[ + i]) + } else { + if (this + .carList + .get(id) + .stockLogList + .has( + purchaseDetails[ + j] + .stockLogList1[ + i] + .attributeList + ) == + true + ) { + this.carList.get(id).stockLogList.get(purchaseDetails[j] + .stockLogList1[i].attributeList).productNum = purchaseDetails[ + j + ] + .stockLogList1[ + i + ].stockCount + + this.carList.get(id).stockLogList.get(purchaseDetails[j] + .stockLogList1[i].attributeList).productCount += + Number( + purchaseDetails[j].stockLogList1[i] + .productCount + ) } else { - if (this.carList.get(id) - .stockLogList.has( - purchaseDetails[j] - .stockLogList1[i] - .attributeList) == true - ) { - this.carList.get(id) - .stockLogList.get( - purchaseDetails[j] - .stockLogList1[i] - .attributeList) - .productCount += - Number(purchaseDetails[ - j] - .stockLogList1[i] - .productCount) - } else { - this.carList.get(id) - .stockLogList.set( - purchaseDetails[j] - .stockLogList1[i] - .attributeList, - purchaseDetails[j] - .stockLogList1[i]) - } + this.carList + .get( + id) + .stockLogList + .set( + purchaseDetails[ + j + ] + .stockLogList1[ + i + ] + .attributeList, + purchaseDetails[ + j + ] + .stockLogList1[ + i + ] + ) } - this.carList.get(id) - .productCount += - Number(purchaseDetails[j] - .stockLogList1[i] - .productCount) } + this.carList.get( + id) + .productCount += + Number( + purchaseDetails[ + j] + .stockLogList1[ + i] + .productCount + ) } - if (this.carList.get(id).stockLogList.get( - '{"颜色":"均色","尺码":"均码"}') - .productCount == 0 && purchaseDetails[ - 0].stockLogList1.length > 0) { - this.carList.get(id).stockLogList - .delete('{"颜色":"均色","尺码":"均码"}') - } - this.carList.get(id).price1 = Number(this - .carList - .get(id).productCount) * this - .carList - .get(id).purchasePrice - } else { - - let isTrue = false - this.carList.forEach(function(value, key) { - if (value.productSn == - purchaseDetails[0] - .productSn) { - isTrue = true - that.tui.toast( - '该货号被页面其他商品占用,请重新输入!' + } + if (this.carList.get(id) + .stockLogList.get( + '{"颜色":"均色","尺码":"均码"}' + ) + .productCount == 0 && + purchaseDetails[ + 0].stockLogList1 + .length > 0) { + this.carList.get(id) + .stockLogList + .delete( + '{"颜色":"均色","尺码":"均码"}' ) - that.carList.get(id) - .productSn = '' - setTimeout(res => { - that.$forceUpdate() - }, 1000) - throw Error('被占用') + } + this.carList.get(id) + .price1 = Number(this + .carList + .get(id) + .productCount) * + this + .carList + .get(id).purchasePrice + } else { + + let isTrue = false + this.carList.forEach( + function(value, + key) { + if (value + .productSn == + purchaseDetails[ + 0] + .productSn + ) { + isTrue = + true + that.tui + .toast( + '该货号被页面其他商品占用,请重新输入!' + ) + that.carList + .get( + id) + .productSn = + '' + setTimeout( + res => { + that.$forceUpdate() + }, + 1000 + ) + throw Error( + '被占用' + ) } }) - - this.$nextTick(() => { - if (this.carList.get(id) - .productName == '') { - this.carList.get(id) - .productName = - purchaseDetails[0] + + this.$nextTick(() => { + if (this + .carList + .get(id) + .productName == + '') { + this.carList + .get( + id) + .productName = + purchaseDetails[ + 0] + .productName + } + this.carList + .get(id) + .customerCategoryList = + purchaseDetails[ + 0] + .customerCategoryRule != + null ? + this.checkPriceRule(JSON.parse( + purchaseDetails[ + 0] + .customerCategoryRule + )) : + null + if (isTrue == + false && + this + .carList + .get(id) + .productSn == + '') { + this.carList + .get( + id) + .productSn = + purchaseDetails[ + 0] + .productSn + } + if (isTrue == + false) { + if (purchaseDetails[ + 0] + .productId + ) { + this.carList + .get( + id + ) + .id = + purchaseDetails[ + 0 + ] + .productId + this.carList + .get( + id + ) + .productId = + purchaseDetails[ + 0 + ] + .productId + this.carList + .get( + id + ) + .isNew = + false + id = purchaseDetails[ + 0 + ] + .productId + + } else if ( + purchaseDetails[ + 0] + .productSn == + '' || + purchaseDetails[ + 0] + .productSn == + null) { + this.carList + .get( + id + ) + .id = + purchaseDetails[ + 0 + ] .productName - } - this.carList.get(id) - .customerCategoryList = - purchaseDetails[0] - .customerCategoryRule != null? - JSON.parse(purchaseDetails[0] - .customerCategoryRule) : null - if (isTrue == false && this - .carList.get(id) - .productSn == '') { - this.carList.get(id) + id = purchaseDetails[ + 0 + ] + .productName + } else if ( + purchaseDetails[ + 0] + .productSn == + '货号') { + this.carList + .get( + id + ) .productSn = - purchaseDetails[0] + purchaseDetails[ + 0 + ] + .productName + this.carList + .get( + id + ) + .id = + purchaseDetails[ + 0 + ] + .productName + id = purchaseDetails[ + 0 + ] + .productName + } else if ( + purchaseDetails[ + 0] + .productSn + ) { + this.carList + .get( + id + ) + .id = + purchaseDetails[ + 0 + ] + .productSn + id = purchaseDetails[ + 0 + ] .productSn } - if (isTrue == false) { - if (purchaseDetails[0] - .productId) { - this.carList.get(id) - .id = - purchaseDetails[0] - .productId - this.carList.get(id) - .productId = - purchaseDetails[0] - .productId - this.carList.get(id) - .isNew = false - id = purchaseDetails[0] - .productId - - } else if (purchaseDetails[ - 0].productSn == - '' || purchaseDetails[ - 0].productSn == - null) { - this.carList.get(id) - .id = - purchaseDetails[0] - .productName - id = purchaseDetails[0] - .productName - } else if (purchaseDetails[ - 0].productSn == - '货号') { - this.carList.get(id) - .productSn = - purchaseDetails[0] - .productName - this.carList.get(id) - .id = - purchaseDetails[0] - .productName - id = purchaseDetails[0] - .productName - } else if (purchaseDetails[ - 0].productSn) { - this.carList.get(id) - .id = - purchaseDetails[0] - .productSn - id = purchaseDetails[0] - .productSn - } - } - }) - if (this.carList.get(id).purchasePrice == - '' || this.carList.get(id) - .purchasePrice == null) { - if (voiceData.purchasePrice) { - this.carList.get(id) - .purchasePrice = voiceData - .purchasePrice - } else { - this.carList.get(id) - .purchasePrice = - purchaseDetails[0] - .purchasePrice - } - - } - this.carList.get(id).customerCategoryList = - purchaseDetails[0].customerCategoryRule != null ? JSON.parse(purchaseDetails[0].customerCategoryRule) : this.customerCategoryList1 - if (this.carList.get(id).productPicture == - '') { - this.carList.get(id).productPicture = - purchaseDetails[0].productPicture } - if (purchaseDetails[0].productId) { - this.carList.get(id).attrId = - purchaseDetails[0].attrId - this.carList.get(id).wholesalePrice = - purchaseDetails[0].wholesalePrice - this.carList.get(id).lsPrice = - purchaseDetails[0].lsPrice + }) + if (this.carList.get(id) + .purchasePrice == + '' || this.carList.get( + id) + .purchasePrice == null + ) { + if (voiceData + .purchasePrice) { + this.carList.get( + id) + .purchasePrice = + voiceData + .purchasePrice + } else { + this.carList.get( + id) + .purchasePrice = + purchaseDetails[ + 0] + .purchasePrice } - - let specMap = - new Map() //新的临时存放值那个更改过的值的map - this.$nextTick(() => { - this.carList.forEach(function( - value, key) { - if (key != value - .id) { - specMap.set( + + } + this.carList.get(id) + .customerCategoryList = + purchaseDetails[0] + .customerCategoryRule != + null ? this.checkPriceRule(JSON.parse( + purchaseDetails[0] + .customerCategoryRule + )) : this.getNewProductRule() + if (this.carList.get(id) + .productPicture == + '') { + this.carList.get(id) + .productPicture = + purchaseDetails[0] + .productPicture + } + if (purchaseDetails[0] + .productId) { + this.carList.get(id) + .attrId = + purchaseDetails[0] + .attrId + this.carList.get(id) + .wholesalePrice = + purchaseDetails[0] + .wholesalePrice + this.carList.get(id) + .lsPrice = + purchaseDetails[0] + .lsPrice + } + + let specMap = + new Map() //新的临时存放值那个更改过的值的map + this.$nextTick(() => { + this.carList + .forEach( + function( + value, + key + ) { + if (key != value - .id, - value) - } else { - specMap.set( - key, - value) - } - }) - this.carList = specMap - }) - this.$nextTick(() => { - for (let j = 0; j < - purchaseDetails.length; j++ - ) { - for (let i = 0; i < - purchaseDetails[j] - .stockLogList1 - .length; i++) { - purchaseDetails[j] - .stockLogList1[i] - .name = this - .sliceMsg( + .id + ) { + specMap + .set( + value + .id, + value + ) + } else { + specMap + .set( + key, + value + ) + } + }) + this.carList = + specMap + }) + this.$nextTick(() => { + for (let j = + 0; j < + purchaseDetails + .length; j++ + ) { + for (let i = + 0; i < + purchaseDetails[ + j] + .stockLogList1 + .length; i++ + ) { + purchaseDetails + [j] + .stockLogList1[ + i + ] + .name = + this + .sliceMsg( + purchaseDetails[ + j + ] + .stockLogList1[ + i + ] + .attributeList + ) + if (this + .carList + .get( + id + ) + .stockLogList + .size == + 0 + ) { + this.carList + .get( + id + ) + .stockLogList + .set( purchaseDetails[ - j] + j + ] .stockLogList1[ - i] - .attributeList) - if (this.carList.get( - id) - .stockLogList - .size == 0) { - this.carList.get( - id) + i + ] + .attributeList, + purchaseDetails[ + j + ] + .stockLogList1[ + i + ] + ) + } else { + if (this.carList.get(id).stockLogList.has(purchaseDetails[ + j + ] + .stockLogList1[ + i + ] + .attributeList + ) == + true + ) { + this.carList + .get( + id + ) .stockLogList - .set( + .get( purchaseDetails[ - j] + j + ] .stockLogList1[ - i] - .attributeList, - purchaseDetails[ - j] + i + ] + .attributeList + ).productNum = purchaseDetails[ + j + ] .stockLogList1[ - i]) - } else { - if (this.carList - .get(id) + i + ].stockCount + + + this.carList + .get( + id + ) .stockLogList - .has( + .get( purchaseDetails[ - j] + j + ] .stockLogList1[ - i] + i + ] .attributeList - ) == true - ) { - this.carList - .get(id) - .stockLogList - .get( - purchaseDetails[ - j] - .stockLogList1[ - i] - .attributeList + ) + .productCount += + Number( + purchaseDetails[ + j + ] + .stockLogList1[ + i + ] + .productCount + ) + } else { + this.carList + .get( + id ) - .productCount += - Number( - purchaseDetails[ - j] - .stockLogList1[ - i] - .productCount + .stockLogList + .set( + purchaseDetails[ + j + ] + .stockLogList1[ + i + ] + .attributeList, + purchaseDetails[ + j + ] + .stockLogList1[ + i + ] ) - } else { - this.carList - .get(id) - .stockLogList - .set( - purchaseDetails[ - j] - .stockLogList1[ - i] - .attributeList, - purchaseDetails[ - j] - .stockLogList1[ - i]) - } } - this.carList.get(id) - .productCount += - Number( - purchaseDetails[ - j] - .stockLogList1[ - i] - .productCount) } + this.carList + .get( + id + ) + .productCount += + Number( + purchaseDetails[ + j + ] + .stockLogList1[ + i + ] + .productCount + ) } - this.carList.get(id).price1 = - Number(this.carList.get(id) - .productCount) * this - .carList.get(id) - .purchasePrice - if (this.carList.get(id) - .stockLogList.get( + } + this.carList + .get(id) + .price1 = + Number(this + .carList + .get( + id) + .productCount + ) * + this + .carList + .get(id) + .purchasePrice + if (this + .carList + .get(id) + .stockLogList + .get( + '{"颜色":"均色","尺码":"均码"}' + ) + .productCount == + 0 && + purchaseDetails[ + 0] + .stockLogList1 + .length > 0 + ) { + this.carList + .get( + id) + .stockLogList + .delete( '{"颜色":"均色","尺码":"均码"}' - ).productCount == 0 && - purchaseDetails[0] - .stockLogList1.length > 0 - ) { - this.carList.get(id) - .stockLogList.delete( - '{"颜色":"均色","尺码":"均码"}' - ) - } - }) - } - - this.$nextTick(() => { - this.getAllPrice() - this.oneGoodsId = '' + ) + } }) - } else { - this.tui.toast("抱歉:小助手本次未识别到商品信息,请检查识别信息是否正确") } + + this.$nextTick(() => { + this.getAllPrice() + this.oneGoodsId = + '' + }) } else { - for (let i = 0; i < purchaseDetails.length; i++) { - let data1 = { - id: "", - price: purchaseDetails[i].price, - productCount: 0, - customerCategoryList:purchaseDetails[i].customerCategoryRule != null?JSON.parse(purchaseDetails[i].customerCategoryRule) : this.customerCategoryList1, - attrId: purchaseDetails[i].attrId, - categoryId: purchaseDetails[i] - .categoryId == '' ? this - .categoryList.categoryId : - purchaseDetails[i].categoryId, - categoryName: purchaseDetails[i] - .categoryName == '' ? this - .categoryList.categoryName : - purchaseDetails[i].categoryName, - wholesalePrice: voiceData - .wholesalePrice ? voiceData - .wholesalePrice : purchaseDetails[ - i].wholesalePrice, - purchasePrice: voiceData - .purchasePrice ? voiceData - .purchasePrice : purchaseDetails[i] - .purchasePrice, - isNew: purchaseDetails[i].productId == - null ? true : false, - productId: purchaseDetails[i] - .productId, - productName: purchaseDetails[i] - .productName, - productSn: purchaseDetails[i] - .productSn, - productPicture: purchaseDetails[i] - .productPicture, - supplierName: purchaseDetails[i] - .supplierName, - productPictures: [], - saleDetailQueryDTO: [] - } - if (purchaseDetails[i].productId) { - data1.id = purchaseDetails[i].productId - } else if (purchaseDetails[i].productSn == - '' || purchaseDetails[i].productSn == - null) { - data1.id = purchaseDetails[i].productName - } else if (purchaseDetails[i].productSn == - '货号') { - data1.productSn = purchaseDetails[i] - .productName - data1.id = purchaseDetails[i].productName - } else if (purchaseDetails[i].productSn) { - data1.id = purchaseDetails[i].productSn - } - for (let m = 0; m < purchaseDetails[i] - .stockLogList1.length; m++) { - let list = { - attributeList: this.getAttribute( - purchaseDetails[i] - .stockLogList1[m] - .attributeList), - productCount: Number( - purchaseDetails[i] - .stockLogList1[m] - .productCount) || - Number(purchaseDetails[i] - .stockLogList1[m] - .productCounts), - productNum: purchaseDetails[i] - .stockLogList1[m].stockCount, - name: this.sliceMsg(this + this.tui.toast( + "抱歉:小助手本次未识别到商品信息,请检查识别信息是否正确" + ) + } + } else { + for (let i = 0; i < purchaseDetails + .length; i++) { + let data1 = { + id: "", + price: purchaseDetails[ + i].price, + productCount: 0, + customerCategoryList: purchaseDetails[ + i] + .customerCategoryRule != + null ? this.checkPriceRule(JSON.parse( + purchaseDetails[ + i] + .customerCategoryRule + )) : this.getNewProductRule(), + attrId: purchaseDetails[ + i].attrId, + categoryId: purchaseDetails[ + i] + .categoryId == '' ? + this + .categoryList + .categoryId : + purchaseDetails[i] + .categoryId, + categoryName: purchaseDetails[ + i] + .categoryName == + '' ? this + .categoryList + .categoryName : + purchaseDetails[i] + .categoryName, + wholesalePrice: voiceData + .wholesalePrice ? + voiceData + .wholesalePrice : + purchaseDetails[ + i] + .wholesalePrice, + purchasePrice: voiceData + .purchasePrice ? + voiceData + .purchasePrice : + purchaseDetails[i] + .purchasePrice, + isNew: purchaseDetails[ + i].productId == + null ? true : + false, + productId: purchaseDetails[ + i] + .productId, + productName: purchaseDetails[ + i] + .productName, + productSn: purchaseDetails[ + i] + .productSn, + productPicture: purchaseDetails[ + i] + .productPicture, + supplierName: purchaseDetails[ + i] + .supplierName, + productPictures: [], + saleDetailQueryDTO: [] + } + if (purchaseDetails[i] + .productId) { + data1.id = purchaseDetails[ + i].productId + } else if (purchaseDetails[i] + .productSn == + '' || purchaseDetails[i] + .productSn == + null) { + data1.id = purchaseDetails[ + i].productName + } else if (purchaseDetails[i] + .productSn == + '货号') { + data1.productSn = + purchaseDetails[i] + .productName + data1.id = purchaseDetails[ + i].productName + } else if (purchaseDetails[i] + .productSn) { + data1.id = purchaseDetails[ + i].productSn + } + for (let m = 0; m < + purchaseDetails[i] + .stockLogList1.length; m++ + ) { + let list = { + attributeList: this + .getAttribute( + purchaseDetails[ + i] + .stockLogList1[ + m] + .attributeList + ), + productCount: Number( + purchaseDetails[ + i] + .stockLogList1[ + m] + .productCount + ) || + Number( + purchaseDetails[ + i] + .stockLogList1[ + m] + .productCounts + ), + productNum: purchaseDetails[ + i] + .stockLogList1[ + m] + .stockCount, + name: this + .sliceMsg(this .getAttribute( - purchaseDetails[i] - .stockLogList1[m] - .attributeList)), - price: purchaseDetails[i] - .stockLogList1[m].purchasePrice - } - data1.productCount += Number( - purchaseDetails[i] - .stockLogList1[m].productCount) - data1.saleDetailQueryDTO.push(list) + purchaseDetails[ + i] + .stockLogList1[ + m] + .attributeList + )), + price: purchaseDetails[ + i] + .stockLogList1[ + m] + .purchasePrice } - this.carList1.push(data1) - } - if (i == convertedStr.length - 1) { - this.$nextTick(() => { - setTimeout(res => { - this.AiVoice() - }, 300) - }) + data1.productCount += + Number( + purchaseDetails[i] + .stockLogList1[m] + .productCount) + data1.saleDetailQueryDTO + .push(list) } + this.carList1.push(data1) + } + if (i == convertedStr.length - 1) { + this.$nextTick(() => { + setTimeout(res => { + this.AiVoice() + }, 300) + }) } + } } else { this.tui.toast(res1.message) } }).catch((res) => {}) - + } else { this.voiceText = '' this.voiceText1 = '' @@ -2610,8 +3755,10 @@ .replace(/[^0-9.]/g, ""); } let data = { - id: voiceData.productSn ? voiceData.productSn : generateUUID(), - productCount: Number(voiceData.productCount) || 0, + id: voiceData.productSn ? voiceData.productSn : + generateUUID(), + productCount: Number(voiceData.productCount) || + 0, productName: voiceData.productName, productSn: voiceData.productSn, categoryId: this.categoryList.categoryId, @@ -2620,7 +3767,8 @@ wholesalePrice: voiceData.wholesalePrice || 0, stockLogList1: [{ attributeList: '{"颜色":"均色","尺码":"均码"}', - productCount: Number(voiceData.productCount) || 1, + productCount: Number(voiceData + .productCount) || 1, stockCount: null }] } @@ -2633,26 +3781,57 @@ if (this.carList.get(id).productSn != '') { for (let j = 0; j < purchaseDetails .length; j++) { - for (let i = 0; i < purchaseDetails[j].stockLogList1.length; i++) { - if (this.carList.get(id).productName == '') { - this.carList.get(id).productName = purchaseDetails[0].productName + for (let i = 0; i < purchaseDetails[j] + .stockLogList1.length; i++) { + if (this.carList.get(id) + .productName == '') { + this.carList.get(id) + .productName = + purchaseDetails[0] + .productName } - if (this.carList.get(id).productSn == '') { - this.carList.get(id).productSn = purchaseDetails[0].productSn + if (this.carList.get(id) + .productSn == '') { + this.carList.get(id) + .productSn = + purchaseDetails[0] + .productSn } - if (this.carList.get(id).attrId =='') { - this.carList.get(id).attrId =purchaseDetails[0].attrId + if (this.carList.get(id).attrId == + '') { + this.carList.get(id).attrId = + purchaseDetails[0].attrId } - if (this.carList.get(id).wholesalePrice == '' || this.carList.get(id).wholesalePrice == null) { - this.carList.get(id).wholesalePrice =purchaseDetails[0].wholesalePrice + if (this.carList.get(id) + .wholesalePrice == '' || this + .carList.get(id) + .wholesalePrice == null) { + this.carList.get(id) + .wholesalePrice = + purchaseDetails[0] + .wholesalePrice } - if (this.carList.get(id).purchasePrice == '' || this.carList.get(id).purchasePrice == null) { - this.carList.get(id).purchasePrice =purchaseDetails[0].purchasePrice + if (this.carList.get(id) + .purchasePrice == '' || this + .carList.get(id) + .purchasePrice == null) { + this.carList.get(id) + .purchasePrice = + purchaseDetails[0] + .purchasePrice } - if (this.carList.get(id).productPicture == '') { - this.carList.get(id).productPicture =purchaseDetails[0].productPicture + if (this.carList.get(id) + .productPicture == '') { + this.carList.get(id) + .productPicture = + purchaseDetails[0] + .productPicture } - purchaseDetails[j].stockLogList1[i].name = this.sliceMsg(purchaseDetails[j].stockLogList1[i].attributeList) + purchaseDetails[j].stockLogList1[i] + .name = this.sliceMsg( + purchaseDetails[j] + .stockLogList1[i] + .attributeList) if (this.carList.get(id) .stockLogList.size == 0) { this.carList.get(id) @@ -2745,21 +3924,48 @@ .productSn } if (isTrue == false) { - if (purchaseDetails[0].productId) { - this.carList.get(id).id =purchaseDetails[0].productId - this.carList.get(id).isNew = false - id = purchaseDetails[0].productId - } else if (purchaseDetails[0].productSn == '' || purchaseDetails[0].productSn ==null) { - this.carList.get(id).id = purchaseDetails[0].productName - id = purchaseDetails[0].productName - } else if (purchaseDetails[0].productSn == '货号') { - this.carList.get(id).productSn = - purchaseDetails[0].productName - this.carList.get(id).id = purchaseDetails[0].productName - id = purchaseDetails[0].productName - } else if (purchaseDetails[0].productSn) { - this.carList.get(id).id = purchaseDetails[0].productSn - id = purchaseDetails[0].productSn + if (purchaseDetails[0] + .productId) { + this.carList.get(id) + .id = + purchaseDetails[0] + .productId + this.carList.get(id) + .isNew = false + id = purchaseDetails[0] + .productId + } else if (purchaseDetails[ + 0].productSn == + '' || purchaseDetails[ + 0].productSn == + null) { + this.carList.get(id) + .id = + purchaseDetails[0] + .productName + id = purchaseDetails[0] + .productName + } else if (purchaseDetails[ + 0].productSn == + '货号') { + this.carList.get(id) + .productSn = + purchaseDetails[0] + .productName + this.carList.get(id) + .id = + purchaseDetails[0] + .productName + id = purchaseDetails[0] + .productName + } else if (purchaseDetails[ + 0].productSn) { + this.carList.get(id) + .id = + purchaseDetails[0] + .productSn + id = purchaseDetails[0] + .productSn } } }) @@ -2786,11 +3992,18 @@ let specMap = new Map() //新的临时存放值那个更改过的值的map this.$nextTick(() => { - this.carList.forEach(function(value, key) { - if (key != value.id) { - specMap.set(value.id,value) + this.carList.forEach(function( + value, key) { + if (key != value + .id) { + specMap.set( + value + .id, + value) } else { - specMap.set(key,value) + specMap.set( + key, + value) } }) this.carList = specMap @@ -3041,9 +4254,30 @@ this.$refs.popup.close() this.$refs.voiceBottomPopup.close() } catch (e) { - await this.tui.request("/purchaseOcrPicture/callWithMessageOfPurchase", "POST", { - questionMsg: this.getMsg - }, false, true).then((res) => { + if (this.getMsg.indexOf('色,') != -1) { + this.getMsg = this.getMsg.replace(/色,/g, '色') + } + if (this.getMsg.indexOf('色') != -1) { + this.getMsg = this.getMsg.replace(/色/g, '色、') + } + if (this.getMsg.indexOf('件,') != -1) { + this.getMsg = this.getMsg.replace(/件,/g, '件') + } + if (this.getMsg.indexOf('件') != -1) { + this.getMsg = this.getMsg.replace(/件/g, '件,') + } + let callObj + if(this.oneGoodsId !='' && !this.carList.get(this.oneGoodsId).isNew){ + callObj = { + productId:this.carList.get(this.oneGoodsId).productId, + questionMsg: this.getMsg + } + }else{ + callObj = { + questionMsg: this.getMsg + } + } + await this.tui.request("/purchaseOcrPicture/callWithMessageOfPurchase", "POST", callObj, false, true).then((res) => { if (res.code == 200) { this.voiceText = '' this.voiceText1 = '' @@ -3098,8 +4332,10 @@ } purchaseDetails[j].stockLogList1[i].name = this.sliceMsg( purchaseDetails[j].stockLogList1[i].attributeList) - purchaseDetails[j].stockLogList1[i].productNum = - purchaseDetails[j].stockLogList1[i].stock + this.carList.get(id).stockLogList.get( + purchaseDetails[j].stockLogList1[i] + .attributeList).productNum = + purchaseDetails[j].stockLogList1[i].stockCount if (this.carList.get(id).stockLogList.size == 0) { this.carList.get(id).stockLogList.set(purchaseDetails[ j].stockLogList1[i].attributeList, @@ -3154,7 +4390,8 @@ this.carList.get(id).productName = purchaseDetails[ 0].productName } - this.carList.get(id).customerCategoryList = JSON.parse(purchaseDetails[0].customerCategoryRule) + this.carList.get(id).customerCategoryList = this.checkPriceRule(JSON.parse( + purchaseDetails[0].customerCategoryRule)) if (isTrue == false && this.carList.get(id) .productSn == '') { this.carList.get(id).productSn = purchaseDetails[0] @@ -3222,11 +4459,13 @@ i].attributeList) if (this.carList.get(id).stockLogList.size == 0) { + purchaseDetails[j].stockLogList1[i].productNum = purchaseDetails[j].stockLogList1[i].stockCount this.carList.get(id).stockLogList.set( purchaseDetails[j].stockLogList1[i] .attributeList, purchaseDetails[j] .stockLogList1[i]) } else { + if (this.carList.get(id).stockLogList.has( purchaseDetails[j].stockLogList1[i] .attributeList) == true) { @@ -3237,6 +4476,10 @@ Number(purchaseDetails[j] .stockLogList1[i] .productCount) + this.carList.get(id).stockLogList.get( + purchaseDetails[j].stockLogList1[i] + .attributeList).productNum = purchaseDetails[j] + .stockLogList1[i].stockCount } else { this.carList.get(id).stockLogList.set( purchaseDetails[j] @@ -3244,6 +4487,11 @@ .attributeList, purchaseDetails[j] .stockLogList1[i]) + this.carList.get(id).stockLogList.get( + purchaseDetails[j].stockLogList1[i] + .attributeList).productNum = this.carList.get(id).stockLogList.get( + purchaseDetails[j].stockLogList1[i] + .attributeList).stockCount } } this.carList.get(id).productCount += @@ -3278,7 +4526,9 @@ price: purchaseDetails[i].price, productCount: 0, attrId: purchaseDetails[i].attrId, - customerCategoryList:purchaseDetails[i].customerCategoryRule == null ? this.customerCategoryList1 : JSON.parse(purchaseDetails[i].customerCategoryRule), + customerCategoryList: purchaseDetails[i] + .customerCategoryRule == null ? this.getNewProductRule() : this.checkPriceRule(JSON.parse(purchaseDetails[i] + .customerCategoryRule)), categoryId: purchaseDetails[i].categoryId == '' ? this .categoryList.categoryId : purchaseDetails[i].categoryId, categoryName: purchaseDetails[i].categoryName == '' ? this @@ -3347,9 +4597,31 @@ }) } } else { - await this.tui.request("/purchaseOcrPicture/callWithMessageOfPurchase", "POST", { - questionMsg: this.getMsg - }, false, true).then((res) => { + if (this.getMsg.indexOf('色,') != -1) { + this.getMsg = this.getMsg.replace(/色,/g, '色') + } + if (this.getMsg.indexOf('色') != -1) { + this.getMsg = this.getMsg.replace(/色/g, '色、') + } + if (this.getMsg.indexOf('件,') != -1) { + this.getMsg = this.getMsg.replace(/件,/g, '件') + } + if (this.getMsg.indexOf('件') != -1) { + this.getMsg = this.getMsg.replace(/件/g, '件,') + } + let callObj + if(this.oneGoodsId !='' && !this.carList.get(this.oneGoodsId).isNew){ + callObj = { + productId:this.carList.get(this.oneGoodsId).productId, + questionMsg: this.getMsg + } + }else{ + callObj = { + questionMsg: this.getMsg + } + } + console.log('oneGoodsId',this.oneGoodsId) + await this.tui.request("/purchaseOcrPicture/callWithMessageOfPurchase", "POST", callObj, false, true).then((res) => { if (res.code == 200) { this.voiceText = '' this.voiceText1 = '' @@ -3402,7 +4674,7 @@ } purchaseDetails[j].stockLogList1[i].name = this.sliceMsg( purchaseDetails[j].stockLogList1[i].attributeList) - purchaseDetails[j].stockLogList1[i].productNum = + purchaseDetails[j].stockLogList1[i].productNum = purchaseDetails[j].stockLogList1[i].stockCount if (this.carList.get(id).stockLogList.size == 0) { this.carList.get(id).stockLogList.set(purchaseDetails[j] @@ -3495,8 +4767,9 @@ this.carList.get(id).purchasePrice = purchaseDetails[0] .purchasePrice } - this.carList.get(id).customerCategoryList = JSON.parse(purchaseDetails[0] - .customerCategoryRule) + this.carList.get(id).customerCategoryList = this.checkPriceRule(JSON.parse(purchaseDetails[ + 0].customerCategoryRule)) + console.log("1111") if (this.carList.get(id).wholesalePrice == '' || this.carList.get(id) .wholesalePrice == null) { this.carList.get(id).wholesalePrice = purchaseDetails[0] @@ -3538,6 +4811,8 @@ .attributeList, purchaseDetails[j] .stockLogList1[i]) } else { + console.log(this.carList) + if (this.carList.get(id).stockLogList.has( purchaseDetails[j].stockLogList1[i] .attributeList) == true) { @@ -3547,11 +4822,19 @@ Number(purchaseDetails[j] .stockLogList1[i] .productCount) + this.carList.get(id).stockLogList.get( + purchaseDetails[j].stockLogList1[i] + .attributeList).productNum = purchaseDetails[j].stockLogList1[i].stockCount } else { this.carList.get(id).stockLogList.set( purchaseDetails[j].stockLogList1[i] .attributeList, purchaseDetails[j] .stockLogList1[i]) + this.carList.get(id).stockLogList.get( + purchaseDetails[j].stockLogList1[i] + .attributeList).productNum = this.carList.get(id).stockLogList.get( + purchaseDetails[j].stockLogList1[i] + .attributeList).stockCount } } this.carList.get(id).productCount += @@ -3568,12 +4851,11 @@ '{"颜色":"均色","尺码":"均码"}') } }) + this.$nextTick(() => { + this.getAllPrice() + this.oneGoodsId = '' + }) } - console.log('carList', this.carList) - this.$nextTick(() => { - this.getAllPrice() - this.oneGoodsId = '' - }) } else { this.tui.toast("抱歉:小助手本次未识别到商品信息,请检查识别信息是否正确") } @@ -3584,7 +4866,9 @@ price: purchaseDetails[i].price, productCount: 0, attrId: purchaseDetails[i].attrId, - customerCategoryList:purchaseDetails[i].customerCategoryRule == null ? this.customerCategoryList1 : JSON.parse(purchaseDetails[i].customerCategoryRule), + customerCategoryList: purchaseDetails[i].customerCategoryRule == + null ? this.getNewProductRule() : this.checkPriceRule(JSON.parse(purchaseDetails[ + i].customerCategoryRule)), categoryId: purchaseDetails[i].categoryId == '' ? this.categoryList .categoryId : purchaseDetails[i].categoryId, categoryName: purchaseDetails[i].categoryName == '' ? this @@ -3600,6 +4884,7 @@ productPictures: [], saleDetailQueryDTO: [] } + if (purchaseDetails[i].productId) { data.id = purchaseDetails[i].productId } else if (purchaseDetails[i].productSn == '' || purchaseDetails[i] @@ -3652,13 +4937,36 @@ } }, + checkPriceRule(ruleArr){ + + if(this.customerCategoryList1 != '' && this.customerCategoryList1 != null){ + if(ruleArr==null){ + ruleArr = [] + } + for(let i=0;i { this.tui.request('/app/product/getShareList', "post", { categoryId: "", pageNum: 1, - pageSize: '10', + pageSize: '1000', searchStr: oneData.productSn }, false, false).then((res) => { if (res.code == 200) { @@ -3711,12 +5019,13 @@ purchaseDetails[0] .productName } - + this.carList.get(id).customerCategoryList = purchaseDetails[0] - .customerCategoryRule != null ?JSON.parse(purchaseDetails[0] - .customerCategoryRule) : this.customerCategoryList1 - + .customerCategoryRule != null ? this.checkPriceRule(JSON.parse( + purchaseDetails[0] + .customerCategoryRule)) : this.getNewProductRule() + if (this.carList.get(id).attrId == '') { this.carList.get(id).attrId = purchaseDetails[0].attrId @@ -3835,6 +5144,8 @@ this.carList.get(id).id = purchaseDetails[0] .productId + this.carList.get(id).productId = + purchaseDetails[0].productId this.carList.get(id).isNew = false id = purchaseDetails[0].productId } else if (purchaseDetails[0] @@ -3972,6 +5283,9 @@ .get(id).productCount) * this .carList.get(id) .purchasePrice + this.carList.get(id).stockLogList.get( + '{"颜色":"均色","尺码":"均码"}') + .productNum = purchaseDetails[0].defaultStockCount if (this.carList.get(id).stockLogList.get( '{"颜色":"均色","尺码":"均码"}') .productCount == 0 && @@ -3998,7 +5312,9 @@ price: purchaseDetails[0].price, productCount: 0, attrId: purchaseDetails[0].attrId, - customerCategoryList: purchaseDetails[0].customerCategoryRule != null ? JSON.parse(purchaseDetails[0].customerCategoryRule): this.customerCategoryList1, + customerCategoryList: purchaseDetails[0] + .customerCategoryRule != null ? this.checkPriceRule(JSON.parse( + purchaseDetails[0].customerCategoryRule)) : this.getNewProductRule(), categoryId: purchaseDetails[0].categoryId == '' ? this .categoryList @@ -4045,7 +5361,7 @@ Number(purchaseDetails[0].saleDetailQueryDTO[0] .productCounts), productNum: purchaseDetails[0].saleDetailQueryDTO[0] - .stockCount, + .stockCount, name: this.sliceMsg(this.getAttribute( purchaseDetails[0] .saleDetailQueryDTO[0] @@ -4084,8 +5400,7 @@ this.$refs.voiceBottomPopup.close() if (oneData.productCount) { - oneData.productCount = Number(oneData.productCount - .replace(/[^0-9]/g, "")); + oneData.productCount = Number(oneData.productCount); } let data = { id: oneData.productSn, @@ -4093,7 +5408,7 @@ 0, productName: oneData.productName, productSn: oneData.productSn, - customerCategoryList: this.customerCategoryList1, + customerCategoryList: this.getNewProductRule(), categoryId: this.categoryList .categoryId, categoryName: this.categoryList @@ -4138,12 +5453,12 @@ purchaseDetails[ 0].attrId } - - this.carList.get(id) - .customerCategoryList = - purchaseDetails[ - 0].customerCategoryList - + + this.carList.get(id) + .customerCategoryList = + purchaseDetails[ + 0].customerCategoryList + if (this.carList.get(id) .purchasePrice == '' || this.carList.get( @@ -4282,12 +5597,12 @@ 0] .productName } - - this.carList.get(id) - .customerCategoryList = - purchaseDetails[0] - .customerCategoryList - + + this.carList.get(id) + .customerCategoryList = + purchaseDetails[0] + .customerCategoryList + if (isTrue == false && this.carList.get( id) @@ -4580,7 +5895,7 @@ productCount: 0, attrId: purchaseDetails[i] .attrId, - customerCategoryList:purchaseDetails[i] + customerCategoryList: purchaseDetails[i] .customerCategoryList, categoryId: purchaseDetails[i] .categoryId == '' ? this @@ -5657,6 +6972,9 @@ '世间': '10件', '实践': '10件', '实件': '10件', + '实价': '10件', + '议价': '1件', + '衣架': '1件', '景': '#', '警': '#', '颈': '#', @@ -5678,7 +6996,7 @@ }; const regex = - /(幺|零|一|二|两|三|四|五|六|七|八|九|杠|刚|军色|叉|井|时间|事件|世间|实践|实件|景|警|颈|括号|名城|名程|名成|明城|上移|时1|时2|时3|时4|时5|时6|时7|时8|时9)/g; + /(幺|零|一|二|两|三|四|五|六|七|八|九|杠|刚|军色|叉|井|时间|衣架|议价|实价|事件|世间|实践|实件|景|警|颈|括号|名城|名程|名成|明城|上移|时1|时2|时3|时4|时5|时6|时7|时8|时9)/g; return str.replace(regex, match => chineseNumToArabic[match]); }, //合并已有 @@ -6155,7 +7473,7 @@ productId: "", productName: "", wholesalePrice: 0, - customerCategoryList:this.customerCategoryList1, + customerCategoryList: this.getNewProductRule(), lsprice: 0, isNew: true, productPictures: [], @@ -6164,7 +7482,6 @@ stockLogList: new Map(), stockLogList1: [] } - let key = '{"颜色":"均色","尺码":"均码"}' let value = { name: '均色/均码', @@ -6172,10 +7489,28 @@ } obj.stockLogList.set(key, value) this.carList.set(obj.id, obj) - console.log('111',this.carList) + console.log('111', this.carList) this.$forceUpdate() uni.hideLoading() }, + getNewProductRule(){ + let arr = [] + console.log('customerCategoryList1',this.customerCategoryList1) + if(this.customerCategoryList1 != null && this.customerCategoryList1 != ''){ + for(let i=0;i - + @@ -435,7 +435,7 @@ typeItem: {}, arrtChange: [], categoryId: '', - dataList: [], + dataList: {}, zPrice: 0, type: 'add', customerCategoryList:[], @@ -513,8 +513,10 @@ if (this.typeItem) { this.formData.categoryId = this.typeItem.id } + }, onLoad(option) { + this.getCustomerCategoryList() if (option.dataList) { this.dataList = JSON.parse(option.dataList) this.tui.request("/app/product/getById/" + this.dataList.id, "POST", { @@ -522,13 +524,15 @@ }, false, true).then((res) => { if (res.code == 200) { this.type = 'edit' - this.customerCategoryList = JSON.parse(res.result.customerCategoryRule) + this.customerCategoryList = this.checkPriceRule((res.result.customerCategoryRule != '' && res.result.customerCategoryRule != null)? JSON.parse(res.result.customerCategoryRule): null) console.log('customerCategoryList',this.customerCategoryList) this.formData.attrId = res.result.attrId this.formData.productName = res.result.productName this.formData.barcode = res.result.barcode this.formData.price = res.result.price this.formData.productSn = res.result.productSn + this.formData.stockCount = this.dataList.stockCount + this.formData.minusStockCount = this.dataList.minusStockCount this.formData.purchasePrice = res.result.purchasePrice this.oldPurchasePrice = res.result.purchasePrice this.formData.wholesalePrice = res.result.wholesalePrice @@ -543,8 +547,6 @@ this.tui.toast(res.message) } }).catch((res) => {}) - }else{ - this.getCustomerCategoryList() } this.userType = uni.getStorageSync('type') @@ -752,7 +754,14 @@ } }, addCustomPrice(){ - this.$refs.customPopup.open() + if(this.customerCategoryList == null){ + uni.navigateTo({ + url: '/package1/index/customClassList' + }) + }else{ + this.$refs.customPopup.open() + } + }, generateSn(value) { this.tui.request("/app/productSn/getNewProductSn", "POST", { @@ -782,6 +791,31 @@ this.$refs.customPopup.close() this.$forceUpdate() }, + checkPriceRule(ruleArr){ + if(ruleArr != null && ruleArr != ''){ + if(this.customerCategoryList != '' && this.customerCategoryList != null){ + let categorySon = [] + for(let i=0;i { - if (res1.code == 200) { - if (res1.result != '') { - this.tui.toast('当前货号已被商品:“' + res1.result[0].productName + '”占用,请重新输入') - this.formData.productSn = '' + if(this.formData.productSn != '' && this.dataList.productSn != this.formData.productSn){ + this.tui.request('/app/product/getByProductSn', "post", { + productSn: this.formData.productSn + }, false, true).then((res1) => { + if (res1.code == 200) { + if (res1.result != '') { + this.tui.toast('当前货号已被商品:“' + res1.result[0].productName + '”占用,请重新输入') + this.formData.productSn = '' + } + } - - } - }) + }) + } }, ejectRuleSelect() { - if (this.dataList != '') { + if (this.dataList.id) { //颜色 for (let m = 0; m < this.multipleList[0].productAttributeValueVoList.length; m++) { let isTrue = true @@ -1064,7 +1100,7 @@ } this.$nextTick(() => { this.oldMultipleList = this.multipleList - if (this.dataList == '') { + if (this.dataList.id) { this.multipleList = [] } this.$refs.addTypeDialog.open('bottom') @@ -1075,7 +1111,7 @@ let that = this; let url = '' this.$refs.form.validate().then(res => { - if (that.dataList != '') { + if (that.dataList.id) { url = '/app/product/edit' this.formData.id = that.dataList.id this.formData.stockCount = that.dataList.stockCount @@ -1112,7 +1148,7 @@ console.log('purchasePrice', this.formData) that.tui.request(url, "post", this.formData, false, false).then((res1) => { if (res1.code == 200) { - if (that.dataList != '') { //编辑商品 + if (that.dataList.id) { //编辑商品 let pages = getCurrentPages(); let prevPage = pages[pages.length - 3]; let shopList = prevPage.$vm.shopList diff --git a/package1/inventory/inventoryConfirm.vue b/package1/inventory/inventoryConfirm.vue index 0473815..88baf07 100644 --- a/package1/inventory/inventoryConfirm.vue +++ b/package1/inventory/inventoryConfirm.vue @@ -126,6 +126,7 @@ purchaseDetails:'', aiinventory:0, //1是AI入库 0是普通入库 2采购退货 userType:1, + claerSubmitBtn:0, leijiqiankuan:0, zhiqianqiankuan:0, yuedikou:0 @@ -178,52 +179,58 @@ this.leijiqiankuan = option.leijiqiankuan }, methods: { - inventorySubmit() { - let url; - uni.showLoading({ - title: '加载中...' - }) - if(this.aiinventory == 1){ - url = '/app/stock/putInPriceOfAi' - for(let i=0;i{ + + this.purchase.balanceDeductionAmount = this.yuedikou + this.tui.request(url, "post", { + purchase: this.purchase, + purchaseDetails: this.purchaseDetails + }, false, false).then((res) => { + if (res.code == 200) { + uni.showToast({ + title: "成功", + icon: 'none' + }) + setTimeout(res => { + uni.switchTab({ + url: '/pages/index/index' + }); + }, 1000) + } else { + uni.showToast({ + title: "失败", + icon: 'none' + }) + } + }) + }) + setTimeout(res => { + uni.hideLoading(); + }, 2000) + }else{ + this.tui.toast("请勿重复提交!") } - this.$nextTick(()=>{ - - this.purchase.balanceDeductionAmount = this.yuedikou - this.tui.request(url, "post", { - purchase: this.purchase, - purchaseDetails: this.purchaseDetails - }, false, false).then((res) => { - if (res.code == 200) { - uni.showToast({ - title: "成功", - icon: 'none' - }) - setTimeout(res => { - uni.switchTab({ - url: '/pages/index/index' - }); - }, 1000) - } else { - uni.showToast({ - title: "失败", - icon: 'none' - }) - } - }) - }) - setTimeout(res => { - uni.hideLoading(); - }, 2000) + }, batchPrint(){ uni.navigateTo({ diff --git a/package1/stock/addStock.vue b/package1/stock/addStock.vue index 591ab19..ae8c0f5 100644 --- a/package1/stock/addStock.vue +++ b/package1/stock/addStock.vue @@ -40,9 +40,12 @@ {{item.price}} 零售价 - - {{item.stockCount}} - 库存 + + {{item.stockCount + item.minusStockCount}} + + 库存 + + @@ -74,9 +77,12 @@ {{item.price}} 零售价 - - {{item.stockCount}} - 库存 + + {{item.stockCount + item.minusStockCount}} + + 库存 + + @@ -142,6 +148,40 @@ + + + + + 库存数 + + + + + 正数库存 + + + {{zheng}} + + + + + 负数库存 + + + {{fu}} + + + + + + 确认 + + + + @@ -155,7 +195,9 @@ status: 'loadmore', pageNum: 1, //分页的页码 shopList: [], - shopList1: [], + shopList1: [], + zheng:'', + fu:'', pages: 1, totalPages: 0, info: 0, @@ -246,6 +288,11 @@ this.storageType = uni.getStorageSync('type') }, methods: { + seeStockCount(zheng,fu){ + this.zheng = zheng; + this.fu = fu; + this.$refs.showPopup.open() + }, //初始化获取分类列表 getGategoryList() { this.tui.request("/app/productCategory/list", "get", {}, false, true).then((res) => { @@ -743,4 +790,30 @@ width: 90%; // margin-top: 20upx; } + .popup-pay-content { + align-items: center; + justify-content: center; + padding: 15px; + width: 500rpx; + height: auto; + background-color: #fff; + } + .popup-pay-title { + font-size: 36rpx; + font-weight: bold; + text-align: center; + position: relative; + } + + .popup-pay-container { + margin-top: 20rpx; + height: 100rpx; + border-radius: 10px; + background: #088FEB; + line-height: 100rpx; + text-align: center; + border-bottom: 1px solid #eee; + border-top: 1px solid #eee; + color: #fff; + } \ No newline at end of file