123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768 |
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="utf-8">
- <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
- <title>商品变更申请</title>
- <meta name="description" content="">
- <meta name="keywords" content="">
- <link href="/css/ims/base.css" rel="stylesheet">
- <link rel="stylesheet" type="text/css" href="/css/ims/jquery.datetimepicker.css"/>
- <link rel="stylesheet" type="text/css" href="/css/ims/bootstrap.min.css"/>
- <link rel="stylesheet" type="text/css" href="/css/ims/ace.min.css"/>
- <link href="/css/ims/ims.css" rel="stylesheet">
- <style>
- .ims-box {
- padding: 30px 50px;
- }
- .ims-box > h1 {
- font-size: 28px;
- }
- .screen {
- width:100%;
- }
- .screen li {
- height: 30px;
- line-height: 30px;
- border: 1px solid #DBDBDB;
- font-size: 0;
- }
- .screen span {
- display: inline-block;
- font-size: 13px;
- }
- .screen .title {
- width: 100px;
- background-color: #EAEAEA;
- text-align: center;
- }
- /*.screen .type {*/
- /*width: 400px;*/
- /*}*/
- .screen .type label {
- margin: 0 20px;
- }
- .list {
- overflow: hidden;
- }
- .list h2 {
- line-height: 30px;
- }
- .list .student-list_box {
- width: 30%;
- }
- .list .student-selected_box {
- margin-left: 60px;
- width: 60%;
- overflow-x: scroll;
- }
- .list .student-list {
- height: 360px;
- overflow: auto;
- padding: 20px;
- background-color: #eef3ff;
- }
- .list .student-list li {
- line-height: 30px;
- cursor: pointer;
- }
- .list .student-list li.active .btn-select_all {
- display: inline-block;
- }
- .list .student-list span {
- cursor: pointer;
- }
- .list .btn-select_all {
- margin-left: 84px;
- color: #2977ff;
- }
- .student-name_box li {
- position: relative;
- margin-left: 28px;
- line-height: 30px;
- }
- .student-name_box input {
- position: absolute;
- left: 140px;
- top: 8px;
- }
- .btn-select_all, .student-name_box {
- display: none;
- }
- .student-selected {
- height: 400px;
- overflow: auto;
- }
- .student-selected li {
- float: left;
- margin-right: 24px;
- margin-bottom: 12px;
- width: 280px;
- height: 26px;
- line-height: 26px;
- text-indent: 20px;
- background-color: #f2f2f2;
- }
- .student-selected .btn-delete {
- float: right;
- margin-right: 20px;
- color: red;
- cursor: pointer;
- }
- .btn-trial {
- display: block;
- margin: 0 auto;
- margin-top: 100px;
- margin-bottom: 50px;
- width: 430px;
- line-height: 54px;
- color: #fff;
- font-family: PingFangSC-Regular, "PingFang SC";
- font-weight: 400;
- font-style: normal;
- font-size: 20px;
- text-align: center;
- background-color: #2977ff;
- cursor: pointer;
- }
- .layui-layer-btn .layui-layer-btn0 {
- border-color: #2977ff !important;
- background-color: #2977ff !important;
- color: #fff;
- }
- .stop-layer-box, .resubmit-layer-box, .delete-layer-box {
- line-height: 140px;
- text-align: center;
- }
- .ims-add-student-box {
- margin: 20px;
- }
- .ims-add-student-box p{
- margin: 0;
- }
- .ims-add-student-box .ims-title{
- font-size: 20px;
- font-weight: bold;
- }
- .ims-add-student-box .ims-title span{
- margin-right: 20px;
- }
- .ims-add-student-box .add-student-box {
- margin-top: 20px;
- font-size: 0;
- overflow: hidden;
- }
- .ims-add-student-box .add-student-box>div{
- display: inline-block;
- height: 530px;
- font-size: 14px;
- vertical-align: top;
- }
- .ims-add-student-box .add-student-box .add-student-title{
- padding: 0 8px;
- line-height: 30px;
- color: #fff;
- background-color: #2977ff;
- }
- .ims-add-student-box .add-student-box .add-student-title label{
- font-size: 14px;
- font-weight: normal;
- cursor: pointer;
- margin-bottom: 0;
- }
- .ims-add-student-box .add-student-box .add-student-title input{
- vertical-align: middle;
- margin: 0;
- }
- #input-search-student{
- width: 120px;
- height: 20px;
- border: 0;
- color:#000;
- }
- .ims-add-student-box .add-student-box{
- line-height: 30px;
- min-width: 938px;
- }
- .ims-add-student-box .add-student-box .class-box {
- width: 180px;
- text-align: center;
- border: 1px solid #ccc;
- }
- .ims-add-student-box .student-list div{
- font-size: 14px;
- font-weight: normal;
- }
- .ims-add-student-box .add-student-box .class-list{
- height: 500px;
- overflow: auto;
- }
- .ims-add-student-box .add-student-box .class-list li{
- border-bottom: 1px solid #ccc;
- cursor: pointer;
- }
- .ims-add-student-box .class-list .active{
- color: #619aff;
- }
- .ims-add-student-box .add-student-box .student-list{
- margin: 0;
- width: 34%;
- min-width: 326px;
- border: 1px solid #ccc;
- border-left: 0;
- }
- .ims-add-student-box .student-list-content,.selected-list-content{
- padding: 8px;
- height: 500px;
- overflow: auto;
- }
- .ims-add-student-box .student-list-content label,.selected-list-content label{
- display: inline-block;
- width: 150px;
- cursor: pointer;
- font-size: 14px;
- font-weight: normal;
- }
- .ims-add-student-box .btn-search-student{
- height: 20px;
- line-height: 20px;
- padding: 0 5px;
- border-radius: 3px;
- color: #2977ff;
- background-color: #fff;
- border: none;
- outline: none;
- cursor: pointer;
- }
- .ims-add-student-box .btns-box {
- width: 100px;
- text-align: center;
- }
- .ims-add-student-box .btn-left,.ims-add-student-box .btn-right{
- margin: 150px auto 0;
- width: 40px;
- height: 40px;border: 1px solid #ccc;
- border-radius: 50%;
- background-color: #fff;
- text-align: center;
- line-height: 40px;
- cursor: pointer;
- }
- .ims-add-student-box .selected-list{
- width: 34%;
- min-width: 326px;
- border: 1px solid #ccc;
- }
- .ims-add-student-box .btn-confirm_purchase {
- display: block;
- margin: 0 auto;
- margin-top: 100px;
- margin-bottom: 50px;
- width: 200px;
- line-height: 54px;
- color: #fff;
- font-family: PingFangSC-Regular, "PingFang SC";
- font-weight: 400;
- font-style: normal;
- font-size: 20px;
- text-align: center;
- background-color: #2977ff;
- cursor: pointer;
- }
- .yiiPager li{display: inline}
- </style>
- </head>
- <body>
- <div class="ims-box">
- <h1 class="title">商品变更申请</h1>
- <div class="screen">
- 选择变更新销售订单
- <table id="formalOrderTable"
- class="table table-bordered table-hover dataTable no-footer DTTT_selectable"
- style="font-size:12px">
- <tr>
- <th class="title">选择学年</th>
- <th style="width:38%">
- <select name="schoolYear" id="schoolYear">
- <option value="0">选择学年</option>
- <?php
- if($schoolYear){
- foreach ($schoolYear as $value){
- echo '<option value="'.$value['schoolYearId'].'">'.$value['schoolYearName'].'</option>';
- }
- }
- ?>
- </select>
- </th>
- <th class="title">选择新销售订单</th>
- <th>
- <select name="sellOrder" id="sellOrder">
- <option value="0">选择新销售订单</option>
- </select>
- </th>
- </tr>
- <tr>
- <th class="title">售价</th>
- <th >
- <span class="sellingPrice">
- </span>
- </th >
- <th class="title" style="width:10%">商品</th>
- <th>
- <span class="goodsName">
- </span>
- </th>
- </tr>
- <tr>
- <th class="title">年级</th>
- <th >
- <span class="gradeName">
- </span>
- </th >
- <th class="title" style="width:10%">商品变更类型</th>
- <th>
- <span class="goodsChangeName" data-goods-change="">
- </span>
- </th>
- </tr>
- </table>
- 需变更财务订单
- <table id="formalOrderTable"
- class="table table-bordered table-hover dataTable no-footer DTTT_selectable"
- style="font-size:12px">
- <tr>
- <th class="title">财务订单号</th>
- <th style="width:38%">
- <select name="financeOrder" id="financeOrder">
- <option value="0">财务订单号</option>
- </select>
- </th>
- <th class="title">商品</th>
- <th>
- <span class="financeGoodsName">
- </span>
- </th>
- </tr>
- <tr>
- <th class="title">售价</th>
- <th >
- <span class="financeSellingPrice">
- </span>
- </th >
- <th class="title" style="width:10%">可变更人数</th>
- <th>
- <span class="canChangeNum">
- </span>
- </th>
- </tr>
- </table>
- </div>
- <div class="ims-add-student-box">
- <h2 class="ims-title"><span>添加学生</span></h2>
- <div class="add-student-box">
- <div class="class-box">
- <div class="add-student-title">
- <p>班级</p>
- </div>
- <ul class="class-list">
- </ul>
- </div>
- <div class="student-list">
- <div class="add-student-title clearfix">
- <span class="fl">
- <label>
- <input type="checkbox" name="select-all" value="1" />全选
- </label>
- <span></span>
- </span>
-
- </div>
- <div class="student-list-content" id="studentListContent">
- </div>
- </div>
- <div class="btns-box">
- <p class="btn-left" id="btnRemoveStudent"><</p>
- <p class="btn-right" id="btnAddStudent" >></p>
- </div>
- <div class="selected-list">
- <div class="add-student-title">
- <p>已选(<span id="studentSelectedLength">0</span>人)</p>
- </div>
- <div class="selected-list-content" id="selectedListContent">
- </div>
- </div>
- </div>
- </div>
- <a class="btn-trial">确定</a>
- </div>
- <script src="/js/productset/jquery.min.js"></script>
- <script src="/js/ims/jquery.datetimepicker.js"></script>
- <script src="/js/layer/layer.js"></script>
- </body>
- </html>
- <script>
- $(function(){
- var sellOrderArr=[],financeOrderArr=[];
- var classStudentArr={};
- $("#schoolYear").change(function(){
- var schoolYear=$(this).val();
- $('.sellingPrice').html('');
- $('.goodsName').html('');
- $('.gradeName').html('');
- $('.goodsChangeName').html('');
- $('.goodsChangeName').attr('data-goods-change','');
- $('.financeSellingPrice').html('');
- $('.financeGoodsName').html('');
- $('.canChangeNum').html('');
- $('.class-list').html('<li>暂无班级数据</li>');
- $('.student-list-content').html('');
- $('.selected-list-content').html('');
- $('#financeOrder').html('<option value="0">选择财务订单</option>');
- if(schoolYear!=0){
- sellOrderArr=[];
- $('#sellOrder').html('<option value="0">选择新销售订单</option>');
- $.ajax({
- url:'<?php echo $this->createUrl('imsSale/canChangeOrder')?>',
- type:'POST',
- dataType:'json',
- data:{'schoolYearId':schoolYear},
- success:function(res){
- if(res.status==1){
- html='<option value="0">选择新销售订单</option>';
- for(var i=0;i<res.data.length;i++){
- html+='<option value="'+res.data[i]['orderId']+'">'+res.data[i]['orderNo']+'</option>';
- sellOrderArr.push(res.data[i]);
- }
- $('#sellOrder').html(html);
- }
- }
- })
- }
- })
- $("#sellOrder").change(function(){
- var orderId=$(this).val();
- $('.sellingPrice').html('');
- $('.goodsName').html('');
- $('.gradeName').html('');
- $('.goodsChangeName').html('');
- $('.goodsChangeName').attr('data-goods-change','');
- $('.financeSellingPrice').html('');
- $('.financeGoodsName').html('');
- $('.canChangeNum').html('');
- $('.class-list').html('<li>暂无班级数据</li>');
- $('.student-list-content').html('');
- $('.selected-list-content').html('');
- if(orderId!=0){
- if(sellOrderArr.length>0){
- $.each(sellOrderArr,function(i,v){
- if(v.orderId==orderId){
- $('.sellingPrice').html(v.sellingPrice);
- $('.goodsName').html(v.goodsName);
- $('.gradeName').html(v.gradeName);
- $('.goodsChangeName').html(v.goodsChangeName);
- $('.goodsChangeName').attr('data-goods-change',v.goodsChange);
- }
- })
- }
- financeOrderArr=[]
- $('#financeOrder').html('<option value="0">选择财务订单</option>');
- $.ajax({
- url:'<?php echo $this->createUrl('imsSale/needChangeOrder')?>',
- type:'POST',
- dataType:'json',
- data:{'orderId':orderId},
- success:function(res){
- if(res.status==1){
- html='<option value="0">选择财务订单</option>';
- for(var i=0;i<res.data.length;i++){
- html+='<option value="'+res.data[i]['orderId']+'">'+res.data[i]['orderNo']+'</option>';
- financeOrderArr.push(res.data[i]);
- }
- $('#financeOrder').html(html);
- }
- }
- })
- }
- })
- $('#financeOrder').change(function(){
- var orderId=$(this).val();
- $('.canChangeNum').html('');
- $('.financeGoodsName').html('');
- $('.financeSellingPrice').html('');
- $('.class-list').html('<li>暂无班级数据</li>');
- $('.student-list-content').html('');
- $('.selected-list-content').html('');
- selectedDataAll=[];
- selectedDataValue=[];
- if(orderId!=0) {
- if (financeOrderArr.length > 0) {
- $.each(financeOrderArr, function (i, v) {
- if (v.orderId == orderId) {
- // $('.canChangeNum').html(v.canChangeNum);
- $('.financeGoodsName').html(v.goodsName);
- $('.financeSellingPrice').html(v.sellingPrice);
- }
- })
- }
- //查询可变理人数
- $.ajax({
- url:'<?php echo $this->createUrl('imsSale/searchChangeNum')?>',
- type:'POST',
- dataType:'json',
- data:{'orderId':$('#sellOrder').val(),financeOrderId:orderId},
- success:function(res){
- if(res.status==1){
- $('.canChangeNum').html(res.data['canChangeNum']);
- }else{
- $('.canChangeNum').html('');
- }
- }
- })
- //查询学生
- $.ajax({
- url:'<?php echo $this->createUrl('imsSale/orderStudentList')?>',
- type:'POST',
- dataType:'json',
- data:{'orderId':orderId},
- success:function(res){
- if(res.status==1){
- if(res.data.length>0){
- classStudentArr=res.data
- var html = '';
- $.each(res.data,function(i,v){
- html+='<li class="classified" classId="'+v['clazzId']+'">'+v['clazzName']+'</li>';
- })
- $('.class-list').html(html);
- }else{
- $('.class-list').html('<li>暂无班级数据</li>');
- }
- }
- }
- })
- }
- })
- //班级切换
- $(".class-list").on("click", "li", function(event) {
- $(".class-list li").removeClass("active");
- $(this).addClass("active");
- selectedClassId=classId=$(this).attr('classId');
- selectedClassName=className=$(this).html();
- getStudent(classId);
- });
- function getStudent(classId){
- var studentHtml='';
- if(classStudentArr.length>0){
- $.each(classStudentArr,function(i,v){
- if(v.clazzId==classId && v.studentInfoList.length>0){
- $.each(v.studentInfoList,function(k,value){
- studentHtml+='<label><input type="checkbox" name="studentName" classId="'+classId+'" className="'+v.clazzName+'" value="'+value.studentId+'" />'+value.studentName+'</label>';
- })
- }
- })
- }
- $('.student-list-content').html(studentHtml);
- }
- // 添加学生
- $("#btnAddStudent").on("click", function() {
- getStudentSelected();
- });
- // 移出学生
- $("#btnRemoveStudent").on("click", function() {
- removeStudentSelected();
- });
- // 全选按钮
- $("input[name='select-all']").change(function() {
- var type = $("input[name='select-all']").prop("checked")
- if(type){
- obj=$("#studentListContent").find("input");
- for(var i=0;i<obj.length;i++){
- if(obj.eq(i).attr('disabled')==undefined){
- obj.eq(i).prop("checked", true);
- }
- }
- }else{
- $("#studentListContent").find("input").prop("checked", false);
- }
- });
- function getStudentSelected() {
- var selectedData = $("#studentListContent input[name='studentName']:checked"); //获取所以选中学生
- var studentName = '';
- for (var i = 0; i < selectedData.length; i++) {
- if (!isSelected(selectedData[i].value)) {
- studentName = $(selectedData[i]).parent().text();
- var student ={
- name:studentName,
- value:selectedData[i].value,
- class:$(selectedData[i]).attr('className'),
- classId:$(selectedData[i]).attr('classId'),
- };
- selectedDataAll.push(student);
- selectedDataValue.push(selectedData[i].value);
- }else{
- //console.log(selectedData[i].value)
- }
- showSelectedStudent();
- }
- }
- function removeStudentSelected() {
- var selectedStudent = $("#selectedListContent input[name='selectedStudent']:checked"); //获取所有选中学生
- var selectedData = $("#studentListContent input[name='studentName']:checked"); //获取所以选中学生
- for (var i = 0; i < selectedStudent.length; i++) {
- $(selectedStudent[i]).parent().remove();
- if(selectedDataValue.length>0){
- for(var k=0;k<selectedDataValue.length;k++){
- if(selectedDataValue[k]===selectedStudent[i].value){
- selectedDataValue.splice(k,1);
- selectedDataAll.splice(k,1);
- }
- }
- }
- for (var j = 0; j < selectedData.length; j++) {
- if(selectedData[j].value===selectedStudent[i].value){
- $(selectedData[j]).prop("checked", false);
- }
- }
- }
- $('#studentSelectedLength').text(selectedDataAll.length);
- }
- function showSelectedStudent() {
- var selectedDataList = [];
- for (var i = 0; i < selectedDataAll.length; i++) {
- selectedDataList.push('<label><input type="checkbox" name="selectedStudent" value="'+ selectedDataAll[i].value +'" />'+selectedDataAll[i].name+'</label>');
- }
- $('#selectedListContent').html(selectedDataList);
- $('#studentSelectedLength').text(selectedDataAll.length);
- }
- function isSelected(val){
- return selectedDataValue.indexOf(val) > -1
- }
- // 提交
- var flag = true;
- $(".btn-trial").on("click", function () {
- if (selectedDataAll.length >0) {
- var oldOrderId=$('#financeOrder').val();
- var purposeOrderId=$('#sellOrder').val();
- var goodsChange= $('.goodsChangeName').attr('data-goods-change');
- var data = {
- oldOrderId: oldOrderId,
- purposeOrderId: purposeOrderId,
- studentList:JSON.stringify(selectedDataAll),
- goodsChange: goodsChange,
- };
- if (flag){
- flag = false;
- $.ajax({
- type: 'post',
- url: "<?php echo Yii::app()->createUrl('imsSale/saveGoodsChange')?>",
- dataType: 'json',
- data: data,
- success: function (data) {
- if (data.status){
- layer.alert(data.msg, {icon:1,closeBtn:0},function () {
- location.href="<?php echo Yii::app()->createUrl('imsSale/goodsChange')?>"
- });
- }else{
- flag = true;
- layer.alert(data.msg, {icon:2});
- }
- },
- error: function () {
- flag = true;
- layer.alert("提交失败!", {icon:2});
- }
- });
- }else{
- layer.msg("稍安勿躁,正在处理中...");
- }
- } else {
- layer.alert("请选择至少一个学生", {'icon':7});
- }
- });
- })
- </script>
|