$(document).ready(function() {	
	$('#txtRPostalcode').keyup(function(){
		var curobj = $(this);
		curobj.val(curobj.val().replace(/\D/g,""));   //替换非数字
	});
	$('#txtRTelephone').keyup(function(){
		var curobj = $(this);
		curobj.val(curobj.val().replace(/\D/g,""));   //替换非数字
	});
	$('#txtQuantity').keyup(function(){
		var curobj = $(this);
		curobj.val(curobj.val().replace(/\D/g,""));   //替换非数字
	});
	$('#btnSure').click(function(){
		var flag = true;
		$.ajax({
			type:"get",
			url:(shopFolder + 'TGShow.aspx?NoCopyRight=1'),
			data:'type=CheckMember&MemberGroup=' + memberGroup,
			cache:false,
			async:false,
			success:function(msg){
				switch(msg)
				{
					case '^1':
						alert('您还没有登录');
						flag = false;
						break;
					case '^2':
						alert('您不在允许参与的会员级别范围内');
						flag = false;
						break;
				}
				
			},
			error:function(XMLHttpRequest,textStatus){if(textStatus=='parsererror'){flag = false;alert('身份已过期,请重新登陆!')}else{flag = false;alert('error')};}
		});
		if(!flag) return flag;
		
		if($.trim($('#txtRAddress').val()) == '')
		{
			alert('收货地点必填');return false;
		}
		if($.trim($('#txtRName').val()) == '')
		{
			alert('收货人姓名必填');return false;
		}
		if($.trim($('#txtRPostalcode').val()) == '')
		{
			alert('邮政编码必填');return false;
		}
		if($.trim($('#txtRTelephone').val()) == '')
		{
			alert('收货人电话必填');return false;
		}
		
		var num = $.trim($('#txtQuantity').val());
		if(num == ''){
			alert('购买的货品数量必填');return false;
		}else if(isNaN(num)){
		    alert('购买数量填写有误');return false;
		};
	});	
});