<!--#include file="conn.asp"-->
<%
page_title=Eval("order_title"&Language)
page_keywords=Eval("order_keywords"&Language)
page_description=Eval("order_description"&Language)
if page_title="" then
page_title=city_title
page_keywords=city_keywords
page_description=city_description
end if
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Language" content="zh-CN">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title><%=page_title%></title>
<meta name="keywords" content="<%=page_keywords%>" />
<meta name="description" content="<%=page_description%>" />
<!--#include file="top.asp"-->
<!--#include file="header.asp"-->
<link href="<%=filepath%>inc/cart.css" rel="stylesheet" type="text/css">
<script src="../inc/jquery-1.8.3.min.js" type="text/javascript"></script>
<script src="../inc/jquery.placeholder.min.js" type="text/javascript"></script>
<script src="../inc/jzoshow.js" type="text/javascript"></script>
<script src="../inc/bo.js" type="text/javascript"></script>
<%
if session("user_xxx_name")<>"" then
username=trim(session("user_xxx_name"))
else
	if request.Cookies("shopxp")("dingdanusername")="" then
	username=now()
	username=replace(trim(username),"-","")
	username=replace(username,"/","")
	username=replace(username,":","")
	username=replace(username," ","")
	username=username
	response.Cookies("shopxp")("dingdanusername")=username

	set rs=server.CreateObject("adodb.recordset")
	rs.open "select * from [com_user] ",conn,1,3
	rs.addnew
	rs("username")=username
	rs("niming")=1
	rs.update
	rs.close
	set rs=nothing
	
	else
	username=request.Cookies("shopxp")("dingdanusername")
	end if
end if
%>
<!--#include file="../inc/geoData.asp"-->

<%
deliveryAddressId=request("deliveryAddressId")
expressId=request("expressId")
deliveryTimeId=request("deliveryTimeId")
deliveryComment=request("deliveryComment")
buy_jifen=request("buy_jifen")
promoRuleId=request("promoRuleId")
couponCodeNumber=request("couponCodeNumber")
isBuyNow=request("isBuyNow")
isCollocationPromo=request("isCollocationPromo")
%>


<script type="text/javascript">
//<![CDATA[
$(function(){
});
var count = 0;
var createOrder = function() {
    if (count != 0) {
    	return;
    }
	count ++;
	app.helper.showLoadingTip();
	$("#backToPreviousStep").attr("disabled", "true");
	$("#backToPreviousStep").removeAttr("href"); 
	$("#createOrder").removeAttr("href"); 
	$("#createOrder span").html("订单生成中...");
	
	var createOrderForm = $('<form action="step_three.asp?action=createOrder" method="post"></form>');
	createOrderForm.append('<input type="hidden" value="<%=deliveryAddressId%>" name="deliveryAddressId"/>');
    createOrderForm.append('<input type="hidden" value="<%=expressId%>" name="expressId"/>');
    createOrderForm.append('<input type="hidden" value="<%=deliveryTimeId%>" name="deliveryTimeId"/>');
    createOrderForm.append('<input type="hidden" value="<%=deliveryComment%>" name="deliveryComment"/>');
	createOrderForm.append('<input type="hidden" value="<%=buy_jifen%>" name="buy_jifen"/>');
    createOrderForm.append('<input type="hidden" value="<%=promoRuleId%>" name="promoRuleId"/>');
    createOrderForm.append('<input type="hidden" value="<%=couponCodeNumber%>" name="couponCodeNumber"/>');
    createOrderForm.append('<input type="hidden" value="<%=isBuyNow%>" name="isBuyNow"/>');
    createOrderForm.append('<input type="hidden" value="<%=isCollocationPromo%>" name="isCollocationPromo"/>');
    createOrderForm.appendTo(document.body).submit();
	return false;
};
//]]>
</script>

<!-- start middle -->
<div class="headnav">
	<div class="cart-steps">
		<ul>
			<li><span>1.我的购物车</span></li>
			<li class="current"><span>2.填写核对订单</span></li>
			<li><span>3.成功提交订单</span></li>
			<li class="clear"></li>
		</ul>
	</div>
</div>
<div id="content" class="w990">
	<div class="div-nav">
		<span>收货地址</span>
	</div>
	<div class="div-content">	
