<style type="text/css"> 
table.etable tr td select{ float:left; }
table.etable tr td em{ font-style:inherit; padding:10px 0 0 10px; color:#FF0000; float:left;}
</style>
<table class="etable">
	<tr>
		<td width="90">姓名：</td>
		<td><input type="text" name="name" id="recive_name" size="38" value="<{$row.name}>" placeholder="收件人姓名"/><em>*</em></td>
	</tr>
	<tr>
		<td>手机：</td> 
		<td><input type="text" name="mobile" id="recive_mobile" size="38" value="<{$row.mobile}>" placeholder="收件人联系电话"/><em>*</em></td>
	</tr>
	<tr>
		<td>地区：</td>
		<td><div class="area_box"></div></td>
	</tr>
	<tr>
		<td>地址：</td>
		<td><input type="text" name=""  id="recive_address" size="38" value="<{$row.address}>" placeholder="收件人详细地址"/><em>*</em></td>
	</tr>
	<tr>
		<td>邮编：</td>
		<td><input type="text" name="" id="recive_zip" size="38" value="<{$row.zip}>" placeholder="收件人邮编"/></td>
	</tr>
	<tr>
		<td>默认：</td>
		<td><input type="checkbox" id="recive_is_default" <{if $row.is_default == '1'}>checked="checked"<{/if}> name="is_default" value="1"/></td>
	</tr> 
</table> 
<script type="text/javascript" src="<{$__PUBLIC__}>js/area.js"></script>
<script type="text/javascript">
	<{if $row.prov == '' && $row.city == '' && $row.dist == ''}>
		$(".area_box").area();
	<{else}>
		$(".area_box").area({ 
			'prov':'<{$row.prov}>',
			'city':'<{$row.city}>',
			'dist':'<{$row.dist}>'
		});	
	<{/if}> 
	function ajax_submit(){ 
		var name = $("#recive_name").val(); 		if(name == '')	{ 	alert('姓名不能为空！');	return false; }
		var mobile = $("#recive_mobile").val();		if(mobile == ''){ 	alert('电话不能为空！');	return false; }
		var prov = $("#prov").val();		if(dist == '0')	{ 	alert('选择省份！');		return false; } 
		var city = $("#city").val();		if(city == '0')	{ 	alert('选择市区！');		return false; } 
		var dist = $("#dist").val(); 		if(dist == '0')	{ 	alert('选择县级！');		return false; } 
		var address = $("#recive_address").val();	if(address == ''){ 	alert('地址不能为空！');	return false; } 
		var zip = $("#recive_zip").val(); 
		if(zip){
			if(!/^[0-9][0-9]{5}$/.test(zip)){ 
				$.alert('邮编格式不正确！');  
				return false; 
			}
		} 
		var is_default = $("#recive_is_default").is(':checked')?'1':'0'; 
		$.post('member.php?m=address&a=edit_save',{<{if $row.id}>id:<{$row.id}>,<{/if}>name:name,mobile:mobile,prov:prov,city:city,dist:dist,address:address, zip:zip, is_default:is_default},function(result){ 
			var data = jQuery.parseJSON(result); 
			if(data.error =='0'){
				<{if $smarty.get.type == '1'}>
					con_html = '<label>'+
									'<span>送至</span>'+
									'<input type="radio" name="address_id" value="'+data.id+'"/>'+
									'<p>'+data.prov_cn+' '+data.city_cn+' '+data.dist_cn+' '+data.address+' ( '+name+' 收) '+data.mobile+'</p>'+
								'</label>'+
								'<div class="rt">'+ 
									'<a href="javascript:;" addrid="'+data.id+'" onClick="address_edit(\'添加地址\',\'member.php?m=address&a=edit&type=1&id='+data.id+'\')">编辑</a> '+
									'<a href="javascript:;" addrid="'+data.id+'" class="address_del">删除</a> '+
								'</div>'; 
					div_num = $('.addr_box').length;
					if(div_num == '0'){ 
						$(".addr_box").html('<div class="addr_box add_con_'+data.id+'">'+con_html+'</div>'); 
					}else{ 
						<{if $row.id}>
							$(".add_con_"+data.id).html(con_html);  
						<{else}>
							$(".add_con:last-child").after('<div class="addr_box add_con_'+data.id+'">'+con_html+'</div>');
						<{/if}>
					} 
					$('.add_con_'+data.id+' input[name=address_id]').attr("checked","checked"); 
					ajax_close(); 
				<{else}>
					$.alert('保存成功', function(){
						location.reload(); 
					});
				<{/if}>
			}else{
				$.alert(data.msg);
			} 
		}); 
	}
</script>