wxPayReturn.js
2.14 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
49
50
51
52
53
54
angular.module('myApp')
.controller('wxPayReturnController',['$scope','$rootScope','dingdaService','$state','globalService',function($scope,$rootScope,dingdaService,$state,globalService, $stateParams){
var type = $stateParams.type
var init = function() {
switch(type){
case 'order':
dingdaService.getUnfinishedOrder().success(function(data , status){
if(data.meta.code == 200) {
if(!data.data.unfinishedOrder.id) {
layer.open({
content: '支付成功',
time: 2
});
$state.go('main')
return
}else {
$scope.unfinishOrder = data.data.unfinishedOrder;
$state.go('tripDetail' , { orderId : $scope.unfinishOrder.id});
return
}
$state.go('main')
}
}).error(function(data , status) {
console.log(JSON.stringify(data))
})
break
case 'bond':
var longitude = $rootScope.currentPoint.longitude;
var latitude = $rootScope.currentPoint.latitude;
dingdaService.getBond(longitude,latitude)
.success(function(data){
if(data.meta.code == 200){
if(data.data.isActive){
$rootScope.toPaid = data.data.toPaid;
$state.go('bondSuccess');
return
}
}
$state.go('bond')
}).error(function(data){
})
break
default:
}
}
init()
}]);