zx_appointment_info.js 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. app.controller('ZxStdReexamInfoCtrl', [ '$rootScope', '$scope', '$stateParams', '$timeout', function($rootScope, $scope, $stateParams, $timeout) {
  2. $scope.curStep = 'appointment';
  3. $scope.getAspect = function() {
  4. $rootScope.ajaxRequest({
  5. url: '../conf/agent/aspect/find.htm',
  6. data: {
  7. aspect_id : $stateParams.aspect_id
  8. }
  9. }, function(response) {
  10. $scope.aspect = response.entity;
  11. });
  12. }
  13. $scope.getAppointmentArray = function() {
  14. $rootScope.ajaxRequest({
  15. url: '../conf/agent/aspect/appointment/date.htm',
  16. data: {
  17. aspect_id: $stateParams.aspect_id
  18. }
  19. }, function(respponse) {
  20. $scope.appointmentArray = respponse.array;
  21. $scope.curStep = 'appointment';
  22. });
  23. }
  24. $scope.goStep = function(step) {
  25. $scope.curStep = step;
  26. }
  27. /************************
  28. * 选择预约日期
  29. */
  30. $scope.chooseAppDate = function(app) {
  31. if(app.appointment_capacity-app.appointment_num == 0) {
  32. $.alert('该日期预约已满,请选择其他空余的日期!');
  33. return;
  34. }
  35. $rootScope.ajaxRequest({
  36. url: '../conf/agent/aspect/appointment/time.htm',
  37. data: app
  38. }, function(response) {
  39. $scope.appTimeArray = response.array;
  40. $scope.curStep = "appointment_time";
  41. });
  42. }
  43. /************************
  44. * 选择预约时间
  45. */
  46. $scope.chooseTime = function(time) {
  47. if(time.appointment_capacity - time.appointment_num == 0) {
  48. $.alert('该时段预约已满,请选择其他空余的时段!');
  49. return;
  50. }
  51. $.confirm('<table><tr><td>预约招考方向:【' + $scope.aspect.aspect_name + "】</td></tr><tr><td>预约日期:【"
  52. + time.appointment_date + "】</td></tr><tr><td>预约时段:【" + time.start_time + "~" + time.end_time + "】</td></tr></table>", "请确定预约信息", function() {
  53. //保存预约信息
  54. $rootScope.ajaxRequest({
  55. url: '../conf/agent/enrol/appointment/save.htm',
  56. data: {
  57. enrol_id: $stateParams.enrol_id,
  58. appointment_id: time.appointment_id
  59. }
  60. },function(response) {
  61. $scope.curStep = 'AppointmentSuccess';
  62. });
  63. });
  64. }
  65. $scope.goBatchPay = function() {
  66. // 需要去判断是否已经超过时间
  67. // if (enrol.batch_pay_status == 'Active') {
  68. // $.alert('该专业已经进行了确认!');
  69. // return;
  70. // }
  71. $.showLoading('正在创建微信支付订单,请稍候......');
  72. $rootScope.ajaxRequest({
  73. url : '../enrol/std/enrol/pay/wx.htm',
  74. data : {
  75. enrol_id : $stateParams.enrol_id,
  76. aspect_batch : 2
  77. }
  78. }, function(data) {
  79. data.entity.success = function(res) {
  80. $timeout(function() {
  81. $scope.curStep = 'paySuccess';
  82. }, 100);
  83. };
  84. wx.chooseWXPay(data.entity);
  85. });
  86. };
  87. $scope.goReeExam = function() {
  88. $rootScope.goLocation('zxappointment/list');
  89. }
  90. $scope.notice = function() {
  91. $scope.curStep = 'AppointmentSuccess';
  92. }
  93. $scope.getAspect();
  94. $scope.getAppointmentArray();
  95. } ])