|
@@ -0,0 +1,271 @@
|
|
|
+<!DOCTYPE html>
|
|
|
+<html>
|
|
|
+
|
|
|
+ <head>
|
|
|
+ <meta charset="utf-8">
|
|
|
+ <title>免费送滤芯</title>
|
|
|
+ <meta http-equiv="pragma" content="no-cache">
|
|
|
+ <meta http-equiv="cache-control" content="no-cache">
|
|
|
+ <meta http-equiv="expires" content="0">
|
|
|
+ <meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1, user-scalable=no">
|
|
|
+ <meta name="apple-mobile-web-app-capable" content="yes">
|
|
|
+ <meta name="apple-mobile-web-app-status-bar-style" content="black">
|
|
|
+ <meta name="format-detection" content="telphone=no, email=no" />
|
|
|
+ <link rel="stylesheet" type="text/css" href="//css.iamberry.com/watero/css/mui.min.css?v=2016111701" />
|
|
|
+ <link rel="stylesheet" type="text/css" href="//css.iamberry.com/watero/css/iconfont.css?v=2016111701" />
|
|
|
+ <link rel="stylesheet" type="text/css" href="//css.iamberry.com/watero/css/style.css?v=2016111701" />
|
|
|
+ </head>
|
|
|
+
|
|
|
+ <body>
|
|
|
+ <!--内容开始-->
|
|
|
+ <div class="mui-content">
|
|
|
+ <div>
|
|
|
+ <img width="100%" src="//s.iamberry.com/watero/images/banner-11.jpg" />
|
|
|
+ </div>
|
|
|
+ <div class="mui-text-center">
|
|
|
+ 验证手机信息
|
|
|
+ </div>
|
|
|
+ <form class="mui-input-group register-group">
|
|
|
+ <div class="mui-input-row">
|
|
|
+ <label>手机号</label>
|
|
|
+ <input type="tel" placeholder="输入您购买时的手机号(11位)" id="ipt-phone" maxlength="11">
|
|
|
+ </div>
|
|
|
+ <div class="mui-input-row">
|
|
|
+ <label>验证码</label>
|
|
|
+ <input type="tel" placeholder="输入短信验证码" maxlength="4" id="code"><button type="button" class="pull-code" id="pull-code">获取验证码</button>
|
|
|
+ </div>
|
|
|
+ </form>
|
|
|
+ <br />
|
|
|
+ <div class="mui-content-padded">
|
|
|
+ <button type="button" data-loading-icon="mui-spinner mui-spinner-custom" data-loading-text="提交中" class="mui-btn mui-btn-block my-btn-confirm" id="btn-confirm" disabled="disabled">领取滤芯</button>
|
|
|
+ </div>
|
|
|
+ <div class="mui-content-padded">
|
|
|
+ <ul>
|
|
|
+ <li>活动说明:</li>
|
|
|
+ <li>1、此活动福利仅针对watero老客户</li>
|
|
|
+ <li>2、每个手机号限领一次,会员中心可查看</li>
|
|
|
+ <li>3、如您为老客户,已更换手机号,请联系客服处理</li>
|
|
|
+ <li>活动福利:</li>
|
|
|
+ <li>1、免费赠送WateroT1或T2滤芯一支</li>
|
|
|
+ <li>2、此后凡购买滤芯套装,均享立减100元优惠</li>
|
|
|
+ <li>3、尊享watero一对一客服售后服务</li>
|
|
|
+ </ul>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <!--内容结束-->
|
|
|
+
|
|
|
+ <script src="//s.iamberry.com/watero/js/mui.min.js?v=2016111701"></script>
|
|
|
+ <script src="//s.iamberry.com/watero/js/jquery-2.1.1.min.js"></script>
|
|
|
+ <script src="//s.iamberry.com/watero/js/shop/main.js?v=20170622"></script>
|
|
|
+ <script src="//s.iamberry.com/watero/js/shop/wechat-utils-1.0.js"></script>
|
|
|
+ <script>
|
|
|
+ var countdown = 60;
|
|
|
+ var check = false,
|
|
|
+ alert_msg = '';
|
|
|
+ var reg_Ch_En_Num = /^[A-Za-z0-9_ \-\u4e00-\u9fa5]{1,15}$/; //简体中文英文数字,横线下划线空格(1-15位)
|
|
|
+ var mobile = /^(13|14|15|16|17|18|19)[0-9]{9}$/; //手机号码
|
|
|
+ var code = /^[0-9]{4}$/; //数字
|
|
|
+ var validate_flag = false,
|
|
|
+ show_msg = '',userNick='';
|
|
|
+ //ready事件
|
|
|
+ mui.ready(function() {
|
|
|
+ if(!window.localStorage) {
|
|
|
+ mui.alert("浏览器不支持localStorage");
|
|
|
+ } else {
|
|
|
+ var codedata = JSON.parse(localStorage.getItem('pull-code-data'));
|
|
|
+ if(codedata != null) {
|
|
|
+ var dates = new Date();
|
|
|
+ $("#ipt-phone").val(codedata.phone);
|
|
|
+ if(codedata.codeTime > 0) {
|
|
|
+ if(((dates.getTime() / 1000) - codedata.updateTime) < codedata.codeTime) {
|
|
|
+ countdown = (codedata.codeTime - (parseInt(dates.getTime() / 1000) - codedata.updateTime)) + 1;
|
|
|
+ settime("pull-code");
|
|
|
+ } else {
|
|
|
+ $(".pull-code").removeAttr("disabled");
|
|
|
+ }
|
|
|
+ $('#btn-confirm').removeAttr("disabled").addClass("active");
|
|
|
+ } else {
|
|
|
+ $(".pull-code").removeAttr("disabled").addClass("active");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ //实时监听文本框字数
|
|
|
+ document.getElementById("ipt-phone").addEventListener("input", function() {
|
|
|
+ var phone = this.value;
|
|
|
+ if(phone.length == 11) {
|
|
|
+ if(mobile.test(phone) && countdown == 60) {
|
|
|
+ $(".pull-code").removeAttr("disabled").addClass("active");
|
|
|
+ } else {
|
|
|
+ $(".pull-code,#btn-confirm").attr("disabled", "disabled").removeClass("active");
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ $(".pull-code,#btn-confirm").attr("disabled", "disabled").removeClass("active");
|
|
|
+ }
|
|
|
+ });
|
|
|
+ //发送验证码
|
|
|
+ $(document).on('tap', '.pull-code', function() {
|
|
|
+ if($("#ipt-phone").val().trim() == "" && (!$(".pull-code").hasClass("active"))) {
|
|
|
+ mui.alert("请填写手机号码", function() {
|
|
|
+ $("#ipt-phone").select();
|
|
|
+ });
|
|
|
+ return;
|
|
|
+ } else {
|
|
|
+ if(!mobile.test($("#ipt-phone").val().trim())) {
|
|
|
+ mui.alert("手机号码不正确,请重新填写", function() {
|
|
|
+ $("#ipt-phone").select();
|
|
|
+ });
|
|
|
+ return;
|
|
|
+ } else {
|
|
|
+ if($(this).hasClass("active")) {
|
|
|
+ $.ajax(base_path + '/send_message?dates=' + new Date().getTime(), {
|
|
|
+ data: {
|
|
|
+ "phone": $("#ipt-phone").val().trim()
|
|
|
+ },
|
|
|
+ dataType: 'json',
|
|
|
+ xhrFields: {
|
|
|
+ withCredentials: true
|
|
|
+ },
|
|
|
+ crossDomain: true,
|
|
|
+ type: 'get',
|
|
|
+ timeout: 15000,
|
|
|
+ success: function(dt) {
|
|
|
+ if(dt.isRedirect) {
|
|
|
+ location.href = dt.redirectURL;
|
|
|
+ } else {
|
|
|
+ if(dt.returnCode == "200") {
|
|
|
+ settime("pull-code");
|
|
|
+ $("#code").select();
|
|
|
+ if(!window.localStorage) {
|
|
|
+ alert("浏览器不支持localStorage");
|
|
|
+ } else {
|
|
|
+ var dates = new Date();
|
|
|
+ //自定义json数据
|
|
|
+ var obj = {
|
|
|
+ "phone": $("#ipt-phone").val().trim(),
|
|
|
+ "codeTime": countdown,
|
|
|
+ "updateTime": parseInt(dates.getTime() / 1000)
|
|
|
+ };
|
|
|
+ //json格式化插入
|
|
|
+ localStorage.setItem('pull-code-data', JSON.stringify(obj));
|
|
|
+ }
|
|
|
+ $('#btn-confirm').removeAttr("disabled").addClass("active");
|
|
|
+ } else {
|
|
|
+ mui.alert(dt.resultMsg);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ error: function(xhr, type, errorThrown) {
|
|
|
+ console.log(xhr);
|
|
|
+ mui.alert("发送短信失败!网络错误");
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ function settime(val) {
|
|
|
+ pullid = dc(val);
|
|
|
+ if(countdown == 0) {
|
|
|
+ pullid.removeAttribute("disabled");
|
|
|
+ pullid.className = 'pull-code active';
|
|
|
+ pullid.innerText = "获取验证码";
|
|
|
+ countdown = 60;
|
|
|
+ return false;
|
|
|
+ } else {
|
|
|
+ countdown--;
|
|
|
+ pullid.setAttribute("disabled", "disabled");
|
|
|
+ pullid.className = 'pull-code';
|
|
|
+ pullid.innerText = "重新发送(" + countdown + ")";
|
|
|
+ }
|
|
|
+ setTimeout(function() {
|
|
|
+ settime(val)
|
|
|
+ }, 1000);
|
|
|
+
|
|
|
+ if(!window.localStorage) {
|
|
|
+ alert("浏览器不支持localStorage");
|
|
|
+ } else {
|
|
|
+ //检查值是否存在
|
|
|
+ if(localStorage.getItem("pull-code-data") != null) {
|
|
|
+ var dates = new Date();
|
|
|
+ var codedata = JSON.parse(localStorage.getItem('pull-code-data'));
|
|
|
+ var edit = JSON.stringify({
|
|
|
+ "phone": codedata.phone,
|
|
|
+ "codeTime": countdown,
|
|
|
+ "updateTime": parseInt(dates.getTime() / 1000)
|
|
|
+ });
|
|
|
+ //改,即重新给变量赋值
|
|
|
+ localStorage.setItem("pull-code-data", edit);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //提交
|
|
|
+ mui('body').on('tap', '#btn-confirm', function() {
|
|
|
+ var val = $("#code").val(),
|
|
|
+ th = this;
|
|
|
+ if(code.test(val)) {
|
|
|
+ mui(th).button('loading');
|
|
|
+ $.ajax(base_path + '/userRegister_TEL?dates=' + new Date().getTime(), {
|
|
|
+ data: {
|
|
|
+ "tel": $("#ipt-phone").val().trim(),
|
|
|
+ "code": $("#code").val().trim()
|
|
|
+ },
|
|
|
+ dataType: 'json',
|
|
|
+ xhrFields: {
|
|
|
+ withCredentials: true
|
|
|
+ },
|
|
|
+ crossDomain: true,
|
|
|
+ type: 'post',
|
|
|
+ timeout: 15000,
|
|
|
+ success: function(dt) {
|
|
|
+ if(dt.isRedirect) {
|
|
|
+ location.href = dt.redirectURL;
|
|
|
+ } else {
|
|
|
+ if(dt.returnCode == "200") {
|
|
|
+ // mui.alert("手机验证成功!",function(){
|
|
|
+ location.href = "register-perfect.html";
|
|
|
+ // });
|
|
|
+ } else {
|
|
|
+ if(typeof(dt.returnMsg.registerTel) != "undefined") {
|
|
|
+ if(dt.returnMsg.registerTel) {
|
|
|
+ mui.alert('该号码已注册会员,换一个手机号试试!', function() {
|
|
|
+ mui(th).button('reset');
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(typeof(dt.returnMsg.registerInfo) != "undefined") {
|
|
|
+ if(dt.returnMsg.registerInfo) {
|
|
|
+ mui.alert('您已完善注册信息!', function() {
|
|
|
+ location.href = 'vip-center.html';
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ error: function(xhr, type, errorThrown) {
|
|
|
+ console.log(xhr);
|
|
|
+ mui.alert("注册验证失败!网络出小差了", function() {
|
|
|
+ mui(th).button('reset');
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ if(val != "") {
|
|
|
+ mui.alert("验证码错误!", function() {
|
|
|
+ $("#code").select();
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ mui.alert("请填写验证码!", function() {
|
|
|
+ $("#code").select();
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ </script>
|
|
|
+ </body>
|
|
|
+
|
|
|
+</html>
|