예제 #1
0
 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);
 }
예제 #2
0
  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()));
  }
예제 #3
0
  @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;
  }