<div class="alert_duihuan">
<div class="alert_content">
	<div class="top_tips none jifen" style="display: block; ">本次兑换需花费 <em class="org exchange-num">{$item.score}</em> 个积分，您有积分 <em class="org">{$info.score}</em> 个</div>
	<form id="J_address_form" name="J_address_form" method="post" action="{:U('gift/address')}">
	<div class="address">
		<ul>
			<li>
				<div class="user">
					<label>兑换数量：</label>
					<input type="text" class="ddinput" style="width:100px;" value="1" name="num" tabindex="1">
				</div>
				<div class="error-box">
					<label class="warn" style="display: none; ">最多兑换{$item.user_num}件</label>
					<label for="num" generated="true" class="error ok" style="">OK!</label>
				</div>
			</li>
			<li>
				<div class="user"><label>姓 名：</label>
				<input name="realname" type="text" id="realname" value="{$info.realname}" style="width:150px;" class="ddinput"/></div>
				<div class="error-box">
					<label class="warn">您的真实姓名，收货姓名</label>
				</div>
			</li>
			<li>
				<div class="user"><label>手机号码：</label>
				<input name="mobile" type="text" id="mobile" value="{$info.mobile}" style="width:150px;" class="ddinput"/></div>
				<div class="error-box">
					<label class="warn">您的手机号码，收货时联系</label>
				</div>
			</li>
			<li>
				<div class="user"><label>QQ号码：</label>
				<input name="qq" type="text" id="qq" value="{$info.qq}" style="width:150px;" class="ddinput"/>
				</div>
				<div class="error-box">
					<label class="warn">QQ号码</label>
				</div>
			</li>
			<li>
				<div class="user"><label>电子邮箱：</label>
				<input name="email" type="text" id="email" value="{$info.email}" style="width:150px;" class="ddinput"/>
				</div>
				<div class="error-box">
					<label class="warn">电子邮箱</label>
				</div>
			</li>
			<li>
				<div class="user"><label>收货地址：</label>
				<input name="address" type="text" class="ddinput" style="width:300px;" value="{$info.address}" id="address" tabindex="7">
				</div>
				<div class="error-box">
					<label class="warn">请填写收货地址</label>
				</div>
			</li>
			<li>
				<input type="hidden" id="id" name="id" value="{$item.id}">
				<input type="hidden" id="iid" name="iid" value="{$item.num_iid}">
				<input type="submit" class="smt smt1 fl ShiftClass" value="确认兑换" tabindex="9">
				<input type="button" class="smt smt2 fl smt_close " value="取消兑换" tabindex="10">
			</li>
		</ul>
	</div>
	</form>
</div>
</div>
<script type="text/javascript" src="__STATIC__/zhe800/js/jquery.validate.js"></script>
<script>
$(function(){
	$('.smt_close').click(function(){
		 $.dialog.get('gift_address').close();
	});


	$('#J_address_form').validate({
        errorPlacement: function(error, element){
            var error_td = element.parent('div').next('div');
            error_td.find('.warn').hide();
            error_td.append(error);
        },
        success       : function(label){
            label.addClass('ok').text('OK!');
        },
        onkeyup: false,
        rules : {
		num : {
                required : true,
                range:[1,{$item.user_num}]
            },
            realname : {
                required : true
            },
            mobile : {
                required : true,
                mobile   : true
            },
	   email : {
                required : true,
                email    : true
            },
            qq : {
                required : true,
                range:[1000,999999999999]
            }
        },
        messages : {
		num : {
                required : '填写您兑换数量',
                range:'数量最多兑换{$item.user_num}件'
            },
			realname : {
                required : '填写姓名'
            },
            mobile  : {
                required : '填写手机号码',
                mobile: '手机号码格式错误'
            },
			            email : {
                required : '填写电子邮箱',
                email    : '邮箱错误'
            },
			qq : {
                required : '填写您的QQ号码',
                range:'QQ号码位数错误'
            }
        } 
    });
});
</script>
