From c89b5b83de6a189e0f06e571923dcd95dcb9bfed Mon Sep 17 00:00:00 2001 From: wangfukang <15630117759@163.com> Date: Thu, 11 Apr 2024 20:56:59 +0800 Subject: [PATCH] 1 --- package1/AI/AIHangOrderList.vue | 273 ++++++++++------- package1/AI/AIInventoryList.vue | 24 +- package1/AI/AIPicture.vue | 384 +++++++++++++++--------- package1/AI/AiChat.vue | 8 +- package1/cropper/.DS_Store | Bin 6148 -> 0 bytes package1/cropper/cropper.vue | 309 ------------------- package1/inventory/addGoods.vue | 4 +- package1/inventory/inventoryConfirm.vue | 7 +- 8 files changed, 433 insertions(+), 576 deletions(-) delete mode 100644 package1/cropper/.DS_Store delete mode 100644 package1/cropper/cropper.vue diff --git a/package1/AI/AIHangOrderList.vue b/package1/AI/AIHangOrderList.vue index a091401..383ef53 100644 --- a/package1/AI/AIHangOrderList.vue +++ b/package1/AI/AIHangOrderList.vue @@ -81,7 +81,7 @@ - {{items.productName}}({{items.productSn}})单价:{{items.discountAmount}} + {{items.productName}}({{items.productSn}})单价:{{items.discountAmount || items.wholesalePrice}} @@ -229,7 +229,7 @@ components: {}, data() { return { - Name:{}, + khName:[], regList:[], pageNumber: 1, recordState: false, @@ -277,20 +277,20 @@ onPullDownRefresh(){ this.getRegList() }, - onShow() { - this.getRegList() - this.Name = JSON.parse(JSON.stringify(this.khName)) || '' + onShow() { + this.khName = JSON.parse(JSON.stringify(this.khName)) || '' if(uni.getStorageSync('hangOrderType') == 'scanCode'){ this.addReg() uni.removeStorageSync('hangOrderType') return; } - if(this.Name != ''){ - this.khName = [] + if(this.khName != ''){ uni.navigateTo({ - url: '/package1/AI/AiChat?khName='+ JSON.stringify(this.Name) + url: '/package1/AI/AiChat?khName='+ JSON.stringify(this.khName) }) - } + } + this.khName = [] + this.getRegList() }, onLoad() { this.shopName = uni.getStorageSync('shopName') @@ -321,14 +321,14 @@ }, addReg() { this.tui.request("/app/sale/saveOrder", "POST", { - userId:this.Name.id, - userName:this.Name.name, + userId:this.khName.id, + userName:this.khName.name, aiFlag:0, status: 7, - area:this.Name.area, - city:this.Name.city, - province:this.Name.province, - receiveAddress:this.Name.address + area:this.khName.area, + city:this.khName.city, + province:this.khName.province, + receiveAddress:this.khName.address }, false, false).then((res) => { if (res.code == 200) { this.getRegList() @@ -486,12 +486,13 @@ value.push(value1) evalue.push(name) } - + console.log(jishuqi) // if (jishuqi == 0) { // this.oldTemList = [] // } - if (this.temporaryList.length == 0) { + // if (this.temporaryList.length == 0) { if (jishuqi == this.goodsList.length) { + console.log(jishuqi) for (var i = 0; i < value.length; i++) { this.attributeList = { attributeList: value[i], @@ -503,55 +504,56 @@ this.temporaryList.push(this.attributeList); } } - } else { - let newProductCount = 0; - for (var i = 0; i < value.length; i++) { - for (var m = 0; m < this.temporaryList.length; m++) { - if (this.temporaryList[m].attributeList == value[i]) { - newProductCount = this.temporaryList[m].productCount - } - } - this.attributeList = { - attributeList: value[i], - productCount: newProductCount, - productNum: this.productNum, - name: evalue[i], - price: this.purchasePrice - } + this.$forceUpdate() + // } else { + // let newProductCount = 0; + // for (var i = 0; i < value.length; i++) { + // for (var m = 0; m < this.temporaryList.length; m++) { + // if (this.temporaryList[m].attributeList == value[i]) { + // newProductCount = this.temporaryList[m].productCount + // } + // } + // this.attributeList = { + // attributeList: value[i], + // productCount: newProductCount, + // productNum: this.productNum, + // name: evalue[i], + // price: this.purchasePrice + // } - this.newTemList.push(this.attributeList); - newProductCount = 0; - } - for (var i = 0; i < this.oldTemList.length; i++) { - let oldAttributeList = ''; - let oldProductCount = ''; - let notChcek = true; - for (var m = 0; m < this.newTemList.length; m++) { - if (this.oldTemList[i].attributeList == this.newTemList[m].attributeList) { - this.newTemList[m].productCount = this.oldTemList[i].productCount - notChcek = false; - } - } - if (this.newTemList.length > 0 && notChcek) { - this.newTemList.push(this.oldTemList[i]); - } - } + // this.newTemList.push(this.attributeList); + // newProductCount = 0; + // } + // for (var i = 0; i < this.oldTemList.length; i++) { + // let oldAttributeList = ''; + // let oldProductCount = ''; + // let notChcek = true; + // for (var m = 0; m < this.newTemList.length; m++) { + // if (this.oldTemList[i].attributeList == this.newTemList[m].attributeList) { + // this.newTemList[m].productCount = this.oldTemList[i].productCount + // notChcek = false; + // } + // } + // if (this.newTemList.length > 0 && notChcek) { + // this.newTemList.push(this.oldTemList[i]); + // } + // } - for (var i = 0; i < this.pageOldTemList.length; i++) { - let oldAttributeList = ''; - let oldProductCount = ''; - let notChcek = true; - for (var m = 0; m < this.newTemList.length; m++) { - if (this.pageOldTemList[i].attributeList == this.newTemList[m].attributeList) { - this.newTemList[m].productCount = this.pageOldTemList[i].productCount - notChcek = false; - } - } - if (this.newTemList.length > 0 && notChcek) { - this.newTemList.push(this.pageOldTemList[i]); - } - } - } + // for (var i = 0; i < this.pageOldTemList.length; i++) { + // let oldAttributeList = ''; + // let oldProductCount = ''; + // let notChcek = true; + // for (var m = 0; m < this.newTemList.length; m++) { + // if (this.pageOldTemList[i].attributeList == this.newTemList[m].attributeList) { + // this.newTemList[m].productCount = this.pageOldTemList[i].productCount + // notChcek = false; + // } + // } + // if (this.newTemList.length > 0 && notChcek) { + // this.newTemList.push(this.pageOldTemList[i]); + // } + // } + // } this.$nextTick(() => { for (var i = 0; i < this.temporaryList.length; i++) { for (var m = 0; m < this.pecsList.length; m++) { @@ -561,17 +563,17 @@ } } }) - if (jishuqi != this.goodsList.length) { - if (this.oldTemList.length == 0 && this.pageOldTemList.length == 0) { - this.newTemList = [] - this.temporaryList = [] - } - } - if (this.newTemList.length != 0 && jishuqi == this.goodsList.length) { - this.temporaryList = this.newTemList; - this.oldTemList = [] - this.newTemList = [] - } + // if (jishuqi != this.goodsList.length) { + // if (this.oldTemList.length == 0 && this.pageOldTemList.length == 0) { + // this.newTemList = [] + // this.temporaryList = [] + // } + // } + // if (this.newTemList.length != 0 && jishuqi == this.goodsList.length) { + // this.temporaryList = this.newTemList; + // this.oldTemList = [] + // this.newTemList = [] + // } }, temporaryChange(val) { @@ -592,6 +594,7 @@ for (var i = 0; i < this.temporaryList.length; i++) { if(this.temporaryList[i].productCount <= 0){ this.tui.toast("商品数量不能为零!") + return } } let data = { @@ -641,6 +644,7 @@ toggle(type, id) { this.type = type if (type == 'bottom') { + this.allChangeNum = 0 this.getById(id); } else { wx.vibrateShort() @@ -697,50 +701,55 @@ //带参数跳转到开单页 goSaleGoods(item) { let dataList = [] - if(item.saleDetailDTOList){ - for (let i = 0; i < item.saleDetailDTOList.length; i++) { + if(item.aiNotRecognition != ''){ + this.tui.toast(item.aiNotRecognition) + } + setTimeout(res => { + if(item.saleDetailDTOList){ + for (let i = 0; i < item.saleDetailDTOList.length; i++) { + let obj = {} + obj.saleDetailQueryDTO = item.saleDetailDTOList[i].stockLogList1 + obj.num = 0 + obj.id = item.saleDetailDTOList[i].productId + obj.price = item.saleDetailDTOList[i].price + obj.lsprice = item.saleDetailDTOList[i].price + obj.zPrice = item.saleDetailDTOList[i].discountAmount + obj.unitPrice = item.saleDetailDTOList[i].discountAmount + obj.productName = item.saleDetailDTOList[i].productName + obj.productPicture = item.saleDetailDTOList[i].productPicture+'?time='+new Date().getTime() + obj.productSn = item.saleDetailDTOList[i].productSn + obj.wholesalePrice = item.saleDetailDTOList[i].wholesalePrice + obj.saleId = item.id + obj.remark = item.remark + obj.xsyId = item.createBy + obj.createByName = item.createByName + dataList.push(obj) + } + }else{ let obj = {} - obj.saleDetailQueryDTO = item.saleDetailDTOList[i].stockLogList1 obj.num = 0 - obj.id = item.saleDetailDTOList[i].productId obj.price = 0 - obj.lsprice = item.saleDetailDTOList[i].price - obj.zPrice = item.saleDetailDTOList[i].discountAmount - obj.unitPrice = item.saleDetailDTOList[i].discountAmount - obj.productName = item.saleDetailDTOList[i].productName - obj.productPicture = item.saleDetailDTOList[i].productPicture+'?time='+new Date().getTime() - obj.productSn = item.saleDetailDTOList[i].productSn - obj.wholesalePrice = item.saleDetailDTOList[i].wholesalePrice obj.saleId = item.id obj.remark = item.remark obj.xsyId = item.createBy obj.createByName = item.createByName dataList.push(obj) } - }else{ - let obj = {} - obj.num = 0 - obj.price = 0 - obj.saleId = item.id - obj.remark = item.remark - obj.xsyId = item.createBy - obj.createByName = item.createByName - dataList.push(obj) - } - let khName = { - name:item.userName, - id:item.userId, - area:item.area, - city:item.city, - address:item.receiveAddress, - province:item.province, - } - uni.setStorageSync('carList1', JSON.stringify(dataList)) - uni.setStorageSync('khName', JSON.stringify(khName)) - - uni.switchTab({ - url: '/pages/inventory/goodsList1' - }) + let khName = { + name:item.userName, + id:item.userId, + area:item.area, + city:item.city, + address:item.receiveAddress, + province:item.province, + } + uni.setStorageSync('carList1', JSON.stringify(dataList)) + uni.setStorageSync('khName', JSON.stringify(khName)) + uni.setStorageSync('hangOrder', true) + uni.switchTab({ + url: '/pages/inventory/goodsList1' + }) + }, 1000) }, //点击切换折叠状态 clickCollapse(item) { @@ -795,6 +804,7 @@ categoryId: this.goodsDetail.categoryId }, false, true).then((res1) => { if (res1.code == 200) { + this.goodsList = [] this.$refs.shopPopup.open('bottom') if (typeof(res1.result) == 'string') { let newObj = JSON.parse(res1.result) @@ -904,6 +914,49 @@ //清空语音输入的文字 clearText(){ this.voiceText = '' + }, + //删除整条商品 + delGoods(item, productId) { + let that = this; + this.hangId = item.id; + uni.showModal({ + title: "提示", + content: "确定删除此条商品吗?", + success: function(res) { + if (res.confirm) { + for (let i = 0; i < item.saleDetailDTOList.length; i++) { + if (item.saleDetailDTOList[i].productId == productId) { + item.saleDetailDTOList.splice(item.saleDetailDTOList[i], 1) + } + } + that.carList = item.saleDetailDTOList + that.setSaleDetail(); + } + } + }) + }, + //选商品的时候能删除规格 + delCarData(index) { + this.temporaryList.splice(index, 1); + this.temporaryChange() + + }, + //删除商品下的单条规格 + delGoodsPrecs(item, index, index1) { + let that = this; + this.hangId = item.id; + uni.showModal({ + title: "提示", + content: "确定删除此条规格吗?", + success: function(res) { + if (res.confirm) { + item.saleDetailDTOList[index].stockLogList1.splice(item.saleDetailDTOList[index] + .stockLogList1[index1], 1) + that.carList = item.saleDetailDTOList + that.setSaleDetail(); + } + } + }) }, } } diff --git a/package1/AI/AIInventoryList.vue b/package1/AI/AIInventoryList.vue index 18d96cd..cdf6634 100644 --- a/package1/AI/AIInventoryList.vue +++ b/package1/AI/AIInventoryList.vue @@ -23,7 +23,11 @@ - 入库列表 + + 入库列表 + + + @@ -42,10 +46,6 @@ - - - - @@ -112,16 +112,17 @@ for(let i=0;i欢迎使用Ai助手,为了提高图片识别准确率,建议您按照以下要求上传图片: 1.每张图片建议您裁剪到20个规格或以下 2.确保最后一款商品规格截取完整 - 3.每张图片输入对应的规格数量 + 3.每张图片输入对应的规格数量 + 4.如果拍照后找不到所拍照片,打开微信的设置-通用-照片、视频里面的照片,点击开启后重启微信即可 @@ -29,15 +30,17 @@ - 上传图片 - + + (←点击此处添加主图) - + @@ -45,26 +48,38 @@ - - - - - - - - - - - 点击添加子图 - + + + + + + + + + + 点击添加子图 + + + - + Ai识别 - + + + + + 拍照 + 从相册选择 + 取消 + + @@ -79,103 +94,75 @@ 'https://jewel-shop.oss-cn-beijing.aliyuncs.com/44e7ccc2fae74db593bd1a10f538e2de.jpg', 'https://jewel-shop.oss-cn-beijing.aliyuncs.com/2a55142e562b4ea480ce553c8b84d092.jpg' ], - purchaseOcrPictureList: [], - parentPicturePath:'', - parentId:'', - newSubmit:[] + purchaseOcrPictureList: [], + parentPicturePath: '', + parentId: '', + newSubmit: [] } }, onShow() { - if (this.uploadUrl && this.uploadNum == 1) { - if(this.parentId !=''){ - for(let i=0;i 0){ - for(let m=0;m { - if (res.code == 200) { - this.tui.toast("识别中,请等待...") - setTimeout(res => { - uni.navigateBack({ - delta: 1 - }) - }, 2000) - - } else { - this.tui.toast(res.message) - } + splitData(str) { + return str.split('/')[3].split('.')[0] + }, + identify() { + this.newSubmit = [] + if (this.purchaseOcrPictureList.length == 0) { + this.tui.toast("请选择要上传的图片") + return + } + for (let i = 0; i < this.purchaseOcrPictureList.length; i++) { + if (this.purchaseOcrPictureList[i].count == 0 || this.purchaseOcrPictureList[i].count == '') { + this.tui.toast("请输入数量") + return + } else { + let data = { + ocrPicture: this.purchaseOcrPictureList[i].ocrPicture, + count: this.purchaseOcrPictureList[i].count, + parentPicturePath: '' + } + this.newSubmit.push(data) + if (this.purchaseOcrPictureList[i].children.length > 0) { + for (let m = 0; m < this.purchaseOcrPictureList[i].children.length; m++) { + if (this.purchaseOcrPictureList[i].children[m].count == 0 || this.purchaseOcrPictureList[i] + .children[m].count == '') { + this.tui.toast("请输入子图片的规格数量") + return + } else { + let data = { + ocrPicture: this.purchaseOcrPictureList[i].children[m].ocrPicture, + count: this.purchaseOcrPictureList[i].children[m].count, + parentPicturePath: this.purchaseOcrPictureList[i].ocrPicture + } + this.newSubmit.push(data) + } + } + } + } + } + console.log(this.newSubmit) + this.tui.request("/purchaseOcrPicture/batchSave", "POST", { + orderId: "", + purchaseOcrPictureList: this.newSubmit + + }, false, false).then((res) => { + if (res.code == 200) { + uni.navigateBack({ + delta: 1 + }) + + } else { + this.tui.toast(res.message) + } }).catch((res) => {}) }, backPage() { @@ -189,20 +176,109 @@ urls: [img], current: img }) + }, + toggle(){ + let that = this; + uni.getSystemInfo({ + success: function (res) { + if(res.osName == 'ios'){ + that.upLoadImg('ios') + }else if(res.osName == 'android'){ + that.$refs.popup.open('bottom') + } + } + }); }, - upLoadImg() { - let that = this; - uni.chooseMedia({ - count: 1, - mediaType: ['image'], - sourceType: ['album', 'camera'], - camera: 'back', - success(res) { - uni.navigateTo({ - url: '/package1/cropper/cropper?imgSrc='+res.tempFiles[0].tempFilePath - }) - } - }) + upLoadImg(type) { + let that = this; + if(type == 'ios'){ + uni.chooseMedia({ + count: 1, + mediaType: ['image'], + sourceType: ['camera','album'], + camera: 'back', + success(res) { + that.upLoadFile(res.tempFiles[0].tempFilePath) + } + }) + }else if(type == 'pai'){ + uni.chooseMedia({ + count: 1, + mediaType: ['image'], + sourceType: ['camera'], + camera: 'back', + success(res) { + uni.chooseMedia({ + count: 1, + mediaType: ['image'], + sourceType: ['album'], + success(res1) { + that.upLoadFile(res1.tempFiles[0].tempFilePath) + } + }) + } + }) + }else if(type == 'xuan'){ + uni.chooseMedia({ + count: 1, + mediaType: ['image'], + sourceType: ['album'], + success(res1) { + that.upLoadFile(res1.tempFiles[0].tempFilePath) + } + }) + } + this.$refs.popup.close() + }, + upLoadFile(path){ + let that = this; + let hiver_token = uni.getStorageSync("hiver_token") + uni.uploadFile({ + url: 'https://dev.xenjoyou.com/hiver/upload/file', + filePath: path, + name: 'file', + header: { + "content-type": "multipart/form-data", + 'accessToken': hiver_token + }, + formData: {}, + success: (uploadFileRes) => { + + let path = JSON.parse(uploadFileRes.data) + + if (that.parentId != '') { + for (let i = 0; i < that.purchaseOcrPictureList + .length; i++) { + if (that.purchaseOcrPictureList[i].id == + that.parentId) { + let data = { + ocrPicture: path.result, + count: '', + } + that.purchaseOcrPictureList[i].children + .push(data) + } + } + that.parentId = '' + } else { + let data = { + ocrPicture: path.result, + count: '', + id: that.splitData(path.result), + children: [] + } + that.purchaseOcrPictureList.push(data) + } + + console.log('查看图片', that.purchaseOcrPictureList) + }, + fail: (err) => { + uni.showToast({ + title: JSON.stringify(err), + icon: 'none' + }) + } + }); }, delImage(index) { let that = this; @@ -215,6 +291,19 @@ } } }) + }, + delSonImage(index,indexs) { + let that = this; + console.log(that.purchaseOcrPictureList) + uni.showModal({ + title: "提示", + content: "确定删除该子图吗?", + success: function(res) { + if (res.confirm) { + that.purchaseOcrPictureList[index].children.splice(indexs, 1); + } + } + }) } } } @@ -353,7 +442,7 @@ animation: blinking 1s infinite; } - .bottom { + .bottom-box { position: fixed; bottom: 100rpx; right: 0; @@ -463,31 +552,38 @@ height: 80%; padding: 10px; } - } - .uni-easyinput { - width: 100%; - height: 20%; - font-size: 36rpx; - line-height: 40rpx; - background: #F8FAFF; - text-align: center; - display: block; - border:none; - border-bottom-left-radius: 10px; - border-bottom-right-radius: 10px; } - .del-icon { - width: 50rpx; - height: 50rpx; - position: absolute; - top: 0; - right: 0; + + .uni-easyinput { + width: 100%; + height: 20%; + font-size: 36rpx; + line-height: 40rpx; + background: #F8FAFF; + text-align: center; + display: block; + border: none; + border-bottom-left-radius: 10px; + border-bottom-right-radius: 10px; } + + .del-icon { + width: 50rpx; + height: 50rpx; + position: absolute; + top: 0; + right: 0; + } + .icon-upload { position: absolute; top: 0; left: 190rpx; - height: 100%; + height: 100%; + + uni-icons{ + float: left; + } } .title-line { @@ -531,5 +627,13 @@ 100% { transform: rotate(360deg); } + } + .popup-photo{ + height: 110rpx; + line-height: 110rpx; + text-align: center; + font-size: 36rpx; + font-weight: 800; + border-bottom: 1px solid #eee; } \ No newline at end of file diff --git a/package1/AI/AiChat.vue b/package1/AI/AiChat.vue index 92af97d..263781c 100644 --- a/package1/AI/AiChat.vue +++ b/package1/AI/AiChat.vue @@ -103,7 +103,8 @@ this.height = wx.getSystemInfoSync().windowHeight this.khName = JSON.parse(option.khName) - console.log(this.khName) + console.log(this.khName) + this.initRecord(); }, methods: { switchChat(type){ @@ -153,6 +154,7 @@ manager.stop() // 识别结束事件 manager.onStop = (res) => { + console.log(res) if (res.result == '') { uni.showToast({ title: "请重新说一遍", @@ -180,6 +182,10 @@ } }, addReg() { + if(this.msgList.length <= 0){ + this.tui.toast("小助手没有检测到可识别的内容哦~") + return + } this.tui.request("/app/sale/saveOrder", "POST", { userId:this.khName.id, userName:this.khName.name, diff --git a/package1/cropper/.DS_Store b/package1/cropper/.DS_Store deleted file mode 100644 index 55cf749ca7ea4bb2c6c9d23ef99e4998371b33ee..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6148 zcmeHKJxc>o5S-N%fix*CUoQy$gJ(#J)cyfUOcyv2Vttjr%YUY`ABf?!5o}}@cIUml zoqKmv+};AP)#>pTSOS>S9r5a6YJS~)Vi%P$BAxem!U4~?!3$24>hBZIU0_evK=xPu zVS60*yW_B9g+JaM{rWwOE149K0#ZNF{(We4$6h!l z#;1cJMgZcB=`gNimLN7y5PRX6$PCSrN=&NNh+#=*zExc>921ici<5buI@xMMu{fRi z7Ui&>s3--bz_|jKxm|ky-_U=U|IbO!2`1J0?au=EmFcRTO1i^EI#c!Z9)E%m - - - - - - 点击中间裁剪框可查看裁剪后的图片 - - - - - - - - - - - \ No newline at end of file diff --git a/package1/inventory/addGoods.vue b/package1/inventory/addGoods.vue index cdbd375..983083d 100644 --- a/package1/inventory/addGoods.vue +++ b/package1/inventory/addGoods.vue @@ -72,7 +72,7 @@ price: '', productSn: '', wholesalePrice: '', - productPicture: [], + productPicture: '', productIntro: '', categoryId: '', salesWeek: '', @@ -192,7 +192,7 @@ return new Promise((resolve, reject) => { let a = uni.uploadFile({ - url: 'https://storage.xenjoyou.com/hiver/upload/file', + url: 'https://dev.xenjoyou.com/hiver/upload/file', filePath: url, name: 'file', header: { diff --git a/package1/inventory/inventoryConfirm.vue b/package1/inventory/inventoryConfirm.vue index b890542..6f7516d 100644 --- a/package1/inventory/inventoryConfirm.vue +++ b/package1/inventory/inventoryConfirm.vue @@ -63,7 +63,7 @@ - 批量打印 + 批量打印 确认提交 @@ -75,7 +75,7 @@ return { purchase:'', purchaseDetails:'', - aiinventory:0 + aiinventory:0 //1是AI入库 0是普通入库 } }, filters: { @@ -131,7 +131,7 @@ uni.navigateTo({ url: "/package1/inventory/batchPrint?purchase=" + JSON.stringify(this.purchase) + '&purchaseDetails=' + JSON.stringify(this.purchaseDetails) }) - } + }, }, } @@ -278,6 +278,7 @@ line-height: 140rpx; color: #777; background: #eee; + margin: 15px 0 0 15px; } .uni-tooltip { display: flex !important;