<% if(data['goods']&&Object.keys(data['goods']).length>0){ var length = 0; var checkedLength = 0; var haiTaoLen = 0; %> <div class="cart-index-list" id="cart-container"> <%for(var shop_id in data['goods']){ var goodsList = data['goods'][shop_id]['goods_list']; for(var goodsId in goodsList){ var goodsItem = goodsList[goodsId]; if(goodsItem.is_checked){ if(goodsItem['goods_type'] == 'haitao'){ haiTaoLen ++; } checkedLength++; } length ++; %> <dl data-product_id="<%=goodsItem['product_id']%>" data-goods_id="<%=goodsItem['goods_id']%>"> <dt> <label> <input xmp-change="selectIt" type="checkbox" <%=goodsItem.is_checked>0?'checked':''%> value="<%=goodsItem['product_id']%>" /> <i class="icon-checkbox-n"></i> <img src="<%=thumb(goodsItem['spec_img'],'m')%>" alt=""> </label> </dt> <dd> <div class="goods-info" xmp-tap="view"> <strong class="tag-<%=goodsItem['goods_type']%>"><%=goodsItem['goods_name']%></strong> <p><%=goodsItem['spec_value']%></p> </div> <div class="action"> <em class="sales-price">¥ <%=goodsItem['sales_price']%></em> <em class="income">佣金 ¥ <%=goodsItem['income']%></em> <i class="icon-close" xmp-tap="delete-cart-item"></i> </div> <span class="counter"><a class="icon-minus minus disable_decrease"></a><input type="text" value="<%=goodsItem['quantity']%>" size="2"><a class="icon-plus plus"></a></span> </dd> </dl> <%}%> </div> <%} window.haiTaoLength = haiTaoLen; window.checkedCartTotal = checkedLength; window.cartTotal = length; window.confrirmHaiTao = haiTaoLen>0&&checkedCartTotal!=haiTaoLen; %> <div class="cart-index-total" style="display:none;"> <span>¥ todo</span> </div> <div class="list-select" style="display:none;"> <ul> <li> <div class="fl"><strong>优惠券</strong></div> <div class="fr"> <span>暂无优惠券可用</span> <i class="icon-arrow2-right"></i> </div> </li> </ul> </div> <div class="cart-total-holder"> <div class="cart-total"> <label> <input xmp-change="selectAll" type="checkbox" <%=checkedCartTotal==cartTotal?'checked':''%> /> <i class="icon-checkbox-n"></i> <span>全选</span> </label> <strong>总金额</strong> <em>¥ <%=data['price']['order_price']%></em> <strong>税后佣金</strong> <em>¥ <%=data['price']['order_income']%></em> </div> </div> <div class="action-ctrl-holder"> <div class="action-ctrl"> <a xmp-tap="goConfirm" id="go-checkout" class="red">去结算</a> </div> </div> <script> !function(){ var $cartContainer = $('#cart-container'); $cartContainer.find('.counter').each(function(){ var productId = $(this).parents('dl').data('product_id'); var goodsId = $(this).parents('dl').data('goods_id'); var $counter = $(this); var counter = new (widget.counter)({ input:$counter.find('input[type=text]'), plus:$counter.find('.plus'), minus:$counter.find('.minus'), max:999, change:function(value){ lib.http.post({ method:'cart.set', goods_id:goodsId, product_id:productId, quantity:value, is_addition:0 }).then(function(){ if(window.refresh)window.refresh(); }); } }); }); }(); </script> <%}else{%> <div class="empty-result"> <img src="images/icos/cart-empty-ico_220.png" alt="" /> <p>购物车还是空的,去逛逛吧~</p> <a href="javascript:;" xmp-tap="goShopping" class="go-shopping">去逛逛</a> </div> <%}%>