delSelect(){
var delectArry
=[]
this.goodlist
.forEach((item
,index
)=>{
var arry
={}
var agoods
=item
.good
var good
=agoods
.filter(function(goodsitem
){
if(goodsitem
.select
===true){
arry
['storeName']=item
.storeName
arry
['storeID']=item
.storeID
}
return goodsitem
.select
===true
})
if(good
.length
!=0){
arry
['goods']=good
delectArry
.push(arry
)
}
})
if(delectArry
.length
){
console
.log('选中了商品',delectArry
);
var delnum
=0;
delectArry
.forEach(delShop
=>{
delnum
+=delShop
.goods
.length
})
uni
.showModal({
content
: '确认将这'+delnum
+'个宝贝删除?',
showCancel
: true,
cancelText
: '我再想想',
confirmText
: '删除',
success
: res
=> {
if(res
.confirm
){
delectArry
.forEach(delShop
=>{
delnum
+=delShop
.goods
.length
this.goodlist
.forEach((item
,shopindex
)=>{
if(delShop
.storeID
==item
.storeID
){
if(delShop
.goods
.length
==item
.good
.length
){
this.goodlist
.splice(shopindex
,1)
}else{
delShop
.goods
.forEach(delGoods
=>{
console
.log(delGoods
);
item
.good
.forEach((goods
,goodsindex
)=>{
if(delGoods
.goodid
==goods
.goodid
){
console
.log(goods
);
item
.good
.splice(goodsindex
,1)
}
})
})
}
}
})
})
}else{
}
},
fail
: () => {},
complete
: () => {}
});
}else{
uni
.showToast({
title
: '您还没有选择宝贝哦',
icon
:'none'
});
}
}
转载请注明原文地址:https://tech.qufami.com/read-12290.html