public void setGroupCheck(boolean isCheck, int groupPosition) {
   for (ShoppingCart.BuyCarListBean.GoodslistBean goods : getGroup(groupPosition).getGoodslist()) {
     if (isCheck) {
       goods.setIsCheck(1);
     } else {
       goods.setIsCheck(0);
     }
   }
   notifyDataSetChanged();
 }
 public void setAllGroupCheck(boolean isCheck) {
   for (ShoppingCart.BuyCarListBean goods : list) {
     goods.setSelect(isCheck);
     for (ShoppingCart.BuyCarListBean.GoodslistBean goodslist : goods.getGoodslist()) {
       if (!"YES".equals(goodslist.getIsInvalid()) && !"YES".equals(goodslist.getIsOff())) {
         if (isCheck) {
           goodslist.setIsCheck(1);
         } else {
           goodslist.setIsCheck(0);
         }
       }
     }
   }
   notifyDataSetChanged();
 }
  @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;
  }