<!--#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"-->
<script type="text/javascript">
//<![CDATA[

$(function(){
	initPostDeliveryAddressEvent();
	
    initDeliveryAddressChangeEvent();
    
    initPromoRuleSelectEvent();
    
    initUserCouponCodeNumberEvent();
	
	userJfNumber();
    
    $("input[type='radio'][name='deliveryAddressId']").each(function(){
    	if(this.checked) {
    		initExpressList();
    	}
    });
});

var originalDeliveryAddressId = "";
var initDeliveryAddressChangeEvent = function() {
	
	$("input[type='radio'][name='deliveryAddressId']").unbind();
	$("input[type='radio'][name='newDeliveryAddressId']").unbind();

	$("input[type='radio'][name='deliveryAddressId']").click(function(){
		closeNewDeliveryAddressDiv();
		if (originalDeliveryAddressId != $(this).val() && confirm("更换地址后，您需要重新确认订单信息")) {
			initExpressList();
		} else {
			$("input[type='radio'][name='deliveryAddressId']").each(function(){
				this.checked = (originalDeliveryAddressId == $(this).val()) ? true : false;
		    });
		    
		    $("input[type='radio'][name='newDeliveryAddressId']").each(function(){
				if (originalDeliveryAddressId == $(this).val()) {
					openNewDeliveryAddressDiv();
				}
		    });
		}
    });
        
    $("input[type='radio'][name='newDeliveryAddressId']").click(function(){
    	originalDeliveryAddressId = $(this).val();
		openNewDeliveryAddressDiv();
    });
};

var closeNewDeliveryAddressDiv = function() {
	clearAddUserDeliveryAddressForm();
	$("#createDeliveryAddressDiv").css("display", "none");
	$('#newDeliveryAddressId').attr("checked", false);
};

var openNewDeliveryAddressDiv = function() {
	cleanExpressList();
	$('#newDeliveryAddressId').attr("checked", true);
	$("#createDeliveryAddressDiv").css("display", "block");
	$("input[type='radio'][name='deliveryAddressId']").each(function(){
		this.checked = false;
    });
};


var initExpressList = function() {
	cleanExpressList();
	originalDeliveryAddressId = $('input:radio[name="deliveryAddressId"]:checked').val();
	app.ajaxHelper.submitRequest({
    	data: {deliveryAddressId:originalDeliveryAddressId,"action":"listExpressAndPrice"},
		url : "Ajax_Address.asp",
    	success: function(data, textStatus, jqXHR){
    		if(app.handlerServiceResponse(data)){
    			if (data.data.isExist) {
    				var html = '';
    				$.each(data.data.expressList, function(n, obj){
    					html += '<li><label>\
									<input type="radio" name="expressId" value="'+obj.expressId+'">&nbsp;'+obj.expressName+'\
								</label>\
								<span class="price">￥<em id="express_price_'+obj.expressId+'">'+app.helper.formatCurrency(obj.price)+'</em></span></li>';
    				});
    				$("#expressList").html(html);	
    				initExpressEvent();
    			}
			}
		}
    }); 
};

var initExpressEvent = function() {
	$("input[type='radio'][name='expressId']").click(function(){
			var expressId = $(this).val();
			app.ajaxHelper.submitRequest({
		    	data: {expressId: expressId,"action":"calculateExpressPrice"},
		    	url: "Ajax_Address.asp",
		    	success: function(data, textStatus, jqXHR){
		    		if(app.handlerServiceResponse(data)){
		    			recalculateTotalPrice(parseFloat($("#express_price_" + expressId).html().replace(/,/g, "")));
					}
				}
		    }); 
    });
};



var cleanExpressList = function() {
	$("#expressList").html("<div class='message-alert'>请选择收货地址，以便为您提供可达到的快递!</div>");	
	recalculateTotalPrice(0);

};

var deliveryFromFocus = function() {
	var checkArray = [ 
		"receiverName", 
		"address", 
		"postCode",
		"telephone",
		"mobile" 
	];
	for ( var i = 0; i < checkArray.length; i++) {
		$('#' + checkArray[i]).focus(function() {
			$("#" + this.id + "_check").css("display", "inline");
		}).blur(function() {
			$("#" + this.id + "_check").css("display", "none");
			checkControl(this.id);
		});
	}
};


