update code
Showing
6 changed files
with
31 additions
and
40 deletions
.vscode/settings.json
0 → 100644
| ... | @@ -48,7 +48,7 @@ var app = angular.module('myApp', [ "ui.router",'myApp.services', 'myApp.direct | ... | @@ -48,7 +48,7 @@ var app = angular.module('myApp', [ "ui.router",'myApp.services', 'myApp.direct |
| 48 | templateUrl: "html/pay.html" | 48 | templateUrl: "html/pay.html" |
| 49 | }) | 49 | }) |
| 50 | .state('bondPay',{ | 50 | .state('bondPay',{ |
| 51 | url: "/bondPay", | 51 | url: "/bondPay/?longitude&latitude", |
| 52 | templateUrl: "html/bondPay.html" | 52 | templateUrl: "html/bondPay.html" |
| 53 | }) | 53 | }) |
| 54 | .state('bondSuccess',{ | 54 | .state('bondSuccess',{ |
| ... | @@ -76,11 +76,8 @@ var app = angular.module('myApp', [ "ui.router",'myApp.services', 'myApp.direct | ... | @@ -76,11 +76,8 @@ var app = angular.module('myApp', [ "ui.router",'myApp.services', 'myApp.direct |
| 76 | 76 | ||
| 77 | 77 | ||
| 78 | }]) | 78 | }]) |
| 79 | app.run(['globalService', function(globalService) { | 79 | app.run(['globalService', '$rootScope', function(globalService, $rootScope) { |
| 80 | globalService.init(); | 80 | globalService.init(); |
| 81 | var loading = document.getElementById("appLoadingIndicator"); | 81 | var loading = document.getElementById("appLoadingIndicator"); |
| 82 | loading.style.display = "none"; | 82 | loading.style.display = "none"; |
| 83 | }]) | 83 | }]) |
| 84 | //$(window).bind("load resize",function(){ | ||
| 85 | // $("body").css({zoom:$(window).width()/320,visibility:"visible"}); | ||
| 86 | //}); | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
| 1 | angular.module('myApp') | 1 | angular.module('myApp') |
| 2 | .controller('bondController',['$scope' , '$rootScope', '$state' , 'dingdaService' , '$stateParams' , | 2 | .controller('bondController',['$scope' , '$rootScope', '$state' , 'dingdaService' , '$stateParams' , |
| 3 | function($scope,$rootScope,$state,dingdaService,$stateParams){ | 3 | function($scope,$rootScope,$state,dingdaService, $stateParams){ |
| 4 | $scope.goPay = function(){ | 4 | $scope.goPay = function(){ |
| 5 | $state.go('bondPay'); | 5 | if($rootScope.toPaid){ |
| 6 | $state.go('bondPay', {longitude: $stateParams.longitude , latitude: $stateParams.latitude }); | ||
| 7 | } | ||
| 6 | } | 8 | } |
| 7 | 9 | ||
| 8 | // function getUrl(name){ | 10 | // function getUrl(name){ |
| ... | @@ -19,15 +21,17 @@ angular.module('myApp') | ... | @@ -19,15 +21,17 @@ angular.module('myApp') |
| 19 | var longitude = $stateParams.longitude || '30.27415'; | 21 | var longitude = $stateParams.longitude || '30.27415'; |
| 20 | dingdaService.getBond(longitude,latitude) | 22 | dingdaService.getBond(longitude,latitude) |
| 21 | .success(function(data){ | 23 | .success(function(data){ |
| 22 | // alert(JSON.stringify(data)) | ||
| 23 | $scope.bondInfo = data.data; | 24 | $scope.bondInfo = data.data; |
| 24 | $rootScope.toPaid = data.data.toPaid; | 25 | $rootScope.toPaid = data.data.toPaid; |
| 25 | }).error(function(data){ | 26 | }).error(function(data){ |
| 26 | // alert(JSON.stringify(data)) | 27 | layer.open({ |
| 27 | layer.open({ | 28 | content: '获取保证金失败,请刷新页面', |
| 28 | content: '获取保证金失败,请刷新页面', | 29 | time:2 |
| 29 | time:2 | 30 | }); |
| 30 | }); | 31 | // layer.open({ |
| 32 | // content: JSON.stringify(data), | ||
| 33 | // time:2 | ||
| 34 | // }); | ||
| 31 | }) | 35 | }) |
| 32 | } | 36 | } |
| 33 | 37 | ||
| ... | @@ -68,7 +72,9 @@ angular.module('myApp') | ... | @@ -68,7 +72,9 @@ angular.module('myApp') |
| 68 | } | 72 | } |
| 69 | }); | 73 | }); |
| 70 | } | 74 | } |
| 71 | }) | 75 | }).error(function(msg) { |
| 76 | |||
| 77 | }) | ||
| 72 | } | 78 | } |
| 73 | 79 | ||
| 74 | }]) | 80 | }]) |
| ... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
| 1 | angular.module('myApp') | 1 | angular.module('myApp') |
| 2 | .controller('bondPayController',['$scope', '$rootScope', '$state', 'wechatPayment', 'dingdaService', | 2 | .controller('bondPayController',['$scope', '$rootScope', '$state', 'wechatPayment', 'dingdaService', '$stateParams', |
| 3 | function($scope,$rootScope,$state, wechatPayment, dingdaService){ | 3 | function($scope,$rootScope,$state, wechatPayment, dingdaService, $stateParams){ |
| 4 | $scope.payType = 100 | 4 | $scope.payType = 100 |
| 5 | if(!$rootScope.toPaid){ | 5 | if(!$rootScope.toPaid){ |
| 6 | $state.go('bond'); | 6 | $state.go('bond', {longitude: $stateParams.longitude , latitude: $stateParams.latitude }); |
| 7 | } | 7 | } |
| 8 | // 支付保证金 | 8 | // 支付保证金 |
| 9 | var ispay = false; | 9 | var ispay = false; |
| ... | @@ -15,30 +15,11 @@ angular.module('myApp') | ... | @@ -15,30 +15,11 @@ angular.module('myApp') |
| 15 | wechatPayment.callDepositTypePay($rootScope.toPaid, $scope.payType) | 15 | wechatPayment.callDepositTypePay($rootScope.toPaid, $scope.payType) |
| 16 | .then(function (result) { | 16 | .then(function (result) { |
| 17 | ispay = false; | 17 | ispay = false; |
| 18 | //支付成功 | ||
| 19 | // alert(window.localStorage.getItem("IswechatPayment")); | ||
| 20 | // window.localStorage.setItem("IswechatPayment", "yes") | ||
| 21 | // $state.go('bondSuccess'); | ||
| 22 | }, function (errMsg) { | 18 | }, function (errMsg) { |
| 23 | ispay = false; | 19 | ispay = false; |
| 24 | // window.localStorage.setItem("IswechatPayment", "no") | 20 | |
| 25 | //支付失败 | ||
| 26 | }) | 21 | }) |
| 27 | } | 22 | } |
| 28 | // wechatPayment.callDepositPay($rootScope.toPaid, $scope.payType) | ||
| 29 | // .then(function (result) { | ||
| 30 | // ispay = false; | ||
| 31 | // //支付成功 | ||
| 32 | // // alert(window.localStorage.getItem("IswechatPayment")); | ||
| 33 | // window.localStorage.setItem("IswechatPayment", "yes") | ||
| 34 | // $state.go('bondSuccess'); | ||
| 35 | // }, function (errMsg) { | ||
| 36 | // ispay = false; | ||
| 37 | // window.localStorage.setItem("IswechatPayment", "no") | ||
| 38 | // //支付失败 | ||
| 39 | // }) | ||
| 40 | // } | ||
| 41 | |||
| 42 | } | 23 | } |
| 43 | 24 | ||
| 44 | }]) | 25 | }]) |
| ... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
| ... | @@ -12,10 +12,12 @@ angular.module('myApp') | ... | @@ -12,10 +12,12 @@ angular.module('myApp') |
| 12 | if(r!=null)return unescape(r[2]); return null; | 12 | if(r!=null)return unescape(r[2]); return null; |
| 13 | } | 13 | } |
| 14 | $scope.userinfo = globalService.getData("user"); | 14 | $scope.userinfo = globalService.getData("user"); |
| 15 | if(!$scope.userinfo) { | 15 | var loginCode = globalService.getData("loginCode"); |
| 16 | var code = getUrl('code') | 16 | var code = getUrl('code') |
| 17 | if(!$scope.userinfo || (code && (loginCode !== code))) { | ||
| 17 | if(code){ | 18 | if(code){ |
| 18 | dingdaService.verifyThirdCode(code).success(function (res) { | 19 | dingdaService.verifyThirdCode(code).success(function (res) { |
| 20 | globalService.saveData('loginCode', code) | ||
| 19 | if(res.meta.code == 200) { | 21 | if(res.meta.code == 200) { |
| 20 | dingdaService.verifyPhoneCode(res.data.mobile, res.data.code).success(function (data) { | 22 | dingdaService.verifyPhoneCode(res.data.mobile, res.data.code).success(function (data) { |
| 21 | if (data.meta.code == 200) { | 23 | if (data.meta.code == 200) { | ... | ... |
| ... | @@ -126,6 +126,7 @@ angular.module('myApp.services') | ... | @@ -126,6 +126,7 @@ angular.module('myApp.services') |
| 126 | ' </form>' | 126 | ' </form>' |
| 127 | var form = document.createElement('div') | 127 | var form = document.createElement('div') |
| 128 | form.innerHTML = html | 128 | form.innerHTML = html |
| 129 | form.style.display = 'none' | ||
| 129 | // form.querySelector('#ok').click() | 130 | // form.querySelector('#ok').click() |
| 130 | document.body.appendChild(form) | 131 | document.body.appendChild(form) |
| 131 | document.querySelector('#ok').click() | 132 | document.querySelector('#ok').click() |
| ... | @@ -184,6 +185,7 @@ angular.module('myApp.services') | ... | @@ -184,6 +185,7 @@ angular.module('myApp.services') |
| 184 | var form = document.createElement('div') | 185 | var form = document.createElement('div') |
| 185 | form.innerHTML = html | 186 | form.innerHTML = html |
| 186 | // form.querySelector('#ok').click() | 187 | // form.querySelector('#ok').click() |
| 188 | form.style.display = 'none' | ||
| 187 | document.body.appendChild(form) | 189 | document.body.appendChild(form) |
| 188 | document.querySelector('#ok').click() | 190 | document.querySelector('#ok').click() |
| 189 | return callUnifiedOrderApiAliPay('支付') | 191 | return callUnifiedOrderApiAliPay('支付') | ... | ... |
-
Please register or sign in to post a comment