upGradeMangementCtrl.js 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. angular.module('push')
  2. .controller('upGradeMangementCtrl', function ($scope, $stateParams, $ionicModal, AccountService, UtilService, UserService, $ionicPopup, $timeout) {
  3. if($scope.app){
  4. $scope.setStatusBar(0);
  5. }
  6. $scope.defaultLan = UserService.defaultLan;
  7. $scope.keyPsMoney = "";
  8. $scope.viplevel = UserService.viplevel;
  9. $scope.paymoney = 29999;
  10. var totalcurrency = $stateParams.totalcurrency;
  11. $ionicModal.fromTemplateUrl('my-payBoard.html', {
  12. scope: $scope,
  13. animation: 'slide-in-up'
  14. }).then(function (modal) {
  15. $scope.modal = modal;
  16. });
  17. //打开支付弹窗
  18. $scope.openPasModal = function () {
  19. if (UserService.ishaspaypassword == 0) {
  20. $ionicPopup.show({
  21. title: '提示',
  22. template: '您的支付密码还未设置',
  23. buttons: [
  24. {
  25. text: '<span class="ionicAction_span">去设置</span>',
  26. type: "button-positive",
  27. onTap: function (e) {
  28. $scope.go("payPsMoneyPassword");
  29. }
  30. }
  31. ]
  32. });
  33. return;
  34. }
  35. if (totalcurrency < 29999) {
  36. notPsEnough();
  37. return;
  38. }
  39. $scope.modal.show();
  40. };
  41. //关闭支付弹窗
  42. $scope.closePasModal = function () {
  43. $scope.keyPsMoney = "";
  44. $scope.modal.hide();
  45. };
  46. //输入密码
  47. $scope.pressKey = function (num) {
  48. $(".gradeBgWrap_Div").removeClass("gradeBgWrap_Div_delete");
  49. if ($scope.keyPsMoney.length >= 6) {
  50. return;
  51. }
  52. $scope.keyPsMoney += num;
  53. // console.log($scope.keyPsMoney);
  54. if ($scope.keyPsMoney.length == 6) {
  55. checkPas();
  56. }
  57. };
  58. /*回退密码*/
  59. $scope.keyBoardDelete = function () {
  60. if ($scope.keyPsMoney.length <= 0) {
  61. return;
  62. }
  63. $scope.keyPsMoney = $scope.keyPsMoney.substring(0, $scope.keyPsMoney.length - 1);
  64. // console.log($scope.keyPsMoney);
  65. };
  66. var checkPas = function () {
  67. $scope.showLoadingToast();
  68. AccountService.checkPayPassword($scope.keyPsMoney).then(function (response) {
  69. //0 支付密码错误 1 升级成功 2 普适币不足 3 支付密码成功,升级失败
  70. // console.log(response);
  71. if (response.status == 0) {
  72. UtilService.showMess("支付密码错误");
  73. } else if (response.status == 1) {
  74. $(".gradeBgWrap").fadeIn("fast");
  75. } else if (response.status == 2) {
  76. notPsEnough();
  77. // UtilService.showMess("普适币不足,请充值");
  78. } else {
  79. UtilService.showMess("升级失败,请重试");
  80. }
  81. $scope.keyPsMoney = "";
  82. $scope.hideLoadingToast();
  83. $scope.closePasModal();
  84. }, function () {
  85. $scope.closePasModal();
  86. $scope.hideLoadingToast();
  87. $scope.keyPsMoney = "";
  88. })
  89. };
  90. $scope.showUpMessage = function () {
  91. // UtilService.showMess("联系客服");
  92. $ionicPopup.show({
  93. template: "<span style='display: block;width:90%;margin: 0 auto 10px;height: 55px;'>客户电话:18112872030</span>" +
  94. "<span style='display: block;width:90%;margin: 0 auto 10px;height: 55px;'>客服QQ:3421717266 2372362384</span>",
  95. title: "请联系客服",
  96. scope: $scope,
  97. buttons: [
  98. {
  99. text: '<span class="ionicAction_span">知道了</span>',
  100. type: "button-positive",
  101. onTap: function (e) {
  102. }
  103. }
  104. ]
  105. })
  106. };
  107. //账户余额不足
  108. var notPsEnough = function () {
  109. $ionicPopup.show({
  110. template: "<span style='display: block;width:90%;margin: 0 auto 10px;height: 55px;'>您的账号余额不足,无法升级,需要充值后才能升级!</span>",
  111. title: "普适币账号余额不足",
  112. scope: $scope,
  113. buttons: [
  114. {
  115. text: "取消"
  116. },
  117. {
  118. text: '<span class="pop_right_button">确认</span>',
  119. type: "button-positive",
  120. onTap: function (e) {
  121. }
  122. }
  123. ]
  124. })
  125. };
  126. // 删除动画提醒
  127. $scope.grade_delete=function () {
  128. $(".gradeBgWrap_Div").addClass("gradeBgWrap_Div_delete");
  129. $(".gradeBgWrap").fadeOut();
  130. $timeout(function () {
  131. $scope.goback();
  132. },500);
  133. }
  134. });