var AddressJSON = {
	'areaString' : '',
	'receiverName' : '',
	'provinceId' : '',
	'cityId' : '',
	'countyId' : '',
	'address' : '',
	'postCode' : '',
	'mobile' : '',
	'telephone' : '',
	'isDefault' : '1',
	'action' : 'addUserDeliverAddress'
};

var checkControl = function(controlID) {
	buildJSONObj();
	var ok = false;
	if (controlID == "receiverName" || controlID == "address") {
		if (eval("AddressJSON." + controlID).length > 0)
			ok = true;
	}
	if (controlID == "postCode") {
		if (/^\d{6}$/.test(AddressJSON.postCode))
			ok = true;
	}
	if (controlID == "telephone" || controlID == "mobile") {
		if (/^[0-9]{3,4}-[0-9]{7,8}$/.test(AddressJSON.telephone)
				|| /^1[3|4|5|8][0-9]\d{8}$/.test(AddressJSON.mobile)) {
			ok = true;
			controlID = "telephone";
		}
	}
	if (ok) {
		$('#' + controlID).siblings("div").find("b").css("display", "none");
	}
}

var initPostDeliveryAddressEvent = function() {
	clearAddUserDeliveryAddressForm();
	deliveryFromFocus();

	$('#Btn_Go').click(function() {
		buildJSONObj();
		if (!checkJSONObj()) {
			return false;
		}
		app.ajaxHelper.submitRequest({
	    	data : AddressJSON,
	    	url : "Ajax_Address.asp",
	    	success: function(data, textStatus, jqXHR){
	    		if(app.handlerServiceResponse(data)){
	    			var ecmDeliveryAddress = data.data.ecmDeliveryAddress;
					var html = '<li id="'+ecmDeliveryAddress.id+'_li">';
						html += '<label><input type="radio" name="deliveryAddressId" value="'+ecmDeliveryAddress.id+'" checked>&nbsp;'+ safeRender(ecmDeliveryAddress.receiverName)+' &nbsp;&nbsp;'+safeRender(ecmDeliveryAddress.areaString)+' &nbsp;&nbsp;'+safeRender(ecmDeliveryAddress.address)+'&nbsp;&nbsp;'+safeRender(ecmDeliveryAddress.postCode)+' &nbsp;&nbsp;'+safeRender(ecmDeliveryAddress.telephone)+' &nbsp;&nbsp;'+safeRender(ecmDeliveryAddress.mobile)+'</label>';
						html += '<a href="javascript:void(0)" onclick="deleteDeliveryAddress(\''+ecmDeliveryAddress.id+'\')">[删除]</a></li>';
					$("#deliveryAddressList").prepend(html); 
					
					closeNewDeliveryAddressDiv();
					
					initDeliveryAddressChangeEvent();
					
					initExpressList();
				}
			}
	    }); 
		
		return false;
	});
	
	$('#countyId').change(_tempCheckArea);
	$('#cityId').change(_tempCheckArea);
	$('#provinceId').change(_tempCheckArea);
};

var safeRender = function(s){
	 return (s && s !="" && s != '_NA_') ? s : "";
 };