<%
set rsp=server.CreateObject("adodb.recordset")
rsp.open "select * from com_Uadd where id="&deliveryAddressId,conn,1,1
provinceId=rsp("provinceId")
%>
<em><%=rsp("receiverName")%></em> &nbsp;&nbsp;<%call showAddName(rsp("provinceId"))%>&nbsp;<%call showAddName(rsp("cityId"))%>&nbsp;<%call showAddName(rsp("countyId"))%> &nbsp;&nbsp;<%=rsp("address")%> &nbsp;&nbsp;<%=rsp("postCode")%> &nbsp;&nbsp;<%=rsp("splitPhone1")%>-<%=rsp("splitPhone2")%><%if rsp("splitPhone3")<>"" then%>-<%=rsp("splitPhone3")%><%end if%> &nbsp;&nbsp;<%=rsp("mobile")%>
<%
rsp.close
set rsp=nothing
%>	 
	</div>

	<div class="div-nav">
		<span>配送方式</span>
	</div>

	<div class="div-con">
		<div class="pl10">
			<ul class="ul_form_list" id="expressList">
				<li>
<%
set rszf=server.CreateObject("adodb.recordset")
rszf.open "select * from com_songhuo where id="&expressId&"",conn,1,1
subject=rszf("subject")
rszf.close
set rszf=nothing

set rsp=server.CreateObject("adodb.recordset")
rsp.open "select * from com_china where id="&provinceId,conn,1,1
expressM=Formatnumber(rsp("sh"&expressId),1,-1,-1,0)
%>
<%=subject%>&nbsp;&nbsp;￥<%=expressM%>
<%
rsp.close
set rsp=nothing
%>
				</li>
			</ul>
			
			<div class="hr"></div>
			<ul class="ul_form_list">
				<li>送货时间： <%
				select case deliveryTimeId
				case "delivery_time_workday"
				response.Write("工作日送货（周一到周五）")
				case "delivery_time_weekend"
				response.Write("周六周天")
				case "delivery_time_allday"
				response.Write("时间不限") 
				end select				
				%>&nbsp;我们会尽量按照您的要求送货 ( 送货时间： 9:00 - 18:00 )
				</li>
				<li>送货备注：<%=deliveryComment%></li>
			</ul>

		</div>
	</div>

	<div class="div-nav">
		<span>商品清单</span>
	</div>
	<div class="gouwu-list">
		<div class="tb-head">
			<table cellspacing="0" cellpadding="0" border="0">
				<tbody>
					<tr>
						<td>商品</td>
						<td width="77">原价</td>
						<td width="77">促销价</td>
						<td width="87">数量</td>
						<td width="77">小计</td>
					</tr>
				</tbody>
			</table>
		</div>
		<div class="tb-body">
<table cellpadding="0" cellspacing="0" border="0" id="shoppingCartListTable">
							<tbody>
<%
set rs=server.CreateObject("adodb.recordset")
	rs.open "select shopxp_action.shopxpacid,shopxp_action.pro_color,shopxp_action.pro_size,shopxp_action.pro_color_id,shopxp_action.pro_size_id,shopxp_action.shopxpptid,shopxp_action.productcount,shopxp_action.zonger,com_books.id,com_books.cid,com_books.titlecn,com_books.bookpicm,com_books.titlecn,com_books.shichangjia,com_books.shopxphyjia,com_books.jifeng,com_books.shopxpvjia from com_books inner join  shopxp_action on com_books.id=shopxp_action.shopxpptid where shopxp_action.username='"&username&"' and shopxp_action.zhuangtai=9",conn,1,1 
	shuliang=rs.recordcount
	jianshu=0
	zongji=0
if shuliang<>0 then

do while not rs.eof
	bookiid=rs("shopxpptid")
	jianshu=jianshu+rs("productcount")
	zongji=zongji+rs("zonger")
	subtitle=rs("titlecn")
	subid=rs("id")
	subcid=rs("cid")
	subbookpicm=rs("bookpicm")
	subjifeng=rs("jifeng")
	shichangjia=rs("shichangjia")
	shopxphyjia=rs("shopxphyjia")
	pro_color=rs("pro_color")
	pro_size=rs("pro_size")
	pro_color_id=rs("pro_color_id")
	pro_size_id=rs("pro_size_id")
%>
			
							
							
							<tr id="item_<%=bookiid%>-<%=pro_color_id%>-<%=pro_size_id%>">
								<td class="td-prod">
									<table border="0" cellpadding="0" cellspacing="0">
										<tbody>
											<tr>
												<td class="prod-pic">
													<a href="products_show.asp?typeid=<%=subcid%>&id=<%=subid%>" target="_blank">
														<img src="../<%=subbookpicm%>" width="80" height="80" border="0">
													</a>
												</td>
												<td class="prod-info">
												<a class="prod-name" href="products_show.asp?typeid=<%=subcid%>&id=<%=subid%>" target="_blank"><%=subtitle%></a>
													<p class="prod-attr">颜色:<%=pro_color%>，规格:<%=pro_size%></p>
												</td>
											</tr>
										</tbody>
									</table>
								</td>
								<td width="77" class="td-price-origin">¥ <%=Formatnumber(shichangjia,2,-1,-1,0)%></td>
								<td width="77" class="td-price-real">¥<span id="price_<%=bookiid%>-<%=pro_color_id%>-<%=pro_size_id%>"><%=Formatnumber(shopxphyjia,2,-1,-1,0)%></span></td>
								<td width="87" class="td-calculate"><%=rs("productcount")%></td>
								
								<td width="77">¥<span id="totalPrice_<%=bookiid%>-<%=pro_color_id%>-<%=pro_size_id%>"><%=Formatnumber(rs("zonger"),2,-1,-1,0)%></span></td>
								
							</tr>
							
