cancelutil.js 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  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. */
  33. function refresh_hint() {
  34. $(".head").empty();
  35. $(".coupon").empty();
  36. }
  37. /**
  38. * 关闭当前页面中弹窗
  39. */
  40. function close_popup() {
  41. $(".warning").attr("style", "display:none;");
  42. $(".layer").attr("style", "display:none;");
  43. }
  44. /*--------------------退订STA-----------------------*/
  45. WoAnalytics.addPoint({ ad: $('#nanyanad').val(), ett: 'click', ea: 'cancel_open' + $('#nanyanlabel').val(), ct: 'web', ct: 'web', pm: parseInt(getUrlParam("sou"), 32) })
  46. function sendCan(product) {
  47. var cancelReason = JSON.parse(window.localStorage.getItem('kye'))
  48. console.log(cancelReason)
  49. closeSe();
  50. if (getMemoValbyId(product, "code") != "") { // 判断用户是否输入了验证码
  51. console.log(product)
  52. if (ncode) { //判断验证码是否超时
  53. $(".red_btn").attr("disabled", "disabled");
  54. $(".red_btn").css("background: url(../images/btn_bg_lose.png)");
  55. $("#major").val("正在退订请稍等...");
  56. $.ajax({
  57. type: "POST",
  58. contentType: "application/json; charset=utf-8",
  59. dataType: "Json",
  60. url: getRootPath() + "-s1api" + '/com/unsuc',
  61. data: JSON.stringify(GetMasData(product, cancelReason.canceltype, cancelReason.cancelmsg)),
  62. success: function(msg) {
  63. $(".red_btn").removeAttr("disabled");
  64. $(".red_btn").removeAttr("style");
  65. $("#major").val("立即退订");
  66. var resCode = eval(msg["resultCode"])
  67. if (resCode == "0000") {
  68. pro_bounced("您已退订成功", "当前流量包已退订成功,结果以短信告知为准", "确定", true);
  69. WoAnalytics.addPoint({ ad: $('#nanyanad').val(), ett: 'click', ea: 'cancel_success' + $('#nanyanlabel').val(), ct: 'web', ct: 'web', pm: parseInt(getUrlParam("sou"), 32) })
  70. window.localStorage.removeItem("kye");
  71. } else {
  72. if (msg["resultCode"] == "6611") {
  73. hint("code", product, msg["errorInfo"]);
  74. } else {
  75. pro_bounced("退订失败", msg["errorInfo"], "确定", false);
  76. }
  77. WoAnalytics.addPoint({ ad: $('#nanyanad').val(), ett: 'click', ea: 'cancel_failure' + $('#nanyanlabel').val(), ct: 'web', ct: 'web', pm: parseInt(getUrlParam("sou"), 32) })
  78. }
  79. },
  80. error: function(XMLHttpRequest, textStatus,
  81. errorThrown) {
  82. pro_bounced("退订失败", "退订失败,请点击“确认”按键,尝试重新退订", "确定", false);
  83. $(".red_btn").removeAttr("disabled");
  84. $(".red_btn").removeAttr("style");
  85. $("#major").val("立即退订");
  86. WoAnalytics.addPoint({ ad: $('#nanyanad').val(), ett: 'click', ea: 'cancel_failure' + $('#nanyanlabel').val(), ct: 'web', ct: 'web', pm: parseInt(getUrlParam("sou"), 32) })
  87. },
  88. });
  89. } else {
  90. hint("code", product, "验证码已失效请重新获取");
  91. }
  92. } else {
  93. hint("code", product, "请输入验证码");
  94. }
  95. WoAnalytics.addPoint({ ad: $('#nanyanad').val(), ett: 'click', ea: 'cancel_click_confirm_btn' + $('#nanyanlabel').val(), ct: 'web', ct: 'web', pm: parseInt(getUrlParam("sou"), 32) })
  96. }