<?php /* Smarty version 2.6.17, created on 2018-04-25 15:04:00
         compiled from events_code.html */ ?>
<?php $_smarty_tpl_vars = $this->_tpl_vars;
$this->_smarty_include(array('smarty_include_tpl_file' => "header.html", 'smarty_include_vars' => array()));
$this->_tpl_vars = $_smarty_tpl_vars;
unset($_smarty_tpl_vars);
 ?>
<!--公用标题居中显示-->
<?php $_smarty_tpl_vars = $this->_tpl_vars;
$this->_smarty_include(array('smarty_include_tpl_file' => "common_header.html", 'smarty_include_vars' => array()));
$this->_tpl_vars = $_smarty_tpl_vars;
unset($_smarty_tpl_vars);
 ?>


<div class="wrapper clear">
    <div class="article_title center"><?php echo $this->_tpl_vars['codeInfo']['events_name']; ?>
</div>
	<!--公用活动说明样式-->
    <div class="article_content">
    	<?php echo $this->_tpl_vars['codeInfo']['events_tips']; ?>

    </div>
    <div class="v_box_w clear">
        <?php if (! $this->_tpl_vars['eventsStatus']): ?>
        <?php if ($this->_tpl_vars['codeInfo']['events_hd_tips']): ?>
        <div class="h3_title"><?php echo $this->_tpl_vars['codeInfo']['events_hd_tips']; ?>
</div>
        <?php endif; ?>
        <?php $_smarty_tpl_vars = $this->_tpl_vars;
$this->_smarty_include(array('smarty_include_tpl_file' => "event_forms_template.html", 'smarty_include_vars' => array()));
$this->_tpl_vars = $_smarty_tpl_vars;
unset($_smarty_tpl_vars);
 ?>
        <?php else: ?>
        <!--公用活动结束提示 begin-->
        <div class="v_end_com_box">
            <div class="v_end_txt_com center">活动已结束!</div>
            <div class="center"><a href="<?php echo $this->_tpl_vars['listUrl']; ?>
" class="submit_btn_style">参与更多特权活动</a></div>
        </div>
        <?php endif; ?>

        <?php if ($this->_tpl_vars['codeInfo']['share_button'] == 2): ?>
        	<?php $_smarty_tpl_vars = $this->_tpl_vars;
$this->_smarty_include(array('smarty_include_tpl_file' => "share_button.html", 'smarty_include_vars' => array()));
$this->_tpl_vars = $_smarty_tpl_vars;
unset($_smarty_tpl_vars);
 ?>
	    <?php endif; ?>
        
        <?php if ($this->_tpl_vars['codeInfo']['operationt_tips']): ?>
        <div class="h3_title"><span><?php echo $this->_tpl_vars['codeInfo']['operationt_tips']; ?>
</span></div>
        <?php endif; ?>
        <!--公用活动规则样式-->
        <div class="activity_des">
            <?php echo $this->_tpl_vars['codeInfo']['events_rules']; ?>

        </div>
        
        <div class="clear"></div>
    </div>
    
    
    
</div>

<!--公用提示背景遮罩层-->
<div class="a_cover"></div>

<!--公用提示样式一 begin-->
<div class="v_tips_box" id="msg_tips_box">
    <div class="v_close_btn"></div>
    <p class="tips_msg"></p>
</div>
<!--公用提示样式一 end-->


<!--公用提示样式二 begin-->
<div class="v_tips_box v_tips_box2">
	<div class="v_close_btn"></div>
    <p class="tips_img"><img src="<?php echo $this->_tpl_vars['codeInfo']['code_img_url']; ?>
"></p>
    <p class="tips_txt_show">恭喜您获得<br><?php echo $this->_tpl_vars['codeInfo']['code_name']; ?>
</p>
    <p class="go_tips_txt">券:<span>请到"我的奖品"中查看</span></p>
    <p class="go_tips_btn center">
        <a href="<?php echo $this->_tpl_vars['giftsUrl']; ?>
" class="submit_btn_style">查看详情</a>
    </p>
</div>
<!--公用提示样式二 end-->

<script>

var seconds = 2000;


//刷新页面
function reload_page (){
	window.location.reload();
}

// 跳转页面
var goUrl = '';
function go_page(){
	location.href = goUrl;
}

$(".v_close_btn").on('click', function(){
	$(".v_tips_box,.a_cover").hide();
});


KISSY.use('node, io', function (S, Node, IO) {
	
	function showMsg($msg) {
		$('.tips_msg').html($msg);
		$('#msg_tips_box, .a_cover').fadeIn().delay(2000).fadeOut();
	}
	
	function showLoading() {
		$('.tips_msg').html('<i class="fa fa-spinner fa-pulse"></i>');
		$('#msg_tips_box, .a_cover').fadeIn();
	}
	
	$('#common_submit_btn').on('click', function () {
		IO.on("send",function(){
			showLoading();
		});
		
		IO.on("complete",function(){
			//$("#v_tips_box").hide();
		});
		
		var formData = IO.serialize('#ff');
		IO.post('<?php echo $this->_tpl_vars['web_cfg']['domain']; ?>
/?c=EventsCode&a=apply&events_id=<?php echo $this->_tpl_vars['codeInfo']['id']; ?>
'
			, formData
			, function (data) {
				
				if (data.ok) {
					S.log(data.msg);
					$("#msg_tips_box").hide();
					$(".go_tips_txt span").html(data.msg.codeData.data);
					$(".v_tips_box2").fadeIn();
				} else {
					if(data.msg.url){
						$(".tips_msg").html('本活需登录后才可以参与');
						$('#msg_tips_box').fadeIn();
						goUrl = '<?php echo $this->_tpl_vars['loginUrl']; ?>
';
						setInterval("go_page();",seconds);
						return ;
					}
					showMsg(data.msg);
					return ;
					
				}
			}
			, 'json'
		);
		return false;
	});
});
</script>

<?php $_smarty_tpl_vars = $this->_tpl_vars;
$this->_smarty_include(array('smarty_include_tpl_file' => "bottom.html", 'smarty_include_vars' => array()));
$this->_tpl_vars = $_smarty_tpl_vars;
unset($_smarty_tpl_vars);
 ?>