/** * 头条订购页面初始化 */ $(document).ready(function () { /** * 初始化页面中开关 */ $(".input_100 , .input_50").focus(function () { $(this).addClass("active"); }); $(".input_100 , .input_50").blur(function () { $(this).removeClass("active"); }); $(".info_data li span").click(function () { if ($(this).hasClass("chose_yes")) { $(this).removeClass("chose_yes").addClass("chose_no"); } else { $(this).addClass("chose_yes").removeClass("chose_no"); } }); $(".mask").click(function () { $(".layer").fadeOut(); }); $(".close").click(function () { $(".layer").fadeOut(); }); $("#useraccount_tt").attr("value", getUrlParam("use")); //window.history.pushState({}, "", getHref()+"?fes="+fes+"&sou="+sou); }); /** * 验证码走动 * @param product 对应产品名称缩写 */ var InterValObj; var curCount = 0; function coderun(product) { curCount = 60; //验证码走码 $(".again_send_btn").removeAttr("style"); $(".send_btn").attr("style", "display:none;"); InterValObj = window.setInterval(SetRemainTime, 1000); } //timer处理函数 function SetRemainTime() { if (curCount == 0) { ncode = false; window.clearInterval(InterValObj);// 停止计时器 $(".again_send_btn").removeAttr("disabled");//启用按钮 $(".send_btn").removeAttr("style"); $(".again_send_btn").attr("style", "display:none;"); } else { //提示 $(".again_send_btn").text(" " + curCount + " 秒内输入"); curCount--; } } /** * 刷新页面中提示 */ function refresh_hint() { $(".head").empty(); $(".coupon").empty(); } /** * 关闭当前页面中弹窗 */ function close_popup() { $(".warning").attr("style", "display:none;"); $(".layer").attr("style", "display:none;"); } /*--------------------预约STA-----------------------*/ function sendYue(product) { closeSe(); if (getMemoValbyId(product, "code") != "") {// 判断用户是否输入了验证码 if (ncode) {//判断验证码是否超时 $(".red_btn").attr("disabled", "disabled"); $(".red_btn").css("background: url(../images/btn_bg_lose.png)"); $("#major").val("正在预约请稍等..."); $.ajax({ type: "POST", contentType: "application/json; charset=utf-8", dataType: "Json", url: getRootPath() + "-s1api" + '/com/yuyue', data: JSON.stringify(GetMasData(product)), success: function (msg) { $(".red_btn").removeAttr("disabled"); $(".red_btn").removeAttr("style"); $("#major").val("立即预约"); var resCode = eval(msg["resultCode"]); if (resCode == "0000") { pro_bounced("您已预约成功", "恭喜您预约升级成功,预约结果以短信告知为准", "确定", true); } else { emptyM(); if (msg["resultCode"] == "6611") { hint("code", product, msg["errorInfo"]); } else { pro_bounced("预约失败", msg["errorInfo"], "确定", false); } } }, error: function (XMLHttpRequest, textStatus, errorThrown) { pro_bounced("预约失败", "预约超时,请稍后再试", "确定", false); $(".red_btn").removeAttr("disabled"); $(".red_btn").removeAttr("style"); $("#major").val("立即预约"); }, }); } else { hint("code", product, "验证码已失效请重新获取"); } } else { hint("code", product, "请输入验证码"); } } /*--------------------预约END-----------------------*/