yuyueutil.js 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. /**
  2. * 头条订购页面初始化
  3. */
  4. $(document).ready(function () {
  5. /**
  6. * 初始化页面中开关
  7. */
  8. $(".input_100 , .input_50").focus(function () {
  9. $(this).addClass("active");
  10. });
  11. $(".input_100 , .input_50").blur(function () {
  12. $(this).removeClass("active");
  13. });
  14. $(".info_data li span").click(function () {
  15. if ($(this).hasClass("chose_yes")) {
  16. $(this).removeClass("chose_yes").addClass("chose_no");
  17. } else {
  18. $(this).addClass("chose_yes").removeClass("chose_no");
  19. }
  20. });
  21. $(".mask").click(function () {
  22. $(".layer").fadeOut();
  23. });
  24. $(".close").click(function () {
  25. $(".layer").fadeOut();
  26. });
  27. $("#useraccount_tt").attr("value", getUrlParam("use"));
  28. //window.history.pushState({}, "", getHref()+"?fes="+fes+"&sou="+sou);
  29. });
  30. /**
  31. * 验证码走动
  32. * @param product 对应产品名称缩写
  33. */
  34. var InterValObj;
  35. var curCount = 0;
  36. function coderun(product) {
  37. curCount = 60;
  38. //验证码走码
  39. $(".again_send_btn").removeAttr("style");
  40. $(".send_btn").attr("style", "display:none;");
  41. InterValObj = window.setInterval(SetRemainTime, 1000);
  42. }
  43. //timer处理函数
  44. function SetRemainTime() {
  45. if (curCount == 0) {
  46. ncode = false;
  47. window.clearInterval(InterValObj);// 停止计时器
  48. $(".again_send_btn").removeAttr("disabled");//启用按钮
  49. $(".send_btn").removeAttr("style");
  50. $(".again_send_btn").attr("style", "display:none;");
  51. } else {
  52. //提示
  53. $(".again_send_btn").text(" " + curCount + " 秒内输入");
  54. curCount--;
  55. }
  56. }
  57. /**
  58. * 刷新页面中提示
  59. */
  60. function refresh_hint() {
  61. $(".head").empty();
  62. $(".coupon").empty();
  63. }
  64. /**
  65. * 关闭当前页面中弹窗
  66. */
  67. function close_popup() {
  68. $(".warning").attr("style", "display:none;");
  69. $(".layer").attr("style", "display:none;");
  70. }
  71. /*--------------------预约STA-----------------------*/
  72. function sendYue(product) {
  73. closeSe();
  74. if (getMemoValbyId(product, "code") != "") {// 判断用户是否输入了验证码
  75. if (ncode) {//判断验证码是否超时
  76. $(".red_btn").attr("disabled", "disabled");
  77. $(".red_btn").css("background: url(../images/btn_bg_lose.png)");
  78. $("#major").val("正在预约请稍等...");
  79. $.ajax({
  80. type: "POST",
  81. contentType: "application/json; charset=utf-8",
  82. dataType: "Json",
  83. url: getRootPath() + "-s1api" + '/com/yuyue',
  84. data: JSON.stringify(GetMasData(product)),
  85. success: function (msg) {
  86. $(".red_btn").removeAttr("disabled");
  87. $(".red_btn").removeAttr("style");
  88. $("#major").val("立即预约");
  89. var resCode = eval(msg["resultCode"]);
  90. if (resCode == "0000") {
  91. pro_bounced("您已预约成功", "恭喜您预约升级成功,预约结果以短信告知为准", "确定", true);
  92. } else {
  93. emptyM();
  94. if (msg["resultCode"] == "6611") {
  95. hint("code", product, msg["errorInfo"]);
  96. } else {
  97. pro_bounced("预约失败", msg["errorInfo"], "确定", false);
  98. }
  99. }
  100. },
  101. error: function (XMLHttpRequest, textStatus,
  102. errorThrown) {
  103. pro_bounced("预约失败", "预约超时,请稍后再试", "确定", false);
  104. $(".red_btn").removeAttr("disabled");
  105. $(".red_btn").removeAttr("style");
  106. $("#major").val("立即预约");
  107. },
  108. });
  109. } else {
  110. hint("code", product, "验证码已失效请重新获取");
  111. }
  112. } else {
  113. hint("code", product, "请输入验证码");
  114. }
  115. }
  116. /*--------------------预约END-----------------------*/