function buildJSONObj() {
	AddressJSON.receiverName = $("#receiverName").val().replace(/\s+/, '');
	var _tempP = $("#provinceId")[0];
	var _tempC = $("#cityId")[0];
	var _tempA = $("#countyId")[0];
	AddressJSON.provinceId = _tempP.options[_tempP.selectedIndex].value;
	AddressJSON.cityId = _tempC.options[_tempC.selectedIndex].value;
	AddressJSON.countyId = _tempA.options[_tempA.selectedIndex].value;
	AddressJSON.areaString = _tempP.options[_tempP.selectedIndex].text + " " + _tempC.options[_tempC.selectedIndex].text + " " + _tempA.options[_tempA.selectedIndex].text;
	AddressJSON.address = $("#address").val();
	AddressJSON.mobile = $("#mobile").val().replace(/\s+/, '');
	AddressJSON.telephone = $("#telephone").val().replace(/\s+/, '');
	AddressJSON.postCode = $("#postCode").val().replace(/\s+/, '');
}
function checkJSONObj() {
	var controlIdArray = new Array();
	if (AddressJSON.receiverName.length == 0)
		controlIdArray[controlIdArray.length] = "receiverName";
	
	if (AddressJSON.provinceId=="" || AddressJSON.provinceId.indexOf("0|请选择") != -1) {
		controlIdArray[controlIdArray.length] = "provinceId";
	}
		
	if (AddressJSON.cityId=="" || AddressJSON.cityId.indexOf("0|请选择") != -1) {
		controlIdArray[controlIdArray.length] = "cityId";
	}
		
	if (AddressJSON.countyId=="" || AddressJSON.countyId.indexOf("0|请选择") != -1) {
		for(var i = 0; i < areaData.length; i++) {
		 	if (areaData[i]["id"] == $("#provinceId").val()) {
		 	
		 		var cityData = areaData[i]["childs"];
		 		for (var j = 0 ; j < cityData.length; j++) {
		 			if (cityData[j]["id"] == $("#cityId").val()) {
		 				var countyData = cityData[j]["childs"];
		 				if (countyData && countyData.length > 0 ) {
		 					controlIdArray[controlIdArray.length] = "countyId";
		 				}
		 			}
		 		}
		 	}
		}
	}
		
	if (AddressJSON.address.length == 0)
		controlIdArray[controlIdArray.length] = "address";
	if (!/^\d{6}$/.test(AddressJSON.postCode))
		controlIdArray[controlIdArray.length] = "postCode";
	if (!/^[0-9]{3,4}-[0-9]{7,8}$/.test(AddressJSON.telephone)
			&& !/^1[3|4|5|8][0-9]\d{8}$/.test(AddressJSON.mobile))
		controlIdArray[controlIdArray.length] = "telephone";
	for ( var j = 0; j < controlIdArray.length; j++) {
		if (controlIdArray[j] == "provinceId" || controlIdArray[j] == "cityId"
				|| controlIdArray[j] == "countyId") {
			$('#' + controlIdArray[j]).siblings("div").find("." + controlIdArray[j] + "Tip").css("display", "block");
		} else
			$('#' + controlIdArray[j]).siblings("div").find("b").css("display","block");
	}
	if (controlIdArray.length > 0)
		return false;
	return true;
}

function _tempCheckArea() {
	if ($(this).val() != "0") {
		$(this).siblings("div").find("." + this.id + "Tip").css("display", "none");
	}
}

var clearAddUserDeliveryAddressForm = function() {
	$("#addUserDeliveryAddressForm")[0].reset();
	new app.CascadeSelect({
		data:areaData,
		uiIds:["provinceId", "cityId", "countyId"]
	});
};


var recalculateTotalPrice = function(freightPrice){
	var totalPrice = parseFloat($("#totalPrice").html().replace(/,/g, ""));
	var totalProductPrice = parseFloat($("#totalProductPrice").html().replace(/,/g, ""));
	var selectedPromoPirce =  parseFloat($("#selectedPromoPirce").html().replace(/,/g, ""));	
	var selectedJfPirce =  parseFloat($("#selectedJfPirce").html().replace(/,/g, ""));	
	
	if (typeof(freightPrice) == "undefined") {
		freightPrice = parseFloat($("#totalFreightPrice").html().replace(/,/g, ""));	
	}

    var totalPriceNew = forDight((totalProductPrice + freightPrice - selectedJfPirce - selectedPromoPirce),2);
    if(totalPriceNew<0){
        totalPriceNew = forDight(0,2);
    }
	$("#totalPrice").html(app.helper.formatCurrency(totalPriceNew));
	$("#totalFreightPrice").html(app.helper.formatCurrency(freightPrice));
};

var forDight = function(dight,how){  
    dight = Math.round(dight*Math.pow(10,how))/Math.pow(10,how);  
    return dight;  
} 

