From d5902c4065c586d15ee44dea03ab147412e2dabe Mon Sep 17 00:00:00 2001 From: jia <1451658316@qq.com> Date: Wed, 6 Sep 2023 13:56:44 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A7=94=E6=89=98=E7=95=8C=E9=9D=A2=E4=BC=98?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/shoppinglist/shoppinglist.vue | 84 ++++++++++++++---- pages.json | 4 +- pages/admin/order/index.vue | 1 - .../commissionedSales/addDelegation/index.vue | 8 +- .../delegation_details/index.vue | 67 ++++++++++++-- .../initiateDelegation/index.vue | 88 ++++++++++++++++--- pages/gather/gather.vue | 3 +- pages/moreProject/moreProject.vue | 4 +- 8 files changed, 215 insertions(+), 44 deletions(-) diff --git a/components/shoppinglist/shoppinglist.vue b/components/shoppinglist/shoppinglist.vue index 3b921a9..29d6598 100644 --- a/components/shoppinglist/shoppinglist.vue +++ b/components/shoppinglist/shoppinglist.vue @@ -62,12 +62,13 @@ 出售数量 + :isMax="true" :isMin="true" index="11" @eventChange="numberChange($event,i)"> + :isMin="true" index="11" @increment="incrementTotal($event,i,item)" + @eventChange="numberChange($event,i)"> @@ -130,7 +131,7 @@ bought: [], checkedArr: [], - + aryys: [], // picker下拉数据源 storageCustomList: [{ CustGoodsCode: "TEST001", @@ -165,14 +166,35 @@ }, mounted() { this.checkedArr = this.checkedObj + this.aryys = this.checkedObj this.getBounht(); }, methods: { //价格 - producrprice(e, i,item) { - + producrprice(e, i, item) { this.bought[i].price = e.detail.value - this.$set(item, 'check',false); + this.$set(item, 'check', false); + for (let i in this.checkedArr) { + if (this.checkedArr[i].product_id == item.product_id) { + this.checkedArr.splice(i, 1) + } + } + + + + }, + incrementTotal(e, i, item) { + this.$set(item, 'check', false); + for (let i in this.checkedArr) { + if (this.checkedArr[i].product_id == item.product_id) { + this.checkedArr.splice(i, 1) + } + } + + + + + }, // picker修改事件 bindPickerChange: function(e, storage, num) { @@ -220,15 +242,22 @@ setValue: function(event) { this.$set(this.whereb, 'keyword', event.detail.value); + if (!event.detail.value) { + this.whereb.page = 1 + this.loadedb = false + this.getBounht() + } }, searchBut() { - this.whereb.page = this.wherec.page = this.wheres.page = - this.bought = [] - this.isActive == 0 ? this.getBounht() : '' + this.bought = [] + this.whereb.page = 1 + this.loadedb = false + this.getBounht() }, getBounht() { var that = this; + // console.log('1111111', that.loadingb, that.loadedb) if (that.loadingb || that.loadedb) return; that.loadingb = true; @@ -268,7 +297,9 @@ getCheckedGoods() { this.checked = [] this.checkedArr.forEach((item, index) => { - this.check.push(item) + this.checkedArr.push(item) + + }) }, /*点击选中与否*/ @@ -278,22 +309,41 @@ if (this.peicenumber == 0) { item.number = 1 } - if (!item.product_attr_unique) { item.product_attr_unique = item.attrValue[0].unique } this.checkedArr.push(item) - + this.arrayUnique(this.checkedArr, 'product_id') } else { - this.checkedArr.splice(this.checkedArr.findIndex(itemn => ((itemn.spu_id == item.spu_id) || (item - .spu_id == ( - itemn.spu && itemn.spu.spu_id)))), 1) + this.checkedArr.splice(this.checkedArr.findIndex(itemn => ((itemn.product_id == item.product_id))), 1) } + }, + //去重 + arrayUnique(arr, name) { + let hash = {} + const result = arr.reduce((acc, cru, index) => { + if (!hash[cru[name]]) { + hash[cru[name]] = { + index: acc.length + } + acc.push(cru) + } else { + console.log(acc, hash[cru[name]]) + acc.splice(hash[cru[name]]['index'], 1, cru) + } + + + return acc; + + }, []) + this.checkedArr = result + + }, /*确定提交*/ submit() { - + this.$emit('getProduct', this.checkedArr); }, @@ -302,6 +352,8 @@ \ No newline at end of file diff --git a/pages/commissionedSales/initiateDelegation/index.vue b/pages/commissionedSales/initiateDelegation/index.vue index ce2d100..1f8eaf2 100644 --- a/pages/commissionedSales/initiateDelegation/index.vue +++ b/pages/commissionedSales/initiateDelegation/index.vue @@ -6,7 +6,7 @@ - + @@ -35,7 +35,7 @@ 处理 - + 详情 @@ -90,7 +90,15 @@ + + + + + + 新增委托 + + @@ -235,6 +243,7 @@