123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142 |
- angular.module('push')
- .controller('upGradeMangementCtrl', function ($scope, $stateParams, $ionicModal, AccountService, UtilService, UserService, $ionicPopup, $timeout) {
- if($scope.app){
- $scope.setStatusBar(0);
- }
- $scope.defaultLan = UserService.defaultLan;
- $scope.keyPsMoney = "";
- $scope.viplevel = UserService.viplevel;
- $scope.paymoney = 29999;
- var totalcurrency = $stateParams.totalcurrency;
- $ionicModal.fromTemplateUrl('my-payBoard.html', {
- scope: $scope,
- animation: 'slide-in-up'
- }).then(function (modal) {
- $scope.modal = modal;
- });
- //打开支付弹窗
- $scope.openPasModal = function () {
- if (UserService.ishaspaypassword == 0) {
- $ionicPopup.show({
- title: '提示',
- template: '您的支付密码还未设置',
- buttons: [
- {
- text: '<span class="ionicAction_span">去设置</span>',
- type: "button-positive",
- onTap: function (e) {
- $scope.go("payPsMoneyPassword");
- }
- }
- ]
- });
- return;
- }
- if (totalcurrency < 29999) {
- notPsEnough();
- return;
- }
- $scope.modal.show();
- };
- //关闭支付弹窗
- $scope.closePasModal = function () {
- $scope.keyPsMoney = "";
- $scope.modal.hide();
- };
- //输入密码
- $scope.pressKey = function (num) {
- $(".gradeBgWrap_Div").removeClass("gradeBgWrap_Div_delete");
- if ($scope.keyPsMoney.length >= 6) {
- return;
- }
- $scope.keyPsMoney += num;
- // console.log($scope.keyPsMoney);
- if ($scope.keyPsMoney.length == 6) {
- checkPas();
- }
- };
- /*回退密码*/
- $scope.keyBoardDelete = function () {
- if ($scope.keyPsMoney.length <= 0) {
- return;
- }
- $scope.keyPsMoney = $scope.keyPsMoney.substring(0, $scope.keyPsMoney.length - 1);
- // console.log($scope.keyPsMoney);
- };
- var checkPas = function () {
- $scope.showLoadingToast();
- AccountService.checkPayPassword($scope.keyPsMoney).then(function (response) {
- //0 支付密码错误 1 升级成功 2 普适币不足 3 支付密码成功,升级失败
- // console.log(response);
- if (response.status == 0) {
- UtilService.showMess("支付密码错误");
- } else if (response.status == 1) {
- $(".gradeBgWrap").fadeIn("fast");
- } else if (response.status == 2) {
- notPsEnough();
- // UtilService.showMess("普适币不足,请充值");
- } else {
- UtilService.showMess("升级失败,请重试");
- }
- $scope.keyPsMoney = "";
- $scope.hideLoadingToast();
- $scope.closePasModal();
- }, function () {
- $scope.closePasModal();
- $scope.hideLoadingToast();
- $scope.keyPsMoney = "";
- })
- };
- $scope.showUpMessage = function () {
- // UtilService.showMess("联系客服");
- $ionicPopup.show({
- template: "<span style='display: block;width:90%;margin: 0 auto 10px;height: 55px;'>客户电话:18112872030</span>" +
- "<span style='display: block;width:90%;margin: 0 auto 10px;height: 55px;'>客服QQ:3421717266 2372362384</span>",
- title: "请联系客服",
- scope: $scope,
- buttons: [
- {
- text: '<span class="ionicAction_span">知道了</span>',
- type: "button-positive",
- onTap: function (e) {
- }
- }
- ]
- })
- };
- //账户余额不足
- var notPsEnough = function () {
- $ionicPopup.show({
- template: "<span style='display: block;width:90%;margin: 0 auto 10px;height: 55px;'>您的账号余额不足,无法升级,需要充值后才能升级!</span>",
- title: "普适币账号余额不足",
- scope: $scope,
- buttons: [
- {
- text: "取消"
- },
- {
- text: '<span class="pop_right_button">确认</span>',
- type: "button-positive",
- onTap: function (e) {
- }
- }
- ]
- })
- };
- // 删除动画提醒
- $scope.grade_delete=function () {
- $(".gradeBgWrap_Div").addClass("gradeBgWrap_Div_delete");
- $(".gradeBgWrap").fadeOut();
- $timeout(function () {
- $scope.goback();
- },500);
- }
- });
|