modimobile.html 17.1 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495
<script type="text/javascript" src="__PUBLIC__/js/rem_new.js"></script>
<!DOCTYPE html >
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width">
    <title>更换手机号-{$tpshop_config['shop_info_store_title']}</title>
    <meta http-equiv="keywords" content="{$tpshop_config['shop_info_store_keyword']}"/>
    <meta name="description" content="{$tpshop_config['shop_info_store_desc']}"/>
    <meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=0"/>
    <link rel="stylesheet" type="text/css" href="__STATIC__/css/public.css"/>
    <link rel="stylesheet" type="text/css" href="__STATIC__/css/jquery.scroller-1.0.2.min.css"/>
    <link rel="stylesheet" href="__STATIC__/css/modify_handset.css?v=__CSSVERSION__">
    <link rel="stylesheet" type="text/css" href="__STATIC__/css/login.css?v=20180716002"/>
    <link rel="stylesheet" type="text/css" href="__STATIC__/css/layer.css"/>
    <script type="text/javascript" src="__STATIC__/js/jquery-1.7.2.min.js"></script>
    <script src="__PUBLIC__/js/global.js?v=__CSSVERSION__"></script>
    <script src="__PUBLIC__/js/mobile_common.js?v=__CSSVERSION__"></script>
    <script type="text/javascript" src="__STATIC__/js/layer.js"></script>
    <script type="text/javascript" src="__STATIC__/js/jquery.scroller-1.0.2.min.js"></script>


    <script type="text/javascript" src="__PUBLIC__/static/js/layer/laydate/laydate.js"></script>
    <style type="text/css">
        .landsec {margin-left: 20px;line-height: 40px}
        .landsec label{ padding-left: 22px; display: block; height:40px; line-height:40px; background: url(__STATIC__/images/category/select2.png) 0 13px no-repeat; background-size: 15px 87px; color: #989da2; font-size:14px;}
        .landsec.on label { background-position: 0 -30px;}
        .landsec label input{display: none}
        .namePic1 {position: absolute;left: 8px; top: 15px;width: 20px;height:19px;}
        .layermbox0_1 .layermchild{position: fixed;z-index: 100;}
       .phonePic{
           top:12px
       }
        .c-form-txt-normal{
            height: 35px;
            line-height: 35px;
            padding-left: 28px;
        }
        .yzmPic{
            width: 20px;
        }
        .phonePic{
            width: 20px;
        }
        .btn_big1{
            width: 60%;
            height: 0.5rem;
            line-height: 0.5rem;
            border-radius: 0.25rem;
        }


    </style>
</head>
<body>
<div class="handset-img-frame flex jc_center ai_center">
    <img class="handset-img" src="__STATIC__/images/user_card/handset.png">
</div>

<div id="tbh5v0">
    <div class="log_reg_box">
        <!--注册页面 新增   20170322-->
        <div id="logRegTabCon">
            <div class="log_reg_item" id="phonearea">


                <form id="mobileForm" name="mobileForm">
                    <div class="field phone">
                        <img class="phonePic" src="__STATIC__/images/user_card/handset-tt.png"/>
                        <input type="tel" id="usernames" maxlength="11" name="usernames" placeholder="当前手机号" readonly="readonly"
                               class="c-form-txt-normal" onblur="change_numbers()"  value="{$user_info['mobile']}"/>
                        <input type="tel" id="username" maxlength="11" name="username" placeholder="当前手机号" readonly="readonly"
                               class="c-form-txt-normal" style="display: none" onblur="checkMobilePhone(this.value);"  value="{$user_info['mobile']}"/>
                     <!--   <div class="tips">
                            <span id="mobile_phone_notice"></span>
                        </div>-->
                    </div>
                    <div class="yanzheng" style=" margin-top:0px;">
                        <div class="codeTxt">
                            <img class="yzmPic" src="__STATIC__/images/user_card/verification_card.png"/>
                            <input type="tel" id="mobile_code" maxlength="4" name="mobile_code" placeholder="手机验证码"/>
                        </div>
                        <div class="codePhoto flex ai_center jc_fe">
                           <!-- <input id="zphone" type="button" rel="mobile" value="输入验证码" onClick="showVerify()"
                                   class="zphone" style=" color:#FFF;padding: 5px 5px;">-->
                            <div class="verification_code flex ai_center jc_center" onClick="showVerify()">获取验证码</div>
                        </div>
                    </div>
                    <!-- 温馨提示说明-->
                    <div class="tips">
                        <div class="fs018">温馨提示:
                            <br/>1.更换手机号下次可使用新手机
                            <br/>2.为保障数据安全,如遇旧手机可联系客服进行解绑
                            <br/>3.收到验证码而非本人操作请及时更改密码
                        </div>

                    </div>

                    <p class="tips1 dn">手机验证已发送,{$s_time_out} 秒未收到点击“重新发送”!</p>
                    <input type="hidden" id="stoid" name="stoid" value="{$Think.request.stoid}">
                    <input type="button" id="btn_submit" name="Submit" readonly="readonly" class="btn_big1 tac"
                           onclick="form_submit()" value="下一步"/>

                </form>
            </div>

        </div>
    </div>


    <input name="stoid" value="{$Think.request.stoid}" type="hidden">
    <input type="hidden" value="{$user_openid}" id="hidopenid" name="hidopenid" />
    <input type="hidden" value="{$user_openidkey}" id="hidopenidkey" name="hidopenidkey" />
    <input type="hidden" value="" id="hidecodekey" name="hidecodekey" />

</div>

<div class="layer_verify " style="display: none;">
    <div class="layer_verify1">
        <Div class="close"><img src="__STATIC__/images/flow/close.png"></Div>
        <div class="title">请输入图片验证</div>
            <div><img src='/Home/Api/vertify' class="chicuele" id="imgVerify" alt="" onclick="fleshVerify()"></div>
               <div class="yz_msg"></div>
        <div class="input_class">

            <div style="position: absolute">
             <input type="number" name="vertify" id="vertify"   value="" placeholder="" class="vertify_input" maxlength="4"  onpropertychange="getyzcode()" />
            </div>
            <ul class="input_class2">
                <li></li>
                <li></li>
                <li></li>
                <li></li>
            </ul>
        </div>
    </div>
</div>



<script type="text/javascript">

    var flag = true;
    //显示转换手机的号码样式如137****1521
    //转换电话格式
    function change_numbers() {
        var val=$("#usernames").val();
        console.log("1111111转换的手机号是多少",val );
        if(val!=null&&val!=""&&val!=undefined){
            var number="";
            for(var i = 0; i < val.length; i++){
                if(i < 3 || i >= val.length-4){
                    number += val[i];
                }else{
                    number += '*';
                }
            }
        }
        console.log("1111111转换的手机号是多少", number );
        var val=$("#usernames").val(number);

    }
    //验证手机
    function checkMobilePhone(mobile) {
        $("#mobile_phone_notice").text("");
        flag = true;
        if (mobile == '') {
            $('#mobile_phone_notice').css('color', '#c4182e');
            $('#mobile_phone_notice').html('* 手机号码不能为空');
            flag = false;
        } else if (checkMobile(mobile)) {

        } else {
            $('#mobile_phone_notice').css('color', '#c4182e');
            $('#mobile_phone_notice').html('* 手机号码格式不正确');
            flag = false;
        }

    }
    //验证输入是否为空
    function check(obj) {
        return;
        var span = $(obj).parent().find("span");
        $(span).text("");
        var name = $(obj).attr('placeholder');
        flag = true;
        if ($(obj).val() == '') {
            $(span).css('color', '#c4182e');
            $(span).html('* ' + name + '不能为空');
            flag = false;
        }
    }

    var date = new Date;
    //日期差
    function CompareDate(d) {
        return ((new Date(d.replace(/-/g, "\/"))) >= new Date(date.toDateString()));
    }

    //表单提交
    function form_submit() {
        //手机号码
        var username = $('#username').val();
        console.log("手机号是多少", username);
        //验证码
        var mobile_code = $('#mobile_code').val();
        if (mobile_code.length == 0 || mobile_code.length != 4) {
            layer.closeAll();
            layer.open({content: '短信验证码不能为空或位数不正确', time: 1});
            return false;
        }

        if (username.length == 0) {
            layer.closeAll();
            layer.open({content: "手机号码不能为空", time: 1});
            return false;
        }
        if (!checkMobile(username)) {
            console.log("走到这里吗", username);
            layer.closeAll();
            layer.open({content: '手机号码格式不正确', time: 1});
            return false;
        }


        if (username.length > 0 && flag) {
            var getstoid = {$Request.param.stoid};
            var t = layer.open({shadeClose: false, type: 2, content: '提交中'});
            $.ajax({
                url: '/index.php?m=mobile&c=User&a=modimobile&stoid=' + getstoid + '&is_ajax=1',
                type: 'post',
                dataType: 'json',
                data: $('#mobileForm').serialize(),
                success: function (res) {
                    layer.close(t);
                    if (res.status == 1) {


                        location.href = "/index.php/Mobile/User/modimobile2/stoid/" + getstoid+"/usercode/"+res.usercode;


                    }
                    else {
                        layer.open({content: res.msg, time: 1});
                        layer.close(t);
                    }
                }
            })

        } else {
            layer.close(t);
            return false;
        }

    }



    function fleshVerify(){
        $('#imgVerify').attr('src','/index.php?m=Home&c=Api&a=vertify&r='+Math.floor(Math.random()*100));//重载验证码
    }


    var is_verifycode="{$is_verifycode}";

    //验证码
    function showVerify() {

        var username = $('#username').val();
        var mobile_code = $('#mobile_code').val();
        if (username.length == 0) {
            layer.open({
                content: '手机号码不能为空'
                , skin: 'msg'
                , time: 1 //2秒后自动关闭
            });
            return false;
        }
        if (username.length !=11) {
            layer.open({
                content: '手机号码位数有误 '
                , skin: 'msg'
                , time: 1 //2秒后自动关闭
            });
            return false;
        }
        if (!checkMobile(username)) {
            layer.closeAll();
            layer.open({content: '手机号码格式不正确', time: 1});
            return false;
        }

        if (is_verifycode=="1") {

            fleshVerify();
            $("#vertify").val('');
            $(".layer_verify").show();
            $("#vertify").focus();
            $(".yz_msg").html("");
        }else
        {
            sendcode();
            flag=true;
        }

    }

    $(".input_class2 li").click(function () {
        $(".input_class2 li").each(function(){
            $(this).removeClass('active');
        });
        $(this).toggleClass('active');
        $("#vertify").focus();
    })

    $(".input_class2 li").mouseover(function () {
        $(".input_class2 li").each(function(){
            $(this).removeClass('active');
        });
        $(this).toggleClass('active');
        $("#vertify").focus();
    })
    $(".input_class2 li").mouseout(function () {
        $(".input_class2 li").each(function(){
            $(this).removeClass('active');
        });

    })
    $(".layer_verify").bind("input propertychange",function(){
        if ($("#vertify").val().length==4)
        {
            var getvertify=$("#vertify").val();
            var getvertify = getvertify.substr(0, 4);
            $.ajax({
                url: '/index.php?m=Home&c=Api&a=smsm_verify&vertifycode=' + getvertify + '',
                type: 'post',
                dataType: 'json',
                success: function (res) {
                    if (res.status == 1) {
                        $(".yz_msg").html("");
                        $(".layer_verify").hide();
                        $("#hidecodekey").val(res.codekey);
                        sendcode();
                        flag=true;

                    }
                    else {
                        fleshVerify();
                        $("#vertify").val('');
                        $(".yz_msg").html(res.msg);
                    }
                }
            })
        }
    });

    $(".layer_verify .close").click(function () {
        $(".layer_verify").hide();
    })

    var wait = "{$s_time_out}";
    //短信+电话语音=0,电话语音=1
    var s_type = "{$s_type}";
    var s_flag = true;
    var s_verifyCode = 0;   //语音验证码
    var s_verifyTime = 0;   //超时时间
    //发送验证码
    function sendcode() {
        var username = $('#username').val();
        var mobile_code = $('#mobile_code').val();
        if (username.length !=11) {
            layer.open({
                content: '手机号码位数有误 '
                , skin: 'msg'
                , time: 1 //2秒后自动关闭
            });
            return false;
        }
        if (!checkMobile(username)) {
            layer.closeAll();
            layer.open({content: '手机号码格式不正确', time: 1});
            return false;
        }
        var getopenid=$("#hidopenid").val();
        var getopenidkey=$("#hidopenidkey").val();
        if (is_verifycode=="1") {
            var getvertify = $("#vertify").val();
            var getcodekey = $("#hidecodekey").val();
        }
        if (is_verifycode=="1") {
            if (getopenid=="" || getopenidkey=="" || getvertify=="" || getcodekey=="")
            {
                layer.closeAll();
                layer.open({content: '参数不完整,无法操作', time: 1});
                return false;
            }
        }
        else {
            if (getopenid=="" || getopenidkey=="")
            {
                layer.closeAll();
                layer.open({content: '参数不完整,无法操作', time: 1});
                return false;
            }
        }


        var o="#zphone";

        var t1 = layer.open({shadeClose: false, type: 2, content: '加载中'});

        if (flag) {
            var url = '/index.php?m=Home&c=Api&a=send_validate_code&t=' + Math.random();
            var data = {
                stoid: '{$Request.param.stoid}',
                s_time_out: wait,
                type: $(o).attr('rel'),
                send: $('#username').val(),
                scene: 1,
                vertifycode: getvertify,
                codekey: getcodekey,
                openid: getopenid,
                openidkey: getopenidkey
            };

            //仅语音验证 或 短信验证第二次开始使用语音验证
            if (s_type== 1 || !s_flag){
                var data = {
                    stoid: '{$Request.param.stoid}',
                    s_time_out: wait,
                    type: $(o).attr('rel'),
                    send: $('#username').val(),
                    scene: 2,
                    vertifycode: getvertify,
                    codekey: getcodekey,
                    openid: getopenid,
                    openidkey: getopenidkey
                };
            }

            $.ajax({
                url: url,
                type: 'post',
                dataType: 'json',
                data: data,
                success: function (res) {
                    s_flag = false; //第一次短信验证以后,第二次开始均用电话语音
                    layer.close(t1);
                    if (res.status == 1) {

                        $(".tips1").removeClass('dn');
                        layer.open({content: res.msg, time: 1});
                        countdown(o);
                    } else {

                        layer.open({content: res.msg, time: 2});
                        layer.close(t1);
                    }
                }, error: function () {
                    layer.close(t1);
                }
            })
        }
    }


    function countdown(obj, msg) {
        obj = $(obj);
        if (wait == 0) {
            obj.removeAttr("disabled");
            obj.val(msg);
            wait = "{$s_time_out}";
        } else {
            if (msg == undefined || msg == null) {
                msg = obj.val();
            }
            obj.attr("disabled", "disabled");
            obj.val(wait + "秒后重新获取");
            wait--;
            setTimeout(function () {
                countdown(obj, msg)
            }, 1000)
        }
    }

    function backarea() {
        $("#layeraddrshow").removeClass("dn");
        $("#layerpickshow").addClass('dn');
    }



</script>
</body>
</html>