bondPayController.js
1.97 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
angular.module('myApp')
.controller('bondPayController',['$scope', '$rootScope', '$state', 'wechatPayment', 'dingdaService',
function($scope,$rootScope,$state, wechatPayment, dingdaService){
$scope.payType = 100
if(!$rootScope.toPaid){
$state.go('bond');
}
if($rootScope.data.user.userName === 17097826207) {
$rootScope.toPaid = 0.01
}
// 支付保证金
var ispay = false;
$scope.goPay = function(){
if(ispay) return;
ispay = true;
var IswechatPayment= window.localStorage.getItem("IswechatPayment");
if (IswechatPayment== undefined || IswechatPayment == "no") {
wechatPayment.callDepositTypePay($rootScope.toPaid, $scope.payType)
.then(function (result) {
ispay = false;
//支付成功
// alert(window.localStorage.getItem("IswechatPayment"));
window.localStorage.setItem("IswechatPayment", "yes")
$state.go('bondSuccess');
}, function (errMsg) {
ispay = false;
window.localStorage.setItem("IswechatPayment", "no")
//支付失败
})
}
// wechatPayment.callDepositPay($rootScope.toPaid, $scope.payType)
// .then(function (result) {
// ispay = false;
// //支付成功
// // alert(window.localStorage.getItem("IswechatPayment"));
// window.localStorage.setItem("IswechatPayment", "yes")
// $state.go('bondSuccess');
// }, function (errMsg) {
// ispay = false;
// window.localStorage.setItem("IswechatPayment", "no")
// //支付失败
// })
// }
}
}])