12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040 |
- <script src="/js/xsgl.js"></script>
- <style type="text/css">
- *{margin:0;padding:0;list-style: none;font-style: normal;font-weight: normal;color: #333;font-family: "Microsoft YaHei"}
- input,select{outline: none;border-radius:2px;border:1px solid #ccc;}
- 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;}
- body{position:relative}
- .mt5{margin-top:5px;}
- .mt10{margin-top:10px;}
- .mt20{margin-top:20px;}
- .ml15{margin-left:15px;}
- .mr15{margin-right:15px;}
- .font_bold{font-weight:bold;}
- .choseImg{cursor:pointer;}
- .ttd{background:url(/images/back-d.png) center repeat;width:100%;height:100%;position:fixed;top:0px;z-index:999}
- .s-state{width:300px;background:#fff;margin:12% auto 0 auto;}
- .hint_size{height:45px;width:90%;color:#333;line-height:45px;margin:0px auto;border-bottom:1px solid #ccc;}
- .mistake_character{text-align:left;color:#606060;font-size:14px;padding:15px 0px;width:90%;margin:0px auto;}
- .roger{width:60px;height:30px;border-radius:6px;border:1px solid #15ae68;background:#15ae68;color:#fff;font-size:14px;cursor:pointer;}
- .rogergb{background:#ccc;border:1px solid #ccc;}
- .fl{float: left;}
- .fr{float: right;}
- .clearfix:after{content: '';display: block;visibility: hidden;height: 0;clear: both;}
- form{padding-left: 20px;}
- .steps-choose h3{font-size: 20px;line-height: 40px;font-size: 16px; border-bottom: 1px solid #ccc;}
- .steps-choose .table-hide{width: 80%;font-size: 14px;display: none;}
- .steps-choose.show .table-hide{display: block;}
- .steps-choose input[type="text"]{padding-left: 5px;}
- .steps-choose table em{margin-right:5px;color: #f00;}
- .steps-choose table th{text-align: right;width: 20%}
- .steps-choose table select{margin:10px 0; width: 100%;outline: none;}
- .steps-choose table input[type="text"]{width: 100%;margin:10px 5px 10px 0; }
- .step-three table{margin-top: 10px;}
- .step-three table input[type="text"]{width: 80%;height: 30px;}
- .step-two input[type=radio]{margin:0 5px 0 0;}
- /*.students-all div{width: 40%;height: 200px;overflow: auto;border:1px solid #ccc;}*/
- .students-all>div{width: 45%;}
- .students-name{ height:200px;overflow:auto;border:1px solid #ccc;}
- .students-name p{cursor: pointer;}
- .students-all input[type="button"]{margin:5px 0; width:100%;height:35px;background:#ccc;border:0;}
- .students-search{width:100%;height:35px;border:1px solid #ccc;border-radius:5px;}
- .create-orders{margin-top:30px;padding-left: 5%;}
- .create-orders .cancel-btn{margin-right:10px; color:#333;background:#fff;}
- input[readonly].datainp{background-color: #fff!important;color: #333;}
- .dn{display: none}
- </style>
- <link rel="stylesheet" type="text/css" href="/css/jquery.datetimepicker.css">
- <script type="text/javascript" src="/js/times/jedate.js"></script>
- <script type="text/javascript" src="/js/jquery.datetimepicker.js"></script>
- <ul class="clearfix main-content-inner-ul">
- <?php if(Yii::app()->session['coachInfo']['leader']==1){?>
- <li class="pull-left">
- <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>
- <img src="/images/line.jpg" style="height:45px;" />
- </li>
- <?php }?>
- </ul>
- <?php if(@$action!="edit"){ ?>
- <form action="<?php echo Yii::app()->createUrl('order/insert')?>" method="post" id="orderAdd" enctype="multipart/form-data">
- <input type="hidden" value="" name="orderid">
- <?php }else{ ?>
- <form action="<?php echo Yii::app()->createUrl('order/update')?>" method="post" id="orderAdd" enctype="multipart/form-data">
- <input type="hidden" value="<?php echo $orderid ?>" name="orderid">
- <?php } ?>
- <div class="step-one steps-choose show">
- <h3>第一步:选择商品</h3>
- <table class="table-hide" style="margin-top: 15px">
- <tbody>
- <tr>
- <th><em>*</em>商品类目:</th>
- <td>
- <div class='diy_select' style="width:175px;float: left;">
- <input type='hidden' class='diy_select_input' id="type_id" name="type_id" value="<?php echo @$orderinfo['goods_type_id'] ?>"/>
- <div class='diy_select_txt' style="width:142px;"><?php
- if(@!$orderinfo){
- echo "请选择商品类别";
- }else{
- foreach($goods_type as $v){
- if($v->id==@$orderinfo['goods_type_id']){
- echo $v->goods_type_name;
- }
- }
- } ?></div>
- <div class='diy_select_btn'></div>
- <ul class='diy_select_list'>
- <li val="0">请选择商品类别</li>
- <?php if(isset($goods_type)){
- foreach($goods_type as $v){
- ?>
- <li val="<?php echo $v->id?>"><?php echo $v->goods_type_name?></li>
- <?php }}?>
- </ul>
- </div>
- </td>
- <th><em>*</em>商品名称:</th>
- <td>
- <div class='diy_select1' style="width:175px;float: left;">
- <input type='hidden' class='diy_select_input1' id="goods_id" name="goods_id" value="<?php echo @$orderinfo['goods_id'] ?>"/>
- <div class='diy_select_txt1' style="width:142px;">
- <?php
- if(@!$orderinfo){
- echo "请选择商品";
- }else{
- foreach($goods_data as $v){
- if((string)$v->id===(string)@$orderinfo['goods_id']){
- echo $v->goods_name;
- }
- }
- } ?>
- </div>
- <div class='diy_select_btn1'></div>
- <ul class='diy_select_list1' id="_goods_id">
- <?php if(@$goods_data){?>
- <li val="0">请选择商品</li>
- <?php if(isset($goods_data)){
- foreach($goods_data as $v){
- ?>
- <li val="<?php echo $v->id?>"><?php echo $v->goods_name?></li>
- <?php }}?>
- <?php } ?>
- </ul>
- </div>
- </td>
- </tr>
- <tr>
- <th style="position: relative;top: 8px;"><em>*</em>学科:</th>
- <td >
- <div class='diy_select2' style="width:175px;float: left;margin-top: 15px">
- <input type='hidden' class='diy_select_input2' id="goods_spec_id" name="goods_spec_id" value="<?php if(isset($goods_spec_data)){
- foreach($goods_spec_data as $v){
- if($v->name==@$orderinfo['subject_name']){
- echo $v->id;
- }
- }
- }?>"/>
- <div class='diy_select_txt2' style="width:142px;">
- <?php
- if(@!$orderinfo){
- echo "请选择学科";
- }else{
- echo @$orderinfo['subject_name'];
- }
- ?>
- </div>
- <div class='diy_select_btn2'></div>
- <ul class='diy_select_list2' id="_goods_spec_id">
- <?php if(@$goods_spec_data){?>
- <li val="0">请选择学科</li>
- <?php if(isset($goods_spec_data)){
- foreach($goods_spec_data as $v){
- ?>
- <li val="<?php echo $v->id?>"><?php echo $v->name?></li>
- <?php }}?>
- <?php } ?>
- </ul>
- </div>
- </td>
-
- </tr>
- <tr id="apply_class" class="<?php if(@$orderinfo['g_classify']==1){echo "dn";} ?>" style="line-height: 40px">
- <th>商品适用年级:</th>
- <td colspan="3">
- <span class="apply_class"><?php
- if(@$orderinfo){
- switch (@$orderinfo['apply_class'])
- {
- case "-1" :
- echo '全年级';
- break;
- case "1" :
- echo '高一';
- break;
- case "2" :
- echo '高二';
- break;
- case "3" :
- echo '高三';
- break;
- }
- }
- ?></span>
- </td>
- </tr>
-
- <tr id="g_price" class="<?php if(@!$orderinfo){echo "dn";} ?>" style="line-height: 40px">
- <th>商品价格:</th>
- <td colspan="3">
- <span class="g_price"><?php echo @$orderinfo['g_price1']?@$orderinfo['g_price1']:@$orderinfo['g_price'] ?></span>
- </td>
- </tr>
-
- <tr id="effective_date" class="<?php if(@$orderinfo['g_classify']==0){echo "dn";} ?>" style="line-height: 40px">
- <th>商品有效期:</th>
- <td colspan="3">
- <span class="effective_date"><?php echo isset($orderinfo['effective_date'])?$orderinfo['effective_date']."天":"" ?></span>
- </td>
- </tr>
-
- <?php if($type!="ordinary"){ ?>
- <tr id="sem" class="<?php if(@!$orderinfo){echo "dn";} ?>" style="line-height: 40px">
- <th>商品适用学期:</th>
- <td colspan="3">
- <span class="sem"><?php echo @$sem['semester_name'] ?></span>
- </td>
- </tr>
- <?php } ?>
- </tbody>
- </table>
- </div>
- <div class="step-two steps-choose show" >
-
- <h3>第二步:填写学生信息<span id="notice" style="color:red;margin-left: 100px;"></span></h3>
- <table class="table-hide" style=" margin-top: 15px;">
- <tbody>
- <tr>
-
- <th></th>
- <td style="width:100px;">
- <div id="grade_div" style="display:none;">
- <div style="float:left;line-height:30px;margin-left: 20px;" ><em>*</em>年级:</div>
- <div class="diy_select4" style="width:175px;float: left;">
-
- <div class="diy_select_txt4" style="width:142px;">
- 请选择年级
- </div>
- <div class="diy_select_btn4"></div>
- <ul class="diy_select_list4" id="grade" style="display: none;">
- <li val="0">请选择年级</li>
- <li val="1">高一</li>
- <li val="2">高二</li>
- <li val="3">高三</li>
- </ul>
- </div>
- </div>
- <div style="float:left;line-height:30px;margin-left: 20px;"><em>*</em>班级:</div>
- <div class="diy_select3" style="width:175px;float: left;">
- <input class="diy_select_input3" id="class_id" name="class_id" value="" type="hidden">
- <div class="diy_select_txt3" style="width:142px;">
- 请选择班级
- </div>
- <div class="diy_select_btn3"></div>
- <ul class="diy_select_list3" id="classes" style="display: none;">
- <li val="0">请选择班级</li>
- <?php if(isset($classes)){
- foreach($classes as $v){
- ?>
- <li val="<?php echo $v->class_id?>"><?php echo $v->class_name?></li>
- <?php
- }
- }?>
- </ul>
- </div>
- </td>
- <th></th>
- <td>
-
- </td>
- </tr>
-
- <tr>
- <th></th>
- <td class="students-all clearfix">
- <div class="students-add fl">
- <input type="text" class="students-search" placeholder="搜索" >
- <input type="button" class="add-btn" value="添加本班全部学生" />
- <div class="students-name" id="ajax_students_name">
-
- </div>
- </div>
- <div class="students-del fr">
- <input type="text" class="students-search" placeholder="搜索"/>
- <input type="button" class="del-btn" value="去掉本班全部学生" />
- <div class="students-name" id="select_student_name">
- <?php
- $arrs=array();
- if(@$stu){
- $arr=array();
- $stucount=count($stu);
- $classnum=array();
- foreach($stu as $v){
- if(!in_array($v['clazz_id'], $classnum)){
- $classnum[]=$v['clazz_id'];
- }
- if(isset($arr['classid'])&&@$arr['classid']!=$v['clazz_id']){
- $arrs[]=$arr;
- $arr=array();
- $arr['classid']=$v['clazz_id'];
- $arr['classname']=$v['clazz_name'];
- }if(!isset($arr['classid'])){
- $arr['classid']=$v['clazz_id'];
- $arr['classname']=$v['clazz_name'];
- }
- $arr['stus'][]=$v['student_id'];
- // echo '<p val="'.$v['student_id'].'">'.$v['student_name'].'</p>';
- }
- $classnum=count($classnum);
- $arrs[]=$arr;
- }else{
- $classnum=0;
- $stucount=0;
- }
- $arrs= json_encode($arrs);
- ?>
- </div>
- </div>
- <input type="button" class="del-btn1 del-all" value="去掉全部学生">
- </td>
- </tr>
- <tr>
- <th></th>
- <td>
- <ul class="selectedTotal">
- <li class="clearfix">
- <div class="fl">已选班级:<span id="select_class_num"><?php echo $classnum ?></span></div>
- <div class="fl">已选学生数:<span id="select_stu_num"><?php echo $stucount ?></span></div></li>
- <li class="clearfix tatal" id="classstunum">
-
- </li>
- </ul>
- </td>
- </tr>
- </tbody>
- </table>
-
- </div>
- <div class="step-three steps-choose show">
- <?php if($type!="test"){ ?>
- <h3>第三步:付款</h3>
- <table class="table-hide">
- <tbody>
- <tr>
- <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>
- </tr>
- <tr>
- <th>付款账户:</th>
- <td>
- <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">
- </td>
- </tr>
- <tr>
- <th>金额:</th>
- <td>
- <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>
- </td>
- </tr>
- <tr>
- <th>打款时间:</th>
- <td>
- <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'})" >
- </td>
- </tr>
- <tr>
- <th>凭证:</th>
- <td>
- <input type="file" name="pic" id="pic" value="<?php echo @$orderinfo['pay_cert'];?>">
- <input type="hidden" id="oldpic" name="oldpic" value="<?php echo @$orderinfo['pay_cert'];?>">
- </td>
- </tr>
- <?php if($type=="all"){ ?>
- <tr>
- <th><br>剩余未付款:</th>
- <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>
- </tr>
- <tr>
- <th><br>下期付款时间:</th>
- <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>
- </tr>
- <?php } ?>
- </tbody>
- </table>
-
- <?php }else{ ?>
- <h3>第三步:设置时间</h3>
- <table class="table-hide">
- <tbody>
- <tr>
- <th><em>*</em>开始时间:</th>
- <td>
- <!--<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',minDate:'<?php /*echo $start_time*/?>',maxDate:'<?php /*echo $end_time*/?>'})" >-->
- <input type="text" id="trial_begin_time_test" value="<?php echo @$orderinfo['trial_begin_time'] ?>" readonly name="trial_begin_time_test" placeholder="请选择" />
- </td>
- </tr>
- </tbody>
- </table>
- <?php }
- ?>
- <div id="settime" <?php if(@$orderinfo['g_classify']==0||$type=="test"){echo 'style="display: none;"';} ?>>
- <h3>第四步:设置时间</h3>
- <table class="table-hide">
- <tbody>
- <tr>
- <th><em>*</em>开始时间:</th>
- <td>
- <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="请选择" >
- </td>
- </tr>
- </tbody>
- </table>
- </div>
- </div>
- <div class="create-orders">
- <span id="goods_price" style="display: none"><?php echo @$orderinfo['g_price1']?@$orderinfo['g_price1']:@$orderinfo['g_price']; ?></span>
- <span id="t_num" style="display: none"></span>
- <input type="hidden" value='<?php echo $arrs; ?>' class="dahei" name="student_ids">
- <input type="hidden" value="<?php echo @$orderinfo['apply_class'] ?>" id="apply_class_hide" name="apply_class_hide">
- <input type="hidden" value="" id="select_grade" name="select_grade">
- <input type="hidden" value="<?php echo $type; ?>" id="type" name="type">
- <input type="hidden" value="<?php echo @$orderinfo['quantity']; ?>" id="stusum" name="stusum">
- <input type="hidden" value="<?php echo @$stu[0]['clazz_name']; ?>" id="class_name" name="class_name">
- <input type="hidden" value="<?php echo @$orderinfo['goods_type_name']; ?>" id="good_type_name" name="good_type_name">
- <input type="hidden" value='<?php
- if(@$stu){
- if($type=="all"||$type=="ordinary"){
- echo $arrs;
- }
- }
- ?>' id="old_stu_ids" name="old_stu_ids">
- <input type="button" name="my_submit" id="my_submit" class="btn btn-success btn-sm" value="提交审核">
- </div>
- <div class="ttd dn">
- <div class="s-state clearfix posirela">
- <div class="hint_size clearfix">
- <span class="fl ml15">错误信息</span>
- </div>
- <div class="mistake_character">
- <p class="ml15" id="err_msg"></p>
- <div class="clearfix" style="width:180px;margin:0px auto;text-align:center">
- <p class="mt20"><button class="roger shut">确定</button></p>
- </div>
- </div>
- </div>
- </div>
- </form>
- <script>
- function checkval(val,e){
- if(e.keyCode!=37&&e.keyCode!=38&&e.keyCode!=39&&e.keyCode!=40){
- val=val.replace( /[^\d.]/g ,'');
- var oTxt1 = document.getElementById("pay_money");
- var cursurPosition=-1;
- if(oTxt1.selectionStart){//非IE浏览器
- cursurPosition= oTxt1.selectionStart;
- }else{//IE
- var range = document.selection.createRange();
- range.moveStart("character",-oTxt1.value.length);
- cursurPosition=range.text.length;
- }
-
- $("#pay_money").val(val)
- if(oTxt1.selectionStart){//非IE浏览器
- oTxt1.setSelectionRange(cursurPosition,cursurPosition);
- }else{//IE
-
- var range = document.selection.createRange();
- range.moveStart("character",-oTxt1.value.length);
- range.text.length=cursurPosition;
- }
- shengyu(val)
- }
- }
- function shengyu(num){
- if($("#total_price").html()-num>=0){
- var num=$("#total_price").html()-num;
- $("#surplusmoney").html(num.toFixed(2))
- }else{
- $("#surplusmoney").html(0);
- }
- }
- $(function(){
- $(".ttd").hide();
- var logic = function( currentDateTime ){
- if( currentDateTime.getDay()==6 ){
- this.setOptions({
- minTime:'11:00'
- });
- }else
- this.setOptions({
- minTime:'8:00'
- });
- };
- $('#trial_begin_time_test').datetimepicker({
- timepicker:false,
- format:'Y-m-d',
- minDate:'<?php echo $start_time?>',
- maxDate:'<?php echo $end_time?>'
- });
- $('#trial_begin_time').datetimepicker({
- timepicker:false,
- format:'Y-m-d',
- minDate:'<?php echo $start_time?>',
- maxDate:'<?php echo $end_time?>'
- });
- var tp = $(".ttd");
- var lq = $(window).height();
- $(".shut").click(function(){
- $(this).parents(".ttd").fadeOut();
- $("body").css({height :"100%",overflow:"auto"});
- return false;
- });
- //手风琴效果
- $('body').on('click','.steps-choose',function(){
- $(this).addClass('show').siblings('.steps-choose').removeClass('show');
- });
- //搜索
- $('body').on('keyup','.students-search',function(){
- var str = $.trim($(this).val());
- var obj = $(this).closest('div').find('.students-name').children('p');
- if(str.length == 0){
- obj.show();
- return;
- }
- for(var i=0;i<obj.length;i++){
- if(obj.eq(i).html().indexOf(str) != -1){
- obj.eq(i).show();
- }else{
- obj.eq(i).hide()
- }
- }
- });
- //全部添加&&删除
- all($('.add-btn'));
- all($('.del-btn'));
- function all(obj){
- obj.click(function(){
- var htmls = $(this).siblings('.students-name').html();
- $(this).siblings('.students-name').html('');
- $(this).parent('div').siblings('div').find('.students-name').append(htmls);
- daheival();
- if($(obj).attr("class")=="del-btn"){
-
- }
- });
- }
- //单个添加
- $('body').on('click','.students-name p',function(){
- var htmls = $(this).html();
- var vals = $(this).attr("val");
- $(this).parent('div').parent('div').siblings('div').find('.students-name').append('<p val="'+vals+'">'+htmls+'</p>');
- $(this).remove();
- daheival();
- });
- var arrs=jQuery.parseJSON('<?php echo $arrs ?>' );
- if(arrs){
- var classnum=0;
- var stunum=0;
- var cstunum=0;
- var classstunumhtml="";
- $.each(arrs,function(n,value) {
- classnum+=1;
- cstunum=0;
- classstunumhtml+='<div class="fl" id="fl_'+value.classid+'">'+value.classname+":";
- $.each(value.stus,function(k,v) {
- stunum+=1;
- cstunum+=1;
- })
- classstunumhtml+=cstunum+'人</div>'
-
- if(cstunum==0){
- classnum-=1;
- nullfl.push(value.classid)
- }
- });
- $("#classstunum").html(classstunumhtml)
- }
- function daheival(){
-
- var classid=$("#class_id").val();
- var classname=$(".diy_select_txt3").html();
- var classnum=0;
- var stunum=0;
- var cstunum=0;
- var index=0;
- var oP = $(".students-del .students-name p");
-
- var arr = {
- stus:new Array(),
- stus_name:new Array()
- // stunames:new Array()
- };
- var ishavaclass=false;
-
- for(var j=0;j<arrs.length;j++){//判断是否是加过的班级
- if(arrs[j].classid==classid){
- ishavaclass=true;
-
- arrs[j].stus=new Array();
- arrs[j].stus_name=new Array();
- index=j;
- }
- }
-
- if(!ishavaclass){//未加过这个班级
- arr.classid=classid;
- arr.classname=classname;
- for(var i=0;i<oP.length;i++){
- arr['stus'].push(oP.eq(i).attr("val"));
- arr['stus_name'].push(oP.eq(i).text());
- }
- arrs.push(arr);
- }else{
- for(var i=0;i<oP.length;i++){
- arrs[index]['stus'].push(oP.eq(i).attr("val"));
- arrs[index]['stus_name'].push(oP.eq(i).text());
- }
- }
- $(".dahei").val(JSON.stringify(arrs));
-
- var classstunumhtml="";
- var nullfl=new Array();
-
- $.each(arrs,function(n,value) {
- classnum+=1;
- cstunum=0;
- classstunumhtml+='<div class="fl" id="fl_'+value.classid+'">'+value.classname+":";
- $.each(value.stus,function(k,v) {
- stunum+=1;
- cstunum+=1;
- })
- classstunumhtml+=cstunum+'人</div>'
-
- if(cstunum==0){
- classnum-=1;
- nullfl.push(value.classid)
- }
- });
- $("#classstunum").html(classstunumhtml)
- $.each(nullfl,function(n,value) {
- $("#fl_"+value).remove();
- })
- $("#select_class_num").html(classnum);
- $("#select_stu_num").html(stunum);
- $("#stusum").val(stunum);
- $("#student_num").html(stunum);
- $("#t_num").html(stunum);
- if($('#goods_price').html())
- {
- $("#total_price").html(parseInt(stunum)*parseFloat($('#goods_price').html())*100/100);
- if($("#total_price").html()-$("#pay_money").val()>=0){
- $("#surplusmoney").html($("#total_price").html()-$("#pay_money").val());
- }else{
- $("#surplusmoney").html(0);
- }
- if($("#apply_class_hide").val()==-1){
- $("#notice").show();
- $("#notice").html("一个订单只能有一个年级的学生,如果选择了"+grade_text+"就不要选择其他年级的学生");
- $("#select_grade").val(grade);
- $("#grade_div").hide();
- }
- // $("#pay_money").val(parseInt(stunum)*parseFloat($('#goods_price').html()));
- // $("#surplusmoney").html(parseInt(stunum)*parseFloat($('#goods_price').html()));
- }
- if(stunum==0&&$("#apply_class_hide").val()==-1){
- $("#grade_div").show();
- $("#select_grade").val(0);
- $("#notice").hide();
- }
- }
- $(".diy_select_list").click(function(){
- var data={
- "type_id":$('#type_id').val()
- };
- $('#good_type_name').val($(this).children('.focus').html());
- $('#apply_class').addClass('dn');
- $('#effective_date').addClass('dn');
- $('#g_price').addClass('dn');
- $('#sem').addClass('dn');
- $('.diy_select_txt1').html('请选择商品');
- $('#goods_id').val(0);
- $.post("<?php echo Yii::app()->createUrl('order/getgoods')?>",data,function(flag){
- var m =JSON.parse(flag);
- if(m.status)
- {
- var str='<li val="0">请选择商品</li>';
- $.each(m.result,function(i,e){
- str+='<li val="'+ e.id+'">'+ e.goods_name+'</li>'
- });
- $('#_goods_id').html(str);
- }else
- {
- var str='<li val="0">请选择商品</li>';
- $('#goods_id').val(0);
- $('#_goods_id').html(str);
- }
- });
- });
- $(".diy_select_list1").click(function(){
- var data={
- "goods_id":$('#goods_id').val(),
- "type":"<?php echo $type ?>"
- };
- $('#g_price').addClass('dn');
- $('#sem').addClass('dn');
- $('.diy_select_txt2').html('请选择学科');
- $('#goods_spec_id').val(0);
- $('.diy_select_txt3').html('请选择班级');
- $('#class_id').val(0);
-
- if(arrs){
- arrs=[];
- $("#select_class_num").html("0")
- $("#select_stu_num").html("0")
- $("#classstunum").html("")
- }
-
- var str='';
-
- $('#ajax_students_name').html(str);
- $('#select_student_name').html(str);
- $.post("<?php echo Yii::app()->createUrl('order/getsubject')?>",data,function(flag){
- var m =JSON.parse(flag);
- if(m.status)
- {
- $('#apply_class').removeClass('dn');
- var s='';
- switch (parseInt(m.apply_class))
- {
- case -1 :
- s = '全年级';
- break;
- case 1 :
- s = '高一';
- break;
- case 2 :
- s = '高二';
- break;
- case 3 :
- s = '高三';
- break;
- }
-
- $("#apply_class_hide").val(parseInt(m.apply_class))
- $('.apply_class').html(s);
- var str='<li val="0">请选择学科</li>';
-
- $.each(m.result,function(i,e){
- str+='<li val="'+ e.id+'">'+ e.name+'</li>'
- });
- $('#_goods_spec_id').html(str);
- if(m.apply_class==-1){
- $("#grade_div").show();
- }else{
- $("#grade_div").hide();
- }
- if(m.class){
-
- var html="";
- $.each(m.class,function(i,e){
- html+='<li val="'+e.class_id+'" grade='+e.grade+'>'+e.class_name+'</li>'
- });
-
- $('#classes').html(html);
-
- }
- }else
- {
- var str='<li val="0">请选择学科</li>';
- $('#goods_spec_id').val(0);
- $('#_goods_spec_id').html(str);
- }
- });
- });
- $(".diy_select_list2").click(function(){
- var data={
- "goods_spec_id":$('#goods_spec_id').val()
- };
- $.post("<?php echo Yii::app()->createUrl('order/getsubject_one')?>",data,function(flag){
- var m =JSON.parse(flag);
- if(m.status)
- {
- $('#g_price').removeClass('dn');
- $('.g_price').html(m.result.price);
- $('#goods_price').html(m.result.price);
- if(m.classify==0){
- $(".sem").html(m.semname);
- $('#sem').removeClass('dn');
- $('#effective_date').addClass('dn');
- $("#settime").hide();
- }else{
- <?php if($type!="test"){ ?>
- $("#settime").show();
- <?php } ?>
- // $('#apply_class').addClass('dn');
- $('#effective_date').removeClass('dn');
- $('.effective_date').html(m.effective_date+"天");
- }
- if($("#t_num").html())
- {
- $("#total_price").html(parseInt($("#t_num").html())*parseFloat($('#goods_price').html())*100/100);
- // $("#pay_money").val(parseInt($("#t_num").html())*parseFloat($('#goods_price').html()));
- }
- }
- });
- });
- $(".diy_select_list3").click(function(){
- var goods_id = $('#goods_id').val();
- var classid=$("#class_id").val()
- var data={
- "class_id":classid,
- "goods_id":goods_id,
- <?php if(@$orderid){ ?>
- "orderid":"<?php echo @$orderid;?>",
- <?php } ?>
- };
- if(!goods_id)
- {
- $('.diy_select_txt3').html('请选择班级');
- $('#class_id').val(0);
- $('#err_msg').html('请先选择商品,再选择班级');
- tp.fadeIn();
- $("body").css({height : lq+"px",overflow:"hidden"});
- return;
- }
- $('#select_student_name').html('');
- $('#class_name').val($(this).children('.focus').html());
- $('#ajax_students_name').html("");
- $('#select_student_name').html("");
- <?php if($type!="test"){ ?>
- $.post("<?php echo Yii::app()->createUrl('order/getstudent')?>",data,function(flag){
- <?php }else{ ?>
- $.post("<?php echo Yii::app()->createUrl('order/getstudent_test')?>",data,function(flag){
- <?php } ?>
- var m =JSON.parse(flag);
-
- if(m.status==2)
- {
- $('.diy_select_txt3').html('请选择班级');
- $('#class_id').val(0);
- $('#err_msg').html('此商品不符合当前年级');
- tp.fadeIn();
- $("body").css({height : lq+"px",overflow:"hidden"});
- return;
- }
- if(m.status==0||m.status==1){
- var str="";
- var str1="";
- var orderstuid=new Array();
- var arrs=jQuery.parseJSON($('.dahei').val());
- console.log(arrs)
- $.each(arrs,function(n,value) {
- if(value.classid==classid){
- // $.each(m.orderstu,function(key,val) {
- // orderstuid.push(val.student_id);
- // str1+='<p val="'+ val.student_id+'">'+ val.student_name+'</p>';
- // })
- $.each(value.stus,function(key,val) {
- orderstuid.push(val);
- str1+='<p val="'+ val+'">'+ value.stus_name[key]+'</p>';
- })
- }
- });
- $.each(m.result,function(i,e){
- if(orderstuid.indexOf(e.student_id)==-1){
- str+='<p val="'+ e.student_id+'">'+ e.realname+'</p>';
- }
- });
-
- str+=$('#ajax_students_name').html();
- $('#ajax_students_name').html(str);
- str1+=$('#select_student_name').html();
- $('#select_student_name').html(str1);
- }
- });
-
- });
- $(".del-all").click(function(){
- $("#classstunum").html("");
- $("#select_class_num").html("0");
- $("#select_stu_num").html("0");
- $(".dahei").val("[]");
- var html=$("#select_student_name").html();
- $("#select_student_name").html('');
- $("#ajax_students_name").append(html);
- $("#grade_div").show();
- $("#select_grade").val(0);
- $("#notice").hide();
- arrs=[];
- });
- $('#my_submit').click(function(){
- var issub=0;
- var type_id = $('#type_id').val();
- var goods_id = $('#goods_id').val();
- var goods_spec_id = $('#goods_spec_id').val();
- var class_id = $('#class_id').val();
- var student_ids = $('.dahei').val();
- var students = $('input[name=students]:checked').val();
- var pay_account = $('#pay_account').val();
- var pay_money = $('#pay_money').val();
- var datebut = $('#datebut').val();
- var pic = $('#pic').val();
- var trial_begin_time =$("#trial_begin_time").val();
- var trial_begin_time_test =$("#trial_begin_time_test").val();
- if(!parseInt(type_id))
- {
- $('#err_msg').html('商品类型不能为空');
- tp.fadeIn();
- $("body").css({height : lq+"px",overflow:"hidden"});
- return;
- }
- if(!parseInt(goods_id))
- {
- $('#err_msg').html('商品不能为空');
- tp.fadeIn();
- $("body").css({height : lq+"px",overflow:"hidden"});
- return;
- }
- if(!parseInt(goods_spec_id))
- {
- $('#err_msg').html('学科不能为空');
- tp.fadeIn();
- $("body").css({height : lq+"px",overflow:"hidden"});
- return;
- }
- if(!parseInt(class_id))
- {
- $('#err_msg').html('未选择班级');
- tp.fadeIn();
- $("body").css({height : lq+"px",overflow:"hidden"});
- return;
- }
- if(!student_ids)
- {
- $('#err_msg').html('未选择学生');
- tp.fadeIn();
- $("body").css({height : lq+"px",overflow:"hidden"});
- }else{
- var ishavenum=0;
- var arrs=jQuery.parseJSON(student_ids);
- $.each(arrs,function(n,value) {
- if(value.stus.length>0){
- ishavenum++;
- }
- });
- if(ishavenum==0){
- $('#err_msg').html('未选择学生');
- tp.fadeIn();
- $("body").css({height : lq+"px",overflow:"hidden"});
- return;
- }
- }
- <?php if($type!="test"){ ?>
- if(pay_account.length>60)
- {
- $('#err_msg').html('支付帐号太长');
- tp.fadeIn();
- $("body").css({height : lq+"px",overflow:"hidden"});
- return;
- }
- if(pay_money){
- var j = /(^[-+]?[1-9]\d*(\.\d{1,2})?$)|(^[-+]?[0]{1}(\.\d{1,2})?$)/;
- if(!j.test(pay_money)){
- $('#err_msg').html('只能为数字或两位小数');
- tp.fadeIn();
- $("body").css({height : lq+"px",overflow:"hidden"});
- return;
- }
-
- }
- if(!$("#settime").is(":hidden")){
- if(!trial_begin_time){
- $('#err_msg').html('未选择开始时间');
- tp.fadeIn();
- $("body").css({height : lq+"px",overflow:"hidden"});
- return;
- }
- }
- <?php }else{ ?>
- if(!student_ids)
- {
- $('#err_msg').html('未选择班级');
- tp.fadeIn();
- $("body").css({height : lq+"px",overflow:"hidden"});
- return;
- }
- if(!trial_begin_time_test){
- $('#err_msg').html('未选择开始时间');
- tp.fadeIn();
- $("body").css({height : lq+"px",overflow:"hidden"});
- return;
- }
- <?php } ?>
- $("#orderAdd").submit();
- $("#my_submit").attr("disabled",true)
- });
- var grade_text="";
- var grade=0;
- $('#grade li').click(function(){
- grade=$(this).attr("val");
- grade_text=$(this).text();
- $(".diy_select_txt3").text('请选择班级');
- $("#ajax_students_name").html("");
- $("#classes li").each(function(){
- if(grade!=0){
- if($(this).attr("grade")==grade){
- $(this).show();
- }else{
- $(this).hide();
- }
- }else{
- $(this).show();
- }
- });
-
- })
- });
-
- </script>
|