123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590 |
- <script src="/js/productset/jquery.min.js"></script>
- <script src="/js/ims/jquery.datetimepicker.js"></script>
- <script src="/js/layer/layer.js"></script>
- <script src="/js/ims/xsgl.js"></script>
- <script type="text/javascript" src="/js/ims/qrcode.min.js"></script>
- <script>
- $(document).ready(function () {
- <?php if (isset($_GET['startDate'])):?>
- $("#some_class_1").attr("value", "<?php echo $_GET['startDate']?>");
- $("#some_class_2").attr("value", "<?php echo $_GET['endDate']?>");
- <?php endif;?>
- <?php if (isset($_GET['inCode'])):?>
- $("#inCode").attr("value", "<?php echo $_GET['inCode']?>");
- <?php endif;?>
- <?php if(isset($_GET['isUse'])):?>
- var isUse = "<?php echo $_GET['isUse'];?>";
- $('#isUse').val(isUse);
- var txt = $('.select-isUse li[val=' + isUse + ']').html();
- $('.select-isUse .diy_select_txt').html(txt);
- <?php endif;?>
- <?php if(isset($_GET['itemId']) && $_GET['itemId'] != ''):?>
- var itemId = "<?php echo $_GET['itemId'];?>";
- $('#itemId').val(itemId);
- var txt = $('.select-itemId li[val=' + itemId + ']').html();
- $('.select-itemId .diy_select_txt').html(txt);
- <?php endif;?>
-
- <?php if(isset($_GET['itemType']) && $_GET['itemType'] != ''):?>
- var itemType = "<?php echo $_GET['itemType'];?>";
- $('#itemType').val(itemId);
- var txt = $('.select-itemType li[val=' + itemType + ']').html();
- $('.select-itemType .diy_select_txt').html(txt);
- <?php endif;?>
- <?php if(isset($_GET['inputStatus']) && $_GET['inputStatus'] != ''):?>
- var inputStatus = "<?php echo $_GET['inputStatus'];?>";
- $('#inputStatus').val(inputStatus);
- var txt = $('.select-inputStatus li[val=' + inputStatus + ']').html();
- $('.select-inputStatus .diy_select_txt').html(txt);
- <?php endif;?>
- $('.some_class').datetimepicker({
- format: "Y-m-d", //格式化日期
- timepicker: false //关闭时间选项
- });
- //初始化状态
- var currStatus = "<?php echo isset($_GET['status']) ? $_GET['status'] : '';?>";
- if (currStatus > 0) {
- var statusText = $(".pm_status>li[val='" + currStatus + "']").text();
- $(".pm_status_txt").text(statusText);
- }
- //初始化品目
- var currPmId = "<?php echo isset($_GET['itemId']) ? $_GET['itemId'] : '';?>";
- if (currPmId > 0) {
- var pmNameText = $(".pm_name>li[val='" + currPmId + "']").text();
- $(".select-itemId .pm_name_txt").text(pmNameText);
- }
- //增加出库单
- $(".add_use_order").click(function () {
- window.location.href = "<?php echo $this->createUrl('imsStore/useAddEdit');?>";
- });
- //增加退库库单
- $(".add_out_order").click(function () {
- window.location.href = "<?php echo $this->createUrl('imsStore/outAddEdit');?>";
- });
- //取消发放新增
- $(".cancle_out").click(function () {
- window.location.href = "<?php echo $this->createUrl('imsStore/deliveryOutAdd');?>";
- });
- //切换领用和出库
- $(".use-out>a").click(function () {
- $(this).addClass("active").siblings().removeClass("active");
- var index = $(this).index();
- var type = $(this).attr('type');
- var url = '';
- if(type == 'out'){
- url = "<?php echo $this->createUrl('imsStore/useOut',array('useOutType'=>'out'));?>";
- }else if(type == 'use'){
- url = "<?php echo $this->createUrl('imsStore/useOut',array('useOutType'=>'use'));?>";
- }else{
- url = "<?php echo $this->createUrl('imsStore/useOut',array('useOutType'=>'cancle'));?>";
- }
- window.location.href = url;
- // $(".ims-box").eq(index).removeClass('hidden').siblings(".ims-box").addClass('hidden');
- });
- $("body").delegate(".grade>span", "click", function () {
- $(this).parent().children(".student-list").toggle();
- return false;
- });
- $("body").delegate(".student-list>.class-li>span", "click", function () {
- $(this).parent().toggleClass("active");
- $(this).parent().children(".student-name_box").toggle();
- return false;
- });
- // 单选按钮
- $('body').on('change', "input[name='studentName']", function () {
- getsStudentSelected();
- });
- //关联订单
- $(".rel-order").click(function () {
- var isUse = $(this).attr('isUse');
- if(isUse <= 0){
- layer.alert('请先完成签字', {icon: 7});
- return false;
- }
- });
- //指定明细
- //-----------------------编辑名单-common---------------------------
- function selectedSet(selectObj){
- selectObj.each(function(idx){
- var val = $(this).attr('value');
- $('.student-list_box').find('input[value='+val+']').prop("checked",true)
- })
- $(".student-list").each(function(){
- var count = 0;
- $(this).find('input').each(function(){
- if($(this).is(":checked")){
- count++;
- }
- })
- if(count == $(this).find('input').length){
- $(this).find('.btn-select_all').addClass('isSelected')
- }else{
- $(this).find('.btn-select_all').removeClass('isSelected')
- }
- })
- }
- $("body").delegate('.appoint-detail',"click", function () {
- var orderId = $(this).attr('orderId');
- var outId = $(this).attr('outId');
- var appointObj = $(this);
- $.ajax({
- type: 'POST',
- url: "<?php echo $this->createUrl('imsStore/ajaxAppointDetail');?>",
- data: {orderId: orderId,outId:outId},
- async: false,
- dataType: 'json',
- success: function (result) {
- if (result.status == 1) {
- $('.student-list_box').html(result.data);
- isGetStu = true;
- } else {
- layer.msg('学生列表获取失败!');
- return false;
- }
- },
- error: function (jqXHR, textStatus, errorThrown) {
- layer.msg('学生列表获取失败!');
- return false;
- }
- });
- //初始化选择的学生
- getsStudentSelected();
- // if (isGetStu == false) {
- // return false;
- // }
-
- selectedSet($(".student-selected i"));
- var layerEditIndex = layer.open({
- type: 1,
- title: '明细订单',
- btn: ['保存'],
- area: ['800px', '420px'], //宽高
- btnAlign: 'c',
- content: $('.layer-edit'),
- yes: function (index, layero) {
- //选择的学生
- var stuSeled = $(".student-selected i");
- var _studentIds = [];
- var _classId = 0;
- stuSeled.each(function () {
- _classId = $(this).attr('classId');
- _studentIds.push($(this).attr('value'));
- });
- if(_studentIds.length <= 0){
- layer.msg('请选择学生!');
- return false;
- }
- $.ajax({
- type: 'post',
- url: "<?php echo Yii::app()->createUrl('imsStore/ajaxSaveRelOrder');?>",
- data: {'outId':outId,studentIds:_studentIds},
- dataType: 'json',
- success: function (data) {
- if (data.status) {
- layer.alert("操作成功", {icon:1,closeBtn:0})
- layer.closeAll();
- location.reload();
- } else {
- layer.alert(data.msg, {icon: 7});
- return false;
- }
- },
- error: function () {
- layer.msg("网络异常");
- return false;
- }
- })
- layer.close(layerEditIndex);
- }
- });
- return false;
- });
- // 全选按钮
- $("body").delegate(".btn-select_all", "click", function () {
- var obj = $(this).parent().find("input");
- if($(this).hasClass('isSelected')){
- obj.each(function () {
- $(this).prop("checked", false);
- })
- $(this).removeClass("isSelected");
- }else{
- obj.each(function () {
- $(this).prop("checked", true);
- })
- $(this).addClass("isSelected");
- }
-
- getsStudentSelected();
- return false;
- });
- //删除学生
- $(".student-selected").on("click", ".btn-delete", function () {
- $(this).parent().remove();
- var studentValue = $(this).attr('value');
- $("input[value='" + studentValue + "']").prop("checked", false);
- var selectedData = $("input[name='studentName']:checked"); //获取所以选中学生
- $('#studentSelectedLength').text(selectedData.length);
- return false;
- });
- //选择学生
- function getsStudentSelected() {
- var selectedData = $("input[name='studentName']:checked"); //获取所以选中学生
- var selectedDataList = [];
- var studentName, studentClass = '';
- var classId = 0;
- for (var i = 0; i < selectedData.length; i++) {
- studentName = $(selectedData[i]).parent().text();
- classId = $(selectedData[i]).attr('classId');
- console.log(classId)
- studentClass = $(selectedData[i]).parents('li').children('span.classTitle').text();
- selectedDataList.push('<li><span class="stu_name">' + studentName + '</span>--<span class="stu_class">' + studentClass + '</span><i class="btn-delete" classId="'+classId+'" value="' + selectedData[i].value + '" gradeName="' + $(selectedData[i]).attr('gradeName') + '" className="' + $(selectedData[i]).attr('className') + '">X</i></li>');
- }
- $('.student-selected').html(selectedDataList);
- $('#studentSelectedLength').text(selectedData.length);
- };
-
- //加减库存
- $(".reduce-out").click(function () {
- var obj = $("input[name='out_stock_num']");
- var stock_nun = parseInt(obj.val());
- if(stock_nun > 1){
- obj.val(stock_nun - 1);
- }
- });
- $(".add-out").click(function () {
- var obj = $("input[name='out_stock_num']");
- var stock_nun = parseInt(obj.val());
- if(stock_nun < $(".valid-num").text()){
- obj.val(stock_nun + 1);
- }
- });
- //生成二维码
- $(".sign-btn").click(function () {
- var url = $(this).attr('url');
- $("#qrcode").html('');
- if(!url){
- layer.msg("没有地址");
- return false;
- }
- var qrcode = new QRCode(document.getElementById("qrcode"), {
- width : 100,
- height : 100
- });
- qrcode.makeCode(url);
- $(".qrcode-fram img").on('load',function(){
- layer.open({
- type: 1,
- title: '签字二维码',
- btn: ['关闭'],
- area: ['340px', '240px'], //宽高
- btnAlign: 'c',
- content: '<div style="text-align:center;"><div id="imsCode">'+$("#qrcode").html()+'</div><p style="font-size: 12px">手机扫描二维码,到手机浏览器打开签字链接</p></div>',
- yes: function(index){
- location.reload();
- },
- btn2: function (index, layero) {
- //取消按钮
- // console.log(111)
- //return false 开启该代码可禁止点击该按钮关闭
- }
- });
- });
- return false;
- });
- $(".signed-btn").click(function () {
- var imgUrl = $(this).attr('imgUrl');
- if(!imgUrl){
- return false;
- }
- layer.open({
- type: 1,
- title: '签字图片',
- btn: ['关闭'],
- area: ['500px', '300px'], //宽高
- btnAlign: 'c',
- content: '<div style="text-align:center;"><img style="max-width:100%;" src="'+imgUrl+'"/> </div>',
- btn2: function (index, layero) {
- //取消按钮
- // console.log(111)
- //return false 开启该代码可禁止点击该按钮关闭
- }
- });
- });
- /*************************************************** 退库 *************************************/
- //删除
- $(".del-btn").on("click", function () {
- var outId = $(this).attr('outId');
- layer.confirm('您确定删除吗?', {
- btn: ['确定', '取消'] //按钮
- }, function () {
- $.ajax({
- type: 'post',
- url: "<?php echo Yii::app()->createUrl('imsStore/ajaxDelOut');?>",
- data: {'outId': outId},
- dataType: 'json',
- success: function (data) {
- if (data.status) {
- layer.alert("删除成功", {icon:1,closeBtn:0},function (index) {
- location.reload();
- layer.closeAll();
- });
- } else {
- layer.alert(data.msg, {icon: 7});
- }
- },
- error: function () {
- layer.msg("网络异常");
- }
- })
- });
- });
- //确认退库
- $(".confirm-out").click(function () {
- var outId = $(this).attr('outId');
- $.ajax({
- type: 'get',
- url: "<?php echo Yii::app()->createUrl('imsStore/ajaxConfirmOut');?>",
- data: {'outId': outId},
- dataType: 'json',
- success: function (data) {
- if (data.status) {
- layer.alert("提交成功", {icon: 1,closeBtn:0},function (index) {
- location.reload();
- layer.closeAll();
- });
- } else {
- layer.alert(data.msg, {icon: 7});
- return false;
- }
- },
- error: function () {
- layer.msg("网络异常");
- return false;
- }
- })
- layer.closeAll();
- });
- //出库和退库,删除和中止
- $(".del-stop-btn").click(function () {
- var businessKey = $(this).attr('businessKey');
- var doType = $(this).attr('doType');
- $.ajax({
- type: 'get',
- url: "<?php echo Yii::app()->createUrl('imsStore/ajaxOutDelStop');?>",
- data: {'businessKey': businessKey,doType:doType},
- dataType: 'json',
- success: function (data) {
- if (data.status) {
- layer.alert("提交成功", {icon: 1,closeBtn:0},function (index) {
- location.reload();
- layer.closeAll();
- });
- } else {
- layer.alert(data.msg, {icon: 7});
- return false;
- }
- },
- error: function () {
- layer.msg("网络异常");
- return false;
- }
- })
- });
- //催办
- $("body").on("click", ".btn-urge", function () {
- var flag = true;
- var businessKey = $(this).attr('businessKey');
- layer.open({
- type: 1,
- title: '催办',
- btn: ['确定', '取消'],
- area: ['600px', '400px'], //宽高
- btnAlign: 'c',
- content: '<p style="color: red;display: none;" class="alert-msg"></p><div class="urge-layer-box"><span>内容:</span><textarea rows="10" cols="60" id="urgeText" /></div>',
- yes: function (index, layero) {
- //提交
- var text = $('#urgeText').val();
- var data = {
- 'smeDesc': text,
- 'businessKey': businessKey
- };
- if ($.trim(text)) {
- if (flag) {
- flag = false;
- $.ajax({
- type: 'post',
- url: "<?php echo Yii::app()->createUrl('imsSale/urge');?>",
- data: data,
- dataType: 'json',
- success: function (data) {
- if (data.status) {
- layer.closeAll();
- location.reload();
- } else {
- flag = true;
- $('.alert-msg').html(data.msg).fadeIn();
- }
- },
- error: function () {
- flag = true;
- $('.alert-msg').html("异常错误").fadeIn();
- }
- });
- }
- } else {
- $('.alert-msg').html("请填写内容").fadeIn();
- }
- },
- btn2: function (index, layero) {
- //取消按钮
- console.log(111)
- //return false 开启该代码可禁止点击该按钮关闭
- }
- });
- });
- $(".viewStudent").on("click", function () {
- var inId = $(this).attr('inId');
- loadStudent(inId,1);
- return false;
- });
- function loadStudent(inId,page){
- $('.layer-relate').find('tbody').html('');
- $('input[name=inId]').val(inId);
- $.ajax({
- type: 'post',
- url: "<?php echo Yii::app()->createUrl('imsStore/AjaxSaleStudentList');?>",
- data: {'inId': inId,'page':page},
- dataType: 'json',
- success: function (res) {
- if(res.status==1){
- list=res.data.list;
- if(list.length>0){
- var html='';
- for(var i=0;i<list.length;i++){
- html+='<tr>';
- html+='<td>'+list[i]['clazzName']+'</td>';
- html+='<td>'+list[i]['studentName']+'</td>';
- html+='</tr>';
- }
- $('.layer-relate').find('tbody').html(html);
- }
- $('.last_page').html(res.data['lastPage']);
- $('.now_page').html(res.data['pageNum']);
- if(res.data['pageNum']==1){
- $('.prev').addClass('hide');
- }
- if(res.data['pageNum']==res.data['lastPage']){
- $('.next').addClass('hide');
- }
- layer.open({
- type: 1,
- title: '学生列表',
- btn: ['关闭'],
- area: ['810px', '420px'], //宽高
- btnAlign: 'c',
- content: $('.layer-relate'),
- yes: function (index, layero) {
- layer.closeAll();
- }
- });
- }
- }
- });
- $('.prev').click(function(){
- var now_page=parseInt($('.now_page').html());
- if(now_page<=1){
- return false;
- }
- var idId=$('input[name=inId]').val();
- loadStudent(idId,(now_page-1));
- });
- $('.next').click(function(){
- var now_page=parseInt($('.now_page').html());
- var last_page=parseInt($('.last_page').html());
- if(now_page>=last_page){
- return false;
- }
- var idId=$('input[name=inId]').val();
- loadStudent(idId,(now_page+1));
- });
- }
- })
- </script>
|