useAddEdit.php 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>新增出库单</title>
  6. <link href="/css/base.css" rel="stylesheet">
  7. <link href="/css/ims/ims.css" rel="stylesheet">
  8. <link rel="stylesheet" type="text/css" href="/css/ims/bootstrap.min.css"/>
  9. <link rel="stylesheet" type="text/css" href="/css/ims/ace.min.css"/>
  10. <link rel="stylesheet" type="text/css" href="/css/ims/jquery.datetimepicker.css"/>
  11. <style>
  12. .ims-box {
  13. margin: 20px;
  14. }
  15. .screen {
  16. padding-left: 20px;
  17. height: 44px;
  18. line-height: 44px;
  19. background-color: #eff4fa;
  20. }
  21. .screen li {
  22. float: left;
  23. margin-right: 65px;
  24. }
  25. .bg-d9bf6e {
  26. margin-left: 5px;
  27. padding: 0 20px;
  28. color: #fff;
  29. background-color: #d9bf6e;
  30. }
  31. .list {
  32. padding: 0 40px;
  33. /*margin-top: 40px;*/
  34. overflow: hidden;
  35. }
  36. .list h2 {
  37. line-height: 30px;
  38. font-size: 14px;
  39. }
  40. .list .student-list_box {
  41. width: 300px;
  42. }
  43. .list .student-list_box > ul {
  44. height: 260px;
  45. overflow: auto;
  46. padding: 20px;
  47. background-color: #eef3ff;
  48. }
  49. .list .student-list_box li {
  50. line-height: 30px;
  51. cursor: pointer;
  52. }
  53. .list .student-selected_box {
  54. margin-left: 60px;
  55. }
  56. .list .student-list {
  57. display: none;
  58. margin-left: 20px;
  59. }
  60. .list .student-list li.active .btn-select_all {
  61. display: inline-block;
  62. }
  63. .list .student-list span {
  64. cursor: pointer;
  65. }
  66. .list .btn-select_all {
  67. margin-left: 84px;
  68. color: #008000;
  69. }
  70. .student-name_box li {
  71. position: relative;
  72. margin-left: 28px;
  73. line-height: 30px;
  74. }
  75. .student-name_box input {
  76. position: absolute;
  77. left: 155px;
  78. top: 8px;
  79. }
  80. .btn-select_all,
  81. .student-name_box {
  82. display: none;
  83. }
  84. .student-selected {
  85. width: 320px;
  86. height: 220px;
  87. overflow: auto;
  88. }
  89. .student-selected li {
  90. float: left;
  91. margin-right: 24px;
  92. margin-bottom: 12px;
  93. height: 26px;
  94. line-height: 26px;
  95. text-indent: 20px;
  96. background-color: #f2f2f2;
  97. }
  98. .student-selected .btn-delete {
  99. float: right;
  100. margin-right: 20px;
  101. color: red;
  102. cursor: pointer;
  103. }
  104. .btn-confirm_purchase {
  105. display: block;
  106. margin: 0 auto;
  107. margin-top: 100px;
  108. margin-bottom: 50px;
  109. width: 430px;
  110. line-height: 54px;
  111. color: #fff;
  112. font-family: PingFangSC-Regular, "PingFang SC";
  113. font-weight: 400;
  114. font-style: normal;
  115. font-size: 20px;
  116. text-align: center;
  117. background-color: rgba(0, 153, 102, 1);
  118. cursor: pointer;
  119. }
  120. #imgPreview {
  121. display: inline-block;
  122. margin-top: 12px;
  123. }
  124. #imgPreview > img {
  125. max-width: 100px;
  126. max-height: 100px;
  127. margin-right: 5px;
  128. }
  129. .layui-layer-btn .layui-layer-btn0 {
  130. border-color: #15ae68 !important;
  131. background-color: #15ae68 !important;
  132. color: #fff;
  133. }
  134. .stop-layer-box, .resubmit-layer-box, .delete-layer-box {
  135. line-height: 140px;
  136. text-align: center;
  137. }
  138. .table-center th,.table-center td{text-align:center;}
  139. .table-center .diy_select{float:none;display:inline-block;}
  140. .out-count-div{display:inline-block;}
  141. .out-count-div a{display:inline-block;width:20px;height:20px;text-align:center;line-height:20px; background:#999;color:#fff;cursor:pointer}
  142. .out-count-div a:hover{background:#666;}
  143. .out-count-div span{margin-left:10px;}
  144. .activePage{display: inline-block;width: 30px;height: 30px;background: #0e8e54;text-align: center;line-height: 30px;color:#fff;margin-right: 10px;}
  145. .page{display: inline-block;width: 30px;height: 30px;border:1px solid #0e8e54;text-align: center;line-height: 30px;color:#000;margin-right: 10px;}
  146. </style>
  147. </head>
  148. <body>
  149. <h3 class="sale-title">学管领用出库单</h3>
  150. <input type="hidden" name="oldOrderId" id="oldOrderId" value="0">
  151. <div class="sale-table">
  152. <table width="100%">
  153. <tr>
  154. <th><em class="red">*</em>出库单标题</th>
  155. <td colspan="3"><input type="text" readonly style="width:100%;" placeholder="请输入标题" name="outTitle" value="<?php echo $schoolName.'-'.$coachName.'的出库单';?>"></td>
  156. </tr>
  157. <tr>
  158. <th><em class="red">*</em>领用日期</th>
  159. <td>
  160. <input id="outTimet" readonly type="text" style="width:100%;" placeholder="请输入出库日期" name="out_date" value="">
  161. </td>
  162. </tr>
  163. <tr>
  164. <th>领用人</th>
  165. <td><?php echo $coachName;?></td>
  166. </tr>
  167. <tr>
  168. <th><em class="red">*</em>领用品目类型</th>
  169. <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>
  170. </tr>
  171. <tr>
  172. <th>领用说明</th>
  173. <td>
  174. <textarea rows="5" cols="50" class="use-explain"><?php echo isset($pmData['remark'])?$pmData['remark']:'';?></textarea>
  175. </td>
  176. </tr>
  177. </table>
  178. <div>&nbsp;</div>
  179. <div style="margin-bottom:5px; font-size:18px;">选择品目</div>
  180. <table width="100%" class="table-center">
  181. <tr>
  182. <th>品目名称</th>
  183. <th>可用库存数量</th>
  184. <th>出库数量</th>
  185. <th>单位</th>
  186. <?php if($itemType==3):?>
  187. <th>低耗使用设备</th>
  188. <?php endif;?>
  189. <th>操作</th>
  190. </tr>
  191. <tr>
  192. <td>
  193. <div class="diy_select" style="width: 240px;">
  194. <input type="hidden" id="itemId" name="typeId" class="diy_select_input" value="0">
  195. <input type="hidden" id="typeId" name="typeId" class="diy_select_input" value="0">
  196. <div class="diy_select_txt pm_name_txt" style="width: 200px;">请选择</div>
  197. <div class="diy_select_btn"></div>
  198. <ul class="diy_select_list pm_name" style="display: none;">
  199. <li val="0" invNo="0" unitName="">请选择</li>
  200. <?php foreach ($pmNameList as $key => $value): ?>
  201. <li val="<?php echo $value['itemId']; ?>" typeId="<?php echo $value['typeId']?>" invNo="<?php echo $value['invNo']-$value['scrapNo']; ?>" unitName="<?php echo isset($value['unitName'])?$value['unitName']:"";?>"><?php echo $value['itemName']; ?></li>
  202. <?php endforeach; ?>
  203. </ul>
  204. </div>
  205. </td>
  206. <td>
  207. <span class="item-num">0</span>
  208. </td>
  209. <td>
  210. <div class="out-count-div">
  211. <a class="reduce-out">-</a>
  212. <input type="text" name="out_stock_num" value="<?php echo isset($stockNum)?$stockNum:1;?>"/>
  213. <a class="add-out">+</a>
  214. </div>
  215. </td>
  216. <td><span class="unit-name"></span></td>
  217. <?php if($itemType==3):?>
  218. <td>
  219. <select name="fcId" id="fcId">
  220. <option value="0">请选择设备</option>
  221. <?php
  222. if($printList){
  223. foreach ($printList as $value){
  224. if(isset($fcId) && $fcId==$value['fcId']){
  225. echo '<option value="'.$value['fcId'].'" selected>'.$value['fixedCodeName'].' '.$value['itemName'].'</option>';
  226. }else{
  227. echo '<option value="'.$value['fcId'].'">'.$value['fixedCodeName'].' '.$value['itemName'].'</option>';
  228. }
  229. }
  230. }
  231. ?>
  232. </select>
  233. </td>
  234. <?php endif;?>
  235. <td>-</td>
  236. </tr>
  237. </table>
  238. <div>&nbsp;</div>
  239. <!--
  240. <div style="margin-bottom:5px; font-size:18px;">发放销售订单
  241. <span style="font-size: 12px;padding-left:20px;">指定领用的学生所在的销售订单,每次只能指定一个订单</span>
  242. <button type="button" class="btn btn-success btn-sm fr">选择销售订单</button>
  243. </div>
  244. <table width="100%" class="table-center">
  245. <tr class="item-out-list">
  246. <th>销售订单号</th>
  247. <th>商品</th>
  248. <th>商品配套数</th>
  249. <th>实际订购人数</th>
  250. <th>实际应发数</th>
  251. <th>待审核发放数</th>
  252. <th>已发放数</th>
  253. <th>本次发放数</th>
  254. </tr>
  255. <tbody class="selected_item">
  256. </tbody>
  257. </table>
  258. -->
  259. <div style="margin:10px 0 20px;">领用出库单填写后,需要提交审批并完成签字,才能完成领用。领用后出现商品损失由领用人承担。</div>
  260. <div class="sale-submit">
  261. <button type="button" class="label-primary-cancle">取消</button>
  262. <button type="button" class="label-primary-s bth-s">提交</button>
  263. </div>
  264. <!-- 关联正式订单弹层 -->
  265. <div class="layer-relate rel-order-layer">
  266. <div class="layer-filter">
  267. <input type="text" name="outCode" placeholder="销售单编号" style="height:28px">
  268. <select name="schoolYearName" id="schoolYear" style="width: 100px;">
  269. <option value="0">学年</option>
  270. <?php if(isset($schoolYear) && $schoolYear):?>
  271. <?php foreach ($schoolYear as $key => $value): ?>
  272. <option value="<?php echo $value['schoolYearId']; ?>"><?php echo $value['schoolYearName']; ?></option>
  273. <?php endforeach; ?>
  274. <?php endif;?>
  275. </select>
  276. <select name="goodsId" id="goodsId" style="width: 100px;">
  277. <option value="0">商品</option>
  278. <?php if(isset($goodList) && $goodList):?>
  279. <?php foreach ($goodList as $key => $value): ?>
  280. <option value="<?php echo $value['goodsId']; ?>"><?php echo $value['goodsName']; ?></option>
  281. <?php endforeach; ?>
  282. <?php endif;?>
  283. </select>
  284. <select name="packageId" id="packageId" style="width: 100px;">
  285. <option value="0">套餐</option>
  286. </select>
  287. <a class="btn btn-success order-search">查询</a>
  288. </div>
  289. <table class="order-table table table-striped table-bordered table-hover dataTable no-footer DTTT_selectable"
  290. style="font-size:12px">
  291. <thead>
  292. <tr>
  293. <th>订单号</th>
  294. <th>商品</th>
  295. <th>年级</th>
  296. <th>单位发放数</th>
  297. <th>实际订购人数</th>
  298. <th>应发放数</th>
  299. <th>待审核发放数</th>
  300. <th>已发放数</th>
  301. <th>选择</th>
  302. </tr>
  303. </thead>
  304. <tbody >
  305. </tbody>
  306. </table>
  307. <div class="col-sm-12">
  308. <ul class="pagination">
  309. </ul>
  310. </div>
  311. </div>
  312. <script src="/js/productset/jquery.min.js"></script>
  313. <script src="/js/ims/jquery.datetimepicker.js"></script>
  314. <script src="/js/ims/layer/layer.js"></script>
  315. <script src="/js/ims/xsgl.js"></script>
  316. <?php include_once '_useDetail.php'?>
  317. <script>
  318. var listData = [];
  319. var sendData={};
  320. //选择销售订单
  321. $('.btn-sm').click(function () {
  322. var typeId = $('#typeId').val();
  323. if(typeId==0 || typeId==undefined){
  324. layer.msg('请先选择品目');
  325. return false;
  326. }
  327. sendData={};
  328. sendData= {
  329. typeId:typeId
  330. }
  331. getOrder(sendData,0);
  332. });
  333. $('.order-table tbody')
  334. .on('click','.select_btn',function(){
  335. var index = $(this).attr('order');
  336. if(!(typeof(listData[index]) == 'undefined')){
  337. $('.selected_item').html(listData[index]);
  338. layer.closeAll();
  339. }
  340. return false;
  341. })
  342. .on('click','.gotoPage',function(){
  343. var page=$(this).attr('rel');
  344. gotoPage(page);
  345. })
  346. //获取套餐
  347. $('#goodsId').change(function () {
  348. var currentGoodsId = $(this).val();
  349. if(currentGoodsId>0){
  350. getPackage(currentGoodsId);
  351. }else{
  352. $('.select-package .diy_select_txt').val("请选择套餐");
  353. $('#packageId').val(0);
  354. $('.select-package ul').html('<li val="0">请选择套餐</li>');
  355. }
  356. });
  357. //搜索
  358. $('.order-search').click(function(){
  359. var outCode=$('input[name=outCode]').val(),
  360. goodsId=$('#goodsId').val(),
  361. packageId=$('#packageId').val(),
  362. schoolYear=$('#schoolYear').val();
  363. var typeId = $('#typeId').val();
  364. sendData={};
  365. sendData={
  366. orderNo:outCode,
  367. goodsId:goodsId,
  368. packageId:packageId,
  369. schoolYearId:schoolYear,
  370. typeId:typeId
  371. };
  372. getOrder(sendData,1);
  373. });
  374. //读取订单
  375. function getOrder(data,type){
  376. listData=[];
  377. //提交数据
  378. $.ajax({
  379. type: 'POST',
  380. url: "<?php echo $this->createUrl('imsStore/ajaxGetOrderList');?>",
  381. data: data,
  382. async: false,
  383. dataType: 'json',
  384. success: function (res) {
  385. if (res.status == 1) {
  386. var hasItemOut = [];
  387. $("input[name='select-itemId-outId']").each(function () {
  388. hasItemOut.push($(this).val());
  389. });
  390. var html = '';
  391. var list=res.data['list'];
  392. for (var i = 0; i < list.length; i++) {
  393. var item = list[i];
  394. temp='';
  395. temp+='<tr>';
  396. temp += '<td>' + item['orderNo'] + '</td>';
  397. temp += '<td>' + item['goodsName'] + '</td>';
  398. temp += '<td>' + item['sendNo'] + '</td>';
  399. temp += '<td>' + item['quantity'] + '</td>';
  400. temp += '<td>' + item['sendNo']*item['quantity'] + '</td>';
  401. temp += '<td>' + item['waitCheckNo'] + '</td>';
  402. temp += '<td>' + item['saleNo'] + '</td>';
  403. temp += '<td><input type="text" name="out_stock_num" value=""></td>';
  404. temp+='</tr>';
  405. listData[i] = temp;
  406. html += '<tr>';
  407. html += '<td class="orderId">' + item['orderNo'] + '</td>';
  408. html += '<td>' + item['goodsName'] + '</td>';
  409. html += '<td>' + item['gradeName'] + '</td>';
  410. html += '<td>' + item['sendNo'] + '</td>';
  411. html += '<td>' + item['quantity'] + '</td>';
  412. html += '<td>' + item['sendNo']*item['quantity'] + '</td>';
  413. html += '<td>' + item['waitCheckNo'] + '</td>';
  414. html += '<td>' + item['saleNo'] + '</td>';
  415. html += '<td><a href="#" class="select_btn" order="'+i+'">选择</a></td>';
  416. html += '</tr>';
  417. }
  418. //分页
  419. var pageHtml='<tr><td colspan="9" align="center">';
  420. lastPage=parseInt(res.data['lastPage']);
  421. if(lastPage){
  422. for(var i=1;i<=lastPage;i++){
  423. if(res.data['pageNum']==i){
  424. pageHtml+='<a href="#" class="activePage">'+i+'</a>';
  425. }else{
  426. pageHtml+='<a href="#" class="gotoPage page" rel="'+i+'">'+i+'</a>';
  427. }
  428. }
  429. }
  430. pageHtml+='</td></tr>';
  431. html+=pageHtml;
  432. $('.order-table tbody').html(html);
  433. if(type==0){
  434. layer.open({
  435. type: 1,
  436. title: '发放销售订单',
  437. btn: ['确定','取消'],
  438. area: ['810px', '420px'], //宽高
  439. btnAlign: 'c',
  440. content: $('.rel-order-layer'),
  441. yes: function (index, layero) {
  442. layer.closeAll();
  443. }
  444. });
  445. }
  446. } else {
  447. flag = true;
  448. layer.msg(result.msg);
  449. }
  450. },
  451. error: function (jqXHR, textStatus, errorThrown) {
  452. /*错误信息处理*/
  453. flag = true;
  454. layer.msg('提交失败');
  455. }
  456. });
  457. }
  458. function gotoPage(page){
  459. sendData.page=page;
  460. getOrder(sendData,1);
  461. }
  462. function getPackage(goodsId) {
  463. console.log(goodsId);
  464. if (goodsId<=0){
  465. var html = '<option val="0">请选择套餐</option>';
  466. $('.select-package ul').html(html);
  467. }else{
  468. $.ajax({
  469. type: 'post',
  470. url: "<?php echo Yii::app()->createUrl('imsSale/getPackages');?>",
  471. data: {goodsId: goodsId},
  472. dataType: 'json',
  473. success: function (data) {
  474. console.log(data);
  475. if (data.status) {
  476. var html = '<option value="0">请选择套餐</option>';
  477. for (var i = 0; i < data.data.length; i++) {
  478. var item = data.data[i];
  479. if (item['packageId']) {
  480. html += '<option value="' + item['packageId'] + '">';
  481. html += item['packageName'];
  482. html += '</option>'
  483. }
  484. }
  485. } else {
  486. var html = '<option val="0">暂无套餐</option>';
  487. }
  488. console.log(html);
  489. $('#packageId').html(html);
  490. },
  491. error: function () {
  492. return;
  493. }
  494. })
  495. }
  496. }
  497. </script>
  498. </body>
  499. </html>