var confirmOrder = function() {
	var deliveryAddressObj = $('input:radio[name="deliveryAddressId"]:checked');
	if (deliveryAddressObj.length < 1 || deliveryAddressObj.val() == "") {
		alert("请选择收货地址！");
		return;
	}
	var expressObj =$('input:radio[name="expressId"]:checked');
	if(expressObj.length < 1 || expressObj.val() == "") {
		alert("请选择配送方式！");
		return;
	}
	
	var deliveryTimeObj = $("#deliveryTimeId");
	if(deliveryTimeObj.length < 1 || deliveryTimeObj.val() == "") {
		alert("请选择送货时间！");
		return;
	}
	
	var deliveryComment = $("#deliveryComment").val();
	var deliveryAddressId = deliveryAddressObj.val();
	var expressId = expressObj.val();
	var deliveryTimeId = deliveryTimeObj.val();
	var buy_jifen = $("#buy_jifen").val();
	var promoRuleId = $("#promoRuleId").val();
	var couponCodeNumber = $("#couponCodeNumber").val();
	
	if (promoRuleId == "coupon_code" && (couponCodeNumber == "" || parseFloat($("#selectedPromoPirce").html().replace(/,/g, "")) <= 0)) {
		if (!confirm("确认不使用优惠劵吗？")) {
			return;
		} else {
			couponCodeNumber="";
		} 	
	}
	
	app.helper.showLoadingTip();
	$("#confirmOrder").attr("disabled", "true");
	$("#confirmOrder").removeAttr("href"); 
	$("#confirmOrder span").html("确认订单...");
	
	var confirmOrderForm = $('<form action="step_two_confirm.asp" method="post"></form>');
    confirmOrderForm.append('<input type="hidden" value="'+deliveryAddressId+'" name="deliveryAddressId"/>');
    confirmOrderForm.append('<input type="hidden" value="'+expressId+'" name="expressId"/>');
    confirmOrderForm.append('<input type="hidden" value="'+deliveryTimeId+'" name="deliveryTimeId"/>');
    confirmOrderForm.append('<input type="hidden" value="'+deliveryComment+'" name="deliveryComment"/>');
	confirmOrderForm.append('<input type="hidden" value="'+buy_jifen+'" name="buy_jifen"/>');
    confirmOrderForm.append('<input type="hidden" value="'+promoRuleId+'" name="promoRuleId"/>');
    confirmOrderForm.append('<input type="hidden" value="'+couponCodeNumber+'" name="couponCodeNumber"/>');
    confirmOrderForm.append('<input type="hidden" value="false" name="isBuyNow"/>');
    confirmOrderForm.append('<input type="hidden" value="false" name="isCollocationPromo"/>');
    confirmOrderForm.appendTo(document.body).submit();
	return false;
};

var deleteDeliveryAddress = function(deliveryAddressId) {
	if (confirm("确定要删除吗?")) {
		app.ajaxHelper.submitRequest({
	    	data : {deliveryAddressId:deliveryAddressId,"action":"deleteUserDeliveryAddress"},
	    	url : "Ajax_Address.asp",
	    	success: function(data, textStatus, jqXHR){
	    		if(app.handlerServiceResponse(data)){
	    			$("#" + deliveryAddressId + "_li").remove();
					
					if ($('input[name="deliveryAddressId"]').length == 0) {
						openNewDeliveryAddressDiv();
					}
					
					cleanExpressList();
				}
			}
	    }); 
	}
	return;
};

var initPromoRuleSelectEvent = function() {
	$("#promoRuleId").change(function(){
		var promoRuleId = $(this).val();
		if(promoRuleId == "coupon_code") {
			$("#coupon_code_input").css("display", "block");
		} else {
			$("#coupon_code_input").css("display", "none");
			initUserCouponCodeNumberEvent();
		}
		
		if (promoRuleId != "") {
			app.ajaxHelper.submitRequest({
		    	data : {promoRuleId:promoRuleId,"action":"calculatePromoPrice"},
		    	url : "Ajax_step_two.asp",
		    	success: function(data, textStatus, jqXHR){
		    		if(app.handlerServiceResponse(data)){
		    			/*$("#shoppingProductListHtml").html(data.data.shoppingProductListHtml);*/
		    			$("#selectedPromoPirce").html(app.helper.formatCurrency(data.data.selectedPromoPirce));
		    			recalculateTotalPrice();
					}
				}
		    }); 			

		}
		
	});
};

