<!doctype html>
<html lang="zh">
<head>
	<meta charset="UTF-8">
	<title>TinyShop商城</title>
	<link type="text/css" rel="stylesheet" href="{url:#css/common.css}" />
	<link type="text/css" rel="stylesheet" href="{url:#css/simple.css}" />
	<link rel="stylesheet" href="{url:#vendors/awesome/css/font-awesome.min.css}">
	{echo:JS::import('jquery');}
	<script type='text/javascript' src="{url:#js/common.min.js}"></script>
</head>
<body>
	{echo:JS::import('form');}
	{echo:JS::import('dialog?skin=brief');}
	{echo:JS::import('dialogtools');}
	<div style="padding:20px 30px;">
			{if:isset($msg)}
			<div class="message_{$msg[0]} ie6png">{$msg[1]}</div>
			{elseif:isset($validator)}
			<div class="message_warning ie6png">{$validator['msg']}</div>
			{/if}
			<form id="address-form" class="tiny-form" action="{url:/simple/address_save}" method="post">
				{if:isset($id)}<input type="hidden" name="id" value="{$id}">{/if}
				<ul class="">
				<li class="line caption">
					<label class="caption">收货人姓名：</label><input type="text" pattern="required" name="accept_name" maxlen="10" class="field" value="{$accept_name}" alt="不为空，且长度不得超过10个字"> <label></label>
				</li>
				<li class="line caption">
					<label class="caption">手机号码：</label><input type="text" class="field" pattern="mobi" name="mobile" value="{$mobile}" alt="手机号码格式错误"><label></label>
				</li>
				<li class="line caption">
					<label class="caption">电话号码：</label><input type="text" class="field" name="phone"  value="{$phone}" empty pattern="phone" alt="电话号码格式错误"><label></label>
				</li>
				<li class="line other" id="areas">
					<label for="" class="caption">收货地址：</label><select id="province" class="field"  name="province" >
			        <option value="0">==省份/直辖市==</option>
			        </select>
			        <select id="city" class="field" name="city"><option value="0">==市==</option></select>
			        <select id="county" class="field" name="county"><option value="0">==县/区==</option></select><input pattern="^\d+,\d+,\d+$" id="test" type="text" style="visibility:hidden;width:0;" value="{$province|0|int},{$city|0|int},{$county|0|int}" alt="请选择完整地区信息！"><label></label>
				</li>
				<li class="line caption">
					<label class="caption">邮政编码：</label><input class="field"  type="text" name="zip" pattern="zip" value="{$zip}" alt="邮政编码错误">
				</li>
				<li class="line other">
					<label for="" class="caption">设为默认：</label>
					<input type="checkbox" id="is_default" class="magic-checkbox" name="is_default" value="1"> <label for="is_default">设置为默认收货地址</label>
				</li>
				<li class="line textarea">
					<label class="caption">街道地址：</label><textarea name="addr" pattern="required" minlen="5" maxlen="120" alt="不需要重复填写省市区，必须大于5个字符，小于120个字符">{$addr}</textarea> <label></label>
				</li>
				<li class="line"><input type="submit" class="btn btn-main"></li>
				</ul>
			</form>
		</div>
		<script type="text/javascript">
		var form =  new Form('address-form');
		form.setValue('is_default','{$is_default}');
		  $("#areas").Linkage({ url:"{url:/ajax/area_data}",selected:[{$province|0|int},{$city|0|int},{$county|0|int}],callback:function(data){
		    var text = new Array();
		    var value = new Array();
		    for(i in data[0]){
		      if(data[0][i]!=0){
		        text.push(data[1][i]);
		        value.push(data[0][i]);
		      }
		    }
		    $("#test").val(value.join(','));
		    FireEvent(document.getElementById("test"),"change");
		    }});
		    {if:isset($invalid)}
		  	autoValidate.showMsg({id:$("input[name='{$invalid['name']}']").get(0),error:true,msg:'{$invalid['msg']}'});
		  {/if}
		</script>
</body>
</html>



