public String getSelectMoney() {
   double selectMoney = 0;
   for (ShoppingCart.BuyCarListBean goods : list) {
     for (ShoppingCart.BuyCarListBean.GoodslistBean goodslist : goods.getGoodslist()) {
       if (1 == goodslist.getIsCheck()
           && !"YES".equals(goodslist.getIsInvalid())
           && !"YES".equals(goodslist.getIsOff())) {
         selectMoney += goodslist.getNewPrice() * goodslist.getCount();
       }
     }
   }
   return StringUtils.doubleTo(selectMoney);
 }
 public String getSelectString() {
   List<SubmitShop> selectList = new ArrayList<>();
   for (ShoppingCart.BuyCarListBean goods : list) {
     for (ShoppingCart.BuyCarListBean.GoodslistBean goodslist : goods.getGoodslist()) {
       if (1 == goodslist.getIsCheck()) {
         SubmitShop submitShop = new SubmitShop();
         submitShop.setCount(goodslist.getCount());
         submitShop.setGoodsId(goodslist.getGoodsId());
         selectList.add(submitShop);
       }
     }
   }
   if (selectList.size() > 0) return GsonUtils.toJson(selectList);
   else return "";
 }
  public int getSelectSize() {
    int select = 0;
    for (ShoppingCart.BuyCarListBean goods : list) {
      for (ShoppingCart.BuyCarListBean.GoodslistBean goodslist : goods.getGoodslist()) {
        if ("YES".equals(goodslist.getIsInvalid()) || "YES".equals(goodslist.getIsOff())) {

        } else {
          if (1 == goodslist.getIsCheck()) {
            select++;
          }
        }
      }
    }
    return select;
  }
  public String getSaveMoney() {
    double oldMoney = 0;
    for (ShoppingCart.BuyCarListBean goods : list) {
      for (ShoppingCart.BuyCarListBean.GoodslistBean goodslist : goods.getGoodslist()) {
        if ("YES".equals(goodslist.getIsInvalid()) || "YES".equals(goodslist.getIsOff())) {

        } else {
          if (1 == goodslist.getIsCheck()) {
            oldMoney += goodslist.getOldPrice() * goodslist.getCount();
          }
        }
      }
    }
    return StringUtils.doubleTo(oldMoney - Double.valueOf(getSelectMoney()));
  }
  @Override
  public View getGroupView(
      final int groupPosition, boolean isExpanded, View convertView, ViewGroup parent) {
    GroupHolder holder;
    if (convertView == null) {
      convertView = View.inflate(context, R.layout.adapter_shopping_cart_parent_item, null);
      holder = new GroupHolder(convertView);
      convertView.setTag(holder);
    } else {
      holder = (GroupHolder) convertView.getTag();
    }
    final ShoppingCart.BuyCarListBean buyCarListBean = getGroup(groupPosition);
    int select = 0;
    for (ShoppingCart.BuyCarListBean.GoodslistBean goodslistBean1 : buyCarListBean.getGoodslist()) {
      if ("YES".equals(goodslistBean1.getIsInvalid()) || "YES".equals(goodslistBean1.getIsOff())) {

      } else {
        if (1 == goodslistBean1.getIsCheck()) {
          select++;
        }
      }
    }

    if (select == getRealChildrenCount(groupPosition)) {
      buyCarListBean.setSelect(true);
    } else {
      buyCarListBean.setSelect(false);
    }
    holder.tvGoodsSortName.setText(buyCarListBean.getGoodscategoryName());
    holder.cbGroup.setChecked(buyCarListBean.isSelect());
    holder.cbGroup.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            onGoodsSelectListener.onGroupGoodsSelect(groupPosition);
          }
        });
    return convertView;
  }
  public boolean isAllChecked() {
    double allSize = 0, selectSize = 0;
    for (ShoppingCart.BuyCarListBean goods : list) {
      allSize += goods.getGoodslist().size();
      for (ShoppingCart.BuyCarListBean.GoodslistBean goodslist : goods.getGoodslist()) {

        if ("YES".equals(goodslist.getIsInvalid()) || "YES".equals(goodslist.getIsOff())) {

        } else {
          if (1 == goodslist.getIsCheck()) {
            selectSize++;
          }
        }

        if ("YES".equals(goodslist.getIsInvalid()) || "YES".equals(goodslist.getIsOff())) {
          allSize--;
        }
      }
    }
    if (allSize > 0 || selectSize > 0) return allSize == selectSize;
    else return false;
  }
  @Override
  public View getRealChildView(
      final int groupPosition,
      final int childPosition,
      boolean isLastChild,
      View convertView,
      ViewGroup parent) {
    ChildHolder holder;
    if (convertView == null) {
      convertView = inflater.inflate(R.layout.adapter_shopping_cart_child_item, parent, false);
      holder = new ChildHolder(convertView);
      convertView.setTag(holder);
    } else {
      holder = (ChildHolder) convertView.getTag();
    }
    final ShoppingCart.BuyCarListBean.GoodslistBean goodslistBean =
        getChild(groupPosition, childPosition);
    holder.tvGoodsName.setText(goodslistBean.getShampooName());
    holder.tvGoodsMoney.setText("¥" + goodslistBean.getNewPrice());
    holder.tvGoodsSort.setText(goodslistBean.getEfficacy());
    holder.tvGoodsOldMoney.setText("¥" + goodslistBean.getOldPrice());
    holder
        .tvGoodsOldMoney
        .getPaint()
        .setFlags(Paint.STRIKE_THRU_TEXT_FLAG | Paint.ANTI_ALIAS_FLAG); // 中划线
    holder.qvNum.setMinValue(1);
    holder.qvNum.setMaxValue(goodslistBean.getStockcount());
    holder.qvNum.setValue(StringUtils.toString(goodslistBean.getCount()));
    ImageLoader.getInstance().displayImage(goodslistBean.getImgUrl(), holder.ivGoodsImage, options);
    if ("YES".equals(goodslistBean.getIsInvalid()) || "YES".equals(goodslistBean.getIsOff())) {
      holder.tvInvalid.setVisibility(View.VISIBLE);
      holder.cbChild.setVisibility(View.INVISIBLE);
      holder.tvInvalid.setClickable(false);
      holder.cbChild.setChecked(false);
      goodslistBean.setIsCheck(0);
    } else {
      holder.tvInvalid.setVisibility(View.INVISIBLE);
      holder.cbChild.setVisibility(View.VISIBLE);
      if (goodslistBean.getIsCheck() == 0) {
        holder.cbChild.setChecked(false);
      } else {
        holder.cbChild.setChecked(true);
      }
      holder.tvInvalid.setClickable(true);
    }
    holder.cbChild.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            onGoodsSelectListener.onChildGoodsSelect(groupPosition, childPosition);
          }
        });
    holder.tvGoodsDel.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            onGoodsDelListener.onGroupGoodsDel(groupPosition, childPosition);
          }
        });
    holder.qvNum.setOnValueChangeListener(
        new QuantityView.OnValueChangeListener() {
          @Override
          public void onValueChange(String value) {
            onGoodsValueChangeListener.onGroupGoodsValueChange(value, groupPosition, childPosition);
          }
        });
    holder.qvNum.setOnBtnClickListener(
        new QuantityView.OnBtnClickListener() {
          @Override
          public void onLessClick(String value) {
            if (onBtnClickListener != null) {
              onBtnClickListener.onLessClick(value, groupPosition, childPosition);
            }
          }

          @Override
          public void onPlusClick(String value) {
            if (onBtnClickListener != null) {
              onBtnClickListener.onPlusClick(value, groupPosition, childPosition);
            }
          }
        });
    holder.ivGoodsImage.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View view) {
            if (onGoodsImageClickListener != null)
              onGoodsImageClickListener.OnGoodsImageClickListener(groupPosition, childPosition);
          }
        });

    List<ShoppingCart.BuyCarListBean.GiftBean> gift = list.get(groupPosition).getGift();
    holder.llGift.removeAllViews();
    if (gift != null
        && gift.size() > 0
        && childPosition == list.get(groupPosition).getGoodslist().size() - 1) {
      for (ShoppingCart.BuyCarListBean.GiftBean giftEntity : gift) {
        View giftView = inflater.inflate(R.layout.view_gift_item, null);
        TextView tvGoodsItem = (TextView) giftView.findViewById(R.id.tvGoodsItem);
        TextView tvGoodsCount = (TextView) giftView.findViewById(R.id.tvGoodsCount);
        tvGoodsItem.setText("[赠品]" + giftEntity.getGiftName());
        tvGoodsCount.setText("X" + giftEntity.getGiftCount());
        holder.llGift.addView(giftView);
      }
    }
    return convertView;
  }