var isUserCouponCodeNumber = false;

var userCouponCodeNumber = function() {
	var couponCodeNumberObj = $("#couponCodeNumber");
	if (couponCodeNumberObj.length < 1 || couponCodeNumberObj.val() == "") {
		alert("请输入优惠券编码！");
		return;
	}
	
	app.ajaxHelper.submitRequest({
    	data : {couponCodeNumber: couponCodeNumberObj.val(),"action":"userCouponCodeNumber"},
    	url : "Ajax_step_two.asp",
    	success: function(data, textStatus, jqXHR){
    		if(app.handlerServiceResponse(data)){
    			isUserCouponCodeNumber = true;
    			$("#selectedPromoPirce").html(app.helper.formatCurrency(data.data.selectedPromoPirce));
    			$("#couponCodeNumber").attr("disabled",true);
    			recalculateTotalPrice();
    			initCancelUserCouponCodeNumberEvent();
			}
		}
    }); 	
};

var userJfNumber = function() {
	var JfNumberObj = $("#buy_jifen");
	var HJfNumberObj = $("#h_jifen");
	var strP=/^\d+$/;
	
	if(!strP.test(JfNumberObj.val())) { 
	alert("抱歉,请输入正确整数积分！"); 
	JfNumberObj.val(0);
	return;
	} 
	if (JfNumberObj.length < 1 || JfNumberObj.val() == "") {
		alert("请输入要使用的积分！");
		JfNumberObj.val(0);
		return;
	}
		if (parseInt(JfNumberObj.val()) > parseInt(HJfNumberObj.val())) {
		alert("抱歉,你目前积分小于"+JfNumberObj.val()+"!");
		JfNumberObj.val(0);
		return;
	}
	
	app.ajaxHelper.submitRequest({
    	data : {JfNumber: JfNumberObj.val(),"action":"userJfNumber"},
    	url : "Ajax_step_two.asp",
    	success: function(data, textStatus, jqXHR){
    		if(app.handlerServiceResponse(data)){
    			$("#selectedJfPirce").html(app.helper.formatCurrency(data.data.selectedPromoPirce));
    			/*$("#buy_jifen").attr("disabled",true);*/
    			recalculateTotalPrice();
			}
		}
    }); 	
};

var initCancelUserCouponCodeNumberEvent = function() {
	$("#couponbtn").unbind();
	$("#couponbtn").val("取消");
	
	$("#couponbtn").click(function(){
		$("#couponCodeNumber").attr("disabled",false);
		$("#selectedPromoPirce").html(0);
		$("#couponCodeNumber").val("");
		recalculateTotalPrice();
		isUserCouponCodeNumber = false;
		initUserCouponCodeNumberEvent();
	});
};

var initUserCouponCodeNumberEvent = function() {
	$("#couponbtn").unbind();
	$("#couponCodeNumber").attr("disabled",false);
	$("#couponCodeNumber").val("")
	$("#couponbtn").val("使用");
	
	$("#couponbtn").click(function(){
		userCouponCodeNumber();		
	});
};

//]]>
</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-con">
		<ul class="ul_form_list" id="deliveryAddressList">
