add_back.php 49 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113
  1. <script src="/js/xsgl.js"></script>
  2. <style type="text/css">
  3. *{margin:0;padding:0;list-style: none;font-style: normal;font-weight: normal;color: #333;font-family: "Microsoft YaHei"}
  4. input,select{outline: none;border-radius:2px;border:1px solid #ccc;}
  5. input:focus,select:focus{border-color: #66afe9!important;box-shadow: 0 1px 1px rgba(0, 0, 0, 0.075) inset, 0 0 8px rgba(102, 175, 233, 0.6);outline: 0 none;}
  6. body{position:relative}
  7. .mt5{margin-top:5px;}
  8. .mt10{margin-top:10px;}
  9. .mt20{margin-top:20px;}
  10. .ml15{margin-left:15px;}
  11. .mr15{margin-right:15px;}
  12. .font_bold{font-weight:bold;}
  13. .choseImg{cursor:pointer;}
  14. .ttd{background:url(/images/back-d.png) center repeat;width:100%;height:100%;position:fixed;top:0px;z-index:999}
  15. .s-state{width:300px;background:#fff;margin:12% auto 0 auto;}
  16. .hint_size{height:45px;width:90%;color:#333;line-height:45px;margin:0px auto;border-bottom:1px solid #ccc;}
  17. .mistake_character{text-align:left;color:#606060;font-size:14px;padding:15px 0px;width:90%;margin:0px auto;}
  18. .roger{width:60px;height:30px;border-radius:6px;border:1px solid #15ae68;background:#15ae68;color:#fff;font-size:14px;cursor:pointer;}
  19. .rogergb{background:#ccc;border:1px solid #ccc;}
  20. .fl{float: left;}
  21. .fr{float: right;}
  22. .clearfix:after{content: '';display: block;visibility: hidden;height: 0;clear: both;}
  23. form{padding-left: 20px;}
  24. .steps-choose h3{font-size: 20px;line-height: 40px;font-size: 16px; border-bottom: 1px solid #ccc;}
  25. .steps-choose .table-hide{width: 80%;font-size: 14px;display: none;}
  26. .steps-choose.show .table-hide{display: block;}
  27. .steps-choose input[type="text"]{padding-left: 5px;}
  28. .steps-choose table em{margin-right:5px;color: #f00;}
  29. .steps-choose table th{text-align: right;width: 20%}
  30. .steps-choose table select{margin:10px 0; width: 100%;outline: none;}
  31. .steps-choose table input[type="text"]{width: 100%;margin:10px 5px 10px 0; }
  32. .step-three table{margin-top: 10px;}
  33. .step-three table input[type="text"]{width: 80%;height: 30px;}
  34. .step-two input[type=radio]{margin:0 5px 0 0;}
  35. /*.students-all div{width: 40%;height: 200px;overflow: auto;border:1px solid #ccc;}*/
  36. .students-all>div{width: 45%;}
  37. .students-name{ height:200px;overflow:auto;border:1px solid #ccc;}
  38. .students-name p{cursor: pointer;}
  39. .students-all input[type="button"]{margin:5px 0; width:100%;height:35px;background:#ccc;border:0;}
  40. .students-search{width:100%;height:35px;border:1px solid #ccc;border-radius:5px;}
  41. .create-orders{margin-top:30px;padding-left: 5%;}
  42. .create-orders .cancel-btn{margin-right:10px; color:#333;background:#fff;}
  43. input[readonly].datainp{background-color: #fff!important;color: #333;}
  44. .dn{display: none}
  45. </style>
  46. <!-- <link rel="stylesheet" type="text/css" href="/css/jquery.datetimepicker.css"> -->
  47. <script type="text/javascript" src="/js/times/jedate.js"></script>
  48. <ul class="clearfix main-content-inner-ul">
  49. <?php if(Yii::app()->session['coachInfo']['leader']==1){?>
  50. <li class="pull-left">
  51. <button onclick='location.href="<?php echo $this->createUrl("order/index");?>?type=<?php echo $type ?>"' class="button button_normal button_group button_arrow" data-button="red">订单列表</button>
  52. <img src="/images/line.jpg" style="height:45px;" />
  53. </li>
  54. <?php }?>
  55. </ul>
  56. <?php if(@$action!="edit"){ ?>
  57. <form action="<?php echo Yii::app()->createUrl('order/insert')?>" method="post" id="orderAdd" enctype="multipart/form-data">
  58. <input type="hidden" value="" name="orderid">
  59. <?php }else{ ?>
  60. <form action="<?php echo Yii::app()->createUrl('order/update')?>" method="post" id="orderAdd" enctype="multipart/form-data">
  61. <input type="hidden" value="<?php echo $orderid ?>" name="orderid">
  62. <?php } ?>
  63. <div class="step-one steps-choose show">
  64. <h3>第一步:选择商品</h3>
  65. <table class="table-hide" style="margin-top: 15px">
  66. <tbody>
  67. <tr>
  68. <th><em>*</em>商品类目:</th>
  69. <td>
  70. <div class='diy_select' style="width:175px;float: left;">
  71. <input type='hidden' class='diy_select_input' id="type_id" name="type_id" value="<?php echo @$orderinfo['goods_type_id'] ?>"/>
  72. <div class='diy_select_txt' style="width:142px;"><?php
  73. if(@!$orderinfo){
  74. echo "请选择商品类别";
  75. }else{
  76. foreach($goods_type as $v){
  77. if($v->id==@$orderinfo['goods_type_id']){
  78. echo $v->goods_type_name;
  79. }
  80. }
  81. } ?></div>
  82. <div class='diy_select_btn'></div>
  83. <ul class='diy_select_list'>
  84. <li val="0">请选择商品类别</li>
  85. <?php if(isset($goods_type)){
  86. foreach($goods_type as $v){
  87. ?>
  88. <li val="<?php echo $v->id?>"><?php echo $v->goods_type_name?></li>
  89. <?php }}?>
  90. </ul>
  91. </div>
  92. </td>
  93. <th><em>*</em>商品名称:</th>
  94. <td>
  95. <div class='diy_select1' style="width:175px;float: left;">
  96. <input type='hidden' class='diy_select_input1' id="goods_id" name="goods_id" value="<?php echo @$orderinfo['goods_id'] ?>"/>
  97. <div class='diy_select_txt1' style="width:142px;">
  98. <?php
  99. if(@!$orderinfo){
  100. echo "请选择商品";
  101. }else{
  102. foreach($goods_data as $v){
  103. if((string)$v->id===(string)@$orderinfo['goods_id']){
  104. echo $v->goods_name;
  105. }
  106. }
  107. } ?>
  108. </div>
  109. <div class='diy_select_btn1'></div>
  110. <ul class='diy_select_list1' id="_goods_id">
  111. <?php if(@$goods_data){?>
  112. <li val="0">请选择商品</li>
  113. <?php if(isset($goods_data)){
  114. foreach($goods_data as $v){
  115. ?>
  116. <li val="<?php echo $v->id?>"><?php echo $v->goods_name?></li>
  117. <?php }}?>
  118. <?php } ?>
  119. </ul>
  120. </div>
  121. </td>
  122. </tr>
  123. <tr>
  124. <th style="position: relative;top: 8px;"><em>*</em>学科:</th>
  125. <td >
  126. <div class='diy_select2' style="width:175px;float: left;margin-top: 15px">
  127. <input type='hidden' class='diy_select_input2' id="goods_spec_id" name="goods_spec_id" value="<?php if(isset($goods_spec_data)){
  128. foreach($goods_spec_data as $v){
  129. if($v->name==@$orderinfo['subject_name']){
  130. echo $v->id;
  131. }
  132. }
  133. }?>"/>
  134. <div class='diy_select_txt2' style="width:142px;">
  135. <?php
  136. if(@!$orderinfo){
  137. echo "请选择学科";
  138. }else{
  139. echo @$orderinfo['subject_name'];
  140. }
  141. ?>
  142. </div>
  143. <div class='diy_select_btn2'></div>
  144. <ul class='diy_select_list2' id="_goods_spec_id">
  145. <?php if(@$goods_spec_data){?>
  146. <li val="0">请选择学科</li>
  147. <?php if(isset($goods_spec_data)){
  148. foreach($goods_spec_data as $v){
  149. ?>
  150. <li val="<?php echo $v->id?>"><?php echo $v->name?></li>
  151. <?php }}?>
  152. <?php } ?>
  153. </ul>
  154. </div>
  155. </td>
  156. </tr>
  157. <tr id="apply_class" class="<?php if(@$orderinfo['g_classify']==1){echo "dn";} ?>" style="line-height: 40px">
  158. <th>商品适用年级:</th>
  159. <td colspan="3">
  160. <span class="apply_class"><?php
  161. if(@$orderinfo){
  162. switch (@$orderinfo['apply_class'])
  163. {
  164. case "-1" :
  165. echo '全年级';
  166. break;
  167. case "1" :
  168. echo '高一';
  169. break;
  170. case "2" :
  171. echo '高二';
  172. break;
  173. case "3" :
  174. echo '高三';
  175. break;
  176. }
  177. }
  178. ?></span>
  179. </td>
  180. </tr>
  181. <tr id="g_price" class="<?php if(@!$orderinfo){echo "dn";} ?>" style="line-height: 40px">
  182. <th>商品价格:</th>
  183. <td colspan="3">
  184. <span class="g_price"><?php echo @$orderinfo['g_price1']?@$orderinfo['g_price1']:@$orderinfo['g_price'] ?></span>
  185. </td>
  186. </tr>
  187. <tr id="effective_date" class="<?php if(@$orderinfo['g_classify']==0){echo "dn";} ?>" style="line-height: 40px">
  188. <th>商品有效期:</th>
  189. <td colspan="3">
  190. <span class="effective_date"><?php echo isset($orderinfo['effective_date'])?$orderinfo['effective_date']."天":"" ?></span>
  191. </td>
  192. </tr>
  193. <?php if($type!="ordinary"){ ?>
  194. <tr id="sem" class="<?php if(@!$orderinfo){echo "dn";} ?>" style="line-height: 40px">
  195. <th>商品适用学期:</th>
  196. <td colspan="3">
  197. <span class="sem"><?php echo @$sem['semester_name'] ?></span>
  198. </td>
  199. </tr>
  200. <?php } ?>
  201. </tbody>
  202. </table>
  203. </div>
  204. <div class="step-two steps-choose show" >
  205. <?php if($type!="test"){ ?>
  206. <h3>第二步:填写学生信息</h3>
  207. <table class="table-hide" style=" margin-top: 15px;">
  208. <tbody>
  209. <tr>
  210. <th><em>*</em>班级:</th>
  211. <td>
  212. <div class='diy_select3' style="width:175px;float: left;">
  213. <input type='hidden' class='diy_select_input3' id="class_id" name="class_id" value="<?php echo @$stu[0]['clazz_id']; ?>"/>
  214. <div class='diy_select_txt3' style="width:142px;">
  215. 请选择班级
  216. </div>
  217. <div class='diy_select_btn3'></div>
  218. <ul class='diy_select_list3' id="classes">
  219. <li val="0">请选择班级</li>
  220. <?php if(isset($classes)){
  221. foreach($classes as $v){
  222. ?>
  223. <li val="<?php echo $v->class_id?>"><?php echo $v->class_name?></li>
  224. <?php
  225. }
  226. }?>
  227. </ul>
  228. </div>
  229. </td>
  230. </tr>
  231. <tr>
  232. <th></th>
  233. <td class="students-all clearfix">
  234. <div class="students-add fl">
  235. <input type="text" class="students-search" placeholder="搜索" >
  236. <input type="button" class="add-btn" value="添加全部学生" />
  237. <div class="students-name" id="ajax_students_name">
  238. </div>
  239. </div>
  240. <div class="students-del fr">
  241. <input type="text" class="students-search" placeholder="搜索"/>
  242. <input type="button" class="del-btn" value="去掉全部学生" />
  243. <div class="students-name" id="select_student_name">
  244. <?php
  245. $arrs=array();
  246. if(@$stu){
  247. $arr=array();
  248. $stucount=count($stu);
  249. $classnum=array();
  250. foreach($stu as $v){
  251. if(!in_array($v['clazz_id'], $classnum)){
  252. $classnum[]=$v['clazz_id'];
  253. }
  254. if(isset($arr['classid'])&&@$arr['classid']!=$v['clazz_id']){
  255. $arrs[]=$arr;
  256. $arr=array();
  257. $arr['classid']=$v['clazz_id'];
  258. $arr['classname']=$v['clazz_name'];
  259. }if(!isset($arr['classid'])){
  260. $arr['classid']=$v['clazz_id'];
  261. $arr['classname']=$v['clazz_name'];
  262. }
  263. $arr['stus'][]=$v['student_id'];
  264. // echo '<p val="'.$v['student_id'].'">'.$v['student_name'].'</p>';
  265. }
  266. $classnum=count($classnum);
  267. $arrs[]=$arr;
  268. }else{
  269. $classnum=0;
  270. $stucount=0;
  271. }
  272. $arrs= json_encode($arrs);
  273. ?>
  274. </div>
  275. </div>
  276. </td>
  277. </tr>
  278. <?php if($type=="all"||$type=="ordinary"){ ?>
  279. <tr>
  280. <th></th>
  281. <td>
  282. <ul class="selectedTotal">
  283. <li class="clearfix">
  284. <div class="fl">已选班级:<span id="select_class_num"><?php echo $classnum ?></span></div>
  285. <div class="fl">已选学生数:<span id="select_stu_num"><?php echo $stucount ?></span></div></li>
  286. <li class="clearfix tatal" id="classstunum">
  287. </li>
  288. </ul>
  289. </td>
  290. </tr>
  291. <?php } ?>
  292. </tbody>
  293. </table>
  294. <?php }else{ ?>
  295. <h3>第二步:选择试用范围</h3>
  296. <table class="table-hide" style=" margin-top: 15px;">
  297. <tbody>
  298. <th><em>*</em>可选班级:</th>
  299. <tr>
  300. <th></th>
  301. <td class="students-all clearfix">
  302. <div class="students-add fl">
  303. <input type="button" value="添加全部班级" class="add-btn"/>
  304. <div class="students-name" id="ajax_students_name">
  305. <?php
  306. if(@$classes){
  307. foreach(@$classes as $v){
  308. echo '<p val="'.$v['class_id'].'">'.$v['class_name'].'</p>';
  309. }
  310. }
  311. ?>
  312. </div>
  313. </div>
  314. <div class="students-del fr">
  315. <input type="button" class="del-btn" value="去掉全部班级" />
  316. <div class="students-name" id="select_student_name">
  317. <?php
  318. if(@$class){
  319. foreach(@$class as $v){
  320. echo '<p val="'.$v['clazz_id'].'">'.$v['clazz_name'].'</p>';
  321. }
  322. }
  323. ?>
  324. </div>
  325. </div>
  326. </td>
  327. </tr>
  328. <?php if($type=="all"||$type=="ordinary"){ ?>
  329. <tr>
  330. <th></th>
  331. <td>
  332. <ul class="selectedTotal">
  333. <li class="clearfix"><div class="fl">已选班级:<span id="select_class_num">0</span></div><div class="fl">已选学生数:<span id="select_stu_num">0</span></div></li>
  334. <li class="clearfix tatal" id="classstunum">
  335. </li>
  336. </ul>
  337. </td>
  338. </tr>
  339. <?php } ?>
  340. </tbody>
  341. </table>
  342. <?php } ?>
  343. </div>
  344. <div class="step-three steps-choose show">
  345. <?php if($type!="test"){ ?>
  346. <h3>第三步:付款</h3>
  347. <table class="table-hide">
  348. <tbody>
  349. <tr>
  350. <td colspan="2">已为<em id="student_num"><?php echo @count($stu) ?></em>名学生创建订单,应付款:<em id="total_price"><?php echo @$orderinfo['g_price1']?@$orderinfo['g_price1']*@count($stu):@$orderinfo['g_price']*@count($stu) ?></em>(元)</td>
  351. </tr>
  352. <tr>
  353. <th>付款账户:</th>
  354. <td>
  355. <input type="text" value="<?php echo @$orderinfo['pay_account'] ?>" name="pay_account" id="pay_account" class="col-xs-10 col-sm-3 addborder addheight marginLeftNo">
  356. </td>
  357. </tr>
  358. <tr>
  359. <th>金额:</th>
  360. <td>
  361. <input type="text" value="<?php echo @$orderinfo['pay_money'] ?>" unselectable="on" id="pay_money" name="pay_money" onkeyup="checkval(this.value,window.event)" class="col-xs-10 col-sm-3 addborder addheight marginLeftNo"><span style="line-height: 50px;">元</span>
  362. </td>
  363. </tr>
  364. <tr>
  365. <th>打款时间:</th>
  366. <td>
  367. <input class="datainp" id="datebut" value="<?php echo @$orderinfo['pay_time'] ?>" readonly name="pay_time" type="text" placeholder="请选择" onClick="jeDate({dateCell:'#datebut',isTime:true,format:'YYYY-MM-DD hh:mm:ss'})" >
  368. </td>
  369. </tr>
  370. <tr>
  371. <th>凭证:</th>
  372. <td>
  373. <input type="file" name="pic" id="pic" value="<?php echo @$orderinfo['pay_cert'];?>">
  374. <input type="hidden" id="oldpic" name="oldpic" value="<?php echo @$orderinfo['pay_cert'];?>">
  375. </td>
  376. </tr>
  377. <?php if($type=="all"){ ?>
  378. <tr>
  379. <th><br>剩余未付款:</th>
  380. <td><br><span class="vitalColor" id="surplusmoney"><?php if(@$orderinfo['g_price1']){ echo @$orderinfo['g_price1']*@count($stu)-@$orderinfo['pay_money'];}else{echo @$orderinfo['g_price']*@count($stu)-@$orderinfo['pay_money'];} ?></span>(元)</td>
  381. </tr>
  382. <tr>
  383. <th><br>下期付款时间:</th>
  384. <td><br><input class="datainp" id="next_pay_time" value="<?php echo @$orderinfo['next_pay_time'] ?>" readonly name="next_pay_time" type="text" placeholder="请选择" onClick="jeDate({dateCell:'#next_pay_time',isTime:true,format:'YYYY-MM-DD hh:mm:ss'})" ></td>
  385. </tr>
  386. <?php } ?>
  387. </tbody>
  388. </table>
  389. <?php }else{ ?>
  390. <h3>第三步:设置时间</h3>
  391. <table class="table-hide">
  392. <tbody>
  393. <tr>
  394. <th><em>*</em>开始时间:</th>
  395. <td>
  396. <input class="datainp" id="trial_begin_time_test" value="<?php echo @$orderinfo['trial_begin_time'] ?>" readonly name="trial_begin_time_test" type="text" placeholder="请选择" onClick="jeDate({dateCell:'#trial_begin_time_test',isTime:true,format:'YYYY-MM-DD'})" >
  397. </td>
  398. </tr>
  399. </tbody>
  400. </table>
  401. <?php }
  402. ?>
  403. <div id="settime" <?php if(@$orderinfo['g_classify']==0||$type=="test"){echo 'style="display: none;"';} ?>>
  404. <h3>第四步:设置时间</h3>
  405. <table class="table-hide">
  406. <tbody>
  407. <tr>
  408. <th><em>*</em>开始时间:</th>
  409. <td>
  410. <input class="datainp" id="trial_begin_time" value="<?php echo isset($orderinfo['trial_begin_time'])?date("Y-m-d", strtotime($orderinfo['trial_begin_time'])):date("Y-m-d") ?>" readonly name="trial_begin_time" type="text" placeholder="请选择" onClick="jeDate({dateCell:'#trial_begin_time',isTime:true,format:'YYYY-MM-DD'})" >
  411. </td>
  412. </tr>
  413. </tbody>
  414. </table>
  415. </div>
  416. </div>
  417. <div class="create-orders">
  418. <span id="goods_price" style="display: none"><?php echo @$orderinfo['g_price1']?@$orderinfo['g_price1']:@$orderinfo['g_price']; ?></span>
  419. <span id="t_num" style="display: none"></span>
  420. <?php if($type=="test"){ ?>
  421. <input type="hidden" value='<?php
  422. if(@$class){
  423. foreach($class as $k=>$v){
  424. if($k<count($class)-1){
  425. echo $v['clazz_id'].",";
  426. }else{
  427. echo $v['clazz_id'];
  428. }
  429. }
  430. }
  431. ?>' class="dahei" name="student_ids">
  432. <?php }else{ ?>
  433. <input type="hidden" value='<?php echo $arrs; ?>' class="dahei" name="student_ids">
  434. <?php } ?>
  435. <input type="hidden" value="<?php echo @$orderinfo['apply_class'] ?>" id="apply_class_hide" name="apply_class_hide">
  436. <input type="hidden" value="<?php echo $type; ?>" id="type" name="type">
  437. <input type="hidden" value="<?php echo @$orderinfo['quantity']; ?>" id="stusum" name="stusum">
  438. <input type="hidden" value="<?php echo @$stu[0]['clazz_name']; ?>" id="class_name" name="class_name">
  439. <input type="hidden" value="<?php echo @$orderinfo['goods_type_name']; ?>" id="good_type_name" name="good_type_name">
  440. <input type="hidden" value='<?php
  441. if(@$stu){
  442. if($type=="all"||$type=="ordinary"){
  443. echo $arrs;
  444. }else{
  445. foreach($stu as $k=>$v){
  446. if($k<count($stu)-1){
  447. echo $v['student_id'].",";
  448. }else{
  449. echo $v['student_id'];
  450. }
  451. }
  452. }
  453. }if(@$class){
  454. foreach(@$class as $k=>$v){
  455. if($k<count($class)-1){
  456. echo $v['clazz_id'].",";
  457. }else{
  458. echo $v['clazz_id'];
  459. }
  460. }
  461. }
  462. ?>' id="old_stu_ids" name="old_stu_ids">
  463. <input type="button" name="my_submit" id="my_submit" class="btn btn-success btn-sm" value="提交审核">
  464. </div>
  465. <div class="ttd dn">
  466. <div class="s-state clearfix posirela">
  467. <div class="hint_size clearfix">
  468. <span class="fl ml15">错误信息</span>
  469. </div>
  470. <div class="mistake_character">
  471. <p class="ml15" id="err_msg"></p>
  472. <div class="clearfix" style="width:180px;margin:0px auto;text-align:center">
  473. <p class="mt20"><button class="roger shut">确定</button></p>
  474. </div>
  475. </div>
  476. </div>
  477. </div>
  478. </form>
  479. <script>
  480. function checkval(val,e){
  481. if(e.keyCode!=37&&e.keyCode!=38&&e.keyCode!=39&&e.keyCode!=40){
  482. val=val.replace( /[^\d.]/g ,'');
  483. var oTxt1 = document.getElementById("pay_money");
  484. var cursurPosition=-1;
  485. if(oTxt1.selectionStart){//非IE浏览器
  486. cursurPosition= oTxt1.selectionStart;
  487. }else{//IE
  488. var range = document.selection.createRange();
  489. range.moveStart("character",-oTxt1.value.length);
  490. cursurPosition=range.text.length;
  491. }
  492. $("#pay_money").val(val)
  493. if(oTxt1.selectionStart){//非IE浏览器
  494. oTxt1.setSelectionRange(cursurPosition,cursurPosition);
  495. }else{//IE
  496. var range = document.selection.createRange();
  497. range.moveStart("character",-oTxt1.value.length);
  498. range.text.length=cursurPosition;
  499. }
  500. shengyu(val)
  501. }
  502. }
  503. function shengyu(num){
  504. if($("#total_price").html()-num>=0){
  505. var num=$("#total_price").html()-num;
  506. $("#surplusmoney").html(num.toFixed(2))
  507. }else{
  508. $("#surplusmoney").html(0);
  509. }
  510. }
  511. $(function(){
  512. $(".ttd").hide();
  513. var tp = $(".ttd");
  514. var lq = $(window).height();
  515. $(".shut").click(function(){
  516. $(this).parents(".ttd").fadeOut();
  517. $("body").css({height :"100%",overflow:"auto"});
  518. return false;
  519. });
  520. //手风琴效果
  521. $('body').on('click','.steps-choose',function(){
  522. $(this).addClass('show').siblings('.steps-choose').removeClass('show');
  523. });
  524. //搜索
  525. $('body').on('keyup','.students-search',function(){
  526. var str = $.trim($(this).val());
  527. var obj = $(this).closest('div').find('.students-name').children('p');
  528. if(str.length == 0){
  529. obj.show();
  530. return;
  531. }
  532. for(var i=0;i<obj.length;i++){
  533. if(obj.eq(i).html().indexOf(str) != -1){
  534. obj.eq(i).show();
  535. }else{
  536. obj.eq(i).hide()
  537. }
  538. }
  539. });
  540. //全部添加&&删除
  541. all($('.add-btn'));
  542. all($('.del-btn'));
  543. function all(obj){
  544. obj.click(function(){
  545. var htmls = $(this).siblings('.students-name').html();
  546. $(this).siblings('.students-name').html('');
  547. $(this).parent('div').siblings('div').find('.students-name').append(htmls);
  548. daheival();
  549. if($(obj).attr("class")=="del-btn"){
  550. }
  551. });
  552. }
  553. //单个添加
  554. $('body').on('click','.students-name p',function(){
  555. var htmls = $(this).html();
  556. var vals = $(this).attr("val");
  557. $(this).parent('div').parent('div').siblings('div').find('.students-name').append('<p val="'+vals+'">'+htmls+'</p>');
  558. $(this).remove();
  559. daheival();
  560. });
  561. <?php if($type=="test"){ ?>
  562. function daheival(){
  563. var oP = $(".students-del .students-name p");
  564. var arr = [];
  565. for(var i=0;i<oP.length;i++){
  566. arr.push(oP.eq(i).attr("val"));
  567. }
  568. $(".dahei").val(arr.join(","));
  569. $("#student_num").html(oP.length);
  570. $("#t_num").html(oP.length);
  571. if($('#goods_price').html())
  572. {
  573. $("#total_price").html(parseInt(oP.length)*parseFloat($('#goods_price').html())*100/100);
  574. // $("#pay_money").val(parseInt(oP.length)*parseFloat($('#goods_price').html()));
  575. }
  576. }
  577. <?php }else{ ?>
  578. var arrs=jQuery.parseJSON('<?php echo $arrs ?>' );
  579. if(arrs){
  580. var classnum=0;
  581. var stunum=0;
  582. var cstunum=0;
  583. var classstunumhtml="";
  584. $.each(arrs,function(n,value) {
  585. classnum+=1;
  586. cstunum=0;
  587. classstunumhtml+='<div class="fl" id="fl_'+value.classid+'">'+value.classname+":";
  588. $.each(value.stus,function(k,v) {
  589. stunum+=1;
  590. cstunum+=1;
  591. })
  592. classstunumhtml+=cstunum+'人</div>'
  593. if(cstunum==0){
  594. classnum-=1;
  595. nullfl.push(value.classid)
  596. }
  597. });
  598. $("#classstunum").html(classstunumhtml)
  599. }
  600. function daheival(){
  601. var classid=$("#class_id").val();
  602. var classname=$(".diy_select_txt3").html();
  603. var classnum=0;
  604. var stunum=0;
  605. var cstunum=0;
  606. var index=0;
  607. var oP = $(".students-del .students-name p");
  608. var arr = {
  609. stus:new Array()
  610. // stunames:new Array()
  611. };
  612. var ishavaclass=false;
  613. for(var j=0;j<arrs.length;j++){//判断是否是加过的班级
  614. if(arrs[j].classid==classid){
  615. ishavaclass=true;
  616. arrs[j].stus=new Array();
  617. index=j;
  618. }
  619. }
  620. if(!ishavaclass){//未加过这个班级
  621. arr.classid=classid;
  622. arr.classname=classname;
  623. for(var i=0;i<oP.length;i++){
  624. arr['stus'].push(oP.eq(i).attr("val"));
  625. }
  626. arrs.push(arr);
  627. }else{
  628. for(var i=0;i<oP.length;i++){
  629. arrs[index]['stus'].push(oP.eq(i).attr("val"));
  630. }
  631. }
  632. $(".dahei").val(JSON.stringify(arrs));
  633. var classstunumhtml="";
  634. var nullfl=new Array();
  635. $.each(arrs,function(n,value) {
  636. classnum+=1;
  637. cstunum=0;
  638. classstunumhtml+='<div class="fl" id="fl_'+value.classid+'">'+value.classname+":";
  639. $.each(value.stus,function(k,v) {
  640. stunum+=1;
  641. cstunum+=1;
  642. })
  643. classstunumhtml+=cstunum+'人</div>'
  644. if(cstunum==0){
  645. classnum-=1;
  646. nullfl.push(value.classid)
  647. }
  648. });
  649. $("#classstunum").html(classstunumhtml)
  650. $.each(nullfl,function(n,value) {
  651. $("#fl_"+value).remove();
  652. })
  653. $("#select_class_num").html(classnum);
  654. $("#select_stu_num").html(stunum);
  655. $("#stusum").val(stunum);
  656. $("#student_num").html(stunum);
  657. $("#t_num").html(stunum);
  658. if($('#goods_price').html())
  659. {
  660. $("#total_price").html(parseInt(stunum)*parseFloat($('#goods_price').html())*100/100);
  661. if($("#total_price").html()-$("#pay_money").val()>=0){
  662. $("#surplusmoney").html($("#total_price").html()-$("#pay_money").val());
  663. }else{
  664. $("#surplusmoney").html(0);
  665. }
  666. // $("#pay_money").val(parseInt(stunum)*parseFloat($('#goods_price').html()));
  667. // $("#surplusmoney").html(parseInt(stunum)*parseFloat($('#goods_price').html()));
  668. }
  669. }
  670. <?php } ?>
  671. $(".diy_select_list").click(function(){
  672. var data={
  673. "type_id":$('#type_id').val()
  674. };
  675. $('#good_type_name').val($(this).children('.focus').html());
  676. $('#apply_class').addClass('dn');
  677. $('#effective_date').addClass('dn');
  678. $('#g_price').addClass('dn');
  679. $('#sem').addClass('dn');
  680. $('.diy_select_txt1').html('请选择商品');
  681. $('#goods_id').val(0);
  682. $.post("<?php echo Yii::app()->createUrl('order/getgoods')?>",data,function(flag){
  683. var m =JSON.parse(flag);
  684. if(m.status)
  685. {
  686. var str='<li val="0">请选择商品</li>';
  687. $.each(m.result,function(i,e){
  688. str+='<li val="'+ e.id+'">'+ e.goods_name+'</li>'
  689. });
  690. $('#_goods_id').html(str);
  691. }else
  692. {
  693. var str='<li val="0">请选择商品</li>';
  694. $('#goods_id').val(0);
  695. $('#_goods_id').html(str);
  696. }
  697. });
  698. });
  699. $(".diy_select_list1").click(function(){
  700. var data={
  701. "goods_id":$('#goods_id').val(),
  702. "type":"<?php echo $type ?>"
  703. };
  704. $('#g_price').addClass('dn');
  705. $('#sem').addClass('dn');
  706. $('.diy_select_txt2').html('请选择学科');
  707. $('#goods_spec_id').val(0);
  708. $('.diy_select_txt3').html('请选择班级');
  709. $('#class_id').val(0);
  710. <?php if($type!="test"){ ?>
  711. if(arrs){
  712. arrs=[];
  713. $("#select_class_num").html("0")
  714. $("#select_stu_num").html("0")
  715. $("#classstunum").html("")
  716. }
  717. <?php } ?>
  718. var str='';
  719. $('#ajax_students_name').html(str);
  720. $('#select_student_name').html(str);
  721. $.post("<?php echo Yii::app()->createUrl('order/getsubject')?>",data,function(flag){
  722. var m =JSON.parse(flag);
  723. if(m.status)
  724. {
  725. $('#apply_class').removeClass('dn');
  726. var s='';
  727. switch (parseInt(m.apply_class))
  728. {
  729. case -1 :
  730. s = '全年级';
  731. break;
  732. case 1 :
  733. s = '高一';
  734. break;
  735. case 2 :
  736. s = '高二';
  737. break;
  738. case 3 :
  739. s = '高三';
  740. break;
  741. }
  742. $("#apply_class_hide").val(parseInt(m.apply_class))
  743. $('.apply_class').html(s);
  744. var str='<li val="0">请选择学科</li>';
  745. $.each(m.result,function(i,e){
  746. str+='<li val="'+ e.id+'">'+ e.name+'</li>'
  747. });
  748. $('#_goods_spec_id').html(str);
  749. if(m.class){
  750. if("<?php echo $type ?>"=="test"){
  751. var html="";
  752. $.each(m.class,function(i,e){
  753. html+='<p val="'+e.class_id+'">'+e.class_name+'</p>'
  754. });
  755. $('#ajax_students_name').html(html);
  756. }else{
  757. var html="";
  758. $.each(m.class,function(i,e){
  759. html+='<li val="'+e.class_id+'">'+e.class_name+'</li>'
  760. });
  761. $('#classes').html(html);
  762. }
  763. }
  764. }else
  765. {
  766. var str='<li val="0">请选择学科</li>';
  767. $('#goods_spec_id').val(0);
  768. $('#_goods_spec_id').html(str);
  769. }
  770. });
  771. });
  772. $(".diy_select_list2").click(function(){
  773. var data={
  774. "goods_spec_id":$('#goods_spec_id').val()
  775. };
  776. $.post("<?php echo Yii::app()->createUrl('order/getsubject_one')?>",data,function(flag){
  777. var m =JSON.parse(flag);
  778. if(m.status)
  779. {
  780. $('#g_price').removeClass('dn');
  781. $('.g_price').html(m.result.price);
  782. $('#goods_price').html(m.result.price);
  783. if(m.classify==0){
  784. $(".sem").html(m.semname);
  785. $('#sem').removeClass('dn');
  786. $('#effective_date').addClass('dn');
  787. $("#settime").hide();
  788. }else{
  789. <?php if($type!="test"){ ?>
  790. $("#settime").show();
  791. <?php } ?>
  792. // $('#apply_class').addClass('dn');
  793. $('#effective_date').removeClass('dn');
  794. $('.effective_date').html(m.effective_date+"天");
  795. }
  796. if($("#t_num").html())
  797. {
  798. $("#total_price").html(parseInt($("#t_num").html())*parseFloat($('#goods_price').html())*100/100);
  799. // $("#pay_money").val(parseInt($("#t_num").html())*parseFloat($('#goods_price').html()));
  800. }
  801. }
  802. });
  803. });
  804. $(".diy_select_list3").click(function(){
  805. var goods_id = $('#goods_id').val();
  806. var classid=$("#class_id").val()
  807. var data={
  808. "class_id":classid,
  809. "goods_id":goods_id,
  810. <?php if(@$orderid){ ?>
  811. "orderid":"<?php echo @$orderid;?>",
  812. <?php } ?>
  813. };
  814. if(!goods_id)
  815. {
  816. $('.diy_select_txt3').html('请选择班级');
  817. $('#class_id').val(0);
  818. $('#err_msg').html('请先选择商品,再选择班级');
  819. tp.fadeIn();
  820. $("body").css({height : lq+"px",overflow:"hidden"});
  821. return;
  822. }
  823. $('#select_student_name').html('');
  824. $('#class_name').val($(this).children('.focus').html());
  825. $.post("<?php echo Yii::app()->createUrl('order/getstudent')?>",data,function(flag){
  826. var m =JSON.parse(flag);
  827. if(m.status==2)
  828. {
  829. $('.diy_select_txt3').html('请选择班级');
  830. $('#class_id').val(0);
  831. $('#err_msg').html('此商品不符合当前年级');
  832. tp.fadeIn();
  833. $("body").css({height : lq+"px",overflow:"hidden"});
  834. return;
  835. }
  836. // if(m.status==1)
  837. // {
  838. // var str1='';
  839. // var str='';
  840. // var selectstu=new Array();
  841. // $.each(arrs,function(n,value) {
  842. // if(value.classid==$("#class_id").val()){
  843. // selectstu=value.stus
  844. // }
  845. // });
  846. //
  847. // $.each(m.result,function(i,e){
  848. // if(selectstu.indexOf(e.student_id)==-1){
  849. // str+='<p val="'+ e.student_id+'">'+ e.realname+'</p>';
  850. // }else{
  851. // str1+='<p val="'+ e.student_id+'">'+ e.realname+'</p>';
  852. // }
  853. // });
  854. // $('#select_student_name').html(str1);
  855. // $('#ajax_students_name').html(str);
  856. // }
  857. // if(m.status==0)
  858. // {
  859. //// $('.diy_select_txt3').html('请选择班级');
  860. // $('#class_id').val(0);
  861. //
  862. // var str='';
  863. //
  864. // $('#ajax_students_name').html(str);
  865. // }
  866. if(m.status==0||m.status==1){
  867. var str="";
  868. var str1="";
  869. var orderstuid=new Array();
  870. $.each(arrs,function(n,value) {
  871. if(value.classid==classid){
  872. $.each(m.orderstu,function(key,val) {
  873. orderstuid.push(val.student_id);
  874. str1+='<p val="'+ val.student_id+'">'+ val.student_name+'</p>';
  875. })
  876. }
  877. });
  878. $.each(m.result,function(i,e){
  879. if(orderstuid.indexOf(e.student_id)==-1){
  880. str+='<p val="'+ e.student_id+'">'+ e.realname+'</p>';
  881. }
  882. });
  883. $('#ajax_students_name').html("");
  884. $('#select_student_name').html("");
  885. str+=$('#ajax_students_name').html();
  886. $('#ajax_students_name').html(str);
  887. str1+=$('#select_student_name').html();
  888. $('#select_student_name').html(str1);
  889. }
  890. });
  891. });
  892. $('#my_submit').click(function(){
  893. var issub=0;
  894. var type_id = $('#type_id').val();
  895. var goods_id = $('#goods_id').val();
  896. var goods_spec_id = $('#goods_spec_id').val();
  897. var class_id = $('#class_id').val();
  898. var student_ids = $('.dahei').val();
  899. var students = $('input[name=students]:checked').val();
  900. var pay_account = $('#pay_account').val();
  901. var pay_money = $('#pay_money').val();
  902. var datebut = $('#datebut').val();
  903. var pic = $('#pic').val();
  904. var trial_begin_time =$("#trial_begin_time").val();
  905. var trial_begin_time_test =$("#trial_begin_time_test").val();
  906. if(!parseInt(type_id))
  907. {
  908. $('#err_msg').html('商品类型不能为空');
  909. tp.fadeIn();
  910. $("body").css({height : lq+"px",overflow:"hidden"});
  911. return;
  912. }
  913. if(!parseInt(goods_id))
  914. {
  915. $('#err_msg').html('商品不能为空');
  916. tp.fadeIn();
  917. $("body").css({height : lq+"px",overflow:"hidden"});
  918. return;
  919. }
  920. if(!parseInt(goods_spec_id))
  921. {
  922. $('#err_msg').html('学科不能为空');
  923. tp.fadeIn();
  924. $("body").css({height : lq+"px",overflow:"hidden"});
  925. return;
  926. }
  927. <?php if($type!="test"){ ?>
  928. if(!parseInt(class_id))
  929. {
  930. $('#err_msg').html('未选择班级');
  931. tp.fadeIn();
  932. $("body").css({height : lq+"px",overflow:"hidden"});
  933. return;
  934. }
  935. // if(!pay_account)
  936. // {
  937. //
  938. // $('#err_msg').html('支付帐号不能为空');
  939. // tp.fadeIn();
  940. // $("body").css({height : lq+"px",overflow:"hidden"});
  941. // return;
  942. //
  943. // }
  944. if(!student_ids)
  945. {
  946. $('#err_msg').html('未选择学生');
  947. tp.fadeIn();
  948. $("body").css({height : lq+"px",overflow:"hidden"});
  949. }else{
  950. var ishavenum=0;
  951. var arrs=jQuery.parseJSON(student_ids);
  952. $.each(arrs,function(n,value) {
  953. if(value.stus.length>0){
  954. ishavenum++;
  955. }
  956. });
  957. if(ishavenum==0){
  958. $('#err_msg').html('未选择学生');
  959. tp.fadeIn();
  960. $("body").css({height : lq+"px",overflow:"hidden"});
  961. return;
  962. }
  963. }
  964. if(pay_account.length>60)
  965. {
  966. $('#err_msg').html('支付帐号太长');
  967. tp.fadeIn();
  968. $("body").css({height : lq+"px",overflow:"hidden"});
  969. return;
  970. }
  971. if(pay_money){
  972. var j = /(^[-+]?[1-9]\d*(\.\d{1,2})?$)|(^[-+]?[0]{1}(\.\d{1,2})?$)/;
  973. if(!j.test(pay_money)){
  974. $('#err_msg').html('只能为数字或两位小数');
  975. tp.fadeIn();
  976. $("body").css({height : lq+"px",overflow:"hidden"});
  977. return;
  978. }
  979. }
  980. if(!$("#settime").is(":hidden")){
  981. if(!trial_begin_time){
  982. $('#err_msg').html('未选择开始时间');
  983. tp.fadeIn();
  984. $("body").css({height : lq+"px",overflow:"hidden"});
  985. return;
  986. }
  987. }
  988. // if(!pay_money)
  989. // {
  990. // $('#err_msg').html('支付金额不能为空');
  991. // tp.fadeIn();
  992. // $("body").css({height : lq+"px",overflow:"hidden"});
  993. // return;
  994. //
  995. // }else
  996. // {
  997. // var j = /(^[-+]?[1-9]\d*(\.\d{1,2})?$)|(^[-+]?[0]{1}(\.\d{1,2})?$)/;
  998. // if(!j.test(pay_money)){
  999. // $('#err_msg').html('只能为数字或两位小数');
  1000. // tp.fadeIn();
  1001. // $("body").css({height : lq+"px",overflow:"hidden"});
  1002. // return;
  1003. //
  1004. // }
  1005. // if(parseFloat(pay_money)<=0){
  1006. // $('#err_msg').html('金额不能为负数或为零');
  1007. // tp.fadeIn();
  1008. // $("body").css({height : lq+"px",overflow:"hidden"});
  1009. // return;
  1010. //
  1011. // }
  1012. //
  1013. //
  1014. // }
  1015. // if(!datebut)
  1016. // {
  1017. // $('#err_msg').html('时间不为空');
  1018. // tp.fadeIn();
  1019. // $("body").css({height : lq+"px",overflow:"hidden"});
  1020. // return;
  1021. //
  1022. // }
  1023. // if(!pic&&!$("#oldpic").val())
  1024. // {
  1025. // $('#err_msg').html('图片不能为空');
  1026. // tp.fadeIn();
  1027. // $("body").css({height : lq+"px",overflow:"hidden"});
  1028. // return;
  1029. //
  1030. // }
  1031. <?php }else{ ?>
  1032. if(!student_ids)
  1033. {
  1034. $('#err_msg').html('未选择班级');
  1035. tp.fadeIn();
  1036. $("body").css({height : lq+"px",overflow:"hidden"});
  1037. return;
  1038. }
  1039. if(!trial_begin_time_test){
  1040. $('#err_msg').html('未选择开始时间');
  1041. tp.fadeIn();
  1042. $("body").css({height : lq+"px",overflow:"hidden"});
  1043. return;
  1044. }
  1045. <?php } ?>
  1046. $("#orderAdd").submit();
  1047. $("#my_submit").attr("disabled",true)
  1048. });
  1049. });
  1050. </script>