})
if(tt){
//店铺内全选,店铺checked,店铺列表+
for(var i = 0;i<input.length;i++){
if(input[i].value == shopId){
input[i].checked = true;
}
}
this.shopList.push(String(shopId)); //防止shopid是number类型造成麻烦
//如果所有店铺都全选,则全选按钮checked
if(this.shopList.length === shopList.length){
//所有店铺全选
for(var i = 0;i<input.length;i++){
if(input[i].name == 'allRadio'){
input[i].checked = true;
}
}
}
}
}else{
//商品列表--
this.goodsList.splice(this.goodsList.indexOf(event.currentTarget.value),1)
//如果店铺checked,则取消,店铺列表--
for(var i = 0;i<input.length;i++){
if(input[i].value == shopId){
if(input[i].checked){
input[i].checked = false;
this.shopList.splice(this.shopList.indexOf(String(shopId)),1); //防止shopid是number类型造成麻烦
}
}
//任意一个不选,全选取消
if(input[i].name == 'allRadio'){
input[i].checked = false;
}
}
}
//计算总价和数量
this.caculate();
},
//店铺选择
shopCheck: function(event,shopList){
//店铺选中则对应商品全选,否则全不选
//console.log(event.currentTarget)
var input = document.getElementsByTagName('input')
if(event.currentTarget.checked){
//店铺列表+,店铺checked,店铺内商品全checked,商品列表++
//console.log(this.shopList)
this.shopList.push(String(event.currentTarget.value));
//店铺内商品全checked
for(var i = 0;i<input.length;i++){
if(input[i].getAttribute('dataId') == event.currentTarget.value){
//将没有选中的checked,并加入列表,去重
if(!input[i].checked){
input[i].checked = true;
//商品列表++
this.goodsList.push(String(input[i].value))
}
}
}
//所有店铺全选
if(this.shopList.length === shopList.length){
for(var i = 0;i<input.length;i++){
if(input[i].name == 'allRadio'){
input[i].checked = true;
}
}
}
}else{
//店铺取消checked,店铺列表--,店铺内所有商品取消checked,商品列表--
this.shopList.splice(this.shopList.indexOf(String(event.currentTarget.value)),1);
//店铺内所有商品取消checked










