From d706faef50fdf3f78b7d23d4b898f2a76898cce2 Mon Sep 17 00:00:00 2001 From: H <30830569@qq.com> Date: Fri, 29 Jul 2022 17:01:10 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=88=A0=E9=99=A4=E5=95=86?= =?UTF-8?q?=E5=93=81=E6=BB=91=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pageB/select_product/index.vue | 36 +++++++++++++++++++++++++----- 1 file changed, 31 insertions(+), 5 deletions(-) diff --git a/src/pageB/select_product/index.vue b/src/pageB/select_product/index.vue index 73f3e03..461472c 100644 --- a/src/pageB/select_product/index.vue +++ b/src/pageB/select_product/index.vue @@ -16,8 +16,10 @@ 下单商品 - - + + + {{index+1}} @@ -33,9 +35,11 @@ - + + + @@ -82,6 +86,14 @@ list: [], //搜索的商品 chooseList: [], //选择的商品 goodItem: {}, + options: [ + { + text: '删除', + style: { + backgroundColor: '#ef4444' + } + } + ] }; }, onLoad({ @@ -115,6 +127,21 @@ } }, methods: { + click(index,index1) { + + if(index1==0){ + this.$nextTick(()=>{ + this.chooseList.splice(index, 1) + this.chooseList[index].show = false; + }) + } + }, + open(index) { + this.chooseList[index].show = true; + this.chooseList.forEach((val, idx) => { + if(index != idx) this.chooseList[idx].show = false; + }) + }, //扫码 onQR(){ uni.scanCode({ @@ -148,11 +175,10 @@ }, //添加商品 addGood(e) { - console.log(e,'2222'); const result = this.chooseList.findIndex(item => item.id == e) if (result == -1) { const goodsItem=this.goodsList?.find(el=>el.id==e) - this.chooseList.unshift(goodsItem) + this.chooseList.push(Object.assign(goodsItem,{show:false})) } else { const num = this.chooseList[result].num + 1 this.getUpdate(result, num)