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)