123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113 |
- <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>
- <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" >
- <?php if($type!="test"){ ?>
- <h3>第二步:填写学生信息</h3>
- <table class="table-hide" style=" margin-top: 15px;">
- <tbody>
- <tr>
- <th><em>*</em>班级:</th>
- <td>
- <div class='diy_select3' style="width:175px;float: left;">
- <input type='hidden' class='diy_select_input3' id="class_id" name="class_id" value="<?php echo @$stu[0]['clazz_id']; ?>"/>
- <div class='diy_select_txt3' style="width:142px;">
- 请选择班级
- </div>
- <div class='diy_select_btn3'></div>
- <ul class='diy_select_list3' id="classes">
- <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>
- </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>
- </td>
- </tr>
- <?php if($type=="all"||$type=="ordinary"){ ?>
- <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>
- <?php } ?>
- </tbody>
- </table>
- <?php }else{ ?>
- <h3>第二步:选择试用范围</h3>
- <table class="table-hide" style=" margin-top: 15px;">
- <tbody>
- <th><em>*</em>可选班级:</th>
- <tr>
- <th></th>
- <td class="students-all clearfix">
- <div class="students-add fl">
- <input type="button" value="添加全部班级" class="add-btn"/>
- <div class="students-name" id="ajax_students_name">
- <?php
- if(@$classes){
- foreach(@$classes as $v){
- echo '<p val="'.$v['class_id'].'">'.$v['class_name'].'</p>';
- }
- }
- ?>
- </div>
- </div>
- <div class="students-del fr">
- <input type="button" class="del-btn" value="去掉全部班级" />
- <div class="students-name" id="select_student_name">
- <?php
- if(@$class){
- foreach(@$class as $v){
- echo '<p val="'.$v['clazz_id'].'">'.$v['clazz_name'].'</p>';
- }
- }
- ?>
- </div>
- </div>
- </td>
- </tr>
- <?php if($type=="all"||$type=="ordinary"){ ?>
- <tr>
- <th></th>
- <td>
- <ul class="selectedTotal">
- <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>
- <li class="clearfix tatal" id="classstunum">
- </li>
- </ul>
- </td>
- </tr>
- <?php } ?>
- </tbody>
- </table>
- <?php } ?>
- </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'})" >
- </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="请选择" onClick="jeDate({dateCell:'#trial_begin_time',isTime:true,format:'YYYY-MM-DD'})" >
- </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>
- <?php if($type=="test"){ ?>
- <input type="hidden" value='<?php
- if(@$class){
- foreach($class as $k=>$v){
- if($k<count($class)-1){
- echo $v['clazz_id'].",";
- }else{
- echo $v['clazz_id'];
- }
- }
- }
- ?>' class="dahei" name="student_ids">
- <?php }else{ ?>
- <input type="hidden" value='<?php echo $arrs; ?>' class="dahei" name="student_ids">
- <?php } ?>
- <input type="hidden" value="<?php echo @$orderinfo['apply_class'] ?>" id="apply_class_hide" name="apply_class_hide">
- <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;
- }else{
- foreach($stu as $k=>$v){
- if($k<count($stu)-1){
- echo $v['student_id'].",";
- }else{
- echo $v['student_id'];
- }
- }
- }
- }if(@$class){
- foreach(@$class as $k=>$v){
- if($k<count($class)-1){
- echo $v['clazz_id'].",";
- }else{
- echo $v['clazz_id'];
- }
- }
- }
- ?>' 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 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();
- });
- <?php if($type=="test"){ ?>
- function daheival(){
- var oP = $(".students-del .students-name p");
- var arr = [];
- for(var i=0;i<oP.length;i++){
- arr.push(oP.eq(i).attr("val"));
- }
- $(".dahei").val(arr.join(","));
- $("#student_num").html(oP.length);
- $("#t_num").html(oP.length);
- if($('#goods_price').html())
- {
-
- $("#total_price").html(parseInt(oP.length)*parseFloat($('#goods_price').html())*100/100);
- // $("#pay_money").val(parseInt(oP.length)*parseFloat($('#goods_price').html()));
- }
- }
- <?php }else{ ?>
- 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()
- // 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();
- 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"));
- }
- arrs.push(arr);
- }else{
- for(var i=0;i<oP.length;i++){
- arrs[index]['stus'].push(oP.eq(i).attr("val"));
- }
- }
- $(".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);
- }
- // $("#pay_money").val(parseInt(stunum)*parseFloat($('#goods_price').html()));
- // $("#surplusmoney").html(parseInt(stunum)*parseFloat($('#goods_price').html()));
- }
- }
- <?php } ?>
- $(".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);
- <?php if($type!="test"){ ?>
- if(arrs){
- arrs=[];
- $("#select_class_num").html("0")
- $("#select_stu_num").html("0")
- $("#classstunum").html("")
- }
- <?php } ?>
- 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.class){
- if("<?php echo $type ?>"=="test"){
- var html="";
- $.each(m.class,function(i,e){
- html+='<p val="'+e.class_id+'">'+e.class_name+'</p>'
- });
- $('#ajax_students_name').html(html);
- }else{
- var html="";
- $.each(m.class,function(i,e){
- html+='<li val="'+e.class_id+'">'+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());
- $.post("<?php echo Yii::app()->createUrl('order/getstudent')?>",data,function(flag){
- 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==1)
- // {
- // var str1='';
- // var str='';
- // var selectstu=new Array();
- // $.each(arrs,function(n,value) {
- // if(value.classid==$("#class_id").val()){
- // selectstu=value.stus
- // }
- // });
- //
- // $.each(m.result,function(i,e){
- // if(selectstu.indexOf(e.student_id)==-1){
- // str+='<p val="'+ e.student_id+'">'+ e.realname+'</p>';
- // }else{
- // str1+='<p val="'+ e.student_id+'">'+ e.realname+'</p>';
- // }
- // });
- // $('#select_student_name').html(str1);
- // $('#ajax_students_name').html(str);
- // }
- // if(m.status==0)
- // {
- //// $('.diy_select_txt3').html('请选择班级');
- // $('#class_id').val(0);
- //
- // var str='';
- //
- // $('#ajax_students_name').html(str);
- // }
- if(m.status==0||m.status==1){
- var str="";
- var str1="";
- var orderstuid=new Array();
- $.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(m.result,function(i,e){
- if(orderstuid.indexOf(e.student_id)==-1){
- str+='<p val="'+ e.student_id+'">'+ e.realname+'</p>';
- }
- });
- $('#ajax_students_name').html("");
- $('#select_student_name').html("");
- str+=$('#ajax_students_name').html();
- $('#ajax_students_name').html(str);
- str1+=$('#select_student_name').html();
- $('#select_student_name').html(str1);
- }
- });
-
- });
- $('#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;
- }
- <?php if($type!="test"){ ?>
- if(!parseInt(class_id))
- {
- $('#err_msg').html('未选择班级');
- tp.fadeIn();
- $("body").css({height : lq+"px",overflow:"hidden"});
- return;
- }
- // if(!pay_account)
- // {
- //
- // $('#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;
- }
- }
-
- 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;
- }
- }
- // if(!pay_money)
- // {
- // $('#err_msg').html('支付金额不能为空');
- // tp.fadeIn();
- // $("body").css({height : lq+"px",overflow:"hidden"});
- // return;
- //
- // }else
- // {
- // 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(parseFloat(pay_money)<=0){
- // $('#err_msg').html('金额不能为负数或为零');
- // tp.fadeIn();
- // $("body").css({height : lq+"px",overflow:"hidden"});
- // return;
- //
- // }
- //
- //
- // }
- // if(!datebut)
- // {
- // $('#err_msg').html('时间不为空');
- // tp.fadeIn();
- // $("body").css({height : lq+"px",overflow:"hidden"});
- // return;
- //
- // }
- // if(!pic&&!$("#oldpic").val())
- // {
- // $('#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)
- });
- });
- </script>
|