<%
if session("UserID")="" then
response.Redirect("login.html")
end if
set rs=server.CreateObject("adodb.recordset")
rs.open "select * from com_Uadd where UserID="&session("UserID")&"  order by isDefault desc",conn,1,1
i=1 
if rs.eof or rs.bof then
else
while not rs.eof
%>
<li id="<%=rs("id")%>_li">
<label><input type="radio" name="deliveryAddressId" value="<%=rs("id")%>" <%if rs("isDefault")=1 then%>checked="checked"<%end if%>> <%=rs("receiverName")%> &nbsp;&nbsp;<%call showAddName(rs("provinceId"))%>&nbsp;<%call showAddName(rs("cityId"))%>&nbsp;<%call showAddName(rs("countyId"))%> &nbsp;&nbsp;<%=rs("address")%> &nbsp;&nbsp;<%=rs("postCode")%> &nbsp;&nbsp;<%=rs("splitPhone1")%>-<%=rs("splitPhone2")%><%if rs("splitPhone3")<>"" then%>-<%=rs("splitPhone3")%><%end if%> &nbsp;&nbsp;<%=rs("mobile")%></label>
<a href="javascript:void(0)" onclick="deleteDeliveryAddress(&#39;<%=rs("id")%>&#39;)">[删除]</a>
</li>
<%
i=i+1
rs.movenext
Wend 
end if
rs.close
set rs=nothing
%>

					
					
			<li><label><input type="radio" name="newDeliveryAddressId" id="newDeliveryAddressId" value="newDeliveryAddressId" > 我要创建新地址</label></li>
		</ul>
		<div id="createDeliveryAddressDiv" class="popcon" style="display: none; ">
			<s class="poparrow"></s>
			<form name="addUserDeliveryAddressForm" id="addUserDeliveryAddressForm" onsubmit="return false;">
				<table cellpadding="0" cellspacing="0" border="0" class="tab_addr">
					<tbody>
						<tr>
							<td class="p10">
								<span class="font-orange">*</span>&nbsp;收货人姓名：
							</td>
							<td>
								<input type="text" class="pinput" name="receiverName" id="receiverName" value="">
								<font id="receiverName_check" style="display: none;">请准确填写真实姓名，以便确保商品准确无误送达。</font>
								<div>
									<b style="display: none;">收货人姓名不能为空。</b>
								</div>
							</td>
						</tr>
						<tr>
							<td class="p10">
								<span class="font-orange">*</span>&nbsp;配送省份/直辖市：
							</td>
							<td>
<select id="provinceId" style="width: 100px;" name="provinceId">
<%
set rsClass1=server.createobject("adodb.recordset")
sqlClass1="select * from com_china where parentid=0 and LevelID=0 order by id asc"
rsClass1.open sqlClass1,conn,1,1
count1=0
do while not rsClass1.eof
response.write "<OPTION value="&rsClass1("id")&">"&rsClass1("name")&"</OPTION>"
count1=count1 + 1
rsClass1.movenext
loop
rsClass1.close
%></select> &nbsp; 
								<span>城市：</span>
								<select id="cityId" style="width: 140px;" name="cityId"><option value="">请选择</option></select> &nbsp; 
								<span>县区：</span>
								<select id="countyId" style="width: 140px;" name="countyId"><option value="">请选择</option></select>
								<div>
									<b class="provinceIdTip" style="display: none;">请选择省份。</b>
									<b class="cityIdTip" style="display: none;">请选择城市。</b>
									<b class="countyIdTip" style="display: none;">请选择县区。</b>
								</div></td>
						</tr>
						<tr>
							<td class="p10"><span class="font-orange">*</span>&nbsp;
								详细地址：</td>
							<td><input type="text" class="pinput" style="width: 330px;" name="address" id="address" value="">
								<font id="address_check" style="display: none;">详细地址不能为空。</font>
								<div>
									<b style="display: none;">详细地址不能为空。</b>
								</div>
							</td>
						</tr>
						<tr>
							<td class="p10">
								<span class="font-orange">*</span>&nbsp;邮政编码：
							</td>
							<td>
								<input type="text" class="pinput" name="postCode" id="postCode" value="">
								<font id="postCode_check" style="display: none;">邮政编码不能为空。</font>
								<div>
									<b>邮编格式不正确。</b>
								</div></td>
						</tr>
						<tr>
							<td class="p10">手机：</td>
							<td>
								<input type="text" class="pinput" name="mobile" id="mobile" value="">
								<font id="mobile_check">手机和固定电话至少填写一项。手机格式：13888888888</font>
							</td>
						</tr>
						<tr>
							<td class="p10">固定电话：</td>
							<td>
								<input type="text" class="pinput" name="telephone" id="telephone" value="">
								<font id="telephone_check">手机和固定电话至少填写一项。固定电话格式：0769-88888888</font>
								<div>
									<b>手机和固定电话至少填写一项，请确保格式填写正确。</b>
								</div>
							</td>
						</tr>
						<tr>
							<td class="p10"><br> 
								<a href="javascript:void(0)" id="Btn_Go" name="Btn_Go" class="btn-gouwu"><span>确认收货地址</span></a>
							</td>
							<td></td>
						</tr>
					</tbody>
				</table>
			</form>
		</div>
	</div>

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

	<div class="div-con">
		<div class="pl10">
			<ul class="ul_form_list" id="expressList">
