12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- angular.module('push')
- .controller('payPsMoneyPasswordCtrl', function ($scope, UserService, AccountService, UtilService, $timeout) {
- $scope.ishaspaypassword = UserService.ishaspaypassword;
- $scope.paypwdobj = {
- oldpwd: "",
- paypwd: "",
- repaypwd: ""
- };
- $scope.upPaypwd = function () {
- if (!UtilService.isDefined($scope.paypwdobj.oldpwd)) {
- if ($scope.ishaspaypassword == 0) {
- UtilService.showMess("登录密码不能为空");
- } else {
- UtilService.showMess("原支付密码不能为空");
- }
- return;
- }
- if (!UtilService.isDefined($scope.paypwdobj.paypwd)) {
- UtilService.showMess("支付密码不能为空");
- return;
- }
- if (!(/^\d{6}$/.test($scope.paypwdobj.paypwd))) {
- UtilService.showMess("请输入6位数字支付密码");
- return;
- }
- if (!UtilService.isDefined($scope.paypwdobj.repaypwd)) {
- UtilService.showMess("重复支付密码不能为空");
- return;
- }
- if (!(/^\d{6}$/.test($scope.paypwdobj.repaypwd))) {
- UtilService.showMess("请输入6位数字重复支付密码");
- return;
- }
- if ($scope.paypwdobj.repaypwd != $scope.paypwdobj.paypwd) {
- UtilService.showMess("支付密码与重复支付密码不一致");
- return;
- }
- var text = $scope.ishaspaypassword == 0 ? '设置' : '修改';
- $scope.showLoadingToast();
- AccountService.upMemberPayPassword($scope.ishaspaypassword, $scope.paypwdobj).then(function (response) {
- // console.log(response);
- // 0 设置不成功 1 设置成功
- if (response.status == 1) {
- text += "成功";
- UtilService.showMess(text);
- UserService.ishaspaypassword = 1;
- $timeout(function () {
- $scope.goback();
- }, 1500);
- } else if (response.status == 2) {
- if ($scope.ishaspaypassword == 0) {
- UtilService.showMess("登录密码不正确");
- } else {
- UtilService.showMess("原支付密码不正确");
- }
- } else {
- text += "失败,请重试";
- UtilService.showMess(text);
- }
- $scope.hideLoadingToast();
- }, function () {
- $scope.hideLoadingToast();
- UtilService.showMess("网络不给力,请重试");
- })
- };
- });
|