<!--#include file="htmlhead.html"-->
<!--#include file="header.html"-->
<form id="bbr-fill-form" name="bbr-fill-form" method="post" action="" >
	<div class="wbox">
		<ul class="flow-steps">
			<li><b class="f"></b><span>1、查看購物車</span><s></s></li>
			<li class="on"><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/>
		<p class="gleft fbold120">確認收貨地址</p>
		<br/>
		<div class="grid-container grid-ttl-tr fn-clear">
			<div class="grid10 gleft gridnomargin">收件地址</div>
			<div class="grid2 gleft">郵政編碼</div>
			<div class="grid2 gleft">收件人</div>
			<div class="grid3 gleft">手機</div>
			<div class="grid3 gleft">固定電話</div>
			<div class="grid4 gleft">常用電子郵箱地址</div>
		</div>
		<div class="grid-container grid-cnt-tr fn-clear">
			<div class="grid10 gleft gridnomargin"><input id="loginedaddress" name="loginedaddress" type="text" value="<%=loginedaddress%>" size="70"/></div>
			<div class="grid2 gleft"><input id="loginedzipcode" name="loginedzipcode" type="text" value="<%=loginedzipcode%>" size="6"/></div>
			<div class="grid2 gleft"><input id="loginedrealname" name="loginedrealname" type="text" value="<%=loginedrealname%>" size="6"/></div>
			<div class="grid3 gleft"><input id="loginedmobile" name="loginedmobile" type="text" value="<%=loginedmobile%>" size="10"/></div>
			<div class="grid3 gleft"><input id="loginedtelephone" name="loginedtelephone" type="text" value="<%=loginedtelephone%>" size="10"/></div>
			<div class="grid4 gleft"><input id="loginedemail" name="loginedemail" type="text" value="<%=loginedemail%>" size="20"/></div>
		</div>
	</div>
	<div class="wbox">
		<br/>
		<p class="gleft fbold120">確認訂單信息</p>
		<br/>
		<div class="grid-container grid-ttl-tr fn-clear">
			<div class="grid2 gcenter gridnomargin">圖片</div>
			<div class="grid9 gleft">商品名稱</div>
			<div class="grid2 gright">單價(元)</div>
			<div class="grid3 gright">優惠價(元)</div>
			<div class="grid2 gcenter">數量(件)</div>
			<div class="grid3 gcenter">運送方式</div>
			<div class="grid3 gright">小計(元)</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="50" height="50" border="0" alt="" style="border:1px #eee solid;"/></div>
				<div class="grid9 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="grid2 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="grid2 gcenter"><%=rs("cartgoodsquantity")%></div>
				<div class="grid3">
				<input name="goodsid" type="hidden" value="<%=rs("aucid")%>" />
				<% if rs("BBR_PayforTM")=2 then %>
					<select name="goodstm" cartid="<%=rs("cartid")%>">
						<option value="">==請選擇==</option>
						<% if cdbl(rs("BBR_AucTM1"))>0 then %><option value="1" moneyval="<%=formatNumber(rs("BBR_AucTM1"),2,-1,0,0)%>">平郵 <%=formatNumber(rs("BBR_AucTM1"),2,-1,0,0)%><%=SYS_WEBMONEY%></option><% end if %>
						<% if cdbl(rs("BBR_AucTM2"))>0 then %><option value="2" moneyval="<%=formatNumber(rs("BBR_AucTM2"),2,-1,0,0)%>">快遞 <%=formatNumber(rs("BBR_AucTM2"),2,-1,0,0)%><%=SYS_WEBMONEY%></option><% end if %>
						<% if cdbl(rs("BBR_AucTM3"))>0 then %><option value="3" moneyval="<%=formatNumber(rs("BBR_AucTM3"),2,-1,0,0)%>">EMS <%=formatNumber(rs("BBR_AucTM3"),2,-1,0,0)%><%=SYS_WEBMONEY%></option><% end if %>
					</select>
				<% else %>
					免郵費<input name="goodstm" type="hidden" value="0" />
				<% end if %>
			</div>
				<div id="cartitemmoney<%=rs("cartid")%>" class="grid3 gright" J-bbr-cart="itemmoney"><%=formatNumber(cartaucbuyprice*rs("cartgoodsquantity"),2,-1,0,0)%></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="grid10 gleft gridnomargin">
				給賣家留言：<input name="buydemo" type="text" value="" size="60" />
			</div>
			<div class="grid12 gright">
				商品總價(含運費)：<span class="carttotalmoney"><%=formatNumber(carttotalmoney,2,-1,0,0)%></span> 元
				<input name="carttotalmoney" type="hidden" value="<%=formatNumber(carttotalmoney,2,-1,0,0)%>" />
			</div>
		</div>
		<!--
		<div class="grid-container fn-clear">
			<div class="grid6 gleft gridnomargin"><br/><br/>
				&nbsp;
			</div>
			<div class="grid18 gright">
				<br/>
				<%=selector("radio","cartpaystyle",0,PayStyleValueStr,PayStyleStr,false)%>
				<br/><br/>
			</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> &nbsp; | &nbsp;
				<a href="cart.asp">返回購物車</a>
			</div>
			<div class="grid18 gright">
				<br/>
				<a class="bbr-button"><input id="bbr_form_fill_submitbtn" type="button" value="提交訂單" /></a>
				<br/><br/>
			</div>
		</div>
	</div>
	<input name="act" type="hidden" value="submitorder" />
