app.controller('ZxStdReexamListCtrl', [ '$rootScope', '$scope', '$stateParams', '$timeout', function($rootScope, $scope, $stateParams, $timeout) { $scope.curStep = 'appointment_info'; $scope.ReexamEnrolArr = []; $scope.getEnrolArray = function() { $rootScope.ajaxRequest({ url : '../enrol/std/reexam/list.htm' }, function(response) { for (var i = 0; i < response.array.length; i++) { if(response.array[i].std_batch >1) { $scope.ReexamEnrolArr.push(response.array[i]); } } // if (response.array.length == 1) { // $scope.goInfo(response.array[0]); // return; // } //$scope.EnrolArray = response.array; }); } $scope.goInfo = function(enrol) { if($rootScope.isAfterTime(enrol.batch_end_time)) { $rootScope.goLocation('zxappointment/info/' + enrol.enrol_id+'/'+enrol.aspect_id); } } $scope.goBatchPay = function(enrol) { // 需要去判断是否已经超过时间 if (enrol.batch_pay_status == 'Active') { $.alert('该专业已经进行了确认!'); return; } $.showLoading('正在创建微信支付订单,请稍候......'); $rootScope.ajaxRequest({ url : '../enrol/std/enrol/pay/wx.htm', data : { enrol_id : enrol.enrol_id, aspect_batch : 2 } }, function(data) { data.entity.success = function(res) { $timeout(function() { $scope.curStep = 'paySuccess'; }, 100); }; wx.chooseWXPay(data.entity); }); }; $scope.goReeExam = function() { $scope.curStep = 'appointment_info'; $scope.ReexamEnrolArr = []; $scope.getEnrolArray(); } $scope.getEnrolArray(); } ])