public void delGoods(Integer goodsId) //删除购物车 { items.remove(goodsId); }
public void updateCart(Integer goodsId, int quantity) //更新购物车的数量 { TOrderItem orderItem = items.get(goodsId); orderItem.setGoodsQuantity(quantity); items.put(goodsId, orderItem); }
public int getTotalPrice() //计算总的价格 { int totalPrice = 0; for (Iterator it = items.values().iterator(); it.hasNext();) { TOrderItem orderItem = (TOrderItem) it.next(); TGoods goods = orderItem.getGoods(); int quantity = orderItem.getGoodsQuantity(); totalPrice += goods.getGoodsTejia() * quantity; 数量 } return totalPrice; } }
//单价乘以
百度搜索“77cn”或“免费范文网”即可找到本站免费阅读全部范文。收藏本站方便下次阅读,免费范文网,提供经典小说综合文库计算机网站设计源代码(2)在线全文阅读。
相关推荐: