diff --git a/package1/.DS_Store b/package1/.DS_Store index d7b21e9..546c695 100644 Binary files a/package1/.DS_Store and b/package1/.DS_Store differ diff --git a/package1/AI/AIHangOrderList.vue b/package1/AI/AIHangOrderList.vue index 6d44838..96b07d7 100644 --- a/package1/AI/AIHangOrderList.vue +++ b/package1/AI/AIHangOrderList.vue @@ -162,7 +162,7 @@ 语音识别中... - + @@ -217,7 +217,7 @@ - - + + @@ -231,7 +231,7 @@ {{item.name}} {{item.productNum==null?'无库存':item.productNum}} - + @@ -266,7 +266,8 @@ @tap.stop="checkPay(purchasePrice)">确定 - + + 貌似没有检测到您上次的语音录入信息,正在反复识别中 @@ -279,12 +280,14 @@ data() { return { khName:[], + isVoice:false, regList:[], pageNumber: 1, status: 'loadmore', recordState: false, voiceText: ' ', list: [], + linshiPrice:0, value: '', isInventory:true, temporaryNum: 0, @@ -425,34 +428,25 @@ }, //按住语音识别,开始 kaishi() { - this.recordState = true - manager.start({ - duration: 60000, - lang: "zh_CN" - }); + if(this.isVoice == false){ + this.recordState = true + uni.vibrateShort(); + manager.start({ + duration: 60000, + lang: "zh_CN" + }); + } }, //松开语音识别,结束 jieshu() { this.recordState = false manager.stop() }, - //语音内容为空 - showRecordEmptyTip() { - uni.showToast({ - title: "请重新说一遍", - icon: 'error' - }) - }, //语音识别功能初始化 initRecord() { let that = this; - manager.stop() // 识别结束事件 manager.onStop = (res) => { - if (res.result == '') { - that.showRecordEmptyTip() - return - } if(that.voiceText == ''){ that.voiceText = res.result }else if(that.voiceText == null){ @@ -465,6 +459,17 @@ // 识别错误事件 manager.onError = (res) => { + if(res.retcode == '-30011'){ + that.isVoice = true + } + if(res.retcode == '-30004'){ + that.isVoice = false + uni.hideToast() + uni.showToast({ + title: "未识别到声音信息,请重新录入", + icon: 'none' + }) + } if (res.retcode == '-40001') { uni.showToast({ title: '使用次数超限制,请联系管理员!', @@ -554,7 +559,7 @@ resultList = this.combination(this.goodsList); } - var evalue = [] + this.evalue = [] var value = [] for (var m = 0; m < resultList.length; m++) { var name = '' @@ -570,7 +575,7 @@ } value1 += "}" value.push(value1) - evalue.push(name) + this.evalue.push(name) } // if (jishuqi == 0) { @@ -592,7 +597,7 @@ attributeList: value[i], productCount: this.temporaryNum, productNum: null, - name: evalue[i], + name: this.evalue[i], price: this.purchasePrice } this.temporaryList.push(this.attributeList); @@ -683,8 +688,13 @@ } this.zPrice = this.zNum * this.purchasePrice }, + clickClose(){ + this.evalue = [] + this.allChangeNum = 0 + }, //弹窗选择规格后,点击弹窗中选好了按钮 temporaryCheck() { + this.evalue = [] if (this.storageType == 0 && this.purchasePrice == 0) { uni.showToast({ title: "请输入实际价格!", @@ -760,12 +770,12 @@ AiOpenOrder(type){ if(type=='AI'){ uni.navigateTo({ - url: '/pages/index/peopleList?popleType=khName' + url: '/package1/index/peopleList?popleType=khName' }) }else{ uni.setStorageSync('hangOrderType','scanCode') uni.navigateTo({ - url: '/pages/index/peopleList?popleType=khName' + url: '/package1/index/peopleList?popleType=khName' }) } }, @@ -1094,11 +1104,35 @@ }) return result; }, + obtainPrice(e,type,num){ + this.linshiPrice = e.target.value + if(type=='zongjishu'){ + this.allChangeNum = '' + } + }, allChange(e){ + if(this.linshiPrice == e.target.value){ + this.allChangeNum = e.target.value + }else{ + if(e.target.value == ''){ + this.allChangeNum = this.linshiPrice + }else{ + this.allChangeNum = e.target.value + } + + } //监听到输入框改变,给所有的都赋值 if(this.isPlusAndMinus == false){ for(var i=0;i \ No newline at end of file diff --git a/package1/AI/AIInventoryList.vue b/package1/AI/AIInventoryList.vue index ac5a40c..e952d85 100644 --- a/package1/AI/AIInventoryList.vue +++ b/package1/AI/AIInventoryList.vue @@ -156,6 +156,7 @@ price: this.purchaseDetails[i].price, productCount: 0, categoryId:this.purchaseDetails[i].categoryId, + categoryName:this.purchaseDetails[i].categoryName, wholesalePrice: this.purchaseDetails[i].wholesalePrice, purchasePrice:this.purchaseDetails[i].purchasePrice, isNew: this.purchaseDetails[i].productId==null?true:false, @@ -168,10 +169,10 @@ } for(let m=0;m + placeholder="请输入规格数量" @blur="numChange('zhu',item,index)"> @@ -58,7 +58,7 @@ - + @@ -113,13 +113,13 @@ 采购价: - + 数量: - + @@ -167,8 +167,8 @@ - - + + @@ -191,6 +191,7 @@ 'https://jewel-shop.oss-cn-beijing.aliyuncs.com/44e7ccc2fae74db593bd1a10f538e2de.jpg', 'https://jewel-shop.oss-cn-beijing.aliyuncs.com/2a55142e562b4ea480ce553c8b84d092.jpg' ], + isShow:false, focus:false, purchaseOcrPictureList: [], parentPicturePath: '', @@ -294,6 +295,30 @@ // this.focus = true // this.$refs.inputText.focus(); }, + numChange(type,item,index,items,indexs){ + if(type == 'zhu'){ + + if(item.count > 20){ + uni.showModal({ + title: '提示', + showCancel:false, + content: '规格数不能超过20,例:“黑色M码”这种为一个规格,“黑色S码”或“白色L码”则为另外的规格,请以此种颜色+尺码组合为一种的方式来计数', + success: function (res) {} + }); + this.purchaseOcrPictureList[index].count = '' + } + }else if(type == 'zi'){ + if(items.count > 20){ + uni.showModal({ + title: '提示', + showCancel:false, + content: '规格数不能超过20,例:“黑色M码”这种为一个规格,“黑色S码”或“白色L码”则为另外的规格,请以此种颜色+尺码组合为一种的方式来计数', + success: function (res) {} + }); + this.purchaseOcrPictureList[index].children[indexs].count = '' + } + } + }, shurukuang(){ if(this.name == 'productSn'){ this.productSn = this.nameText @@ -388,6 +413,10 @@ // } } }); + }, + showBtn(){ + this.isShow = true + uni.hideLoading(); }, async upLoadImg(type) { uni.showLoading({ @@ -478,6 +507,41 @@ } }); + }, + obtainPrice(e,type,num){ + console.log("获得焦点") + this.linshiPrice = e.target.value + if(type=='price'){ + this.price = '' + }else if(type=='productCount'){ + this.productCount = '' + } + }, + changessPrice(e,type) { + if(type == 'price'){ + if(this.linshiPrice == e.target.value){ + this.price = e.target.value + }else{ + if(e.target.value == ''){ + this.price = this.linshiPrice + }else{ + this.price = e.target.value + } + + } + }else{ + if(this.linshiPrice == e.target.value){ + this.productCount = e.target.value + }else{ + if(e.target.value == ''){ + this.productCount = this.linshiPrice + }else{ + this.productCount = e.target.value + } + + } + } + }, cameraUpload(){ let that = this; diff --git a/package1/AI/AiChangeGoods.vue b/package1/AI/AiChangeGoods.vue index fbedd57..6ce0ae3 100644 --- a/package1/AI/AiChangeGoods.vue +++ b/package1/AI/AiChangeGoods.vue @@ -20,14 +20,17 @@ - + 暂无图片 - {{item.productName}} + + {{item.productName}} + (已下架) + {{item.productSn}} @@ -51,8 +54,8 @@ - + 暂无图片 diff --git a/package1/AI/AiChat.vue b/package1/AI/AiChat.vue index 14e53a7..88545be 100644 --- a/package1/AI/AiChat.vue +++ b/package1/AI/AiChat.vue @@ -84,7 +84,8 @@ - + + 貌似没有检测到您上次的语音录入信息,正在反复识别中 @@ -96,6 +97,7 @@ data() { return { isVoice:true, + isNoVoice:false, height:0, khName:{}, msgList:[], @@ -133,8 +135,17 @@ close(){ this.$refs.popup.close() }, + //正则匹配处理“2十9”等情况 + convertStringCorrectly(str) { + var regexForSingleTen = /(\d+)十(?!\d)/g; + var regexForFollowedByDigit = /(\d+)十(?=\d)/g; + var step1Result = str.replace(regexForSingleTen, '$10'); + var finalResult = step1Result.replace(regexForFollowedByDigit, '$1'); + + return finalResult; + }, spliceMsg(res){ - let regex = /嗯|啊|儿|各|阿|恩/g; + let regex = /嗯|啊|儿|阿|恩/g; return res.replace(regex, '') }, convertChineseToArabic(str) { @@ -150,7 +161,30 @@ }, inputSaveText(){ let convertedStr = this.convertChineseToArabic(this.editText); - let getMsg = this.spliceMsg(convertedStr) + if(convertedStr.indexOf('点') != -1){ + convertedStr = this.replaceCharAfterNumber(convertedStr,'点','.') + } + if(convertedStr.indexOf('货号,') != -1){ + convertedStr = convertedStr.replace(/货号,/g,'货号') + } + if(convertedStr.indexOf('货号') != -1){ + convertedStr = convertedStr.replace(/货号/g,'货号:') + } + if(convertedStr.indexOf(',数量') != -1){ + convertedStr = convertedStr.replace(/,数量/g,'数量') + } + if(convertedStr.indexOf('数量,') != -1){ + convertedStr = convertedStr.replace(/数量,/g,'数量') + } + if(convertedStr.indexOf('数量') != -1){ + convertedStr = convertedStr.replace(/数量/g,',数量:') + } + convertedStr = this.convertStringCorrectly(convertedStr) + convertedStr = this.spliceMsg(convertedStr) + if(convertedStr.indexOf(',') == 0){ + convertedStr = convertedStr.substr(1) + } + let getMsg = convertedStr if(this.editText == ''){ return; } @@ -162,35 +196,62 @@ }, //按住语音识别,开始 kaishi() { - this.recordState = true - manager.start({ - duration: 60000, - lang: "zh_CN" - }); + if(this.isNoVoice == false){ + this.recordState = true + uni.vibrateShort(); + manager.start({ + duration: 60000, + lang: "zh_CN" + }); + } }, //松开语音识别,结束 jieshu() { this.recordState = false manager.stop() }, + replaceCharAfterNumber(str, charToFind, charToReplace) { + // 正则表达式匹配字符前是否有数字,并且该字符与charToFind相同 + const regex = new RegExp(`\\d${charToFind}`, 'g'); + // 使用replace方法进行替换 + return str.replace(regex, (match) => { + // 将匹配到的字符中的指定字符替换为charToReplace + return match.replace(charToFind, charToReplace); + }); + }, //语音识别功能初始化 initRecord() { let that = this; manager.stop() // 识别结束事件 manager.onStop = (res) => { - - if (res.result == '') { - uni.showToast({ - title: "请重新说一遍", - icon: 'error' - }) - return - } let convertedStr = this.convertChineseToArabic(res.result); - + if(convertedStr.indexOf('点') != -1){ + convertedStr = that.replaceCharAfterNumber(convertedStr,'点','.') + } + if(convertedStr.indexOf('货号,') != -1){ + convertedStr = convertedStr.replace(/货号,/g,'货号') + } + if(convertedStr.indexOf('货号') != -1){ + convertedStr = convertedStr.replace(/货号/g,'货号:') + } + if(convertedStr.indexOf(',数量') != -1){ + convertedStr = convertedStr.replace(/,数量/g,'数量') + } + if(convertedStr.indexOf('数量,') != -1){ + convertedStr = convertedStr.replace(/数量,/g,'数量') + } + if(convertedStr.indexOf('数量') != -1){ + convertedStr = convertedStr.replace(/数量/g,',数量:') + } + convertedStr = this.convertStringCorrectly(convertedStr) + convertedStr = this.spliceMsg(convertedStr) + if(convertedStr.indexOf(',') == 0){ + console.log('位置',convertedStr.indexOf(',')) + convertedStr = convertedStr.substr(1) + } let data = { - text:this.spliceMsg(convertedStr) + text:convertedStr } that.msgList.push(data) that.$forceUpdate() @@ -199,6 +260,18 @@ // 识别错误事件 manager.onError = (res) => { + if(res.retcode == '-30011'){ + that.isNoVoice = true + } + if(res.retcode == '-30004'){ + // uni.hideLoading() + that.isNoVoice = false + uni.hideToast() + uni.showToast({ + title: "未识别到声音信息,请重新录入", + icon: 'none' + }) + } if (res.retcode == '-40001') { uni.showToast({ title: '使用次数超限制,请联系管理员!', @@ -405,5 +478,21 @@ color: #fff; line-height: 80rpx; margin-top: 50rpx; + } + .mask-model{ + width: 60%; + height: 100rpx; + position: fixed; + top: 0; + left: 0; + right: 0; + bottom: 0; + margin: auto; + text-align: center; + background: rgba(0,0,0,0.7); + color: #eee; + padding: 5px; + border-radius: 5px; + z-index: 99; } \ No newline at end of file diff --git a/package1/AI/addAiList.vue b/package1/AI/addAiList.vue index 6e51f0b..0d80887 100644 --- a/package1/AI/addAiList.vue +++ b/package1/AI/addAiList.vue @@ -1,105 +1,3226 @@ - - - + + \ No newline at end of file diff --git a/package1/AI/voiceInventory.vue b/package1/AI/voiceInventory.vue index db2f56b..fa43e1a 100644 --- a/package1/AI/voiceInventory.vue +++ b/package1/AI/voiceInventory.vue @@ -69,15 +69,15 @@ - 分类: {{value[1].categoryName}} - + 分类: {{value[1].categoryName==null?'':value[1].categoryName}} + - - 单价: + + 单价: - 批发价: - 零售价: + 批发价: + 零售价: 添加规格 @@ -109,19 +109,19 @@ - + 应付金额 - + - + 已付金额 - + - + 欠款 @@ -146,7 +146,7 @@ 合计:{{totalAmount}} - ¥{{shouldPay}} + ¥{{shouldPay}} @@ -154,7 +154,7 @@ - + @@ -198,7 +198,7 @@ - - + + @@ -374,7 +374,8 @@ 语音识别中... - + + 貌似没有检测到您上次的语音录入信息,正在反复识别中 @@ -390,6 +391,7 @@ computed: mapState(['shopName']), data() { return { + isVoice:false, allChangeNum:0, voiceText:'', khName: [], @@ -399,7 +401,8 @@ noPay: 0, alreadyPay: '', realAmount: 0, - shouldPay: '', + shouldPay: '', + userType:'', totalAmount: 0, index: '', index1: '', @@ -423,6 +426,7 @@ dataObj: new Map(), isPlusAndMinus:false, indexList:[], + evalue:[], attributeValue:[], specifications:'', currentAnchor: '', @@ -495,21 +499,17 @@ this.merge = 0 return; } - if(this.carList1 == ''){ - console.log('回来') - } if(uni.getStorageSync('carList1') != ''){ this.carList1 = uni.getStorageSync('carList1') }else{ this.carList1 = this.carList1 - } - console.log('拿数据',this.carList1) + } this.khName = JSON.parse(JSON.stringify(this.khName)) || '' if (this.carList.size == 0) { //当前页没有数据 for (let i = 0; i < this.carList1.length; i++) { let obj = { - purchasePrice: this.carList1[i].purchasePrice || 0, //进货价 + purchasePrice: this.userType == 0?this.carList1[i].purchasePrice:'', //进货价 price1: 0, price:this.carList1[i].price, productCount: 0, @@ -518,31 +518,14 @@ productId: this.carList1[i].productId == null ? '' : this.carList1[i].productId, productName: this.carList1[i].productName, wholesalePrice: this.carList1[i].wholesalePrice || 0, - categoryName:'', + categoryName:this.carList1[i].categoryName, categoryId:this.carList1[i].categoryId, lsprice: this.carList1[i].price || 0, productPicture: this.carList1[i].productPicture, productSn: this.carList1[i].productSn, stockLogList: new Map(), stockLogList1: [] - } - - // let attrMap = new Map() - // let newSaleDetailDTOList = [] - // for(let m = 0; m < item.saleDetailDTOList[i].stockLogList1.length; m++){ - // if(attrMap.has(item.saleDetailDTOList[i].stockLogList1[m].attributeList) == true){ - // let hasCount = attrMap.get(item.saleDetailDTOList[i].stockLogList1[m].attributeList) - // let trueCount = hasCount.split('-')[0] - // let lastConut = Number(trueCount) + Number(item.saleDetailDTOList[i].stockLogList1[m].productCount) - // newSaleDetailDTOList[hasCount.split('-')[1]].productCount = lastConut - // }else{ - // newSaleDetailDTOList.push(item.saleDetailDTOList[i].stockLogList1[m]) - // attrMap.set(item.saleDetailDTOList[i].stockLogList1[m].attributeList,item.saleDetailDTOList[i].stockLogList1[m].productCount+'-'+m) - // } - // } - // obj.saleDetailQueryDTO = newSaleDetailDTOList - - + } for (let m = 0; m < this.carList1[i].saleDetailQueryDTO.length; m++) { let productCount = this.carList1[i].saleDetailQueryDTO[m].productCount if(obj.stockLogList.has(this.carList1[i].saleDetailQueryDTO[m].attributeList) ==true){ @@ -592,7 +575,7 @@ } } else { //商品不同 let obj = { - purchasePrice: this.carList1[i].purchasePrice || 0, //进货价 + purchasePrice: this.userType == 0?this.carList1[i].purchasePrice:'', //进货价 price1: 0, price:this.carList1[i].price, productCount: 0, @@ -601,7 +584,7 @@ isNew:this.carList1[i].isNew, productName: this.carList1[i].productName, wholesalePrice: this.carList1[i].wholesalePrice || 0, - categoryName:'', + categoryName:this.carList1[i].categoryName, categoryId:this.carList1[i].categoryId, lsprice: this.carList1[i].price || 0, productPicture: this.carList1[i].productPicture, @@ -650,14 +633,14 @@ console.log(this.carList) }, onLoad(options) { - + this.userType=uni.getStorageSync('type') }, methods: { AiVoice(){ if (this.carList.size == 0) { //当前页没有数据 for (let i = 0; i < this.carList1.length; i++) { let obj = { - purchasePrice: this.carList1[i].purchasePrice || 0, //进货价 + purchasePrice: this.userType == 0?this.carList1[i].purchasePrice:'', //进货价 price1: 0, price:this.carList1[i].price, productCount: 0, @@ -666,7 +649,7 @@ productId: this.carList1[i].productId == null ? '' : this.carList1[i].productId, productName: this.carList1[i].productName, wholesalePrice: this.carList1[i].wholesalePrice || 0, - categoryName:'', + categoryName:this.carList1[i].categoryName, categoryId:this.carList1[i].categoryId, lsprice: this.carList1[i].price || 0, productPicture: this.carList1[i].productPicture, @@ -741,7 +724,7 @@ } } else { //商品不同 let obj = { - purchasePrice: this.carList1[i].purchasePrice || 0, //进货价 + purchasePrice: this.userType == 0?this.carList1[i].purchasePrice:'', //进货价 price1: 0, price:this.carList1[i].price, productCount: 0, @@ -750,7 +733,7 @@ isNew:this.carList1[i].isNew, productName: this.carList1[i].productName, wholesalePrice: this.carList1[i].wholesalePrice || 0, - categoryName:'', + categoryName:this.carList1[i].categoryName, categoryId:this.carList1[i].categoryId, lsprice: this.carList1[i].price || 0, productPicture: this.carList1[i].productPicture, @@ -941,8 +924,56 @@ }, //确认语音输入的内容 setDetail(e) { + if(this.voiceText ==''){ + this.tui.toast('识别内容不能为空') + return + } let convertedStr = this.convertChineseToArabic(this.voiceText); - this.getMsg = this.spliceMsg(convertedStr) + if(convertedStr.indexOf('点') != -1){ + convertedStr = this.replaceCharAfterNumber(convertedStr,'点','.') + } + if(convertedStr.indexOf(',名称') != -1){ + convertedStr = convertedStr.replace(/,名称/g,'名称') + } + if(convertedStr.indexOf('名称,') != -1){ + convertedStr = convertedStr.replace(/名称,/g,'名称') + } + if(convertedStr.indexOf('名称') != -1){ + convertedStr = convertedStr.replace(/名称/g,',名称:') + } + if(convertedStr.indexOf(',单价') != -1){ + convertedStr = convertedStr.replace(/,单价/g,'单价') + } + if(convertedStr.indexOf('单价,') != -1){ + convertedStr = convertedStr.replace(/单价,/g,'单价') + } + if(convertedStr.indexOf('单价') != -1){ + convertedStr = convertedStr.replace(/单价/g,',单价:') + } + if(convertedStr.indexOf(',数量') != -1){ + convertedStr = convertedStr.replace(/,数量/g,'数量') + } + if(convertedStr.indexOf('数量,') != -1){ + convertedStr = convertedStr.replace(/数量,/g,'数量') + } + if(convertedStr.indexOf('数量') != -1){ + convertedStr = convertedStr.replace(/数量/g,',数量:') + } + if(convertedStr.indexOf('货号,') != -1){ + convertedStr = convertedStr.replace(/货号,/g,'货号') + } + if(convertedStr.indexOf('货号') != -1){ + convertedStr = convertedStr.replace(/货号/g,'货号:') + } + //名称111,白色M码1一件 + convertedStr = this.convertStringCorrectly(convertedStr) + convertedStr = this.spliceMsg(convertedStr) + if(convertedStr.indexOf(',') == 0){ + console.log('位置',convertedStr.indexOf(',')) + convertedStr = convertedStr.substr(1) + console.log('位置',convertedStr) + } + this.getMsg = convertedStr this.tui.request("/purchaseOcrPicture/callWithMessageOfPurchase", "POST", { questionMsg:this.getMsg }, false, true).then((res) => { @@ -954,10 +985,11 @@ // uni.setStorageSync('AiInventoryId', res.result.purchase.id) for(let i=0;i {}) }, allChange(e){ + if(this.linshiPrice == e.target.value){ + this.allChangeNum = e.target.value + }else{ + if(e.target.value == ''){ + this.allChangeNum = this.linshiPrice + }else{ + this.allChangeNum = e.target.value + } + + } //监听到输入框改变,给所有的都赋值 if(this.isPlusAndMinus == false){ for(var i=0;i { + // 将匹配到的字符中的指定字符替换为charToReplace + return match.replace(charToFind, charToReplace); + }); }, //语音识别功能初始化 initRecord() { @@ -1469,11 +1579,51 @@ manager.stop() // 识别结束事件 manager.onStop = (res) => { - if (res.result == '') { - that.showRecordEmptyTip() - return - } let convertedStr = this.spliceMsg(this.convertChineseToArabic(res.result)); + console.log(convertedStr) + if(convertedStr.indexOf('点') != -1){ + convertedStr = that.replaceCharAfterNumber(convertedStr,'点','.') + } + if(convertedStr.indexOf(',名称') != -1){ + convertedStr = convertedStr.replace(/,名称/g,'名称') + } + if(convertedStr.indexOf('名称,') != -1){ + convertedStr = convertedStr.replace(/名称,/g,'名称') + } + if(convertedStr.indexOf('名称') != -1){ + convertedStr = convertedStr.replace(/名称/g,',名称:') + } + if(convertedStr.indexOf(',单价') != -1){ + convertedStr = convertedStr.replace(/,单价/g,'单价') + } + if(convertedStr.indexOf('单价,') != -1){ + convertedStr = convertedStr.replace(/单价,/g,'单价') + } + if(convertedStr.indexOf('单价') != -1){ + convertedStr = convertedStr.replace(/单价/g,',单价:') + } + if(convertedStr.indexOf(',数量') != -1){ + convertedStr = convertedStr.replace(/,数量/g,'数量') + } + if(convertedStr.indexOf('数量,') != -1){ + convertedStr = convertedStr.replace(/数量,/g,'数量') + } + if(convertedStr.indexOf('数量') != -1){ + convertedStr = convertedStr.replace(/数量/g,',数量:') + } + if(convertedStr.indexOf('货号,') != -1){ + convertedStr = convertedStr.replace(/货号,/g,'货号') + } + if(convertedStr.indexOf('货号') != -1){ + convertedStr = convertedStr.replace(/货号/g,'货号:') + } + convertedStr = this.convertStringCorrectly(convertedStr) + + if(convertedStr.indexOf(',') == 0){ + console.log('位置',convertedStr.indexOf(',')) + convertedStr = convertedStr.substr(1) + } + if(that.voiceText == '' || that.voiceText == null){ that.voiceText = convertedStr }else{ @@ -1483,6 +1633,18 @@ // 识别错误事件 manager.onError = (res) => { + if(res.retcode == '-30011'){ + that.isVoice = true + } + if(res.retcode == '-30004'){ + // uni.hideLoading() + that.isVoice = false + uni.hideToast() + uni.showToast({ + title: "未识别到声音信息,请重新录入", + icon: 'none' + }) + } if (res.retcode == '-40001') { uni.showToast({ title: '使用次数超限制,请联系管理员!', @@ -1491,12 +1653,26 @@ } } }, + getAttribute(str){ + str = str.replace(/"色"(?![^{]*": *"色")/g, '"均色"'); + str = str.replace(/"码"(?![^{]*": *"码")/g, '"均码"'); + return str + }, //清空语音输入的文字 clearText(){ this.voiceText = '' }, + //正则匹配处理“2十9”等情况 + convertStringCorrectly(str) { + var regexForSingleTen = /(\d+)十(?!\d)/g; + var regexForFollowedByDigit = /(\d+)十(?=\d)/g; + var step1Result = str.replace(regexForSingleTen, '$10'); + var finalResult = step1Result.replace(regexForFollowedByDigit, '$1'); + + return finalResult; + }, spliceMsg(res){ - let regex = /嗯|啊|儿|各|阿|恩/g; + let regex = /嗯|啊|儿|阿|恩/g; return res.replace(regex, '') }, convertChineseToArabic(str) { @@ -1733,12 +1909,16 @@ this.zNum += this.temporaryList[i].productCount || 0 } }, - + clickClose(){ + this.evalue = [] + this.allChangeNum = 0 + }, //弹窗选择规格后,点击弹窗中选好了按钮 temporaryCheck() { uni.showLoading({ title: '加载中...' }) + this.evalue = [] console.log(this.temporaryList) let that = this, carList1 = [] @@ -1750,7 +1930,7 @@ productName: this.goodsDetail.productName, wholesalePrice: this.goodsDetail.wholesalePrice, purchasePrice:this.goodsDetail.purchasePrice, - categoryName:'', + categoryName:this.goodsDetail.categoryName, categoryId:this.carList1.categoryId, lsprice: this.goodsDetail.price, productSn: this.goodsDetail.productSn, @@ -1772,14 +1952,14 @@ if (this.carList.size == 0) { //当前页没有数据 for (let i = 0; i < carList1.length; i++) { let obj = { - purchasePrice: this.goodsDetail.purchasePrice, //进货价 + purchasePrice: this.userType == 0?this.goodsDetail.purchasePrice:'', //进货价 price:this.goodsDetail.price, price1:0, productCount: 0, id: carList1[i].id, productId: carList1[i].id, wholesalePrice: this.goodsDetail.wholesalePrice, - categoryName:'', + categoryName:this.goodsDetail.categoryName, categoryId:this.goodsDetail.categoryId, lsprice: this.goodsDetail.price, productName: carList1[i].productName, @@ -1846,7 +2026,7 @@ } } else { //商品不同 let obj = { - purchasePrice: this.goodsDetail.purchasePrice, //进货价 + purchasePrice: this.userType == 0?this.goodsDetail.purchasePrice:'', //进货价 price:this.goodsDetail.price, price1: 0, productCount: 0, @@ -1883,7 +2063,18 @@ uni.hideLoading(); }, 500) }, - changessPrice() { + changessPrice(e) { + if(this.linshiPrice == e.target.value){ + this.shouldPay = e.target.value + }else{ + if(e.target.value == ''){ + this.shouldPay = this.linshiPrice + }else{ + this.shouldPay = e.target.value + } + + } + this.alreadyPay = this.shouldPay this.noPay = this.shouldPay - this.alreadyPay; }, //货号是否重复 @@ -1908,14 +2099,24 @@ }, //计算欠款 changePay(e) { - this.alreadyPay = Number(e.target.value) > Number(this.shouldPay) ? this.shouldPay : e.target.value + if(this.linshiPrice == e.target.value){ + this.alreadyPay = e.target.value + }else if(Number(e.detail.value) > Number(this.shouldPay)){ + this.alreadyPay = this.shouldPay + }else{ + if(e.target.value == ''){ + this.alreadyPay = this.linshiPrice + }else{ + this.alreadyPay = e.target.value + } + } this.noPay = this.shouldPay - this.alreadyPay this.noPay = this.noPay.toFixed(2) }, //跳转选择供应商 goPopleList(popleType) { uni.navigateTo({ - url: '/pages/index/peopleList?popleType=' + popleType + url: '/package1/index/peopleList?popleType=' + popleType }) }, //删除整条商品 @@ -1975,37 +2176,62 @@ } }) - }, - async inventorySubmit() { - if (this.khName == '' || this.carList == '') { - uni.showToast({ - title: "请选择供应商后入库~", - icon: 'none' - }) - return - } - let that = this; + }, + gysList(){ + let that = this; + this.tui.request("/app/supplier/getByCondition", "post", { + searchStr:'默认供应商', + pageNumber: 1, + pageSize: 10 + }, false, true).then((res) => { + if (res.code == 200) { + if(res.result.content.length == 0){ + that.tui.request("/app/supplier/save", "post", { + consigneeMobile: '', + consigneeName: '默认供应商', + address1: '', + address: '', + province: '', + city: '', + area: '' + }, false,true).then((res) => { + if (res.code == 200) { + that.gysList() + } + }) + }else{ + that.khName = res.result.content[0] + that.goRuku() + } + + }else{ + this.tui.toast(res.message) + } + }) + }, + async goRuku(){ + let that = this; let purchase = { - // id:uni.getStorageSync('AiInventoryId'), - alreadyPay: this.alreadyPay == '' ? 0 : this.alreadyPay, //已付金额 - noPay: this.noPay == '' ? 0 : this.noPay, //欠款 - shouldPay: this.shouldPay, //应付金额 - totalAmount: this.totalAmount, //总数量 - remark: this.remark, - otherPay: this.otherPay == '' ? 0 : this.otherPay, - supplierId: this.khName.id, //供应商id和姓名 - supplierName: this.khName.consigneeName - } + // id:uni.getStorageSync('AiInventoryId'), + alreadyPay: this.alreadyPay == '' ? 0 : this.alreadyPay, //已付金额 + noPay: this.noPay == '' ? 0 : this.noPay, //欠款 + shouldPay: this.shouldPay, //应付金额 + totalAmount: this.totalAmount, //总数量 + remark: this.remark, + otherPay: this.otherPay == '' ? 0 : this.otherPay, + supplierId: this.khName.id, //供应商id和姓名 + supplierName: this.khName.consigneeName + } let purchaseDetails = []; - let jishuqi = 0 + let jishuqi = 0 this.carList.forEach(function(value, key) { - if(value.productName == ''){ - uni.showToast({ - title: "品名必须维护~", - icon: 'none' - }) - return - } + // if(value.productName == ''){ + // uni.showToast({ + // title: "品名必须维护~", + // icon: 'none' + // }) + // return + // } if(value.productSn == ''){ uni.showToast({ title: value.productName + "的货号必须维护~", @@ -2013,51 +2239,58 @@ }) return } - if(value.wholesalePrice ==null || value.wholesalePrice ==undefined || value.wholesalePrice <= 0 || value.wholesalePrice == ""){ - uni.showToast({ - title: value.productName + "的批发价必须维护~", - icon: 'none' - }) - return - } - if(value.lsprice ==null || value.lsprice ==undefined || value.lsprice <= 0 || value.lsprice == ""){ - uni.showToast({ - title: value.productName + "的零售价必须维护~", - icon: 'none' - }) - return - }else{ + // if(value.wholesalePrice ==null || value.wholesalePrice ==undefined || value.wholesalePrice <= 0 || value.wholesalePrice == ""){ + // uni.showToast({ + // title: value.productName + "的批发价必须维护~", + // icon: 'none' + // }) + // return + // } + // if(value.lsprice ==null || value.lsprice ==undefined || value.lsprice <= 0 || value.lsprice == ""){ + // uni.showToast({ + // title: value.productName + "的零售价必须维护~", + // icon: 'none' + // }) + // return + // }else{ value.price = value.lsprice - } + // } value.stockLogList1 = [] - if (value.purchasePrice == '' || value.purchasePrice == 0) { - uni.showToast({ - title: value.productName + "的价格必须维护~", - icon: 'none' - }) - return - } + // if (value.purchasePrice == '' || value.purchasePrice == 0) { + // uni.showToast({ + // title: value.productName + "的价格必须维护~", + // icon: 'none' + // }) + // return + // } if((value.categoryId == '' && value.productId == '') || (value.categoryId == null && value.productId == '')){ that.tui.toast(value.productName + "分类未维护~") return; - } - value.stockLogList.forEach(function(values, keys) { - if (values <= 0) { - that.tui.toast("入库数量不能为零~") - return; - } - let obj = { - productCount: values.productCount, - attributeList: keys - } - value.stockLogList1.push(obj) + } + value.stockLogList.forEach(function(values, keys) { + if (values <= 0) { + that.tui.toast("入库数量不能为零~") + return; + } + let obj = { + productCount: values.productCount, + attributeList: keys + } + value.stockLogList1.push(obj) }) - // delete value.id; + // delete value.id; purchaseDetails.push(value) - jishuqi ++ + jishuqi ++ }) if(jishuqi == this.carList.size){ await this.goInventory(purchase,purchaseDetails) + } + }, + async inventorySubmit() { + if (this.khName == '') { + await this.gysList() + }else{ + this.goRuku() } }, @@ -2068,18 +2301,45 @@ }, //编辑每一个的单价 clickCollapse(e,id) { - this.carList.get(id).purchasePrice = Number(e.detail.value) + if(this.linshiPrice == e.target.value){ + this.carList.get(id).purchasePrice = e.target.value + }else{ + if(e.detail.value == ''){ + this.carList.get(id).purchasePrice = this.linshiPrice + }else{ + this.carList.get(id).purchasePrice = Number(e.detail.value) + } + } this.carList.get(id).price1 = this.carList.get(id).productCount * this.carList.get(id).purchasePrice this.getAllPrice() }, //编辑每一个的批和零售 PriceAndWho(e,id,type) { if(type == 'pi'){ - this.carList.get(id).wholesalePrice = Number(e.detail.value) + if(this.linshiPrice == e.target.value){ + this.carList.get(id).wholesalePrice = e.target.value + }else{ + if(e.detail.value == ''){ + this.carList.get(id).wholesalePrice = this.linshiPrice + }else{ + this.carList.get(id).wholesalePrice = Number(e.detail.value) + } + } }else{ - this.carList.get(id).price = Number(e.detail.value) - this.carList.get(id).lsprice = Number(e.detail.value) + if(this.linshiPrice == e.target.value){ + this.carList.get(id).price = e.target.value + this.carList.get(id).lsprice = e.target.value + }else{ + if(e.detail.value == ''){ + this.carList.get(id).price = this.linshiPrice + this.carList.get(id).lsprice = this.linshiPrice + }else{ + this.carList.get(id).price = Number(e.detail.value) + this.carList.get(id).lsprice = Number(e.detail.value) + } + } } + this.$forceUpdate() }, //计算总金额和总数量 getAllPrice() { @@ -2656,5 +2916,21 @@ height: 180rpx; background: #eee; border-radius: 50%; + } + .mask-model{ + width: 60%; + height: 100rpx; + position: fixed; + top: 0; + left: 0; + right: 0; + bottom: 0; + margin: auto; + text-align: center; + background: rgba(0,0,0,0.7); + color: #eee; + padding: 5px; + border-radius: 5px; + z-index: 99; } \ No newline at end of file diff --git a/package1/inventory/addGoods.vue b/package1/inventory/addGoods.vue index fe319e9..d74644d 100644 --- a/package1/inventory/addGoods.vue +++ b/package1/inventory/addGoods.vue @@ -16,17 +16,12 @@ - - - - - - - - - + + + + - + @@ -39,6 +34,27 @@ + + + + + + + + + + + + + + + + + @@ -57,7 +73,40 @@ - + + + + + + 添加规格 + + + + + +
    +
  • + + {{item.name}} + + + + {{item1.value}} + +
  • +
+ + 确认 + +
+
+
@@ -69,16 +118,143 @@ fileList1: [], formData: { productName: '', - price: '', + price: 0, productSn: '', - wholesalePrice: '', + wholesalePrice: 0, productPicture: '', productIntro: '', categoryId: '', salesWeek: '', tailWarn: '', barcode:'' - }, + }, + defaultList:[{ + name:'颜色', + list:[{ + value:'均色', + checked:false, + },{ + value:'白色', + checked:false, + },{ + value:'黑色', + checked:false, + },{ + value:'浅蓝', + checked:false, + },{ + value:'蓝色', + checked:false, + },{ + value:'灰色', + checked:false, + },{ + value:'咖色', + checked:false, + },{ + value:'紫色', + checked:false, + },{ + value:'红色', + checked:false, + },{ + value:'米色', + checked:false, + }] + },{ + name:'尺码', + list:[{ + value:'均码', + checked:false, + },{ + value:'XS码', + checked:false + },{ + value:'S码', + checked:false, + },{ + value:'M码', + checked:false, + },{ + value:'L码', + checked:false, + },{ + value:'XL码', + checked:false, + },{ + value:'2XL码', + checked:false, + },{ + value:'3XL码', + checked:false, + },{ + value:'4XL码', + checked:false, + },{ + value:'25码', + checked:false + },{ + value:'26码', + checked:false + },{ + value:'27码', + checked:false + },{ + value:'28码', + checked:false + },{ + value:'29码', + checked:false + },{ + value:'30码', + checked:false + },{ + value:'31码', + checked:false + },{ + value:'32码', + checked:false + },{ + value:'33码', + checked:false + },{ + value:'34码', + checked:false + },{ + value:'35码', + checked:false + },{ + value:'36码', + checked:false + },{ + value:'37码', + checked:false + },{ + value:'38码', + checked:false + },{ + value:'39码', + checked:false + },{ + value:'40码', + checked:false + },{ + value:'41码', + checked:false + },{ + value:'42码', + checked:false + },{ + value:'43码', + checked:false + },{ + value:'44码', + checked:false + },{ + value:'45码', + checked:false + }] + }], categoryList: [], productId:'', arrtList: [], @@ -86,7 +262,8 @@ arrtChange: [], categoryId:'', dataList:[], - type:'add', + type:'add', + multipleList:[], rules: { categoryId: { rules: [{ @@ -94,18 +271,18 @@ errorMessage: '请选择商品分类', }, ], }, - price: { - rules: [{ - required: true, - errorMessage: '请填写市场价', - }, ], - }, - wholesalePrice: { - rules: [{ - required: true, - errorMessage: '请填写批发价', - }, ], - }, + // price: { + // rules: [{ + // required: true, + // errorMessage: '请填写市场价', + // }, ], + // }, + // wholesalePrice: { + // rules: [{ + // required: true, + // errorMessage: '请填写批发价', + // }, ], + // }, productSn: { rules: [{ required: true, @@ -154,9 +331,25 @@ this.formData.categoryId = this.dataList.categoryId this.formData.salesWeek = this.dataList.salesWeek this.formData.tailWarn = this.dataList.tailWarn - } + } + this.getGategoryList() }, - methods: { + methods: { + //初始化获取分类列表 + getGategoryList() { + this.tui.request("/app/productCategory/list", "get", { + // shopId: 1, + }, false, true).then((res) => { + if (res.code == 200) { + if(res.result.length > 0){ + this.typeItem = res.result[0] + this.formData.categoryId = this.typeItem.id + } + } else { + this.tui.toast(res.message) + } + }).catch((res) => {}) + }, // 删除图片 deletePic(event) { this[`fileList${event.name}`].splice(event.index, 1) @@ -187,6 +380,104 @@ })) fileListLen++ } + }, + obtainPrice(e,type,num){ + console.log("获得焦点") + this.linshiPrice = e.target.value + if(type=='price'){ + this.formData.price = '' + }else if(type=='wholesalePrice'){ + this.formData.wholesalePrice = '' + } + }, + dialogInputConfirm(e) { + let that = this; + if(that.multipleList == ''){ + that.multipleList = [{ + attributeName:'颜色', + productAttributeValueVoList:[{ + checked: true, + value: "均色" + }] + },{ + attributeName:'尺码', + productAttributeValueVoList:[{ + checked: true, + value: "均码" + }] + }] + }else{ + for(let i=0;i { if(that.dataList !=''){ url = '/app/product/edit' - res.id = that.dataList.id + this.formData.id = that.dataList.id }else{ url = '/app/product/save' + this.formData.purchasePrice = 0 } if(res.productPicture == ''){ res.productPicture = '' } - that.tui.request(url, "post", res, false, false).then((res1) => { + that.tui.request(url, "post", this.formData, false, false).then((res1) => { if (res1.code == 200) { uni.navigateBack({ delta: 1 @@ -286,7 +581,57 @@ }) } }) - } + }, + //选择多个规格保存 + addMultipleType(item,item1,index){ + item.list[index].checked = !item.list[index].checked + var list = [] + if(this.multipleList == ''){ + list.push(item.list[index]) + var data = { + attributeName:item.name, + productAttributeValueVoList: list + } + this.multipleList.push(data) + }else{ + for(var i=0;i @@ -339,6 +684,11 @@ width: 160rpx; height: 160rpx; } + .checked{ + background: #60F3FF !important; + color: #fff !important; + border-radius: 5px !important; + } .content-list { height: 70rpx; border: 1px solid #eee; @@ -350,5 +700,79 @@ color: #fff; background: #5fd9ee; border-radius: 10px; + } + .content-input { + width: auto; + position: relative; + overflow: hidden; + flex: 1; + line-height: 1; + font-size: 14px; + height: 35px; + border: 2px solid #eee; + padding-left: 20rpx; + border-radius: 5px; + } + .add-popup-content { + align-items: center; + justify-content: center; + padding: 15px; + width: 100%; + height: 1050rpx; + background-color: #fff; + } + + .add-popup-title { + font-size: 36rpx; + font-weight: bold; + text-align: center; + position: relative; + } + + .add-popup-container { + margin-top: 20rpx; + } + + .add-popup-bottom { + display: flex; + height: 80rpx; + color: #fff; + line-height: 80rpx; + margin-top: 50rpx; + } + + .add-popup-btn { + flex: 1; + text-align: center; + background: linear-gradient(90deg, #60F3FF, #088FEB); + } + .title-fur { + width: 95%; + height: 70rpx; + margin: 0 auto; + border-bottom: 1px solid #eee; + .name { + font-size: 30rpx; + width: 90%; + float: left; + height: 70rpx; + line-height: 70rpx; + } + } + .content-fur { + padding-bottom: 25rpx; + } + + .content-low { + width: auto; + border: 1px solid #eee; + display: inline-block; + min-width: 90rpx; + padding: 5rpx; + font-size: 35rpx; + text-align: center; + color: #777; + margin: 20rpx 0 0 20rpx; + border-radius: 5px; } \ No newline at end of file diff --git a/package1/inventory/batchPrint.vue b/package1/inventory/batchPrint.vue index 2d9d7e8..a9d6756 100644 --- a/package1/inventory/batchPrint.vue +++ b/package1/inventory/batchPrint.vue @@ -350,6 +350,7 @@ this.bufferData.push(strCmd); } that.$nextTick(()=>{ + console.log('bufferData',that.bufferData) that.$refs.payDialog.close(); that.bufferData = [] uni.navigateBack({ diff --git a/package1/inventory/gategory.vue b/package1/inventory/gategory.vue index 2bcd5e4..39b334d 100644 --- a/package1/inventory/gategory.vue +++ b/package1/inventory/gategory.vue @@ -8,9 +8,12 @@
  • {{item.categoryName}} - - - + + + + + +
  • @@ -47,12 +50,12 @@ style="height:40rpx;line-height: 40rpx;position: absolute !important;bottom:0;right: 30rpx;">
    - + -
      + 确认 @@ -73,7 +76,7 @@ - + 提示 @@ -187,13 +190,13 @@ value:'XL码', checked:false, },{ - value:'XXL码', + value:'2XL码', checked:false, },{ - value:'XXXL码', + value:'3XL码', checked:false, },{ - value:'XXXXL码', + value:'4XL码', checked:false, },{ value:'25码', @@ -305,7 +308,7 @@ this.inputVal = ''; this.isOpenId = item; this.dialogTit = '输入分类名' - this.$refs.addTypeDialog.open('bottom') + this.$refs.addTypeDialog.open('center') } }, @@ -540,12 +543,9 @@ }, //选择多个规格保存 addMultipleType(item,item1,index){ - - item.list[index].checked = !item.list[index].checked var list = [] if(this.multipleList == ''){ - list.push(item.list[index]) var data = { attributeName:item.name, @@ -687,10 +687,9 @@ } .bj-btn { - width: 120rpx; + width: 80rpx; height: 60rpx; font-size: 26rpx; - background: red; margin: 20rpx 0; float: left; padding: 0; @@ -698,7 +697,7 @@ } .name { - width: 75%; + width: 86%; float: left; display: flex; } @@ -771,8 +770,8 @@ align-items: center; justify-content: center; padding: 15px; - width: 100%; - height: 1300rpx; + width: 500rpx; + height: 350rpx; background-color: #fff; } diff --git a/package1/inventory/inventoryConfirm.vue b/package1/inventory/inventoryConfirm.vue index 87c4f73..52fadaf 100644 --- a/package1/inventory/inventoryConfirm.vue +++ b/package1/inventory/inventoryConfirm.vue @@ -23,21 +23,21 @@ - + 应付金额 ¥ {{ purchase.shouldPay == null ?'暂无':purchase.shouldPay }} - + 已付金额 ¥ {{ purchase.alreadyPay == null ?'暂无':purchase.alreadyPay }} - + 欠款 ¥ @@ -75,7 +75,8 @@ return { purchase:'', purchaseDetails:'', - aiinventory:0 //1是AI入库 0是普通入库 + aiinventory:0, //1是AI入库 0是普通入库 + userType:1 } }, filters: { @@ -93,7 +94,8 @@ onLoad(option) { this.purchaseDetails = JSON.parse(option.purchaseDetails) this.purchase = JSON.parse(option.purchase) - this.aiinventory = option.aiinventory + this.aiinventory = option.aiinventory + this.userType = uni.getStorageSync('type') }, methods: { inventorySubmit() { diff --git a/package1/staff/addStaff.vue b/package1/staff/addStaff.vue index ae71d66..14bccb0 100644 --- a/package1/staff/addStaff.vue +++ b/package1/staff/addStaff.vue @@ -81,7 +81,7 @@ let url; if(this.type=='edit'){ url = '/app/common/user/edit' - this.addForm.username = this.mobile + this.addForm.username = this.addForm.mobile this.addForm.id = this.id }else{ url = '/app/common/user/add' diff --git a/package1/stock/addStock.vue b/package1/stock/addStock.vue index fb28754..109dd39 100644 --- a/package1/stock/addStock.vue +++ b/package1/stock/addStock.vue @@ -118,7 +118,7 @@ {{item1.stockCount}} - + diff --git a/package1/stock/stockDetail.vue b/package1/stock/stockDetail.vue index 16f2d9e..e48513c 100644 --- a/package1/stock/stockDetail.vue +++ b/package1/stock/stockDetail.vue @@ -30,7 +30,7 @@ {{item.stockCount}} - +