</form>
<script type="text/javascript">
	$(document).ready(function(){
		//修改運送方式
		$("select[name=goodstm]").each(function(){
			$(this).change(function(){
				var thisval=$(this).find('option:selected').attr("moneyval");
				if(isNaN(thisval)){ thisval=0; }
				var thiscartid=$(this).attr("cartid");
				var $cartitemprice=$("#cartitemprice"+thiscartid.toString());
				var $cartitemquantity=$("#cartitemquantity"+thiscartid.toString());
				var $cartitemmoney=$("#cartitemmoney"+thiscartid.toString());
				var cartitemmoney=parseFloat($cartitemprice.text())*parseInt($cartitemquantity.text())+parseFloat(thisval);
				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());
				});
				$("input[name=carttotalmoney]").val(carttotalmoney);
				$(".carttotalmoney").text(carttotalmoney);
			
			});
		});
		$("#bbr_form_fill_submitbtn").click(function(){
			var validatestatus=true;
			//檢測收件信息
			var loginedaddress=$("#loginedaddress").val();
			if(loginedaddress==""){
				alert('請填寫收件地址');
				return false;
			}
			var loginedrealname=$("#loginedrealname").val();
			if(loginedrealname==""){
				alert('請填寫收件人姓名');
				return false;
			}
			var loginedmobile=$("#loginedmobile").val();
			var loginedtelephone=$("#loginedtelephone").val();
			if(loginedmobile==""&&loginedtelephone==""){
				alert('請填寫收件人聯系手機或者固定電話號碼');
				return false;
			}
			var loginedemail=$("#loginedemail").val();
			if(loginedemail==""){
				alert('請填寫常用電子郵件地址');
				return false;
			}
			if(loginedemail.indexOf('@')<=0){
				alert('常用電子郵件地址格式錯誤');
				return false;
			}
			//檢測運送方式選擇
			$("select[name=goodstm]").each(function(){
				if($(this).val()==''){
					alert('請選擇訂單信息列表里的運送方式！');
					validatestatus=false;
					return false;
				}
			});
			//檢測購物車項目數量
			if($("div[J-cart-list=item]").length==0){
				alert('購物車為空，請先購物將您需要的商品加入購物車');
				return false;
			}
			if(validatestatus){ $("#bbr-fill-form").submit(); }
		});
	});
</script>
<!--#include file="footer.html"-->