添加删除商品滑动
parent
7b1cc19c89
commit
d706faef50
|
|
@ -16,8 +16,10 @@
|
||||||
</view>
|
</view>
|
||||||
<view v-if="chooseList.length>0" class="py-20rpx text-40rpx font-extrabold text-center">下单商品</view>
|
<view v-if="chooseList.length>0" class="py-20rpx text-40rpx font-extrabold text-center">下单商品</view>
|
||||||
<!-- 提货数量 -->
|
<!-- 提货数量 -->
|
||||||
<view class="px-30rpx bg-white">
|
<view class=" bg-white">
|
||||||
<view class="py-20rpx flex w-full items-start" v-for="(item,index) in chooseList" :key="index">
|
<u-swipe-action v-for="(item, index) in chooseList" :key="item.id" :show="item.show" :index="index" @click="click" @open="open" :options="options"
|
||||||
|
>
|
||||||
|
<view class="py-20rpx flex w-full items-start px-30rpx" >
|
||||||
<view
|
<view
|
||||||
class="w-38rpx mt-8rpx h-38rpx rounded-full border border-hex-ef4444 border-solid text-center leading-38rpx text-hex-ef4444">
|
class="w-38rpx mt-8rpx h-38rpx rounded-full border border-hex-ef4444 border-solid text-center leading-38rpx text-hex-ef4444">
|
||||||
{{index+1}}
|
{{index+1}}
|
||||||
|
|
@ -33,9 +35,11 @@
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<GoodsItem class="px-0" :goods="item" @numChange="numChange" />
|
<GoodsItem class="px-0" :goods="item" @numChange="numChange" />
|
||||||
<u-line v-if="chooseList.length-1!=index" :hair-line="false" color="#c8c9cc"></u-line>
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
<u-line v-if="chooseList.length-1!=index" :hair-line="false" color="#c8c9cc"></u-line>
|
||||||
|
</u-swipe-action>
|
||||||
</view>
|
</view>
|
||||||
<view class="h-180rpx"></view>
|
<view class="h-180rpx"></view>
|
||||||
<!-- 底部按钮 -->
|
<!-- 底部按钮 -->
|
||||||
|
|
@ -82,6 +86,14 @@
|
||||||
list: [], //搜索的商品
|
list: [], //搜索的商品
|
||||||
chooseList: [], //选择的商品
|
chooseList: [], //选择的商品
|
||||||
goodItem: {},
|
goodItem: {},
|
||||||
|
options: [
|
||||||
|
{
|
||||||
|
text: '删除',
|
||||||
|
style: {
|
||||||
|
backgroundColor: '#ef4444'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
onLoad({
|
onLoad({
|
||||||
|
|
@ -115,6 +127,21 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
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(){
|
onQR(){
|
||||||
uni.scanCode({
|
uni.scanCode({
|
||||||
|
|
@ -148,11 +175,10 @@
|
||||||
},
|
},
|
||||||
//添加商品
|
//添加商品
|
||||||
addGood(e) {
|
addGood(e) {
|
||||||
console.log(e,'2222');
|
|
||||||
const result = this.chooseList.findIndex(item => item.id == e)
|
const result = this.chooseList.findIndex(item => item.id == e)
|
||||||
if (result == -1) {
|
if (result == -1) {
|
||||||
const goodsItem=this.goodsList?.find(el=>el.id==e)
|
const goodsItem=this.goodsList?.find(el=>el.id==e)
|
||||||
this.chooseList.unshift(goodsItem)
|
this.chooseList.push(Object.assign(goodsItem,{show:false}))
|
||||||
} else {
|
} else {
|
||||||
const num = this.chooseList[result].num + 1
|
const num = this.chooseList[result].num + 1
|
||||||
this.getUpdate(result, num)
|
this.getUpdate(result, num)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue