grant.php 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373
  1. <link href="/css/base.css" rel="stylesheet">
  2. <link href="/css/ims/ims.css" rel="stylesheet">
  3. <link rel="stylesheet" type="text/css" href="/css/ims/bootstrap.min.css"/>
  4. <link rel="stylesheet" type="text/css" href="/css/ims/ace.min.css"/>
  5. <link rel="stylesheet" type="text/css" href="/css/ims/jquery.datetimepicker.css"/>
  6. <style>
  7. .sale-title{font-size: 14px;font-weight:bold}
  8. .whiteColor{background: #fff;color:#000}
  9. .ims-box {
  10. margin: 20px;
  11. }
  12. .screen {
  13. padding-left: 20px;
  14. height: 44px;
  15. line-height: 44px;
  16. background-color: #eff4fa;
  17. }
  18. .screen li {
  19. float: left;
  20. margin-right: 65px;
  21. }
  22. .bg-d9bf6e {
  23. margin-left: 5px;
  24. padding: 0 20px;
  25. color: #fff;
  26. background-color: #d9bf6e;
  27. }
  28. .list {
  29. padding: 0 40px;
  30. /*margin-top: 40px;*/
  31. overflow: hidden;
  32. }
  33. .list h2 {
  34. line-height: 30px;
  35. font-size: 14px;
  36. }
  37. .list .student-list_box {
  38. width: 300px;
  39. }
  40. .list .student-list_box > ul {
  41. height: 260px;
  42. overflow: auto;
  43. padding: 20px;
  44. background-color: #eef3ff;
  45. }
  46. .list .student-list_box li {
  47. line-height: 30px;
  48. cursor: pointer;
  49. }
  50. .list .student-selected_box {
  51. margin-left: 60px;
  52. }
  53. .list .student-list {
  54. display: none;
  55. margin-left: 20px;
  56. }
  57. .list .student-list li.active .btn-select_all {
  58. display: inline-block;
  59. }
  60. .list .student-list span {
  61. cursor: pointer;
  62. }
  63. .list .btn-select_all {
  64. margin-left: 84px;
  65. color: #008000;
  66. }
  67. .student-name_box li {
  68. position: relative;
  69. margin-left: 28px;
  70. line-height: 30px;
  71. }
  72. .student-name_box input {
  73. position: absolute;
  74. left: 155px;
  75. top: 8px;
  76. }
  77. .btn-select_all,
  78. .student-name_box {
  79. display: none;
  80. }
  81. .student-selected {
  82. width: 320px;
  83. height: 220px;
  84. overflow: auto;
  85. }
  86. .student-selected li {
  87. float: left;
  88. margin-right: 24px;
  89. margin-bottom: 12px;
  90. height: 26px;
  91. line-height: 26px;
  92. text-indent: 20px;
  93. background-color: #f2f2f2;
  94. }
  95. .student-selected .btn-delete {
  96. float: right;
  97. margin-right: 20px;
  98. color: red;
  99. cursor: pointer;
  100. }
  101. .btn-confirm_purchase {
  102. display: block;
  103. margin: 0 auto;
  104. margin-top: 100px;
  105. margin-bottom: 50px;
  106. width: 430px;
  107. line-height: 54px;
  108. color: #fff;
  109. font-family: PingFangSC-Regular, "PingFang SC";
  110. font-weight: 400;
  111. font-style: normal;
  112. font-size: 20px;
  113. text-align: center;
  114. background-color: rgba(0, 153, 102, 1);
  115. cursor: pointer;
  116. }
  117. #imgPreview {
  118. display: inline-block;
  119. margin-top: 12px;
  120. }
  121. #imgPreview > img {
  122. max-width: 100px;
  123. max-height: 100px;
  124. margin-right: 5px;
  125. }
  126. .layui-layer-btn .layui-layer-btn0 {
  127. border-color: #15ae68 !important;
  128. background-color: #15ae68 !important;
  129. color: #fff;
  130. }
  131. .stop-layer-box, .resubmit-layer-box, .delete-layer-box {
  132. line-height: 140px;
  133. text-align: center;
  134. }
  135. .table-center th,.table-center td{text-align:center;}
  136. .table-center .diy_select{float:none;display:inline-block;}
  137. .out-count-div{display:inline-block;}
  138. .out-count-div a{display:inline-block;width:20px;height:20px;text-align:center;line-height:20px; background:#999;color:#fff;cursor:pointer}
  139. .out-count-div a:hover{background:#666;}
  140. .out-count-div span{margin-left:10px;}
  141. .activePage{display: inline-block;width: 30px;height: 30px;background: #0e8e54;text-align: center;line-height: 30px;color:#fff;margin-right: 10px;}
  142. .page{display: inline-block;width: 30px;height: 30px;border:1px solid #0e8e54;text-align: center;line-height: 30px;color:#000;margin-right: 10px;}
  143. .grant th{width:10%}
  144. .grant-info{color:#0e8e54}
  145. </style>
  146. <!--发放情况-->
  147. <div class="ims-box">
  148. <h3 class="sale-title"> 发放情况</h3>
  149. <div class="sale-table">
  150. <table width="100%" class="table grant ">
  151. <tr>
  152. <th>领用出库数</th>
  153. <td class="whiteColor" ><?php echo $num;?></td>
  154. <th>已退库数</th>
  155. <td class="whiteColor"><?php echo $refoundNo;?></td>
  156. <th>已发放数</th>
  157. <td class="whiteColor"><?php echo $sendNo;?></td>
  158. <th>剩余发放数</th>
  159. <td class="whiteColor"><?php echo ($num-$refoundNo-$sendNo);?></td>
  160. </tr>
  161. </table>
  162. </div>
  163. <h3 class="sale-title"> 发放销售订单</h3>
  164. <span class="grant-info">填写正数代表发放,填写负数代表撤销发放</span>
  165. <div class="layer-filter">
  166. <form action="<?php echo Yii::app()->createUrl('imsStore/grant'); ?>" id="orderSearch" method="get">
  167. <select name="schoolYearId" id="schoolYearId" style="width: 100px;">
  168. <option value="0">学年</option>
  169. <?php if(isset($schoolYear) && $schoolYear):?>
  170. <?php foreach ($schoolYear as $key => $value): ?>
  171. <option value="<?php echo $value['schoolYearId']; ?>"><?php echo $value['schoolYearName']; ?></option>
  172. <?php endforeach; ?>
  173. <?php endif;?>
  174. </select>
  175. <select name="semester" id="semester" style="width: 100px;">
  176. <option value="0">学期</option>
  177. <option value="1" <?php if(isset($grade) && $grade==1) echo 'selected';?>>上学期</option>
  178. <option value="2" <?php if(isset($grade) && $grade==2) echo 'selected';?>>下学期</option>
  179. <option value="3" <?php if(isset($grade) && $grade==3) echo 'selected';?>>跨学期</option>
  180. </select>
  181. <select name="grade" id="grade" style="width: 100px;">
  182. <option value="0">年级</option>
  183. <option value="1">高一</option>
  184. <option value="2">高二</option>
  185. <option value="3">高三</option>
  186. </select>
  187. <input type="text" name="orderNo" placeholder="订单号" style="height:28px">
  188. <a class="btn btn-success order-search">查询</a>
  189. <input type="hidden" name="outId" value="<?php echo $outId?>">
  190. <input type="hidden" name="ajaxDataRequest" value="1">
  191. <input type="hidden" name="typeId" value="<?php echo $typeId?>">
  192. <input type="hidden" name="page" value="1">
  193. </form>
  194. </div>
  195. <div class="table-box ">
  196. <table id="record-table"
  197. class="table table-striped table-bordered table-hover dataTable no-footer DTTT_selectable order-table"
  198. style="font-size:12px">
  199. <thead>
  200. <tr>
  201. <th>订单号</th>
  202. <th>商品名称</th>
  203. <th>套餐</th>
  204. <th>年级</th>
  205. <th>有效人数</th>
  206. <th>配套标准</th>
  207. <th>配套数</th>
  208. <th>应发放数</th>
  209. <th>已发放数</th>
  210. <th>本次发放数</th>
  211. </tr>
  212. </thead>
  213. <tbody>
  214. </tbody>
  215. </table>
  216. </div>
  217. </div>
  218. <div class="sale-submit">
  219. <button type="button" class="label-primary-cancle">取消</button>
  220. <button type="button" class="label-primary-s bth-s">提交</button>
  221. </div>
  222. <script>
  223. $(function(){
  224. $('.order-search').click(function(){
  225. $('input[name=page]').val(1);
  226. getOrder();
  227. });
  228. $('.order-table')
  229. .on('click','.gotoPage',function(){
  230. var page=$(this).attr('rel');
  231. $('input[name=page]').val(page);
  232. getOrder();
  233. })
  234. function getOrder(){
  235. $.ajax({
  236. url:'<?php echo $this->createUrl('imsStore/ajaxGetOrderList')?>',
  237. type:'POST',
  238. dataType:'json',
  239. data:$('#orderSearch').serialize(),
  240. success:function(res){
  241. var html = '';
  242. var list=res.data['list'];
  243. for (var i = 0; i < list.length; i++) {
  244. var item = list[i];
  245. html += '<tr>';
  246. html += '<td class="orderId" orderId="'+item['orderId']+'">' + item['orderNo'] + '</td>';
  247. html += '<td>' + item['goodsName'] + '</td>';
  248. html += '<td>' + item['packageName'] + '</td>';
  249. html += '<td>' + item['gradeName'] + '</td>';
  250. html += '<td>' + item['quantity'] + '</td>';
  251. html += '<td>' + item['typeName'] + '</td>';
  252. html += '<td>' + item['sendNo'] + '</td>';
  253. html += '<td class="should">' + item['sendNo']*item['quantity'] + '</td>';
  254. html += '<td class="already">' + item['saleNo'] + '</td>';
  255. html += '<td><input type="text" name="outNo" class="outNo" value=""></td>';
  256. html += '</tr>';
  257. }
  258. //分页
  259. var pageHtml='<tr><td colspan="11" align="center">';
  260. lastPage=parseInt(res.data['lastPage']);
  261. if(lastPage){
  262. for(var i=1;i<=lastPage;i++){
  263. if(res.data['pageNum']==i){
  264. pageHtml+='<a href="#" class="activePage">'+i+'</a>';
  265. }else{
  266. pageHtml+='<a href="#" class="gotoPage page" rel="'+i+'">'+i+'</a>';
  267. }
  268. }
  269. }
  270. pageHtml+='</td></tr>';
  271. html+=pageHtml;
  272. $('.order-table tbody').html(html);
  273. }
  274. });
  275. }
  276. //保存
  277. $('.bth-s').click(function(){
  278. var outId='<?php echo $outId?>'
  279. var len=$('.outNo').length;
  280. var regu = /^[0-9]+$/;
  281. sendData=[];
  282. for(var i=0;i<len;i++) {
  283. if($('.outNo').eq(i).val()!==''){
  284. should=parseInt($('.outNo').eq(i).closest('tr').find('.should').html());
  285. already=parseInt($('.outNo').eq(i).closest('tr').find('.already').html());
  286. outNo=parseInt($('.outNo').eq(i).val());
  287. if (isNaN(outNo)) {
  288. layer.msg("请填写正确的数值")
  289. return false;
  290. }
  291. if(outNo>0){
  292. if(outNo>(should-already)){
  293. layer.msg("本次发放总数超过领用出库单剩余发放数")
  294. return false;
  295. }
  296. }else{
  297. if((already+outNo)<0){
  298. layer.msg("本次退回数不能超过剩余退回数")
  299. return false;
  300. }
  301. }
  302. sendData.push({orderId:$('.outNo').eq(i).closest('tr').find('.orderId').attr('orderId'),outNo:outNo});
  303. }
  304. }
  305. if(sendData.length>0){
  306. $('.bth-s').attr('disabled',true);
  307. $.ajax({
  308. url:'<?php echo $this->createUrl('imsStore/saveGrant')?>',
  309. type:'POST',
  310. data:{outId:outId,orders:sendData},
  311. dataType:'json',
  312. success:function(res){
  313. if(res.status==1){
  314. layer.msg('保存成功',{time: 1000, icon:6,end:function(){
  315. window.location.href='<?php echo $this->createUrl('imsStore/viewGrant',array('outId'=>$outId))?>';
  316. }});
  317. }else{
  318. if(res.msg!=undefined){
  319. layer.msg(res.msg);
  320. }else{
  321. layer.msg('提交失败');
  322. }
  323. }
  324. $('.bth-s').attr('disabled',false);
  325. }
  326. })
  327. }else{
  328. layer.msg("请填写本次发放数")
  329. }
  330. });
  331. })
  332. </script>