<div class="main f_r">
    <div class='tabs'>
		<div class="uc_title m_10 tabs_menu">
			<label class="current node"><span>地址管理</span></label>
		</div>
	    <div class='tabs_content'>
	        <div id="address_list" class="form_content m_10 node">
	            <div class="uc_title2 m_10"><strong>已保存的有效地址</strong></div>
	            <table class="list_table" width="100%" cellpadding="0" cellspacing="0">
	            	<colgroup>
	                	<col width="120px" />
		                <col width="120px" />
		                <col width="120px" />
		                <col width="120px" />
		                <col width="120px" />
		                <col />
	            	</colgroup>

	                <thead>
	                	<tr>
	                		<th>收货人</th>
	                		<th>所在地区</th>
	                		<th>街道地址</th>
	                		<th>手机</th>
	                		<th>邮编</th>
	                		<th>操作</th>
	                	</tr>
	                </thead>
	                <tbody>
	                {foreach:items=$this->address}
	                    <tr>
	                        <td>{$item['accept_name']}</td>
	                        <td>{$this->areas[$item['province']]}{$this->areas[$item['city']]}{$this->areas[$item['area']]}</td>
	                        <td>{$item['address']}</td>
	                        <td>{$item['mobile']}</td>
	                        <td>{$item['zip']}</td>
	                        <td>
	                        	<a class="blue" href='javascript:void(0)' onclick='editAddress({$item['id']})'>修改</a>|
	                        	<a class="blue" href="javascript:void(0)" onclick="delModel({link:'{url:/ucenter/address_del/id/$item[id]}'});">删除</a>|
	                        	{if:$item['is_default']==1}
	                        	<a class="red2" href="{url:/ucenter/address_default/id/$item[id]/is_default/0}">取消默认</a>
	                        	{else:}
	                        	<a class="blue" href="{url:/ucenter/address_default/id/$item[id]/is_default/1}">设为默认</a>
	                        	{/if}
	                        </td>
	                    </tr>
	                {/foreach}
	                </tbody>

	                <tfoot>
	                	<tr>
	                		<td colspan="6" class="t_l">
	                			<label class="btn_gray_s"><input type="button" value="新增地址" onclick="editAddress();" /></label>
	                		</td>
	                	</tr>
	                </tfoot>
	            </table>
	        </div>
	    </div>
    </div>
</div>

<script type='text/javascript'>
//地址修改
function editAddress(addressId)
{
	art.dialog.open(creatUrl("block/address/id/"+addressId),
	{
		"id":"addressWindow",
		"title":"收货地址",
		"ok":function(iframeWin, topWin){
			var formObject = iframeWin.document.forms[0];
			if(formObject.onsubmit() === false)
			{
				alert("请正确填写各项信息");
				return false;
			}
			$.getJSON(formObject.action,$(formObject).serialize(),function(content){
				if(content.result == false)
				{
					alert(content.msg);
					return;
				}
				window.location.reload();
			});
			return false;
		},
		"okVal":"提交",
		"cancel":true,
		"cancelVal":"取消",
	});
}
</script>