<%
rs.movenext
loop
showgo=1
%>
<%else
showgo=0
%>
	<tr><td valign="middle" height="80" bgcolor="#FFFFFF" colspan="6">您还没有挑选商品，现在就去挑选自己心爱的商品。</td></tr>				
<%
end if
rs.close
set rs=nothing
%>
</tbody></table>
		</div>
		<div class="tb-foot">
			<div class="footl">
				产品数量总计：<em><%=jianshu%></em>件
			</div>
			<div class="footr">
				产品金额总计：<em>¥<%=Formatnumber(zongji,2,-1,-1,0)%></em>
			</div>
		</div>
	</div>
	<div class="div-con">
		<ul class="settlelist">
<li><%
if session("user_xxx_name")<>"" then
set shopxp=server.CreateObject("adodb.recordset")
shopxp.open "select * from [com_user] where username='"&session("user_xxx_name")&"' ",conn,1,1
%>
<div class="footl font-orange">
* 目前积分：
<%
response.Write "<b>"&shopxp("jifen")&"</b>"
%>&nbsp;(<%=cart_jfdk%>积分=￥1)
</div>
<%
if shopxp("jifen") < int(cart_jfdk) then
'response.Write("积分小于"&cart_jfdk&",不能抵扣金额.")
else
response.Write("使用："&buy_jifen&"积分")
end if
shopxp.close
set shopxp=nothing
userjf=buy_jifen/cart_jfdk
%>
<span>-￥<em id="selectedJfPirce"><%=Formatnumber(userjf,2,-1,-1,0)%></em></span>
<%end if%>
		
<div class="clear"></div>		
		</li>
			<li>
				<div class="footl font-orange">* 价格可能会随着活动的状态变化而波动，请随时关注商城活动情况；</div>
				<label>
<%
if promoRuleId<>"coupon_code" then
	setId=replace(promoRuleId,"act_","")
	set rsp=server.CreateObject("adodb.recordset")
	rsp.open "select * from com_act where id="&setId&"",conn,1,1
	if not rsp.bof or not rsp.eof then
	amount=rsp("amount")
	act_name=rsp("CodeNumber")
	end if
	rsp.close
	set rsp=nothing
%>
(<%=act_name%>)优惠：<span>-￥<em id="selectedPromoPirce"><%=Formatnumber(amount,2,-1,-1,0)%></em></span>
<%
elseif promoRuleId="coupon_code" and couponCodeNumber<>"" then
	set rsp=server.CreateObject("adodb.recordset")
	rsp.open "select * from com_coupon where CodeNumber='"&couponCodeNumber&"'",conn,1,1
	if not rsp.bof or not rsp.eof then
	amount=rsp("amount")
	end if
	rsp.close
	set rsp=nothing
%>
优惠券：<span>-￥<em id="selectedPromoPirce"><%=Formatnumber(amount,2,-1,-1,0)%></em></span>		
<%else
amount=0
%>	
无优惠：<span>-￥<em id="selectedPromoPirce">0.00</em></span>
<%end if%>	
				</label>

				<div class="clear"></div>
			</li>
			<li><label>运费：</label><span>¥<em id="totalFreightPrice"><%=expressM%></em></span></li>
			<%
			if zongji-userjf-amount+expressM<0 then
			zongji_all=0
			else
			zongji_all=zongji-userjf-amount+expressM
			end if
			%>
			<li class="count"><label>应付总额：</label><span>¥<em id="totalPrice"><%=Formatnumber(zongji_all,2,-1,-1,0)%></em></span></li>
		</ul>
		<div class="btnbar">
			<a href="javascript:history.back();" id="backToPreviousStep" class="btn-back"><span>返回上一步修改</span></a>
			<%if showgo=1 then%><a href="javascript:createOrder();" id="createOrder" class="btn-gouwu"><span>确认订单</span></a><%end if%>
		</div>
	</div>
</div>
<!--end middle-->
	
	
   <div class="clear"></div>
   
  <div id="bg" class="bg" style="display: none;"></div>
	<iframe id="popIframe" class="popIframe" frameborder="0"></iframe>
	<div id="loadingTip" class="loadingTip" style="display: none;">
		数据处理中...
	</div> 
   
<!--#include file="foot.asp"--> 

