ExaminationApply.js 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  1. var mnu = "";
  2. var windowID = "";
  3. var examinationRegistrationID = "";
  4. var fee;
  5. var feeTypeName = "";
  6. //加载
  7. $(function () {
  8. mnu = $.SystemGeneral.getUrlParam("MNU");
  9. windowID = $.SystemGeneral.getUrlParam("WindowID");
  10. })
  11. function reload() {
  12. $("#dgCourseScheduleSettingList").cmsXDataTable("load", $.getDataGridParams("dgCourseScheduleSettingList"));
  13. $("#dgUserGrade").cmsXDataTable("load", $.getDataGridParams("dgUserGrade"));
  14. }
  15. //获取选中的数据
  16. function validChoose() {
  17. var d = [];
  18. $.each($("#dgCourseScheduleSettingList").cmsXDataTable("getSelections"), function (index) {
  19. d.push(this);
  20. });
  21. return d;
  22. }
  23. function idvalidChoose() {
  24. var d = [];
  25. $.each($("#dgCourseScheduleSettingList").cmsXDataTable("getSelections"), function (index) {
  26. d.push(this.ExaminationBatchProjectID);
  27. });
  28. return d;
  29. }
  30. function validChooseUserGrade() {
  31. var d = [];
  32. $.each($("#dgUserGrade").cmsXDataTable("getSelections"), function (index) {
  33. d.push(this);
  34. });
  35. return d;
  36. }
  37. //报名按钮
  38. function ExamineApply_Update() {
  39. var d = validChoose();
  40. var id = idvalidChoose().join(',');
  41. var myDateTime = getNowFormatDate();
  42. var newData = new Date(myDateTime.replace("-", "/").replace("-", "/"));
  43. if (d.length == 0) {
  44. $.messager.alert("系统提示", "请选择您要报名的考试科目。");
  45. return;
  46. }
  47. else if (d.length > 1) {
  48. $.messager.alert("系统提示", "每次只能选择一个科目报考。");
  49. return;
  50. }
  51. var isError = false;
  52. $.each(d, function (index, value) {
  53. if (value.EndDate != null) {
  54. var dt1 = new Date();
  55. var dtime = new Date(dt1.getFullYear(), dt1.getMonth(), dt1.getDate());
  56. var dt2 = getDate(value.EndDate);
  57. if (dtime > dt2) {
  58. $.messager.alert("系统提示", "不在报名时间内,不能报名。");
  59. isError = true;
  60. return false;
  61. }
  62. }
  63. });
  64. if (isError) {
  65. return;
  66. }
  67. $.popupTopWindow('报名', CMS_SystemConfig.VirtualDirectoryPath + '/ExamineApply/Register?MNU=' + mnu + '&ExaminationBatchProjectID=' + id, 650, 500, ExamineApply_Refresh);
  68. }
  69. //function ResgisterSuccess() {
  70. // $("#dgCourseScheduleSettingList").cmsXDataTable('load');
  71. // $("#dgUserGrade").cmsXDataTable('load');
  72. //}
  73. function ExamineApply_Refresh() {
  74. $("#dgCourseScheduleSettingList").cmsXDataTable('load');
  75. $("#dgUserGrade").cmsXDataTable('load');
  76. }
  77. //撤销
  78. function ExamineApply_Cancel() {
  79. var d = validChooseUserGrade();
  80. // var myDateTime = getNowFormatDate();
  81. // var newData = new Date(myDateTime.replace("-", "/").replace("-", "/"));
  82. if (d.length == 0) {
  83. $.messager.alert("系统提示", "请选择您要撤销报名的考试科目。");
  84. return;
  85. }
  86. //var dt1 = new Date();
  87. //var dtime = new Date(dt1.getFullYear(), dt1.getMonth(), dt1.getDate());
  88. //var dt2 = getDate(d[0].EndDate);
  89. //var isError = false;
  90. //$.each(d, function (index, value) {
  91. // if (value.EndDate != null) {
  92. // var dt1 = new Date();
  93. // var dtime = new Date(dt1.getFullYear(), dt1.getMonth(), dt1.getDate());
  94. // var dt2 = getDate(value.EndDate);
  95. // if (dtime > dt2) {
  96. // $.messager.alert("系统提示", "对不起,已过报名截止时间,不能进行撤销操作!");
  97. // isError = true;
  98. // return false;
  99. // }
  100. // }
  101. //});
  102. //if (isError) {
  103. // return;
  104. //}
  105. var ids = $.map(d, function (x) { return x.ExaminationRegistrationID; }).join(',');
  106. $.postWithLoading(CMS_SystemConfig.VirtualDirectoryPath + '/ExamineApply/Cancel?MNU=' + mnu + '&WindowID=' + windowID, { ExaminationRegistrationIDs: ids }, function (data) {
  107. if (data.IsSuccess && data.Type == 99) {
  108. $.popupTopWindow('信息确认', CMS_SystemConfig.VirtualDirectoryPath + '/ExamineApply/Refund?MNU=' + mnu + '&examinationRegistrationIDs=' + data.Message, 650, 500, reload);
  109. } else if (data.IsSuccess) {
  110. $.messager.alert("系统提示", data.Message);
  111. $("#dgCourseScheduleSettingList").cmsXDataTable('load');
  112. $("#dgUserGrade").cmsXDataTable('load');
  113. } else if (!data.IsSuccess) {
  114. $.messager.alert("系统提示", data.Message);
  115. $("#dgCourseScheduleSettingList").cmsXDataTable('load');
  116. $("#dgUserGrade").cmsXDataTable('load');
  117. } else {
  118. $.messager.alert("系统提示", "请确认银行卡信息");
  119. }
  120. });
  121. }
  122. //缴费按钮
  123. function ExamineApply_Pay() {
  124. var d = validChooseUserGrade();
  125. if (d.length == 0) {
  126. $.messager.alert("系统提示", "请选择您要缴费的考试科目。");
  127. return;
  128. }
  129. if (d.length > 1) {
  130. $.messager.alert("系统提示", "只能选择一个报名项进行缴费。");
  131. return;
  132. }
  133. $.postWithLoading(CMS_SystemConfig.VirtualDirectoryPath + '/ExamineApply/CanPay', { examinationRegistrationID: d[0].ExaminationRegistrationID }, function (data) {
  134. if (data.IsSuccess) {
  135. var url = CMS_SystemConfig.VirtualDirectoryPath + '/Weixin/NativePay?MNU=' + mnu + '&examinationRegistrationID=' + d[0].ExaminationRegistrationID;
  136. //开启支付宝缴费// var url = CMS_SystemConfig.VirtualDirectoryPath + '/ExamineApply/NativePay?MNU=' + mnu + '&examinationRegistrationID=' + d[0].ExaminationRegistrationID;
  137. url += "&fee=" + d[0].Fee.toString() + "&feeTypeName=" + d[0].FeeTypeName;
  138. $.popupTopWindow('在线缴费', url, 320, 380, reload);
  139. //开启支付宝缴费// $.popupTopWindow('在线缴费', url, 428, 280, reload);
  140. } else {
  141. $.messager.alert("系统提示", data.Message);
  142. }
  143. });
  144. }
  145. //获取系统时间 时分秒yyyy-MM-dd HH:MM:SS
  146. function getNowFormatDate() {
  147. var d = new Date(), str = '';
  148. str += d.getFullYear() + '-'; //获取当前年份
  149. str += d.getMonth() + 1 + '-'; //获取当前月份(0——11)
  150. str += d.getDate() + '-';
  151. str += d.getHours() + '-';
  152. str += d.getMinutes() + '-';
  153. str += d.getSeconds();
  154. return str;
  155. }
  156. //字符串转时间格式
  157. function getDate(strDate) {
  158. var date = eval('new Date(' + strDate.replace(/\d+(?=-[^-]+$)/,
  159. function (a) { return parseInt(a, 10) - 1; }).match(/\d+/g) + ')');
  160. return date;
  161. }
  162. function CheckIsRister(index, row, value, bb) {
  163. //alert(aa);
  164. if (row.IsRister == true) {
  165. return " <input type=\"checkbox\" disabled='disabled' value=" + value + ">";
  166. //return " <span style=\"color:red;\">" + value + "</span>";
  167. }
  168. else {
  169. return " <input type=\"checkbox\" value=" + value + ">";
  170. }
  171. }
  172. function CheckIsRister1(index, row, value, bb) {
  173. //alert(aa);
  174. if (row.IsRister == true) {
  175. return "display :none";
  176. }
  177. else {
  178. return "";
  179. }
  180. }
  181. function showMassage(rowindex, rowdata) {
  182. if (rowdata.RecordStatus == 2) {
  183. alert("由于暂时未能获取到微信支付结果或支付操作被中断,当前缴费状态显示为支付中,请五分钟后再尝试查看,谢谢!");
  184. }
  185. }