app.controller('ZxStdReexamInfoCtrl', [ '$rootScope', '$scope', '$stateParams', '$timeout', function($rootScope, $scope, $stateParams, $timeout) { $scope.curStep = 'appointment'; $scope.getAspect = function() { $rootScope.ajaxRequest({ url: '../conf/agent/aspect/find.htm', data: { aspect_id : $stateParams.aspect_id } }, function(response) { $scope.aspect = response.entity; }); } $scope.getAppointmentArray = function() { $rootScope.ajaxRequest({ url: '../conf/agent/aspect/appointment/date.htm', data: { aspect_id: $stateParams.aspect_id } }, function(respponse) { $scope.appointmentArray = respponse.array; $scope.curStep = 'appointment'; }); } $scope.goStep = function(step) { $scope.curStep = step; } /************************ * 选择预约日期 */ $scope.chooseAppDate = function(app) { if(app.appointment_capacity-app.appointment_num == 0) { $.alert('该日期预约已满,请选择其他空余的日期!'); return; } $rootScope.ajaxRequest({ url: '../conf/agent/aspect/appointment/time.htm', data: app }, function(response) { $scope.appTimeArray = response.array; $scope.curStep = "appointment_time"; }); } /************************ * 选择预约时间 */ $scope.chooseTime = function(time) { if(time.appointment_capacity - time.appointment_num == 0) { $.alert('该时段预约已满,请选择其他空余的时段!'); return; } $.confirm('
预约招考方向:【' + $scope.aspect.aspect_name + "】
预约日期:【" + time.appointment_date + "】
预约时段:【" + time.start_time + "~" + time.end_time + "】
", "请确定预约信息", function() { //保存预约信息 $rootScope.ajaxRequest({ url: '../conf/agent/enrol/appointment/save.htm', data: { enrol_id: $stateParams.enrol_id, appointment_id: time.appointment_id } },function(response) { $scope.curStep = 'AppointmentSuccess'; }); }); } $scope.goBatchPay = function() { // 需要去判断是否已经超过时间 // if (enrol.batch_pay_status == 'Active') { // $.alert('该专业已经进行了确认!'); // return; // } $.showLoading('正在创建微信支付订单,请稍候......'); $rootScope.ajaxRequest({ url : '../enrol/std/enrol/pay/wx.htm', data : { enrol_id : $stateParams.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() { $rootScope.goLocation('zxappointment/list'); } $scope.notice = function() { $scope.curStep = 'AppointmentSuccess'; } $scope.getAspect(); $scope.getAppointmentArray(); } ])