123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628 |
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <title>新增退库单</title>
- <link href="/css/base.css" rel="stylesheet">
- <link href="/css/ims/ims.css" rel="stylesheet">
- <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 rel="stylesheet" type="text/css" href="/css/ims/jquery.datetimepicker.css"/>
- <style>
- .ims-box {
- margin: 20px;
- }
- .screen {
- padding-left: 20px;
- height: 44px;
- line-height: 44px;
- background-color: #eff4fa;
- }
- .screen li {
- float: left;
- margin-right: 65px;
- }
- .bg-d9bf6e {
- margin-left: 5px;
- padding: 0 20px;
- color: #fff;
- background-color: #d9bf6e;
- }
- .list {
- padding: 0 40px;
- /*margin-top: 40px;*/
- overflow: hidden;
- }
- .list h2 {
- line-height: 30px;
- font-size: 14px;
- }
- .list .student-list_box {
- width: 300px;
- }
- .list .student-list_box > ul {
- height: 260px;
- overflow: auto;
- padding: 20px;
- background-color: #eef3ff;
- }
- .list .student-list_box li {
- line-height: 30px;
- cursor: pointer;
- }
- .list .student-selected_box {
- margin-left: 60px;
- }
- .list .student-list {
- display: none;
- margin-left: 20px;
- }
- .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: 155px;
- top: 8px;
- }
- .btn-select_all,
- .student-name_box {
- display: none;
- }
- .student-selected {
- width: 320px;
- height: 220px;
- overflow: auto;
- }
- .student-selected li {
- float: left;
- margin-right: 24px;
- margin-bottom: 12px;
- 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-confirm_purchase {
- 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;
- }
- #imgPreview {
- display: inline-block;
- margin-top: 12px;
- }
- #imgPreview > img {
- max-width: 100px;
- max-height: 100px;
- margin-right: 5px;
- }
- .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;
- }
- .table-center th,.table-center td{text-align:center;}
- .table-center .diy_select{float:none;display:inline-block;}
- .out-count-div{display:inline-block;}
- .out-count-div a{display:inline-block;width:20px;height:20px;text-align:center;line-height:20px; background:#999;color:#fff;cursor:pointer}
- .out-count-div a:hover{background:#666;}
- .out-count-div span{margin-left:10px;}
- .hidden{display: none}
- .search-item{
- border-color: #2977ff !important;
- background-color: #2977ff !important;
- color: #fff;
- height: 28px;
- line-height: 28px;
- padding: 0 15px;
- background-color: #fff;
- border-radius: 2px;
- font-weight: 400;
- cursor: pointer;
- text-decoration: none;
- display: inline-block;
- }
- </style>
- </head>
- <body>
- <h3 class="sale-title">退库单</h3>
- <input type="hidden" name="oldOrderId" id="oldOrderId" value="0">
- <div class="sale-table">
- <table width="100%">
- <tr>
- <th><em class="red">*</em>出库单标题</th>
- <!-- <td colspan="3">-->
- <!-- <input type="text" style="width:100%;" placeholder="请输入标题" name="outTitle" value="--><?php //echo isset($pmData['inTitle'])?$pmData['inTitle']:'';?><!--">-->
- <!-- </td> -->
- <td colspan="3"><input type="text" readonly style="width:100%;" name="outTitle" value="<?php echo $schoolName.'-'.$coachName.'的退库单';?>"></td>
- </td>
- </tr>
- <tr>
- <th><em class="red">*</em>退库人</th>
- <td><?php echo $coachName;?></td>
- <td></td>
- <td></td>
- </tr>
- <tr>
- <th>退库所在仓库</th>
- <td><?php echo $schoolName;?></td>
- <th><em class="red">*</em>领用日期</th>
- <td>
- <input id="outTimet" readonly type="text" style="width:100%;" placeholder="请输入出库日期" name="out_date" value="<?php echo isset($pmData['inDate'])?date('Y-m-d',strtotime($pmData['inDate'])):'';?>">
- </td>
- </tr>
- <tr>
- <th><em class="red">*</em>退库品目类型</th>
- <td><input type="radio" name="itemType" value="2" <?php if($itemType == 2)echo "checked='checked'";?>>产成品<input type="radio" name="itemType" value="3" style="margin-left: 60px;" <?php if($itemType == 3)echo "checked='checked'";?>>低值易耗品</td>
- </tr>
- <tr>
- <th>退库说明</th>
- <td>
- <textarea rows="5" cols="50" class="use-explain" ><?php echo isset($pmData['remark'])?$pmData['remark']:'';?></textarea>
- </td>
- <td></td>
- <td></td>
- </tr>
- </table>
- <div> </div>
- <div style="margin-bottom:5px; font-size:18px;"><button type="button" class="select-item label-primary-s bth-s" style="margin-bottom: 5px">选择品目</button></div>
- <table width="100%" class="table-center">
- <tr class="item-out-list">
- <th>品目名称</th>
- <th>领用单号</th>
- <th>可退库数量</th>
- <th>退库数量</th>
- <th>操作</th>
- </tr>
- <?php if(isset($pmData['itemList']) && $pmData['itemList']):?>
- <?php foreach ($pmData['itemList'] as $v):?>
- <tr>
- <td>
- <?php echo $v['itemName'];?>
- <input type="hidden" name="select-itemId-outId" value="<?php echo $v['itemId'].'_'.$v['outId'];?>"/>
- </td>
- <td><?php echo $v['outCode'];?></td>
- <td class="item-num"><?php echo $v['validNum'];?></td>
- <td>
- <div class="out-count-div">
- <a class="reduce-out">-</a>
- <input type="text" name="out_stock_num" num="<?php echo $v['validNum'];?>" value="<?php echo isset($v['num']) ? $v['num'] : 1;?>" itmeName="<?php echo $v['itemName'];?>" id="<?php echo $v['itemId'].'_'.$v['outId'];?>"/>
- <a class="add-out">+</a>
- </div>
- </td>
- <td><a class="remove-list">移除</a></td>
- </tr>
- <?php endforeach;?>
- <?php endif;?>
- </table>
- <div style="margin:10px 0 20px;"></div>
- <div> </div>
- <!-- <div style="margin-bottom:5px; font-size:18px;">发放销售订单
- <span style="font-size: 12px;padding-left:20px;">指定领用的学生所在的销售订单,每次只能指定一个订单</span>
- </div>
- <table width="100%" class="table-center">
- <tr >
- <th>销售订单号</th>
- <th>商品</th>
- <th>商品配套数</th>
- <th>实际订购人数</th>
- <th>实际应发数</th>
- <th>待审核发放数</th>
- <th>已发放数</th>
- <th>本次发放数</th>
- </tr>
- <tbody class="item-order-out-list">
- </tbody>
- </table>
- -->
- <div class="sale-submit">
- <button type="button" class="label-primary-cancle">取消</button>
- <button type="button" class="label-primary-s submit-bth bth-s">提交</button>
- </div>
- <!-- 关联正式订单弹层 -->
- <div class="layer-relate rel-order-layer">
- <div class="layer-filter">
- <input type="text" name="outCode" placeholder="领用单编号" style="height:28px">
- <select name="itemId">
- <option value="0">品目名称</option>
- <?php if(isset($itemList) && $itemList):?>
- <?php foreach ($itemList as $key => $value): ?>
- <option value="<?php echo $value['itemId']; ?>"><?php echo $value['itemName']; ?></option>
- <?php endforeach; ?>
- <?php endif;?>
- </select>
- <a class="search-item">查询</a>
- </div>
- <table class="order-table table table-striped table-bordered table-hover dataTable no-footer DTTT_selectable"
- style="font-size:12px">
- <thead>
- <tr>
- <th>选择</th>
- <th>领用单号</th>
- <th>品目名称</th>
- <th>可退库数量</th>
- </tr>
- </thead>
- <tbody>
- </tbody>
- </table>
- <div class="col-sm-12">
- <ul class="pagination">
- </ul>
- </div>
- </div>
- <script src="/js/productset/jquery.min.js"></script>
- <script src="/js/ims/jquery.datetimepicker.js"></script>
- <script src="/js/ims/layer/layer.js"></script>
- <script src="/js/ims/xsgl.js"></script>
- <!-- --><?php //include_once '_useDetail.php'?>
- <script>
- $(document).ready(function () {
- $('#outTimet').datetimepicker({
- format: "Y-m-d", //格式化日期
- timepicker: false //关闭时间选项
- });
- });
- <?php if (isset($pmData) && $pmData):?>
- //编辑页面数据初始化
- var D = "<?php echo date('Y-m-d', strtotime($pmData['inDate']));?>";
- $("#outTimet").val(D);
- <?php else:?>
- //新增页面数据初始化
- var date = new Date;
- var year = date.getFullYear();
- var month = date.getMonth() + 1;
- var day = date.getDate(); //获取当前日(1-31)
- month = month > 10 ? month : "0" + month;
- day = day > 10 ? day : "0" + day;
- var maxD = year + '-' + month + '-' + day;
- $("#outTimet").attr("value", maxD);
- <?php endif;?>
- $(function(){
- //选择品目
- $(".select-item").click(function () {
- var page = 1;
- selectItem(page,1);
- });
- function selectItem(page,open_type) {
- var itemOutIds = [];
- $(".select-itme-data").each(function () {
- itemOutIds.push($(this).attr('itemId')+'_'+$(this).attr('outId'));
- });
- var listData = [];
- var listOrderData = [];
- var itemType = $("input[name='itemType']:checked").val();
- var outCode = $("input[name='outCode']").val();
- var itemId = $("select[name='itemId']").val();
- // alert(itemId);return false;
- $.ajax({
- type: 'post',
- url: "<?php echo $this->createUrl('imsStore/stockChioceItme');?>",
- data: {page:page,itemOutIds:itemOutIds,itemType:itemType,outCode:outCode,itemId:itemId},
- dataType: 'json',
- success: function (res) {
- if (res.status) {
- //列表已存在的不显示
- var hasItemOut = [];
- $("input[name='select-itemId-outId']").each(function () {
- hasItemOut.push($(this).val());
- });
- var html = '';
- for (var i = 0; i < res.data.length; i++) {
- var item = res.data[i];
- if($.inArray(item['itemId']+'_'+item['outId'],hasItemOut) >= 0){
- continue;
- }
- var _btn = '<div class="out-count-div">\n' +
- ' <a class="reduce-out">-</a>\n' +
- ' <input type="text" name="out_stock_num" num="'+item['validNum']+'" value="<?php echo isset($stockNum) ? $stockNum : 1;?>" itmeName="'+item['itemName']+'" id="'+item['itemId']+'_'+item['outId']+'"/>\n' +
- ' <a class="add-out">+</a>\n' +
- ' </div>';
- listData[i] = '<tr><td>'+item['itemName']+'<input type="hidden" name="select-itemId-outId" value="'+item['itemId']+'_'+item['outId']+'"/></td><td>' + item['outCode'] + '</td><td class="valid-num" >'+item['validNum']+'</td><td>'+_btn+'</td><td><a class="remove-list">移除</a></td></tr>';
- temp='';
- temp+='<tr>';
- temp += '<td>' + item['orderId'] + '</td>';
- temp += '<td>' + item['goodsName'] + '</td>';
- temp += '<td>' + item['sendNo'] + '</td>';
- temp += '<td>' + item['quantity'] + '</td>';
- temp += '<td>' + item['sendNo']*item['quantity'] + '</td>';
- temp += '<td>' + item['waitCheckNo'] + '</td>';
- temp += '<td>' + item['saleNo'] + '</td>';
- temp += '<td></td>';
- temp+='</tr>';
- listOrderData[i] = temp;
- // listData = '';
- html += '<tr>';
- html += '<td><label class="checkbox-inline">';
- html += '<input type="checkbox" name="select-tr" value="'+i+'"/>';
- html += '</label></td>';
- html += '<td>' + item['outCode'] + '</td>';
- html += '<td>' + item['itemName'] + '</td>';
- html += '<td>' + item['validNum'] + '</td>';
- html += '</tr>';
- }
- // setPage(res.data);
- } else {
- layer.alert(res.msg, {icon: 7});
- return false;
- }
- $('.order-table tbody').html(html);
- },
- error: function () {
- layer.msg('品目列表获取失败!');
- return false;
- }
- })
- if(open_type == 1){
- layer.open({
- type: 1,
- title: '选择品目',
- btn: ['确定','取消'],
- area: ['810px', '420px'], //宽高
- btnAlign: 'c',
- content: $('.rel-order-layer'),
- yes: function (index, layero) {
- var listStr = '',listOrderStr='';
- // console.log($("input[name='select-tr']:checked"));
- $("input[name='select-tr']:checked").each(function () {
- var index = $(this).val();
- if(!(typeof(listData[index]) == 'undefined')){
- listStr += listData[index];
- }
- if(!(typeof(listOrderData[index]) == 'undefined')){
- listOrderStr += listOrderData[index];
- }
- });
- $(".item-out-list").after(listStr);
- $(".item-order-out-list").html(listOrderStr);
- layer.closeAll();
- }
- });
- }
- return false;
- }
- //提交数据
- $(".submit-bth").click(function () {
- var outId = "<?php echo isset($_GET['outId'])?$_GET['outId']:0;?>";
- var flag = true;
- if (flag){
- flag = false;
- //验证数据
- var outTitle = $.trim($("input[name='outTitle']").val());
- if (outTitle.length == 0) {
- showMsg('标题名称不能为空!');
- return false;
- } else if (outTitle.length > 49) {
- showMsg('标题名称不能超过50个字符!');
- return false;
- }
- var outDate = $.trim($("input[name='out_date']").val());
- if (!outDate) {
- showMsg('退库日期不正确!');
- return false;
- }
- if (!checkDate(outDate)) {
- showMsg('退库日期不正确!');
- return false;
- }
- //领用说明
- var useExplain = $(".use-explain").val();
- // var itemId = $("#itemId").val();
- //
- // if (itemId <= 0) {
- // showMsg('请选择品目名称!');
- // return false;
- // }
- //判断出库数量
- var itemNum = parseFloat($(".item-num").text());
- var varfiyMsg = '';
- // layer.msg('出库数量必须大于0!');return false;
- $("input[name='out_stock_num']").each(function () {
- if($(this).val() <= 0){
- varfiyMsg = '出库数量必须大于0!';
- return false;
- }
- // if($(this).val() > $(this).attr('num')){
- // varfiyMsg = $(this).attr('itmeName')+',退库数量不能大于可退库数量!';
- // return false;
- // }
- });
- if(varfiyMsg){
- layer.msg(varfiyMsg);
- return false;
- }
- var itemOutArr = [];
- $("input[name='select-itemId-outId']").each(function () {
- itemOutArr.push($(this).val()+'_'+$("#"+$(this).val()).val());
- });
- if(itemOutArr.length <= 0){
- showMsg('请选择品目!');
- return false;
- }
- var data = {
- itemOutArr: itemOutArr,
- useExplain: useExplain,
- outDate: outDate,
- outTitle: outTitle,
- outId:outId
- }
- //提交数据
- $.ajax({
- type: 'POST',
- url: "<?php echo $this->createUrl('imsStore/ajaxOutAdd');?>",
- data: data,
- async: false,
- dataType: 'json',
- success: function (result) {
- console.log(result);
- if (result.status == 1) {
- layer.alert("提交成功", {icon: 1,closeBtn:0}, function () {
- window.location.href = "<?php echo $this->createUrl('imsStore/useOut',array('useOutType'=>'out'));?>";
- })
- } else {
- flag = true;
- layer.msg(result.msg);
- }
- },
- error: function (jqXHR, textStatus, errorThrown) {
- /*错误信息处理*/
- flag = true;
- layer.msg('提交失败');
- }
- });
- }else{
- layer.msg("稍安勿躁,正在处理中...");
- }
- function showMsg(msg) {
- layer.msg(msg);
- }
- function checkDate(date) {
- return (new Date(date).getDate() == date.substring(date.length - 2));
- }
- });
- //移除列表
- $("body").delegate('.remove-list','click',function () {
- $(this).parents('tr').remove();
- });
- //加减库存
- $(".table-center").delegate('.reduce-out','click',function () {
- var ipt = $(this).siblings("input[name='out_stock_num']");
- var _num = parseInt(ipt.val());
- if(_num>1){
- ipt.val(_num - 1);
- }
- });
- $(".table-center").delegate('.add-out','click',function () {
- var ipt = $(this).siblings("input[name='out_stock_num']");
- var _num = parseInt(ipt.val());
- if(_num < ipt.attr('num')){
- ipt.val(_num + 1);
- }
- });
- $(".label-primary-cancle").click(function () {
- history.go(-1);
- });
- //查询
- $("body").delegate('.search-item','click',function () {
- selectItem(1,0);
- });
- //切换品目类型
- $("body").delegate('input[type=radio][name=itemType]','change',function(k,v) {
- $(".item-out-list").siblings("tr").remove();
- });
- })
- </script>
- </body>
- </html>
|