From 55d6e6a10a5d33dcd1535d70aa18817928f3ecf0 Mon Sep 17 00:00:00 2001 From: "tianyi@bogon" Date: Sun, 5 Nov 2023 14:50:57 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=A5=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/index/addHangOrder.vue | 26 ++-- pages/inventory/addinventory.vue | 98 +++++++++----- pages/inventory/changeGoods1.vue | 225 ++++++++++++++++--------------- 3 files changed, 200 insertions(+), 149 deletions(-) diff --git a/pages/index/addHangOrder.vue b/pages/index/addHangOrder.vue index ecba05f..cbd5fe5 100644 --- a/pages/index/addHangOrder.vue +++ b/pages/index/addHangOrder.vue @@ -12,7 +12,7 @@ {{item.saleName}} 编辑 - 扫码开单 + 扫码开单 语音备注 @@ -29,13 +29,14 @@ 备注: {{item.remark}} - + - 女士连衣裙(HD738206579) - + {{items.productName}} {{items.productSn}} + + + + {{itemss.attributeList}} * {{itemss.productCount}} - 颜色:黑色,尺码:s码 * 2 - 颜色:黑色,尺码:s码 * 2 @@ -190,7 +191,8 @@ purchasePrice: 0, zPrice:0, zNum:0, - storageType:0 + storageType:0, + hangId:'' } }, onLoad() { @@ -280,9 +282,10 @@ } }, //扫一扫功能 - scanCodeAdd() { + scanCodeAdd(id) { uni.scanCode({ - success: (res) => { + success: (res) => { + this.hangId = id this.toggle('bottom', res.result); }, @@ -375,6 +378,9 @@ supplierName: this.goodsDetail.supplierName, saleDetailQueryDTO:this.temporaryList } + // if(){ + + // } this.carList.push(data) console.log(this.carList); this.temporaryList = [] @@ -397,7 +403,7 @@ setSaleDetail(){ this.tui.request("/app/sale/setSaleDetail", "post", { saleDetailList:this.carList, - saleId:this.goodsDetail.id + saleId:this.hangId }, false, false).then((res) => { if (res.code == 200) { this.getRegList() diff --git a/pages/inventory/addinventory.vue b/pages/inventory/addinventory.vue index 59fab5f..353753c 100644 --- a/pages/inventory/addinventory.vue +++ b/pages/inventory/addinventory.vue @@ -33,11 +33,12 @@ 品名:{{item.productName}} 货号:{{item.productSn}} - 总价:{{item.price}} 数量:{{item.num}} + 总价:{{item.price}} 数量:{{item.num}} - + {{items.name}} 单价:¥{{items.price}} 数量:{{items.productCount}} @@ -89,11 +90,11 @@ - - - - + + + + @@ -121,15 +122,43 @@ alreadyPay: 0, realAmount: 0, shouldPay: 0, - totalAmount: 0, - index:'', - index1:'' + totalAmount: 0, + index: '', + index1: '' } }, onShow() { this.khName = JSON.parse(JSON.stringify(this.khName)) || '' - this.carList = this.carList || '' + let lsList = this.carList; + if (lsList.length == 0) { + this.carList = this.carList1 || [] + } else { //111 222 + for (var i = 0; i < lsList.length; i++) { + for (var s = 0; s < lsList[i].saleDetailQueryDTO.length; s++) { + for (var m = 0; m < this.carList1.length; m++) { + if (lsList[i].id == this.carList1[m].id) { //是相同商品 + for (var v = 0; v < this.carList1[m].saleDetailQueryDTO.length; v++) { //不是相同规格 + if (lsList[i].saleDetailQueryDTO[s].name != this.carList1[m].saleDetailQueryDTO[v].name) { + //已经是最后一项循环 + if (s + 1 == lsList[i].saleDetailQueryDTO.length) { + + this.carList[i].saleDetailQueryDTO.push(this.carList1[m].saleDetailQueryDTO[v]) + } + } else { //是相同规格 + this.carList[i].saleDetailQueryDTO[s].productCount += this.carList1[m].saleDetailQueryDTO[v].productCount + } + } + }else{ + if (i + 1 == lsList.length) { //已经是最后一项循环 + this.carList.push(this.carList1[m]) + } + } + } + } + } + } console.log(this.carList) + console.log(lsList) for (let i = 0; i < this.carList.length; i++) { this.totalAmount += this.carList[i].num this.shouldPay += this.carList[i].price @@ -174,6 +203,12 @@ inventorySubmit() { console.log(this.khName) console.log(this.carList) + if (this.khName == '' || this.carList == '') { + uni.showToast({ + title: "信息填写完成后入库!", + icon: 'none' + }) + } let that = this; let purchase = { alreadyPay: this.alreadyPay, //已付金额 @@ -218,25 +253,26 @@ }) } }) - }, - //编辑每一个的单价 - clickCollapse(index,index1){ - this.index = index - this.index1 = index1 - this.$refs.inputDialog.open() - }, - //计算价格 - changePrice(val){ - this.shouldPay = 0 - this.carList[this.index].price = 0 - this.carList[this.index].saleDetailQueryDTO[this.index1].price = val; - console.log(this.carList) - for (let m = 0; m < this.carList[this.index].saleDetailQueryDTO.length; m++) { - this.carList[this.index].price += this.carList[this.index].saleDetailQueryDTO[m].productCount *this.carList[this.index].saleDetailQueryDTO[m].price - } - for (let i = 0; i < this.carList.length; i++) { - this.shouldPay += this.carList[i].price - } + }, + //编辑每一个的单价 + clickCollapse(index, index1) { + this.index = index + this.index1 = index1 + this.$refs.inputDialog.open() + }, + //计算价格 + changePrice(val) { + this.shouldPay = 0 + this.carList[this.index].price = 0 + this.carList[this.index].saleDetailQueryDTO[this.index1].price = val; + console.log(this.carList) + for (let m = 0; m < this.carList[this.index].saleDetailQueryDTO.length; m++) { + this.carList[this.index].price += this.carList[this.index].saleDetailQueryDTO[m].productCount * this + .carList[this.index].saleDetailQueryDTO[m].price + } + for (let i = 0; i < this.carList.length; i++) { + this.shouldPay += this.carList[i].price + } } } } @@ -364,7 +400,7 @@ .shop-collapse text { flex: 1; - text-align: center; + text-align: center; padding-right: 40rpx; border-right: 1px solid #eee; } diff --git a/pages/inventory/changeGoods1.vue b/pages/inventory/changeGoods1.vue index bdd9527..8cdc213 100644 --- a/pages/inventory/changeGoods1.vue +++ b/pages/inventory/changeGoods1.vue @@ -90,14 +90,14 @@ - + - {{item.name}} + {{item[0]}} - + - + 数量:{{zNum}} 件 @@ -171,23 +171,22 @@ temporaryNum: 0, goodsDetail: [], attrNameList: [], - temporaryList: [], - carList: [], + temporaryList: new Map(), + carList: new Map(), columns: [], keyList: [], - specsList: [], evalue: [], attributeList: [], - purchasePrice: 0, - zPrice:0, - zNum:0, - storageType:0, - carNum:0, - carType:0 + purchasePrice: 0, + zPrice: 0, + zNum: 0, + storageType: 0, + carNum: 0, + carType: 0 } }, onLoad() { - this.getGategoryList() + this.getGategoryList() this.storageType = uni.getStorageSync('type') }, methods: { @@ -219,8 +218,7 @@ this.goodsDetail.attributeList[index].value[index1].isChecked = true; var name = '', evalue = [], - obj = {}, - specsList = [] + obj = {} for (var i = 0; i < this.goodsDetail.attributeList.length; i++) { for (var m = 0, Ien = this.goodsDetail.attributeList[i].value; m < Ien.length; m++) { if (Ien[m].isChecked == true) { @@ -238,45 +236,50 @@ jishuqi++ } } + // this.temporaryList = new Map(); if (this.goodsDetail.attributeList.length == jishuqi) { - let data = {} this.attributeList = { attributeList: JSON.stringify(obj), - productCount: this.temporaryNum, - name:name, - price:this.purchasePrice + productCount: this.temporaryNum, + name: name, + price: this.purchasePrice } - if (this.temporaryList.length == 0) { - this.temporaryList.push(this.attributeList); - } else { - for (var i = 0; i < this.temporaryList.length; i++) { - if (this.temporaryList[i].name.indexOf(this.attributeList.name) != -1) { - this.temporaryList[i] = this.attributeList - return - } else { - if (this.temporaryList.length == (i+1)) { - this.temporaryList.push(this.attributeList); - return - } - } + for (let i = 0; i < this.goodsDetail.attributeList.length; i++) { + this.goodsDetail.attributeList[i].isChecked = false; + for (let m = 0; m < this.goodsDetail.attributeList[i].value.length; m++) { + this.goodsDetail.attributeList[i].value[m].isChecked = false } - } - } + // if (this.temporaryList.size == 0) { + this.temporaryList.set(name, this.attributeList); + // } else { + // console.log(this.carList) + // console.log(this.goodsDetail.id) + console.log(Array.from(this.temporaryList)) + // if (this.carList.get(this.goodsDetail.id).saleDetailQueryDTO.has(this.attributeList.name)) { + + // this.carList.get(this.goodsDetail.id).saleDetailQueryDTO.get(this.attributeList.name).value = this.attributeList + // } else { + // this.temporaryList.set(name, this.attributeList); + // // this.temporaryList.push(this.attributeList); + // } + + // } + } }, - temporaryChange(val) { + temporaryChange(val) { this.zNum = 0 - for (var i=0;i