delivery.php 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  6. <title>销售出库</title>
  7. <meta name="description" content="">
  8. <meta name="keywords" content="">
  9. <link href="/css/base.css" rel="stylesheet">
  10. <link rel="stylesheet" type="text/css" href="/css/ims/bootstrap.min.css"/>
  11. <link rel="stylesheet" type="text/css" href="/css/ims/jquery.datetimepicker.css"/>
  12. <link rel="stylesheet" type="text/css" href="/css/ims/ace.min.css"/>
  13. <style>
  14. .green {
  15. color: green;
  16. }
  17. .red {
  18. color: red;
  19. }
  20. .ims-box {
  21. margin: 20px;
  22. }
  23. .screen > div {
  24. float: left;
  25. margin-right: 8px;
  26. }
  27. .screen > span {
  28. line-height: 30px;
  29. margin-right: 5px;
  30. }
  31. .screen .date > input {
  32. height: 30px;
  33. border-radius: 4px;
  34. border: 1px solid #ccc;
  35. box-shadow: none;
  36. text-indent: 10px;
  37. }
  38. .screen button {
  39. padding: 4px 12px;
  40. }
  41. .table-box {
  42. margin-top: 30px;
  43. }
  44. .btn-formal-order {
  45. cursor: pointer;
  46. }
  47. .application-number-box {
  48. margin-top: 50px;
  49. text-align: center;
  50. }
  51. .application-number-box span {
  52. margin-right: 20px;
  53. }
  54. .layui-layer-btn .layui-layer-btn0 {
  55. border-color: #2977ff !important;
  56. background-color: #2977ff !important;
  57. color: #fff;
  58. }
  59. .stop-layer-box, .resubmit-layer-box, .delete-layer-box {
  60. line-height: 140px;
  61. text-align: center;
  62. }
  63. .qrcode-fram{display:none;}
  64. #imsCode img{display:inline-block!important;margin:10px 0;}
  65. #qrcode{display:inline-block;}
  66. .use-out{margin:20px; border-bottom:1px solid #ccc;}
  67. .use-out a{line-height:30px;padding:0 50px;margin-right:20px;font-size:16px;color:#333;}
  68. .use-out a.active{color:#2977ff;border-bottom:3px solid #2977ff}
  69. .table-box table th,.table-box td{text-align:center;}
  70. .page-div{text-align:right;}
  71. .page-div a{display:inline-block;width:20px;height:20px;text-align:center;line-height:20px;background:#999;color:#fff;cursor:pointer;}
  72. .page-div a:hover{background:#666;}
  73. .page-div span{margin:0 10px;}
  74. .layui-layer-page .layui-layer-content{overflow-x:hidden;}
  75. .out-count-div{display:inline-block;}
  76. .out-count-div a{display:inline-block;width:20px;height:20px;text-align:center;line-height:20px; background:#999;color:#fff;cursor:pointer}
  77. .out-count-div a:hover{background:#666;}
  78. .out-count-div span{margin-left:10px;}
  79. </style>
  80. </head>
  81. <body>
  82. <div class="use-out clearfix">
  83. <a class="<?php echo ($useOutType == 'use')?'active':'';?> fl" href="javascript:;" type="use">销售出库</a>
  84. <a href="javascript:;" class="<?php echo ($useOutType == 'out')?'active':'';?> fl" type="out">销售退库</a>
  85. </div>
  86. <div class="ims-box">
  87. <form action="<?php echo Yii::app()->createUrl('imsStore/delivery'); ?>" method="get">
  88. <div class="screen clearfix">
  89. <div class="diy_select select-isUse">
  90. <input type="hidden" id="isUse" name="isUse" class="diy_select_input" value="0">
  91. <div class="diy_select_txt pm_status_txt">请选择状态</div>
  92. <div class="diy_select_btn"></div>
  93. <ul class="diy_select_list pm_status" style="display: none;">
  94. <li val="0">请选择状态</li>
  95. <li val="1">未领用</li>
  96. <li val="2">已领用</li>
  97. </ul>
  98. </div>
  99. <div class="diy_select select-itemId">
  100. <input type="hidden" id="itemId" name="itemId" class="diy_select_input" value="0">
  101. <div class="diy_select_txt pm_name_txt">请选择品目名称</div>
  102. <div class="diy_select_btn"></div>
  103. <ul class="diy_select_list pm_name" style="display: none;">
  104. <li val="0">请选择品目名称</li>
  105. <?php foreach ($itemList as $key => $value): ?>
  106. <li val="<?php echo $value['itemId']; ?>"><?php echo $value['itemName']; ?></li>
  107. <?php endforeach; ?>
  108. </ul>
  109. </div>
  110. <div class="date">
  111. <span>发货时间:</span>
  112. <input type="text" readonly name="startDate" class="some_class" value="" id="some_class_1"/> --
  113. <input type="text" readonly name="endDate" class="some_class" value="" id="some_class_2"/>
  114. </div>
  115. <button type="submit" class="label-primary-s bth-s">搜索</button>
  116. <!-- <button type="button" class="label-primary-s bth-s add_out_order">新增出库单</button>-->
  117. </div>
  118. </form>
  119. <div class="table-box ">
  120. <table id="record-table"
  121. class="table table-striped table-bordered table-hover dataTable no-footer DTTT_selectable"
  122. style="font-size:12px">
  123. <thead>
  124. <tr>
  125. <th>销售出库编号</th>
  126. <th>品目名称</th>
  127. <th>规格</th>
  128. <th>发货数量</th>
  129. <th>发货时间</th>
  130. <th>领用学生名单</th>
  131. <th>财务订单</th>
  132. <th>状态</th>
  133. <th>操作</th>
  134. </tr>
  135. </thead>
  136. <tbody>
  137. <?php if (isset($pmDataList['list']) && $pmDataList['list']): ?>
  138. <?php foreach ($pmDataList['list'] as $key => $value): ?>
  139. <?php
  140. if (isset($value['outputDetails']) && isset($value['outputDetails'][0])) {
  141. $outputDetails = $value['outputDetails'][0];
  142. }
  143. ?>
  144. <tr>
  145. <td><?php echo $value['outCode']; ?></td>
  146. <td><?php echo isset($outputDetails['itemName']) ? $outputDetails['itemName'] : ''; ?></td>
  147. <td><?php echo isset($outputDetails['itemSpec']) ? $outputDetails['itemSpec'] : ''; ?></td>
  148. <td><?php echo isset($outputDetails['no']) ? $outputDetails['no'] : ''; ?></td>
  149. <td><?php echo date('Y/m/d', strtotime($value['outDate'])); ?></td>
  150. <td><?php echo $value['studentNo']; ?></td>
  151. <td class="blue"><?php echo isset($value['orderNo']) ? $value['orderNo'] : '-'; ?></td>
  152. <?php if ($value['isUse'] == 1):?>
  153. <td class="green">已领用</td>
  154. <td>
  155. <a href="<?php echo $this->createUrl('imsStore/deliveryView', array('outId' => $value['outId'])); ?>">查看</a>
  156. <?php if(isset($value['isSign']) && $value['isSign']):?>
  157. <a href="<?php echo $this->createUrl('imsStore/sign', array('outId' => $value['outId'])); ?>" class="sign-btn" outId="<?php echo $value['outId'] ?>">已签字</a>
  158. <?php endif;?>
  159. </td>
  160. <?php else: ?>
  161. <td class="red">未领用</td>
  162. <td>
  163. <?php if(isset($value['isSign']) && $value['isSign']):?>
  164. <a href="<?php echo $this->createUrl('imsStore/sign', array('outId' => $value['outId'])); ?>" class="sign-btn" outId="<?php echo $value['outId'] ?>">已签字</a>
  165. <?php else:?>
  166. <a href="javascript:;" class="signed-btn" url="<?php echo Yii::app()->params['qrcode'].'/#/signclazz?outId='.$value['outId'];?>">签字</a>
  167. <a href="<?php echo $this->createUrl('imsStore/deliveryEdit', array('outId' => $value['outId'])); ?>">编辑</a>
  168. <?php endif;?>
  169. <a href="javascript:;" class="del-btn" outId="<?php echo $value['outId'] ?>">删除</a>
  170. <a href="javascript:;" class="send-btn" isSign="<?php echo isset($value['isSign'])?$value['isSign']:0;?>" outId="<?php echo $value['outId'] ?>">确认出库</a>
  171. </td>
  172. <?php endif; ?>
  173. </tr>
  174. <?php endforeach; ?>
  175. <?php endif; ?>
  176. </tbody>
  177. </table>
  178. <?php if ($pmDataList): ?>
  179. <div class="col-sm-12">
  180. <ul class="pagination">
  181. <?php
  182. $params = array();
  183. if (isset($_GET['isUse']) && $_GET['isUse']) {
  184. $params['isUse'] = $_GET['isUse'];
  185. }
  186. if (isset($_GET['itemId']) && $_GET['itemId']) {
  187. $params['itemId'] = $_GET['itemId'];
  188. }
  189. if (isset($_GET['startDate']) && $_GET['startDate']) {
  190. $params['startDate'] = $_GET['startDate'];
  191. }
  192. if (isset($_GET['endDate']) && $_GET['endDate']) {
  193. $params['endDate'] = $_GET['endDate'];
  194. }
  195. if (isset($_GET['page'])) {
  196. $params['page'] = $_GET['page'];
  197. } else {
  198. $params['page'] = 1;
  199. }
  200. echo formatPage($pmDataList, 'imsStore/delivery', $params);
  201. ?>
  202. </ul>
  203. </div>
  204. <?php endif; ?>
  205. </div>
  206. </div>
  207. <!--二维码-->
  208. <div class="qrcode-fram" style="display: none">
  209. <div id="qrcode" style="width:100px; height:100px;margin: 10px auto"></div>
  210. <p>手机扫描二维码,到手机浏览器打开签字链接</p>
  211. </div>
  212. <script src="/js/productset/jquery.min.js"></script>
  213. <script src="/js/ims/jquery.datetimepicker.js"></script>
  214. <script src="/js/layer/layer.js"></script>
  215. <script src="/js/ims/xsgl.js"></script>
  216. <script type="text/javascript" src="/js/ims/qrcode.min.js"></script>
  217. <script>
  218. $(document).ready(function () {
  219. <?php if (isset($_GET['startDate'])):?>
  220. $("#some_class_1").attr("value", "<?php echo $_GET['startDate']?>");
  221. $("#some_class_2").attr("value", "<?php echo $_GET['endDate']?>");
  222. <?php endif;?>
  223. <?php if(isset($_GET['isUse'])):?>
  224. var isUse = "<?php echo $_GET['isUse'];?>";
  225. $('#isUse').val(isUse);
  226. var txt = $('.select-isUse li[val=' + isUse + ']').html();
  227. $('.select-isUse .diy_select_txt').html(txt);
  228. <?php endif;?>
  229. <?php if(isset($_GET['itemId']) && $_GET['itemId'] != ''):?>
  230. var itemId = "<?php echo $_GET['itemId'];?>";
  231. $('#itemId').val(itemId);
  232. var txt = $('.select-itemId li[val=' + itemId + ']').html();
  233. $('.select-itemId .diy_select_txt').html(txt);
  234. <?php endif;?>
  235. $('.some_class').datetimepicker({
  236. format: "Y-m-d", //格式化日期
  237. timepicker: false //关闭时间选项
  238. });
  239. //初始化状态
  240. var currStatus = "<?php echo isset($_GET['status']) ? $_GET['status'] : '';?>";
  241. if (currStatus > 0) {
  242. var statusText = $(".pm_status>li[val='" + currStatus + "']").text();
  243. $(".pm_status_txt").text(statusText);
  244. }
  245. //初始化品目
  246. var currPmId = "<?php echo isset($_GET['itemId']) ? $_GET['itemId'] : '';?>";
  247. if (currPmId > 0) {
  248. var pmNameText = $(".pm_name>li[val='" + currPmId + "']").text();
  249. $(".pm_name_txt").text(pmNameText);
  250. }
  251. //增加出库dan
  252. $(".add_out_order").click(function () {
  253. var url = window.location.href = "<?php echo $this->createUrl('imsStore/deliveryAdd');?>";
  254. });
  255. //确认出库
  256. $(".send-btn").on("click", function () {
  257. var isSign = $(this).attr('isSign');
  258. if(isSign <= 0){
  259. layer.alert("请先完成签字,在确认出库");
  260. return false;
  261. }
  262. var outId = $(this).attr('outId');
  263. layer.open({
  264. type: 1,
  265. title: '确认出库后',
  266. btn: ['确定', '取消'],
  267. area: ['420px', '240px'], //宽高
  268. btnAlign: 'c',
  269. content: '<div class="application-number-box" style="padding-left:120px;text-align: left;color: red;"><p>1、库存量根据出库数量进行核减</p><p>2、领用的学生记录为已发货</p><p>确认要出库吗?</p></div>',
  270. yes: function (index, layero) {
  271. //提交
  272. $.ajax({
  273. type: 'post',
  274. url: "<?php echo Yii::app()->createUrl('imsStore/ajaxUseOut');?>",
  275. data: {'outId': outId},
  276. dataType: 'json',
  277. success: function (data) {
  278. if (data.status) {
  279. layer.alert("确认成功", {icon:1,closeBtn:0},function () {
  280. location.reload();
  281. })
  282. } else {
  283. layer.msg(data.msg);
  284. }
  285. }
  286. })
  287. },
  288. btn2: function (index, layero) {
  289. //取消按钮
  290. // console.log(111)
  291. //return false 开启该代码可禁止点击该按钮关闭
  292. }
  293. });
  294. return false;
  295. });
  296. //删除
  297. $(".del-btn").on("click", function () {
  298. var outId = $(this).attr('outId');
  299. layer.confirm('您确定删除吗?', {
  300. btn: ['确定', '取消'] //按钮
  301. }, function () {
  302. $.ajax({
  303. type: 'post',
  304. url: "<?php echo Yii::app()->createUrl('imsStore/ajaxDelOut');?>",
  305. data: {'outId': outId},
  306. dataType: 'json',
  307. success: function (data) {
  308. if (data.status) {
  309. layer.alert("删除成功", {icon:1,closeBtn:0},function () {
  310. location.reload();
  311. })
  312. } else {
  313. layer.alert(data.msg, {icon: 7});
  314. }
  315. },
  316. error: function () {
  317. layer.msg("网络异常");
  318. }
  319. })
  320. });
  321. });
  322. //生成二维码
  323. $(".signed-btn").click(function () {
  324. var url = $(this).attr('url');
  325. $("#qrcode").html('');
  326. if(!url){
  327. layer.msg("没有地址");
  328. return false;
  329. }
  330. var qrcode = new QRCode(document.getElementById("qrcode"), {
  331. width : 100,
  332. height : 100
  333. });
  334. qrcode.makeCode(url);
  335. $(".qrcode-fram img").on('load',function(){
  336. layer.open({
  337. type: 1,
  338. title: '签字二维码',
  339. btn: ['关闭'],
  340. area: ['340px', '240px'], //宽高
  341. btnAlign: 'c',
  342. content: '<div style="text-align:center;"><div id="imsCode">'+$("#qrcode").html()+'</div><p style="font-size: 12px">手机扫描二维码,到手机浏览器打开签字链接</p></div>',
  343. btn2: function (index, layero) {
  344. //取消按钮
  345. // console.log(111)
  346. //return false 开启该代码可禁止点击该按钮关闭
  347. }
  348. });
  349. });
  350. return false;
  351. });
  352. //切换领用和出库
  353. $(".use-out>a").click(function () {
  354. $(this).addClass("active").siblings().removeClass("active");
  355. var index = $(this).index();
  356. var type = $(this).attr('type');
  357. var url = '';
  358. if(type == 'out'){
  359. url = "<?php echo $this->createUrl('imsStore/DeliveryOut');?>";
  360. }else{
  361. url = "<?php echo $this->createUrl('/imsStore/Delivery');?>";
  362. }
  363. window.location.href = url;
  364. // $(".ims-box").eq(index).removeClass('hidden').siblings(".ims-box").addClass('hidden');
  365. });
  366. })
  367. </script>
  368. </body>
  369. </html>