|
@@ -223,16 +223,18 @@
|
|
})
|
|
})
|
|
};
|
|
};
|
|
}]);
|
|
}]);
|
|
- app.controller('explainCtrl', ["$scope","$ionicTabsDelegate", "$state", "myService", "msg","storage"
|
|
|
|
- , function ($scope,$ionicTabsDelegate, $state,myService, msg, storage) {
|
|
|
|
-
|
|
|
|
- }]);
|
|
|
|
- app.controller('payDetailCtrl', ["$scope","$ionicTabsDelegate","$ionicHistory", "$state", "myService", "msg","storage"
|
|
|
|
- , function ($scope,$ionicTabsDelegate,$ionicHistory, $state,myService, msg, storage) {
|
|
|
|
|
|
+ app.controller('paySuccessCtrl', ["$scope","$stateParams","$ionicTabsDelegate","$ionicHistory", "$state", "myService", "msg","storage"
|
|
|
|
+ , function ($scope,$stateParams,$ionicTabsDelegate,$ionicHistory, $state,myService, msg, storage) {
|
|
|
|
+ var item = $stateParams.item;
|
|
|
|
+ alert(item.out_trade_no);
|
|
$scope.goBack = function(){
|
|
$scope.goBack = function(){
|
|
$ionicHistory.goBack();
|
|
$ionicHistory.goBack();
|
|
}
|
|
}
|
|
}]);
|
|
}]);
|
|
|
|
+ app.controller('explainCtrl', ["$scope","$ionicTabsDelegate", "$state", "myService", "msg","storage"
|
|
|
|
+ , function ($scope,$ionicTabsDelegate, $state,myService, msg, storage) {
|
|
|
|
+
|
|
|
|
+ }]);
|
|
app.controller('contactCtrl', ["$scope","$ionicTabsDelegate", "$timeout","$state", "myService", "msg","storage"
|
|
app.controller('contactCtrl', ["$scope","$ionicTabsDelegate", "$timeout","$state", "myService", "msg","storage"
|
|
, function ($scope,$ionicTabsDelegate, $timeout,$state,myService, msg, storage) {
|
|
, function ($scope,$ionicTabsDelegate, $timeout,$state,myService, msg, storage) {
|
|
$scope.vm={
|
|
$scope.vm={
|
|
@@ -397,10 +399,11 @@
|
|
});
|
|
});
|
|
});
|
|
});
|
|
}]);
|
|
}]);
|
|
- app.controller('rechargeCtrl', ["$scope","$timeout","$ionicHistory","$ionicTabsDelegate", "$state", "myService", "msg"
|
|
|
|
- , function ($scope,$timeout, $ionicHistory,$ionicTabsDelegate,$state, myService, msg) {
|
|
|
|
|
|
+ app.controller('rechargeCtrl', ["$scope","$ionicModal","$timeout","$ionicHistory","$ionicTabsDelegate", "$state", "myService", "msg"
|
|
|
|
+ , function ($scope,$ionicModal,$timeout, $ionicHistory,$ionicTabsDelegate,$state, myService, msg) {
|
|
$scope.$on('$ionicView.beforeEnter', function () {
|
|
$scope.$on('$ionicView.beforeEnter', function () {
|
|
$ionicTabsDelegate.showBar(false);
|
|
$ionicTabsDelegate.showBar(false);
|
|
|
|
+ $scope.vm = {}
|
|
myService.myInfo().then(function(result){
|
|
myService.myInfo().then(function(result){
|
|
$scope.vm = result.data.data;
|
|
$scope.vm = result.data.data;
|
|
$scope.vm.number = '';
|
|
$scope.vm.number = '';
|
|
@@ -427,6 +430,23 @@
|
|
// },500)
|
|
// },500)
|
|
});
|
|
});
|
|
};
|
|
};
|
|
|
|
+ $ionicModal.fromTemplateUrl('paysuccess-modal.html', {
|
|
|
|
+ scope: $scope,
|
|
|
|
+ animation: 'slide-in-up'
|
|
|
|
+ }).then(function(modal) {
|
|
|
|
+ $scope.modal = modal;
|
|
|
|
+ });
|
|
|
|
+ $scope.openModal = function() {
|
|
|
|
+ $scope.modal.show();
|
|
|
|
+ };
|
|
|
|
+ $scope.closeModal = function() {
|
|
|
|
+ $scope.modal.hide();
|
|
|
|
+ };
|
|
|
|
+ //当我们用到模型时,清除它!
|
|
|
|
+ $scope.$on('$destroy', function() {
|
|
|
|
+ $scope.modal.remove();
|
|
|
|
+ });
|
|
|
|
+
|
|
//充值
|
|
//充值
|
|
$scope.charge = function(number){
|
|
$scope.charge = function(number){
|
|
if (!number) {
|
|
if (!number) {
|
|
@@ -437,6 +457,9 @@
|
|
//todo:result需要返回支付宝或者微信的签名信息
|
|
//todo:result需要返回支付宝或者微信的签名信息
|
|
console.log("result: " + JSON.stringify(result));
|
|
console.log("result: " + JSON.stringify(result));
|
|
var payInfo = result.data.data;
|
|
var payInfo = result.data.data;
|
|
|
|
+ var orderID = payInfo.transaction_id
|
|
|
|
+ $scope.vm.transaction_id = payInfo.transaction_id;
|
|
|
|
+ $scope.vm.price = payInfo.price;
|
|
if ($scope.vm.payType == 1) { //支付宝
|
|
if ($scope.vm.payType == 1) { //支付宝
|
|
cordova.plugins.AliPay.pay(payInfo, function success(e) {
|
|
cordova.plugins.AliPay.pay(payInfo, function success(e) {
|
|
//e.resultStatus 状态代码 e.result 本次操作返回的结果数据 e.memo 提示信息
|
|
//e.resultStatus 状态代码 e.result 本次操作返回的结果数据 e.memo 提示信息
|
|
@@ -472,10 +495,16 @@
|
|
// console.log("result: " + JSON.stringify(params));
|
|
// console.log("result: " + JSON.stringify(params));
|
|
Wechat.sendPaymentRequest(params, function (r) {
|
|
Wechat.sendPaymentRequest(params, function (r) {
|
|
$scope.clicksub = false;
|
|
$scope.clicksub = false;
|
|
- courseService.orderStatus(orderID, $scope.paytype).then(function (result) {
|
|
|
|
|
|
+ // $state.go("app.paySuccess")
|
|
|
|
+ // $state.go('app.paySuccess',{item:payInfo})
|
|
|
|
+ $scope.openModal();
|
|
|
|
+ // alert(orderID);
|
|
|
|
+ myService.orderStatus(orderID).then(function (result) {
|
|
// alert(result);
|
|
// alert(result);
|
|
//支付成功
|
|
//支付成功
|
|
// $state.go('app.my');
|
|
// $state.go('app.my');
|
|
|
|
+
|
|
|
|
+
|
|
}, function (erro) {
|
|
}, function (erro) {
|
|
// msg.alert("支付反馈失败:" + JSON.stringify(erro));
|
|
// msg.alert("支付反馈失败:" + JSON.stringify(erro));
|
|
});
|
|
});
|
|
@@ -491,95 +520,7 @@
|
|
}
|
|
}
|
|
|
|
|
|
}]);
|
|
}]);
|
|
- app.controller('payCtrl', ["$scope","$timeout","$ionicHistory","$ionicTabsDelegate", "$timeout","$ionicHistory","$state", "myService", "msg"
|
|
|
|
- , function ($scope,$timeout,$ionicHistory,$ionicTabsDelegate, $timeout,$ionicHistory,$state, myService, msg) {
|
|
|
|
- $scope.$on('$ionicView.beforeEnter', function () {
|
|
|
|
- myService.myInfo().then(function(result){
|
|
|
|
- $scope.vm = result.data.data;
|
|
|
|
- $scope.vm.money = '';
|
|
|
|
- $scope.vm.payType = 2;
|
|
|
|
- })
|
|
|
|
- });
|
|
|
|
- $scope.payExplain = function(){
|
|
|
|
- $state.go("app.explain")
|
|
|
|
- };
|
|
|
|
- $scope.withdraw = function(){
|
|
|
|
- $state.go("app.payout")
|
|
|
|
- };
|
|
|
|
- //充值
|
|
|
|
- $scope.testcharge = function(number){
|
|
|
|
- if (!number) {
|
|
|
|
- msg.text('请输入充值金额');
|
|
|
|
- return;
|
|
|
|
- }
|
|
|
|
- myService.testcharge(number,2).then(function (result) {
|
|
|
|
- msg.text("充值成功");
|
|
|
|
- $scope.vm.coin = parseInt($scope.vm.coin) + parseInt(number);
|
|
|
|
- $timeout(function(){
|
|
|
|
- $ionicHistory.goBack();
|
|
|
|
- },500)
|
|
|
|
- });
|
|
|
|
- }
|
|
|
|
- //充值
|
|
|
|
- $scope.charge = function(number){
|
|
|
|
- if (!number) {
|
|
|
|
- msg.text('请输入充值金额');
|
|
|
|
- return;
|
|
|
|
- }
|
|
|
|
- myService.charge(number,2).then(function (result) {
|
|
|
|
- //todo:result需要返回支付宝或者微信的签名信息
|
|
|
|
- console.log("result: " + JSON.stringify(result));
|
|
|
|
- var payInfo = result.data;
|
|
|
|
- if ($scope.vm.payType == 1) { //支付宝
|
|
|
|
- cordova.plugins.AliPay.pay(payInfo, function success(e) {
|
|
|
|
- //e.resultStatus 状态代码 e.result 本次操作返回的结果数据 e.memo 提示信息
|
|
|
|
- //e.resultStatus 9000 订单支付成功 ;8000 正在处理中 调用function success
|
|
|
|
- //e.resultStatus 4000 订单支付失败 ;6001 用户中途取消 ;6002 网络连接出错 调用function error
|
|
|
|
- //当e.resultStatus为9000时,请去服务端验证支付结果
|
|
|
|
- $scope.clicksub = false;
|
|
|
|
- if (e.resultStatus == '9000') {
|
|
|
|
- alert(orderID);
|
|
|
|
- //支付成功
|
|
|
|
- // $state.go('app.my');
|
|
|
|
- } else {
|
|
|
|
- msg.error("支付失败");
|
|
|
|
- // msg.error("支付失败:" + JSON.stringify(e));
|
|
|
|
- }
|
|
|
|
- }, function error(e) {
|
|
|
|
- $scope.clicksub = false;
|
|
|
|
- // msg.error("支付失败:" + JSON.stringify(e));
|
|
|
|
- msg.error("支付失败");
|
|
|
|
- });
|
|
|
|
- }
|
|
|
|
- if ($scope.vm.payType == 2) { //微信
|
|
|
|
- var obj = JSON.parse(payInfo);
|
|
|
|
- var params = {
|
|
|
|
- partnerid: obj.partnerid, // merchant id
|
|
|
|
- prepayid: obj.prepayid, // prepay id
|
|
|
|
- noncestr: obj.noncestr, // nonce
|
|
|
|
- timestamp: obj.timestamp, // timestamp
|
|
|
|
- sign: obj.sign, // signed string
|
|
|
|
- };
|
|
|
|
- Wechat.sendPaymentRequest(params, function (r) {
|
|
|
|
- $scope.clicksub = false;
|
|
|
|
- courseService.orderStatus(orderID, $scope.paytype).then(function (result) {
|
|
|
|
- // alert(result);
|
|
|
|
- //支付成功
|
|
|
|
- // $state.go('app.my');
|
|
|
|
- }, function (erro) {
|
|
|
|
- msg.alert("支付反馈失败:" + JSON.stringify(erro));
|
|
|
|
- });
|
|
|
|
- }, function (reason) {
|
|
|
|
- $scope.clicksub = false;
|
|
|
|
- msg.alert("支付失败:" + JSON.stringify(reason));
|
|
|
|
- });
|
|
|
|
- }
|
|
|
|
- // msg.text("充值成功");
|
|
|
|
- // $state.go('app.my');
|
|
|
|
- });
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- }]);
|
|
|
|
|
|
+
|
|
app.controller('accountCtrl', ["$scope","$ionicTabsDelegate", "$state", "myService", "msg"
|
|
app.controller('accountCtrl', ["$scope","$ionicTabsDelegate", "$state", "myService", "msg"
|
|
, function ($scope,$ionicTabsDelegate, $state, myService, msg) {
|
|
, function ($scope,$ionicTabsDelegate, $state, myService, msg) {
|
|
$scope.$on('$ionicView.beforeEnter', function () {
|
|
$scope.$on('$ionicView.beforeEnter', function () {
|