From cce8468ce32beaf316a30f8d9b8358783beaccb3 Mon Sep 17 00:00:00 2001 From: wangfukang <15630117759@163.com> Date: Tue, 2 Apr 2024 20:34:15 +0800 Subject: [PATCH] 11 --- pages/inventory/AIInventory.vue | 125 +++++++++++++++++++++++++++---- pages/inventory/addinventory.vue | 3 +- pages/inventory/gategoryLow.vue | 85 +++------------------ pages/inventory/goodsList1.vue | 2 +- 4 files changed, 124 insertions(+), 91 deletions(-) diff --git a/pages/inventory/AIInventory.vue b/pages/inventory/AIInventory.vue index 26b8034..a509c30 100644 --- a/pages/inventory/AIInventory.vue +++ b/pages/inventory/AIInventory.vue @@ -29,12 +29,15 @@ :key="key"> - + - - + + + + + 删除 - 合并 + 合并 @@ -51,7 +54,9 @@ 单价: - 添加规格 + + 添加规格 + @@ -206,6 +211,36 @@ + + + + + 请选择要合并到的商品 + + + + + + 暂无图片 + + + + {{value[1].productName}} + + + 货号:{{value[1].productSn}} + + + + + + 没有要合并的商品?那就去库存里看看吧~ ↓↓ + + + 同库存商品合并 + + + @@ -270,7 +305,8 @@ pageOldTemList: [], oldTemList: [], attrList: [], - goodsList: [], + goodsList: [], + mergeId:'', newTemList: [], pecsList: [], dataObj: new Map(), @@ -296,7 +332,22 @@ title: '加载中...' }) let that = this; - + if(this.merge ==1){ + this.$refs.mergePopup.close(); + this.carList.get(this.mergeId).productId = this.carList1.id + this.carList.get(this.mergeId).id = this.carList1.id + this.carList.get(this.mergeId).productName = this.carList1.productName + this.carList.get(this.mergeId).productPicture = this.carList1.productPicture + this.carList.get(this.mergeId).productSn = this.carList1.productSn + this.carList.get(this.mergeId).categoryId = this.carList1.categoryId + this.carList.get(this.mergeId).isNew=false + setTimeout(res => { + uni.hideLoading(); + }, 300) + this.$forceUpdate() + this.merge ==0 + return; + } if(uni.getStorageSync('carList1') != ''){ this.carList1 = uni.getStorageSync('carList1') }else{ @@ -310,8 +361,9 @@ purchasePrice: this.carList1[i].price, //进货价 price: 0, productCount: 0, + id:this.carList1[i].id, isNew:this.carList1[i].isNew, - productId: this.carList1[i].id, + productId: this.carList1[i].productId == null ? '' : this.carList1[i].productId, productName: this.carList1[i].productName, wholesalePrice: this.carList1[i].wholesalePrice, categoryName:'', @@ -366,8 +418,9 @@ let obj = { purchasePrice: "", //进货价 price: 0, - productCount: 0, - productId: this.carList1[i].id, + productCount: 0, + id:this.carList1[i].id, + productId: this.carList1[i].productId == null ? '' : this.carList1[i].productId, isNew:this.carList1[i].isNew, productName: this.carList1[i].productName, wholesalePrice: this.carList1[i].wholesalePrice, @@ -634,6 +687,9 @@ uni.navigateTo({ url: "/pages/inventory/changeGoods1" }) + }, + mergeGoods(){ + }, addGategory(){ this.tui.request("/app/productCategory/save", "post", { @@ -683,6 +739,11 @@ this.temporaryList[i].productCount-- } this.temporaryChange() + }, + goChooseGoods(){ + uni.navigateTo({ + url: '/package1/AI/AiChangeGoods' + }) }, attrNameChange(index, data1, index1) { let that= this; @@ -837,7 +898,39 @@ this.$refs.typePopup.open() }else if(type== 'addGateDialog'){ this.$refs.addGateDialog.open() + }else if(type== "mergePopup"){ + console.log(id) + this.mergeId = id + this.$refs.mergePopup.open() } + }, + //合并已有 + clickMerge(value,key){ + let that = this; + console.log('key',this.mergeId) + console.log('11',this.carList.get(this.mergeId)) // 旧的 + console.log('订单',this.carList.get(value)) // 新的 + this.carList.get(this.mergeId).stockLogList.forEach(function(values, keys) { + if(that.carList.get(value).stockLogList.has(keys)){ + console.log('找到了') + that.carList.get(value).stockLogList.get(keys).productCount += that.carList.get(that.mergeId).stockLogList.get(keys).productCount + }else{ + console.log('没找到',that.carList.get(that.mergeId).stockLogList.get(keys)) + console.log('没找到',keys) + that.carList.get(value).stockLogList.set(keys,that.carList.get(that.mergeId).stockLogList.get(keys)) + } + that.carList.get(value).productCount += that.carList.get(that.mergeId).stockLogList.get(keys).productCount + that.carList.get(value).price = that.carList.get(value).productCount * that.carList.get(value).purchasePrice + }) + this.carList.delete(this.mergeId) + this.$forceUpdate() + console.log(this.carList) + this.getAllPrice() + this.$refs.mergePopup.close() + }, + AiAddSpec(value){ + console.log(value) + this.toggle('bottom', value.id); }, //通过商品id查询商品详细信息 getById(id) { @@ -1018,7 +1111,8 @@ let data = { id: this.goodsDetail.id, price: 0, - num: this.zNum, + num: this.zNum, + productId:this.goodsDetail.id, productName: this.goodsDetail.productName, wholesalePrice: this.goodsDetail.wholesalePrice, categoryName:'', @@ -1046,7 +1140,8 @@ let obj = { purchasePrice: "", //进货价 price: 0, - productCount: 0, + productCount: 0, + id: carList1[i].id, productId: carList1[i].id, wholesalePrice: this.goodsDetail.wholesalePrice, categoryName:'', @@ -1241,7 +1336,8 @@ supplierId: this.khName.id, //供应商id和姓名 supplierName: this.khName.consigneeName } - let purchaseDetails = []; + let purchaseDetails = []; + console.log(this.carList) this.carList.forEach(function(value, key) { value.stockLogList1 = [] if (value.purchasePrice == '' || value.purchasePrice == 0) { @@ -1265,7 +1361,8 @@ attributeList: keys } value.stockLogList1.push(obj) - }) + }) + delete value.id; purchaseDetails.push(value) }) console.log(purchaseDetails) diff --git a/pages/inventory/addinventory.vue b/pages/inventory/addinventory.vue index dd13f4e..6e53f0a 100644 --- a/pages/inventory/addinventory.vue +++ b/pages/inventory/addinventory.vue @@ -864,7 +864,8 @@ let obj = { purchasePrice: "", //进货价 price: 0, - productCount: 0, + productCount: 0, + id:carList1[i].id, productId: carList1[i].id, productName: carList1[i].productName, wholesalePrice: this.goodsDetail.wholesalePrice, diff --git a/pages/inventory/gategoryLow.vue b/pages/inventory/gategoryLow.vue index 440633a..15af60f 100644 --- a/pages/inventory/gategoryLow.vue +++ b/pages/inventory/gategoryLow.vue @@ -111,15 +111,15 @@ }, methods: { //初始化获取子分类列表 - getGategoryList() { + getGategoryList() { + let data = [] this.tui.request("/app/productAttribute/selectByCategoryId", "POST", { categoryId: this.categoryId }, false, true).then((res1) => { if (res1.code == 200) { - this.attrList = res1.result; + data = res1.result; if (res1.result.length > 0) { - this.attrList.forEach((items) => { - + data.forEach((items) => { this.tui.request( "/app/productAttributeValue/selectByAttributeId", "get", { @@ -127,7 +127,6 @@ }, false, true).then((res2) => { if (res2.code == 200) { items.attributeValue = res2.result; - // } else { this.tui.toast(res.message) } @@ -135,13 +134,15 @@ }).catch((res) => {}) }) } - setTimeout(() => { - this.showList = this.attrList; - }, 1000) + } else { this.tui.toast(res.message) } - }).catch((res) => {}) + }).catch((res) => {}) + this.$forceUpdate() + setTimeout(() => { + this.attrList = data + }, 1000) }, //查询分类下有没有库存 getTypeToNum() { @@ -156,76 +157,10 @@ this.$refs.carPopup.open('bottom') } else { that.show = true - // this.tui.request("/app/productAttribute/selectByCategoryId", "POST", { - // categoryId: this.delItems.id - // }, false, true).then((res1) => { - // if (res1.code == 200) { - // if (res1.result.length > 0) { - // uni.showModal({ - // title: "提示", - // content: "此分类已经维护了子分类,确定继续删除吗?", - // success: function(res2) { - // if (res2.confirm) { - // that.delItemModal() - // } - // } - // }) - // } else { - // that.show = true - // } - // } - // }).catch((res) => {}) } } }).catch((res) => {}) }, - // 获取属性名 - getProductAttribute() { - this.attrList.forEach((item, index) => { - this.tui.request("/app/productAttribute/selectByCategoryId", "get", { - categoryId: this.categoryId - }, false, true).then((res) => { - if (res.code == 200) { - item.attrName = res.result; - if (item.attrName.length > 0) { - item.attrName.forEach((items) => { - this.tui.request( - "/app/productAttributeValue/selectByAttributeId", - "get", { - id: items.id - }, false, true).then((res) => { - if (res.code == 200) { - items.attributeValue = res.result; - this.showList = this.attrList - } else { - this.tui.toast(res.message) - } - }).catch((res) => {}) - }) - } - } else { - this.tui.toast(res.message) - } - }).catch((res) => {}) - }) - }, - // 获取属性值 - getProductAttributeValue(index) { - - this.attrList.forEach((item) => { - this.tui.request("/app/productAttributeValue/selectByAttributeId", "get", { - id: item.id - }, false, true).then((res) => { - if (res.code == 200) { - item.attributeValue = res.result; - } else { - this.tui.toast(res.message) - } - }).catch((res) => {}) - }) - this.showList = JSON.parse(JSON.stringify(this.attrList)) - - }, inputDialogToggle(type, item, parent) { this.typeModel = type; if (type == 'edit') { diff --git a/pages/inventory/goodsList1.vue b/pages/inventory/goodsList1.vue index da6a7d1..1d4386f 100644 --- a/pages/inventory/goodsList1.vue +++ b/pages/inventory/goodsList1.vue @@ -352,7 +352,7 @@ - + 上次拿货时间: {{historyList.createTime}} 上次拿货数:{{historyList.productCount}}