<!--#include file="htmlhead.html"-->
<!--#include file="header.html"-->
<div class="wbox">
	<ul class="flow-steps">
    	<li class="on"><b class="f"></b><span>1、查看购物车</span><s></s></li>
        <li><b></b><span>2、确认订单信息</span><s></s></li>
        <li><b></b><span>3、为订单付款</span><s></s></li>
		<li><b></b><span>4、确认收货</span><s></s></li>
        <li><b></b><span>5、评价</span><s></s></li>
    </ul>
</div>

<div class="wbox">
	<br/>
	<div class="grid-container grid-ttl-tr fn-clear">
		<div class="grid2 gcenter gridnomargin">图片</div>
		<div class="grid7 gleft">域名名称</div>
		<div class="grid3 gright">单价(元)</div>
		<div class="grid3 gright">优惠价(元)</div>
		<div class="grid3 gright">数量(件)</div>
		<div class="grid3 gright">小计(元)</div>
		<div class="grid3">&nbsp;</div>
	</div>
	<% dim carttotalmoney:carttotalmoney=0 %>
	<% do while not rs.eof %>
		<%
		dim cartaucbuyprice
		cartaucbuyprice=rs("aucbuyprice")
		if chknum(rs("msaucdiscountprice")) then
			cartaucbuyprice=rs("msaucdiscountprice")
		end if
		cartaucbuyprice=formatNumber(cartaucbuyprice,2,-1,0,0)
		%>
		<div class="grid-container grid-cnt-tr fn-clear" J-cart-list="item">
			<div class="grid2 gcenter gridnomargin"><img src="<%=SYS_HTTP_WEBURL & rs("aucimageurl")%>" width="60" height="60" border="0" alt="" style="border:1px #eee solid;"/></div>
			<div class="grid7 gleft">
				<a href="<%=SYS_HTTP_WEBURL%>item.asp?aucid=<%=rs("aucid")%>" target="_blank"><%=rs("aucitemtitle")%></a><br/>
				卖家：<%=rs("bbruname")%> &nbsp; <%=Disp_UserCredit(rs("aucitemowner"),rs("creditseller"),0)%><br/>
				可购数量：<%=rs("aucnum")%>件 &nbsp; 所在地：<%=rs("BBR_AucProv")%><%=rs("BBR_AucCity")%>
			</div>
			<div class="grid3 gright">
				<% if chknum(rs("msaucdiscountprice")) then %>
					<s><%=formatNumber(rs("aucbuyprice"),2,-1,0,0)%></s>
				<% else %>
					<span id="cartitemprice<%=rs("cartid")%>"><%=formatNumber(rs("aucbuyprice"),2,-1,0,0)%></span>
				<% end if %>
			</div>
			<div class="grid3 gright">
				<% if chknum(rs("msaucdiscountprice")) then %>
					<span id="cartitemprice<%=rs("cartid")%>" class="CurrentPrice_ex"><%=formatNumber(rs("msaucdiscountprice"),2,-1,0,0)%></span>
				<% end if %>
			</div>
			<div id="cartitemquantity<%=rs("cartid")%>" class="grid3 gright"><input name="cartgoodsquantity" type="text" value="<%=rs("cartgoodsquantity")%>" cartid="<%=rs("cartid")%>" J-bbrcartgoodsid="<%=rs("aucid")%>" J-bbrcartgoodsownerid="<%=rs("aucitemowner")%>" size="3" style="text-align:center" /></div>
			<div id="cartitemmoney<%=rs("cartid")%>" class="grid3 gright" J-bbr-cart="itemmoney"><%=formatNumber(cartaucbuyprice*rs("cartgoodsquantity"),2,-1,0,0)%></div>
			<div class="grid3"><a href="<%=SYS_HTTP_WEBURL%>bbr_ajaxaddtocart.asp?act=del&cartid=<%=rs("cartid")%>">删除</a></div>
		</div>
		<% carttotalmoney=carttotalmoney+formatNumber(cartaucbuyprice*rs("cartgoodsquantity"),2,-1,0,0) %>
		<% rs.movenext %>
	<% loop %>
	<div class="grid-container grid-ttl-tr fn-clear">
		<div class="grid24 gright gridnomargin">域名总价(不含运费)：<span class="carttotalmoney"><%=formatNumber(carttotalmoney,2,-1,0,0)%></span> 元</div>
	</div>
	<div class="grid-container fn-clear">
		<div class="grid6 gleft gridnomargin"><br/><br/>
			<a href="<%=SYS_HTTP_WEBURL%>">继续购物</a> &nbsp; | &nbsp;
			<a href="<%=SYS_HTTP_WEBURL%>bbr_ajaxaddtocart.asp?act=clearall">清空购物车</a>
		</div>
		<div class="grid18 gright">
			<br/>
			<a class="bbr-button"><input id="bbr-form-fill-submitbtn" type="button" value="下一步，确认订单" onclick="javascript: location.href='confirmorder.asp';" /></a>
			<br/><br/>
		</div>
	</div>
</div>
<!--#include file="footer.html"-->
<script type="text/javascript">
<!--
	//cart
	$(document).ready(function(){
		$("input[name=cartgoodsquantity]").each(function(){
			$(this).change(function(){
				var $thistrogger=$(this);
				var buyquantity=$thistrogger.val();
				if(isNaN(buyquantity)){
					alert('购买数量必须填写整数数字！');
					return false;
				}
				buyquantity=parseInt(buyquantity);
				var bbrcartgoodsid=$thistrogger.attr("J-bbrcartgoodsid");
				if(isNaN(bbrcartgoodsid)){
					alert('域名属性错误，无法更新购物车！');
					return false;
				}
				var bbrcartgoodsownerid=$thistrogger.attr("J-bbrcartgoodsownerid");
				if(isNaN(bbrcartgoodsownerid)){
					alert('域名属性错误，无法更新购物车！');
					return false;
				}
				$.ajax({
					type: "post",
					url: $("#J_BBRWEBURL").val()+"bbr_ajaxaddtocart.asp",
					data: {act:'update',goodsid:bbrcartgoodsid,goodsownerid:bbrcartgoodsownerid,goodsquantity:buyquantity},
					beforeSend: function(XMLHttpRequest){
						$thistrogger.css("background","orange");
					},
					success: function(data, textStatus){
						if(data=='[success]'){
							//alert('成功更新购物车！');
							var thiscartid=$thistrogger.attr("cartid");
							var $cartitemprice=$("#cartitemprice"+thiscartid.toString());
							var $cartitemquantity=$("#cartitemquantity"+thiscartid.toString());
							var $cartitemmoney=$("#cartitemmoney"+thiscartid.toString());
							var cartitemmoney=parseFloat(($cartitemprice.text())*parseInt($thistrogger.val()));
							cartitemmoney=Math.round(cartitemmoney*Math.pow(10, 2))/Math.pow(10, 2);
							cartitemmoney=cartitemmoney.toString();
							if(cartitemmoney.indexOf(".")>0){cartitemmoney=cartitemmoney.substr(0,cartitemmoney.indexOf(".")+3);}
							$cartitemmoney.text(cartitemmoney);
							var carttotalmoney=0;
							$("div[J-bbr-cart=itemmoney]").each(function(){
								carttotalmoney=carttotalmoney + parseFloat($(this).text());
							});
							$(".carttotalmoney").text(carttotalmoney);
							return false;
						}else{
							alert('更新购物车操作失败！');
							return false;
						}
					},
					complete: function(XMLHttpRequest, textStatus){
						$thistrogger.css("background","white");
					},
					error: function(){
						//请求出错处理
					}
				});
			});
		});
	});
//-->
</script>