<%
set rszf=server.CreateObject("adodb.recordset")
rszf.open "select * from com_songhuo where type=0 and sh=1 order by pid asc",conn,1,1
set subject=rszf("subject")
set subid=rszf("id")
i=1
do while not rszf.eof
%>
<li><label><input type="radio" name="expressId" value="<%=subid%>">&nbsp;<%=subject%></label><span class="price">￥<em id="express_price_13">0.00</em></span></li>
<%
i=i+1
rszf.movenext
loop
rszf.close
set rszf=nothing
%>
			</ul>
			
			<div class="hr"></div>
			<ul class="ul_form_list">

				<li>送货时间：<label><select name="deliveryTimeId" id="deliveryTimeId" style="height: 22px;">
										<option selected="selected" value="delivery_time_workday">工作日送货（周一到周五）</option>
										<option value="delivery_time_weekend">周六周天</option>
										<option value="delivery_time_allday">时间不限</option>
					</select></label>&nbsp;&nbsp;我们会尽量按照您的要求送货 ( 送货时间： 9:00 - 18:00 )
				</li>
				<li>送货备注：<label><input name="deliveryComment" type="text" id="deliveryComment" style="width: 290px;height: 22px;"></label></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>￥<span id="totalProductPrice"><%=Formatnumber(zongji,2,-1,-1,0)%></span></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>"
%>
(<%=cart_jfdk%>积分=￥1)<input name="h_jifen" id="h_jifen" type="hidden" value="<%=shopxp("jifen")%>" />
</div>
<%
if shopxp("jifen") < int(cart_jfdk) then
response.Write("<input type='hidden' id='buy_jifen'  name='buy_jifen' value='0' />")
else
response.Write("使用：<input type='text' id='buy_jifen'  name='buy_jifen' onChange='userJfNumber()' style='width:38px;' value='0' />积分")
end if
shopxp.close
set shopxp=nothing
%>
<span>-￥<em id="selectedJfPirce">0.00</em></span>
<%end if%>
		
<div class="clear"></div>		
		</li>
		
			<li>
				<div class="footl font-orange">
				* 价格可能会随着活动的状态变化而波动，请随时关注商城活动情况；</div>
				<label>
<select class="couponselect" id="promoRuleId">
<%
	set rsp=server.CreateObject("adodb.recordset")
	rsp.open "select * from com_act where sh=1 and upamount<"&zongji&" order by pid asc,amount desc",conn,1,1
	k=0
	act_amount=0
	if not rsp.bof or not rsp.eof then
	do while not rsp.eof
		if k=0 then
		act_amount=rsp("amount")
		end if
	act_name=rsp("CodeNumber")
	act_id=rsp("id")
	%>
	<option value="act_<%=act_id%>" <%if k=0 then%> selected=""<%end if%>><%=act_name%></option>
	<%
	k=k+1
	rsp.movenext
	loop
	end if
	rsp.close
	set rsp=nothing
%>
<option value="coupon_code">使用优惠劵</option>
</select>
					<span>-￥<em id="selectedPromoPirce"><%=Formatnumber(act_amount,2,-1,-1,0)%></em></span>
				</label>
				<div id="coupon_code_input" <%if k>0 then%>style="display:none;"<%end if%>>
					<label><input class="coupontxt" id="couponCodeNumber" name="couponCodeNumber" type="text" placeholder="请输入优惠券代码"><input type="button" class="couponbtn" id="couponbtn" value="使用"></label>
				</div>
				
				<div class="clear"></div>
			</li>
			<li><label>运费：</label><span>¥<em id="totalFreightPrice">0.00</em></span></li>
			<li class="count"><label>应付总额：</label><span>¥<em id="totalPrice">100.00</em></span></li>
		</ul>
		<div class="btnbar">
				<a href="cart.asp" class="btn-back"><span>返回购物车修改</span></a>
			<%if showgo=1 then%><a href="javascript:confirmOrder();" id="confirmOrder" 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"--> 

