trialTableDeleteApply.php 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>试用订单删除申请</title>
  6. <link href="/css/ims/base.css" rel="stylesheet">
  7. <link href="/css/ims/ims.css" rel="stylesheet">
  8. <link rel="stylesheet" type="text/css" href="/css/ims/bootstrap.min.css" />
  9. <link rel="stylesheet" type="text/css" href="/css/ims/ace.min.css" />
  10. <link rel="stylesheet" type="text/css" href="/css/ims/jquery.datetimepicker.css" />
  11. <style>
  12. .ims-box {
  13. margin-top: 5px;
  14. margin-left: 20px;
  15. margin-right: 20px;
  16. }
  17. .screen {
  18. padding-left: 20px;
  19. height: 44px;
  20. line-height: 44px;
  21. background-color: #eff4fa;
  22. }
  23. .screen li {
  24. float: left;
  25. margin-right: 65px;
  26. }
  27. .bg-d9bf6e {
  28. margin-left: 5px;
  29. padding: 0 20px;
  30. color: #fff;
  31. background-color: #d9bf6e;
  32. }
  33. .number{
  34. margin-top: 10px;
  35. }
  36. .ims-add-student-box {
  37. margin: 20px;
  38. }
  39. .ims-add-student-box p{
  40. margin: 0;
  41. }
  42. .ims-add-student-box .ims-title{
  43. font-size: 20px;
  44. font-weight: bold;
  45. }
  46. .ims-add-student-box .ims-title span{
  47. margin-right: 20px;
  48. }
  49. .ims-add-student-box .add-student-box {
  50. margin-top: 20px;
  51. font-size: 0;
  52. overflow: hidden;
  53. }
  54. .ims-add-student-box .add-student-box>div{
  55. display: inline-block;
  56. height: 530px;
  57. font-size: 14px;
  58. vertical-align: top;
  59. }
  60. .ims-add-student-box .add-student-box .add-student-title{
  61. padding: 0 8px;
  62. line-height: 30px;
  63. color: #fff;
  64. background-color: #2977ff;
  65. }
  66. .ims-add-student-box .add-student-box .add-student-title label{
  67. font-size: 14px;
  68. font-weight: normal;
  69. cursor: pointer;
  70. margin-bottom: 0;
  71. }
  72. .ims-add-student-box .add-student-box .add-student-title input{
  73. vertical-align: middle;
  74. margin: 0;
  75. }
  76. #input-search-student{
  77. width: 120px;
  78. height: 20px;
  79. border: 0;
  80. color:#000;
  81. }
  82. .ims-add-student-box .add-student-box{
  83. line-height: 30px;
  84. min-width: 938px;
  85. }
  86. .ims-add-student-box .add-student-box .class-box {
  87. width: 180px;
  88. text-align: center;
  89. border: 1px solid #ccc;
  90. }
  91. .ims-add-student-box .student-list div{
  92. font-size: 14px;
  93. font-weight: normal;
  94. }
  95. .ims-add-student-box .add-student-box .class-list{
  96. height: 500px;
  97. overflow: auto;
  98. }
  99. .ims-add-student-box .add-student-box .class-list li{
  100. border-bottom: 1px solid #ccc;
  101. cursor: pointer;
  102. }
  103. .ims-add-student-box .class-list .active{
  104. color: #629aff;
  105. }
  106. .ims-add-student-box .add-student-box .student-list{
  107. margin: 0;
  108. width: 34%;
  109. min-width: 326px;
  110. border: 1px solid #ccc;
  111. border-left: 0;
  112. }
  113. .ims-add-student-box .student-list-content,.selected-list-content{
  114. padding: 8px;
  115. height: 500px;
  116. overflow: auto;
  117. }
  118. .ims-add-student-box .student-list-content label,.selected-list-content label{
  119. display: inline-block;
  120. width: 150px;
  121. cursor: pointer;
  122. font-size: 14px;
  123. font-weight: normal;
  124. }
  125. .ims-add-student-box .btn-search-student{
  126. height: 20px;
  127. line-height: 20px;
  128. padding: 0 5px;
  129. border-radius: 3px;
  130. color: #629aff;
  131. background-color: #fff;
  132. border: none;
  133. outline: none;
  134. cursor: pointer;
  135. }
  136. .ims-add-student-box .btns-box {
  137. width: 100px;
  138. text-align: center;
  139. }
  140. .ims-add-student-box .btn-left,.ims-add-student-box .btn-right{
  141. margin: 150px auto 0;
  142. width: 40px;
  143. height: 40px;border: 1px solid #ccc;
  144. border-radius: 50%;
  145. background-color: #fff;
  146. text-align: center;
  147. line-height: 40px;
  148. cursor: pointer;
  149. }
  150. .ims-add-student-box .selected-list{
  151. width: 34%;
  152. min-width: 326px;
  153. border: 1px solid #ccc;
  154. }
  155. .ims-add-student-box .btn-confirm_purchase {
  156. display: block;
  157. margin: 0 auto;
  158. margin-top: 100px;
  159. margin-bottom: 50px;
  160. width: 200px;
  161. line-height: 54px;
  162. color: #fff;
  163. font-family: PingFangSC-Regular, "PingFang SC";
  164. font-weight: 400;
  165. font-style: normal;
  166. font-size: 20px;
  167. text-align: center;
  168. background-color: #2977ff;
  169. cursor: pointer;
  170. }
  171. .yiiPager li{display: inline}
  172. .clear{clear: both}
  173. </style>
  174. </head>
  175. <body>
  176. <div class="ims-box">
  177. <h3 class="sale-title">删除试用学生申请</h3>
  178. <p class="red">*注意:本功能用户填错试用订单时使用,不可用于其它情况</p>
  179. <h4 >删除原因说明</h4>
  180. <table width="100%">
  181. <tr>
  182. <td >
  183. <textarea name="remark" id="remark" cols="50" class="use-explain" rows="5"></textarea>
  184. </td>
  185. </tr>
  186. </table>
  187. <br><br>
  188. <span>删除试用学生名单</span>
  189. <button type="submit" class="label-primary-s bth-s stop">添加</button>
  190. <button type="submit" class="label-primary-s bth-s remove-student">删除</button>
  191. <table width="100%" class="table table-striped table-bordered table-hover dataTable no-footer DTTT_selectable" id="P_list">
  192. <tr>
  193. <td>序号</td>
  194. <td>学生</td>
  195. <td>班级</td>
  196. </tr>
  197. </table>
  198. <button type="button" class="label-primary-s bth-s add-order" style="float: left;margin-top:5px;" >提交</button>
  199. <div class="clear"></div>
  200. <div class="layer-edit">
  201. <div class="ims-add-student-box">
  202. <h2 class="ims-title"><span>添加学生</span></h2>
  203. <div class="add-student-box">
  204. <div class="class-box">
  205. <div class="add-student-title">
  206. <p>班级</p>
  207. </div>
  208. <ul class="class-list">
  209. <li class="active">一班</li>
  210. <li>二班</li>
  211. <li>三班</li>
  212. </ul>
  213. </div>
  214. <div class="student-list">
  215. <div class="add-student-title clearfix">
  216. <span class="fl">
  217. <label>
  218. <input type="checkbox" name="select-all" value="1" /><span class="msg1">试用学生</span>
  219. </label>
  220. <span></span>
  221. </span>
  222. <span class="fr">
  223. </span>
  224. </div>
  225. <div class="student-list-content" id="studentListContent">
  226. </div>
  227. </div>
  228. <div class="btns-box">
  229. <p class="btn-left" id="btnRemoveStudent"><</p>
  230. <p class="btn-right" id="btnAddStudent" >></p>
  231. </div>
  232. <div class="selected-list">
  233. <div class="add-student-title">
  234. <p><span class="msg2">删除</span>(<span id="studentSelectedLength">0</span>人)</p>
  235. </div>
  236. <div class="selected-list-content" id="selectedListContent">
  237. </div>
  238. </div>
  239. </div>
  240. <input type="hidden" name="actionType" value="">
  241. <button type="button" class="label-primary-s bth-s cancel" style="float: left;margin-top:5px;margin-left:45%" >返回</button>
  242. <button type="button" class="label-primary-s bth-s save" style="float: left;margin-top:5px;" >保存</button>
  243. </div>
  244. </div>
  245. </div>
  246. </body>
  247. <script src="/js/jquery-2.2.2.min.js" ></script>
  248. <script src="/js/layer/layer.js"></script>
  249. <script>
  250. var orderId='<?php echo $orderId?>';
  251. var selectedDataAll=[];
  252. var selectedDataValue =[];
  253. var selectedClassId=0;
  254. var selectedClassName='';
  255. $('.cancel').click(function(){
  256. layer.closeAll();
  257. selectedDataAll=[];
  258. selectedDataValue =[];
  259. $('#selectedListContent').html('');
  260. });
  261. $('.save').click(function(){
  262. actionType=$('input[name=actionType]').val();
  263. if(selectedDataValue.length==0){
  264. layer.msg('请选择学生');
  265. return false;
  266. }
  267. console.log(selectedDataAll);
  268. html='<tr><td></td><td>序号</td><td>姓名</td><td>班级</td></tr>';
  269. for (var i = 0; i < selectedDataAll.length; i++) {
  270. html+='<tr id="'+selectedDataAll[i]['value']+'" class="select-student-list">';
  271. html+='<td width="1%"><input type="checkbox" value="'+selectedDataAll[i]['value']+'" name="select-student"></td>';
  272. html+='<td>'+(i+1)+'</td>';
  273. html=html+'<td>'+selectedDataAll[i].name+'</td>';
  274. html+='<td>'+selectedDataAll[i].class+'</td>';
  275. html+='</tr>';
  276. }
  277. $('#P_list').html(html);
  278. layer.closeAll();
  279. return false;
  280. });
  281. $('.stop').click(function(){
  282. selectedDataAll=[];
  283. selectedDataValue =[];
  284. selectedClassId=0;
  285. selectedClassName='';
  286. $('#selectedListContent').html('');
  287. $('#studentSelectedLength').html(0);
  288. $('input[name=actionType]').val(0);
  289. $.ajax({
  290. url:'<?php echo $this->createUrl('imsSale/GetDeleteClassesByOrderId')?>',
  291. type:'POST',
  292. dataType:'json',
  293. data:{orderId:orderId,type:1},
  294. success:function (res) {
  295. if(res.status==1){
  296. var html='';
  297. for(var i=0;i<res.data.length;i++){
  298. html+='<li classId="'+res.data[i]['clazzId']+'" rel="1">'+res.data[i]['clazzName']+'</li>';
  299. }
  300. $('.class-list').html(html);
  301. var studentHtml='';
  302. for(var i=0;i<res.students.length;i++){
  303. studentHtml+='<label><input type="checkbox" className="'+res.students[i]['clazzName']+'" name="studentName" value="'+res.students[i]['osId']+'" />'+res.students[i]['studentName']+'</label>';
  304. }
  305. $('.student-list-content').html(studentHtml);
  306. var selectStudentIndex=layer.open({
  307. title: false,
  308. closeBtn: 1,
  309. type: 1,
  310. offset: '20px',
  311. area: ['65%', '650px'],
  312. content: $(".layer-edit")
  313. });
  314. }
  315. }
  316. });
  317. });
  318. //班级切换
  319. $(".class-list").on("click", "li", function(event) {
  320. if(!$(this).hasClass('subjectObj')){
  321. $(".class-list li").removeClass("active");
  322. $(this).addClass("active");
  323. selectedClassId=classId=$(this).attr('classId');
  324. selectedClassName=className=$(this).html();
  325. getStudent(classId);
  326. }
  327. });
  328. function getStudent(classId){
  329. $.ajax({
  330. url:'<?php echo $this->createUrl('imsSale/GetDeleteStudentByClassIdOrderId')?>',
  331. type:'POST',
  332. dataType:'json',
  333. data:{'classId':classId,'orderId':orderId},
  334. success:function(res){
  335. if(res.status==1){
  336. var studentHtml='';
  337. for(var i=0;i<res.data.length;i++){
  338. studentHtml+='<label><input type="checkbox" className="'+res.data[i]['clazzName']+'" name="studentName" classId="'+classId+'" value="'+res.data[i]['osId']+'" />'+res.data[i]['studentName']+'</label>';
  339. }
  340. $('.student-list-content').html(studentHtml);
  341. }else{
  342. $('.student-list-content').html('');
  343. }
  344. }
  345. });
  346. }
  347. // 全选按钮
  348. $("input[name='select-all']").change(function() {
  349. var type = $("input[name='select-all']").prop("checked")
  350. if(type){
  351. obj=$("#studentListContent").find("input");
  352. for(var i=0;i<obj.length;i++){
  353. if(obj.eq(i).attr('disabled')==undefined){
  354. obj.eq(i).prop("checked", true);
  355. }
  356. }
  357. }else{
  358. $("#studentListContent").find("input").prop("checked", false);
  359. }
  360. });
  361. // 添加学生
  362. $("#btnAddStudent").on("click", function() {
  363. getStudentSelected();
  364. });
  365. // 移出学生
  366. $("#btnRemoveStudent").on("click", function() {
  367. removeStudentSelected();
  368. });
  369. //删除选中学生
  370. $('.remove-student').click(function(){
  371. var selectedData = $("#P_list input[name='select-student']:checked"); //获取所以选中学生
  372. if(selectedDataAll.length==0){
  373. layer.msg('请选择要删除的学生');
  374. return false;
  375. }
  376. for (var i = 0; i < selectedDataAll.length; i++) {
  377. for (var j = 0; j < selectedData.length; j++) {
  378. if(selectedData[j].value===selectedDataAll[i].value){
  379. selectedDataAll.splice(i,1);
  380. }
  381. $(selectedData[j]).closest('tr').remove();
  382. }
  383. }
  384. $('#studentSelectedLength').text(selectedDataAll.length);
  385. });
  386. function getStudentSelected() {
  387. var selectedData = $("#studentListContent input[name='studentName']:checked"); //获取所以选中学生
  388. var studentName = '';
  389. for (var i = 0; i < selectedData.length; i++) {
  390. if (!isSelected(selectedData[i].value)) {
  391. studentName = $(selectedData[i]).parent().text();
  392. var student ={
  393. name:studentName,
  394. value:selectedData[i].value,
  395. class:$(selectedData[i]).attr('className'),
  396. classId:$(selectedData[i]).attr('classId'),
  397. };
  398. selectedDataAll.push(student);
  399. selectedDataValue.push(selectedData[i].value);
  400. }else{
  401. //console.log(selectedData[i].value)
  402. }
  403. showSelectedStudent();
  404. }
  405. };
  406. function isSelected(val){
  407. return selectedDataValue.indexOf(val) > -1
  408. };
  409. function removeStudentSelected() {
  410. var selectedStudent = $("#selectedListContent input[name='selectedStudent']:checked"); //获取所有选中学生
  411. var selectedData = $("#studentListContent input[name='studentName']:checked"); //获取所以选中学生
  412. for (var i = 0; i < selectedStudent.length; i++) {
  413. $(selectedStudent[i]).parent().remove();
  414. for (var j = 0; j < selectedData.length; j++) {
  415. if(selectedData[j].value===selectedStudent[i].value){
  416. $(selectedData[j]).prop("checked", false);
  417. if(selectedDataValue.length>0){
  418. for(var k=0;k<selectedDataValue.length;k++){
  419. if(selectedDataValue[k]===selectedStudent[i].value){
  420. selectedDataValue.splice(k,1);
  421. selectedDataAll.splice(k,1);
  422. }
  423. }
  424. }
  425. }
  426. }
  427. }
  428. $('#studentSelectedLength').text(selectedDataAll.length);
  429. };
  430. function showSelectedStudent() {
  431. var selectedDataList = [];
  432. for (var i = 0; i < selectedDataAll.length; i++) {
  433. selectedDataList.push('<label><input type="checkbox" name="selectedStudent" value="'+ selectedDataAll[i].value +'" />'+selectedDataAll[i].name+'</label>');
  434. }
  435. $('#selectedListContent').html(selectedDataList);
  436. $('#studentSelectedLength').text(selectedDataAll.length);
  437. };
  438. $('.add-order').click(function(){
  439. var selectedData = $(".select-student-list");
  440. var osIds=[];
  441. var reason=$('.use-explain').val();
  442. if(reason==''){
  443. layer.msg('删除原因不能为空');
  444. return false;
  445. }
  446. for (var j = 0; j < selectedData.length; j++) {
  447. osIds.push($(selectedData[j]).attr('id'))
  448. }
  449. console.log(osIds)
  450. $.ajax({
  451. url:'<?php echo $this->createUrl('imsSale/orderTrialDelete')?>',
  452. type:'POST',
  453. dataType:'json',
  454. data:{'osIds':osIds,'orderId':orderId,'reason':reason},
  455. success:function(res){
  456. if(res.status==1){
  457. layer.msg('提交成功');
  458. window.location.href='<?php echo $this->createUrl('imsSale/trialDeleteList')?>'
  459. }else{
  460. if(res.msg!=undefined){
  461. layer.msg(res.msg);
  462. }else{
  463. res.msg('提交失败');
  464. }
  465. }
  466. }
  467. });
  468. });
  469. </script>
  470. </html>