<?php /* Smarty version Smarty-3.1.8, created on 2015-11-25 16:55:54
         compiled from "D:\wwwroot\o2o\htdocs\themes\default\ucenter\set\wxmodifymobile.html" */ ?>
<?php /*%%SmartyHeaderCode:178825655779a44ca82-84871531%%*/if(!defined('SMARTY_DIR')) exit('no direct access allowed');
$_valid = $_smarty_tpl->decodeProperties(array (
  'file_dependency' => 
  array (
    '86d042a34b70ea9f205d6e62ff89fd5fe07bd27e' => 
    array (
      0 => 'D:\\wwwroot\\o2o\\htdocs\\themes\\default\\ucenter\\set\\wxmodifymobile.html',
      1 => 1448266890,
      2 => 'file',
    ),
  ),
  'nocache_hash' => '178825655779a44ca82-84871531',
  'function' => 
  array (
  ),
  'variables' => 
  array (
    'MEMBER' => 0,
  ),
  'has_nocache_code' => false,
  'version' => 'Smarty-3.1.8',
  'unifunc' => 'content_5655779a4ae515_26903482',
),false); /*/%%SmartyHeaderCode%%*/?>
<?php if ($_valid && !is_callable('content_5655779a4ae515_26903482')) {function content_5655779a4ae515_26903482($_smarty_tpl) {?><?php if (!is_callable('smarty_function_link')) include 'D:\\wwwroot\\o2o\\htdocs\\system\\plugins/smarty\\function.link.php';
?><?php $_smarty_tpl->tpl_vars['tpl_title'] = new Smarty_variable('绑定手机', null, 0);?>
<!DOCTYPE HTML>
<html>
<head>
<?php echo $_smarty_tpl->getSubTemplate ("xiche/block/sheader.html", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, null, null, array(), 0);?>

</head>
<body>
<header>
	<i class="left"><a id="icon_goback" href="javascript:history.back(-1);"></a></i>
    <div class="title">请先微信绑定手机</div>
    <i class="right"></i>
</header>
<section id="order_sub" class="page_center_box">
  
    <ul class="form_list_box mt10">
        <li class="pd">
        	<table width="100%">
            	<tr>
                	<th><em class="ico_1"></em></th>
                    <td>
                        <input type="text" name="data[mobile]" placeholder="请输入手机号" id="mobile" value="">
                        <div class="get_yzm on" login="passport:sendsms" >获取验证码</div>
                    </td>
                </tr>
            </table>
        </li>
        <li class="pd">
        	<table>
            	<tr>
                	<th><em class="ico_2"></em></th>
                    <td>
                        <input type="text" name="mobile_yzm" id="mobile_yzm" placeholder="请输入验证码">
                    </td>
                </tr>
            </table>
        </li>
   
    </ul>
    <div class="long_btn_box"><input class="long_btn" id="form_btn" type="submit" value="确认修改"></div>

</section>
<script type="text/javascript">
    
 require(["zepto", "underscore", "submit", "frozen"], function($, _, submit, fz) {
    $("#form_btn").on("click", function(){
        if($("#mobile").val().length<1){
            $.tips({content:'请输入新手机号'});
            return false;
        }else if($("#mobile_yzm").val().length < 4){
            $.tips({content:'手机验证码不正确'});
            return false;
        }
    });
   // var sbt = new submit();
    //sbt.init({"form": $("#member_modifypwd")});
    
    $('#form_btn').click(function(){
        var link = "<?php echo smarty_function_link(array('ctl'=>'ucenter/set/wxmodifymobile'),$_smarty_tpl);?>
";
        var mobile = $('#mobile').val();
        var mobile_yzm = $('#mobile_yzm').val();
        $.post(link,{mobile:mobile,mobile_yzm:mobile_yzm},function(ret){
             if(ret.error){
                    $.tips({content: ret.message});
                }else{
                    $.tips({content: ret.message});
                    setTimeout(function(){
                      window.location.href='<?php echo smarty_function_link(array('ctl'=>"xiche/index"),$_smarty_tpl);?>
';
                    },1000)
                }
        },'json');
       })
      
    
    var wx_mobile = '<?php echo $_smarty_tpl->tpl_vars['MEMBER']->value['mobile'];?>
';
    setInterval(function(){
        if(wx_mobile.length > 1){
            window.location.href='<?php echo smarty_function_link(array('ctl'=>"xiche/index"),$_smarty_tpl);?>
';
        }
    },1000)
    
    
});

require(["zepto"], function($, fz){
         function  BtnCount() {
            if (mobile_count == 0) {
                $(".get_yzm").removeClass("on");
                $('.get_yzm').removeAttr("disabled");
                $('.get_yzm').text("重新获取");
                mobile_lock = 0;
                clearTimeout(mobile_timeout);
                $('.get_yzm').addClass("on");
            } else {
                mobile_count--;
                $('.get_yzm').text( + mobile_count.toString() + "秒...");
                mobile_timeout = setTimeout(BtnCount, 1000);
            }
        }    
        var minute = 60;
        var mobile_timeout;
        var mobile_count = minute;
        var mobile_lock = 0;

        $("[login]").click(function () {            
            if (mobile_lock == 0) {

            
            var mobile = $('#mobile').val(); 
            var link = "<?php echo smarty_function_link(array('ctl'=>'xiche/passport/sendsms'),$_smarty_tpl);?>
";
             $.post(link,{mobile:mobile},function(ret){
                if(ret.error){
                       $.tips({content: ret.message.join("")});
                   }else{
                        $.tips({content: "验证码发送成功"});
                    BtnCount();
                   }
               },'json');

            
            mobile_count = minute;
            $(".get_yzm").removeClass("on");
            $('.get_yzm').attr("disabled", "disabled");
            BtnCount();
            mobile_lock = 1;
        }
    });   
});

</script>
</body>
</html><?php }} ?>