123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596 |
- <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");?>"' 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_back')?>" method="post" id="orderAdd" enctype="multipart/form-data">
- <input type="hidden" value="<?php echo @$orderid ?>" name="old_order_id">
- <?php }else{ ?>
- <form action="<?php echo Yii::app()->createUrl('order/update_back')?>" method="post" id="orderAdd" enctype="multipart/form-data">
- <input type="hidden" value="<?php echo $orderid ?>" name="orderid">
- <input type="hidden" value="<?php echo @$old_order_id ?>" name="old_order_id">
- <?php } ?>
- <input type="hidden" value="<?php echo @$type ?>" name="type">
- <div class="step-two steps-choose show" >
- <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['clazz_id']?>"><?php echo $v['clazz_name']?></li>
- <?php
- }
- }?>
- </ul>
- </div>
- <!-- <div style="margin-left: 10px;" id="back_all">
- <a href="#" onclick="back_all(1)">全部一键退订</a>
- </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>
- <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">
- <h3>第二步:填入实际退款金额</h3>
- <table class="table-hide">
- <tbody>
- <tr>
- <td colspan="2">已为<em id="student_num"><?php echo @count($stu) ?></em>名学生创建退单,应退款:<em id="total_price"></em>(元)</td>
- </tr>
- <tr>
- <th>付款账户:</th>
- <td>
- <input type="text" value="<?php echo @$orderinfo['account'] ?>" name="back_account" id="back_account" class="col-xs-10 col-sm-3 addborder addheight marginLeftNo">
- </td>
- </tr>
- <tr>
- <th>实际退款金额:</th>
- <td>
- <input type="text" value="<?php echo @$orderinfo['money'] ?>" unselectable="on" id="back_money" name="back_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>
- </tbody>
- </table>
- </div>
- <div class="create-orders">
- <span id="goods_price" style="display: none"><?php echo @$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['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)
- 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 back_all(act){
- if(act==1){
- $("#back_all").html("<a href='#' onclick='back_all(0)'>取消全部一键退订</a>");
- }else{
- $("#back_all").html("<a href='#' onclick='back_all(1)'>全部一键退订</a>");
- }
-
- }
- 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();
- });
- 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()));
- 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()));
- }
- }
- $(".diy_select_list").click(function(){
- var data={
- "type_id":$('#type_id').val()
- };
- $('#good_type_name').val($(this).children('.focus').html());
- $('#apply_class').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_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');
- $(".sem").html(m.semname);
- $('#sem').removeClass('dn');
- $('.g_price').html(m.result.price);
- $('#goods_price').html(m.result.price);
-
- if($("#t_num").html())
- {
- $("#total_price").html(parseInt($("#t_num").html())*parseFloat($('#goods_price').html()));
- // $("#pay_money").val(parseInt($("#t_num").html())*parseFloat($('#goods_price').html()));
- }
- }
- });
- });
- $(".diy_select_list3").click(function(){
- var goods_id = $('#goods_id').val();
- var data={
- "class_id":$("#class_id").val(),
- <?php if(@$orderid){ ?>
- "orderid":"<?php echo @$orderid;?>",
- <?php } ?>
- <?php if(@$old_order_id){ ?>
- "old_order_id":"<?php echo @$old_order_id;?>",
- <?php } ?>
- };
- $('#select_student_name').html('');
- $('#class_name').val($(this).children('.focus').html());
- $.post("<?php echo Yii::app()->createUrl('order/get_back_student')?>",data,function(flag){
- var m =JSON.parse(flag);
- 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.student_name+'</p>';
- }else{
- str1+='<p val="'+ e.student_id+'">'+ e.student_name+'</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);
- }
-
- });
-
- });
- $('#my_submit').click(function(){
- var issub=0;
- var type_id = $('#type_id').val();
- var class_id = $('#class_id').val();
- var student_ids = $('.dahei').val();
- var students = $('input[name=students]:checked').val();
- var back_account = $('#back_account').val();
- var back_money = $('#back_money').val();
- 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;
- }
- }
-
- if(back_account.length>60)
- {
- $('#err_msg').html('支付帐号太长');
- tp.fadeIn();
- $("body").css({height : lq+"px",overflow:"hidden"});
- return;
- }
- if(back_money){
- var j = /(^[-+]?[1-9]\d*(\.\d{1,2})?$)|(^[-+]?[0]{1}(\.\d{1,2})?$)/;
- if(!j.test(back_money)){
- $('#err_msg').html('只能为数字或两位小数');
- tp.fadeIn();
- $("body").css({height : lq+"px",overflow:"hidden"});
- return;
- }
-
- }
- $("#orderAdd").submit();
- $("#my_submit").attr("disabled",true)
- });
- });
- </script>
|