get_delivery_list.html 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <?php $shoname_name = D('Home/Front')->get_config_by_name('shoname'); ?>
  6. <title><?php echo $shoname; ?></title>
  7. <link rel="shortcut icon" href="" />
  8. <meta name="renderer" content="webkit">
  9. <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  10. <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
  11. <link rel="stylesheet" href="/layuiadmin/style/admin.css" media="all">
  12. <!-- 让IE8/9支持媒体查询,从而兼容栅格 -->
  13. <!--[if lt IE 9]>
  14. <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
  15. <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
  16. <![endif]-->
  17. <link href="./resource/css/bootstrap.min.css?v=201903260001" rel="stylesheet">
  18. <link href="./resource/css/common.css?v=201903260001" rel="stylesheet">
  19. <script type="text/javascript">
  20. window.sysinfo = {
  21. <?php if (!empty($_W['uniacid']) ){ ?>'uniacid': '{$_W['uniacid']}',<?php } ?>
  22. <?php if( !empty($_W['acid']) ){ ?>'acid': '{$_W['acid']}',<?php } ?>
  23. <?php if (!empty($_W['openid']) ) { ?>'openid': '{$_W['openid']}',<?php } ?>
  24. <?php if( !empty($_W['uid']) ) { ?>'uid': '{$_W['uid']}',<?php } ?>
  25. 'isfounder': <?php if (!empty($_W['isfounder']) ) { ?>1<?php }else{ ?>0<?php } ?>,
  26. 'siteroot': '{$_W['siteroot']}',
  27. 'siteurl': '{$_W['siteurl']}',
  28. 'attachurl': '{$_W['attachurl']}',
  29. 'attachurl_local': '{$_W['attachurl_local']}',
  30. 'attachurl_remote': '{$_W['attachurl_remote']}',
  31. 'module': {'url' : '<?php if( defined('MODULE_URL') ) { ?>{MODULE_URL}<?php } ?>', 'name' : '<?php if (defined('IN_MODULE') ) { ?>{IN_MODULE}<?php } ?>'},
  32. 'cookie': {'pre': ''},
  33. 'account': {:json_encode($_W['account'])},
  34. };
  35. </script>
  36. <script type="text/javascript" src="./resource/js/lib/jquery-1.11.1.min.js"></script>
  37. <script type="text/javascript" src="./resource/js/lib/bootstrap.min.js"></script>
  38. <script type="text/javascript" src="./resource/js/app/util.js?v=201903260001"></script>
  39. <script type="text/javascript" src="./resource/js/app/common.min.js?v=201903260001"></script>
  40. <script type="text/javascript" src="./resource/js/require.js?v=201903260001"></script>
  41. <script type="text/javascript" src="./resource/js/lib/jquery.nice-select.js?v=201903260001"></script>
  42. <link rel="stylesheet" href="/layuiadmin/layui/css/layui.css" media="all">
  43. <link href="/static/css/snailfish.css" rel="stylesheet">
  44. <style>
  45. .daterangepicker select.ampmselect, .daterangepicker select.hourselect, .daterangepicker select.minuteselect {
  46. width: auto!important;
  47. }
  48. </style>
  49. </head>
  50. <body layadmin-themealias="default">
  51. <div class="layui-fluid">
  52. <div class="layui-card">
  53. <div class="layui-card-header layui-elem-quote">当前位置:<span class="line-text">生成配送单</span></div>
  54. <div class="layui-card-body" style="padding:15px;">
  55. <div class="page-content">
  56. <span class="line-text">说明:此处所有的生成,只针对待发货的订单。如果要使用这个流程,请勿在后台--“订单”,把待发货的订单给变更为已发货,也不能在后台--“订单设置”里设置自动发货,这将导致这些订单永远不会统计在配送单中。其它细节参考帮助文档,搜索 “常规发货”。</span>
  57. <br><br>
  58. <form action="" method="get" class="form-horizontal form-search layui-form" role="form">
  59. <input type="hidden" name="c" value="delivery" />
  60. <input type="hidden" name="a" value="get_delivery_list" />
  61. <div class="page-toolbar">
  62. <div class="layui-form-item">
  63. <span class="layui-input-inline">
  64. <select name='searchtime' class='form-control' style="width:100px;padding:0 5px;" id="searchtime">
  65. <option value=''>不按时间</option>
  66. <option value='pay' <?php if( $gpc['searchtime']=='pay'){ ?>selected<?php } ?>>付款时间</option>
  67. <option value='create' <?php if( $gpc['searchtime']=='create' ){ ?>selected<?php } ?>>下单时间</option>
  68. </select>
  69. </span>
  70. <span class="layui-input-inline" style="width:280px;">
  71. {:tpl_form_field_daterange('time', array('starttime'=>date('Y-m-d H:i', $starttime),'endtime'=>date('Y-m-d H:i', $endtime)),true);}
  72. </span>
  73. <span class="layui-input-inline">
  74. <select name="line_id" class='form-control select2' style="width:200px;" data-placeholder="配送线路">
  75. <option value="-1" <?php if( empty($gpc['line_id'])){ ?>selected<?php } ?> >配送线路</option>
  76. <?php foreach($line_list as $line){ ?>
  77. <option value="<?php echo $line['id']; ?>" <?php if( $gpc['line_id']== $line['id'] ){ ?>selected<?php } ?> ><?php echo $line['name']; ?></option>
  78. <?php } ?>
  79. </select>
  80. </span>
  81. <div class="layui-input-inline">
  82. <input type="text" class="layui-input" name='keyword' value="{$gpc['keyword']}" placeholder="输入店铺名称然后回车">
  83. </div>
  84. <span class="layui-input-inline">
  85. <button class="btn btn-primary" type="submit"> 搜索</button>
  86. </span>
  87. </div>
  88. </div>
  89. </form>
  90. <form action="" method="post" class="layui-form" role="form" >
  91. <div class="row">
  92. <div class="col-md-12">
  93. <div class="page-table-header">
  94. <input type='checkbox' type='checkbox' name="checkall" lay-skin="primary" lay-filter="checkboxall" />
  95. <span class="pull-right">
  96. <a class='btn layui-btn layui-btn-sm' href="{:U('delivery/auto_get_delivery_list')}" >
  97. <span data-toggle="tooltip" data-placement="top" title="" data-original-title="打印配送单">
  98. 一键生成所有清单
  99. </span>
  100. </a>
  101. </span>
  102. <div class="btn-group">
  103. <button class="btn btn-default btn-sm btn-operation" type="button" data-toggle='batch-remove' data-confirm="确认要批量生成吗,请确认商品数量是否正确?" data-href="{:U('delivery/sub_delivery_list', array('endtime' => $endtime,'starttime' => $starttime,'searchtime' => $gpc['searchtime'] ) )}">
  104. <i class='icow icow-shanchu1'></i> 批量生成清单
  105. </button>
  106. </div>
  107. </div>
  108. <table class="table table-responsive">
  109. <thead>
  110. <tr>
  111. <th style="width:25px;"></th>
  112. <th style="width:100px;text-align:center;">社区ID</th>
  113. <th style="">社区名称</th>
  114. <th style="width: 300px;">配送线路</th>
  115. <th style="width: 100px;">商品总数</th>
  116. <th style="width: 200px;">操作</th>
  117. </tr>
  118. </thead>
  119. <tbody>
  120. <?php foreach( $list as $item ){ ?>
  121. <tr>
  122. <td style="width:25px;">
  123. <input type='checkbox' value="{$item['head_id']}" value="{$row['id']}" name="item_checkbox" lay-skin="primary"/>
  124. </td>
  125. <td style="width:100px;text-align:center;">
  126. {$item['head_id']}
  127. </td>
  128. <td>
  129. {$item['community_name']}
  130. </td>
  131. <td>
  132. {$item['line_name']}
  133. </td>
  134. <td>
  135. {$item['goods_count']}
  136. </td>
  137. <td style="overflow:visible;position:relative">
  138. <a class='layui-btn layui-btn-primary layui-btn-xs create_list' href="javascript:;" data-href="{:U('delivery/sub_delivery_list', array('head_id' => $item['head_id'],'endtime' => $endtime,'starttime' => $starttime,'searchtime' => $gpc['searchtime'] ))}" >
  139. <span data-toggle="tooltip" data-placement="top" title="" data-original-title="生成清单">
  140. 生成清单
  141. </span>
  142. </a>
  143. <a class='layui-btn layui-btn-primary layui-btn-xs head_ordergoods_detail' href="javascript:;" data-href="{:U('delivery/head_ordergoods_detail', array('head_id' => $item['head_id'],'endtime' => $endtime,'starttime' => $starttime,'searchtime' => $gpc['searchtime'],'ok'=>1 ))}" >
  144. <span data-toggle="tooltip" data-placement="top" title="" data-original-title="商品详情">
  145. <i class="icow icow-bianji2"></i>商品详情
  146. </span>
  147. </a>
  148. </td>
  149. </tr>
  150. <?php } ?>
  151. </tbody>
  152. <tfoot>
  153. <tr>
  154. <td colspan="3" style="padding-left: 0;">
  155. <div class="page-table-header">
  156. <input type="checkbox" type='checkbox' name="checkall" lay-skin="primary" lay-filter="checkboxall">
  157. <div class="btn-group">
  158. <button class="btn btn-default btn-sm btn-operation" type="button" data-toggle='batch-remove' data-confirm="确认要批量生成吗,请确认商品数量是否正确?" data-href="{php echo shopUrl('delivery/sub_delivery_list', array('endtime' => $endtime,'starttime' => $starttime,'searchtime' => $_GPC['searchtime']) )}">
  159. <i class='icow icow-shanchu1'></i> 批量生成清单
  160. </button>
  161. </div>
  162. </div>
  163. </td>
  164. <td colspan="3" style="text-align: right">
  165. {$pager}
  166. </td>
  167. </tr>
  168. </tfoot>
  169. </table>
  170. </div>
  171. </div>
  172. </form>
  173. </div>
  174. </div>
  175. </div>
  176. </div>
  177. <script src="/layuiadmin/layui/layui.js"></script>
  178. <script>
  179. layui.config({
  180. base: '/layuiadmin/' //静态资源所在路径
  181. }).extend({
  182. index: 'lib/index' //主入口模块
  183. }).use('index');
  184. </script>
  185. <script>
  186. var layer = layui.layer;
  187. var $;
  188. var can_sb = true;
  189. layui.use(['jquery', 'layer', 'form'], function(){
  190. $ = layui.$;
  191. var form = layui.form;
  192. $('.create_list').click(function(){
  193. if(!can_sb)
  194. {
  195. return false;
  196. }
  197. can_sb = false;
  198. var s_url = $(this).attr('data-href');
  199. $.ajax({
  200. url:s_url,
  201. type:'post',
  202. dataType:'json',
  203. success:function(info){
  204. if(info.status == 0)
  205. {
  206. layer.msg(info.result.message,{icon: 1,time: 2000});
  207. can_sb = true;
  208. }else if(info.status == 1){
  209. var go_url = location.href;
  210. if( info.result.hasOwnProperty("url") )
  211. {
  212. go_url = info.result.url;
  213. }
  214. layer.msg('生成成功',{time: 1000,
  215. end:function(){
  216. location.href = info.result.url;
  217. }
  218. });
  219. }
  220. }
  221. })
  222. })
  223. $('.deldom').click(function(){
  224. var s_url = $(this).attr('data-href');
  225. layer.confirm($(this).attr('data-confirm'), function(index){
  226. $.ajax({
  227. url:s_url,
  228. type:'post',
  229. dataType:'json',
  230. success:function(info){
  231. if(info.status == 0)
  232. {
  233. layer.msg(info.result.message,{icon: 1,time: 2000});
  234. }else if(info.status == 1){
  235. var go_url = location.href;
  236. if( info.result.hasOwnProperty("url") )
  237. {
  238. go_url = info.result.url;
  239. }
  240. layer.msg('操作成功',{time: 1000,
  241. end:function(){
  242. location.href = info.result.url;
  243. }
  244. });
  245. }
  246. }
  247. })
  248. });
  249. })
  250. $('.btn-operation').click(function(){
  251. if(!can_sb)
  252. {
  253. return false;
  254. }
  255. can_sb = false;
  256. var ids_arr = [];
  257. var obj = $(this);
  258. var s_toggle = $(this).attr('data-toggle');
  259. var s_url = $(this).attr('data-href');
  260. $("input[name=item_checkbox]").each(function() {
  261. if( $(this).prop('checked') )
  262. {
  263. ids_arr.push( $(this).val() );
  264. }
  265. })
  266. if(ids_arr.length < 1)
  267. {
  268. layer.msg('请选择要操作的内容');
  269. can_sb = true;
  270. }else{
  271. var can_sub = true;
  272. if( s_toggle == 'batch-remove' )
  273. {
  274. var nlb_can = true;
  275. layer.confirm($(obj).attr('data-confirm'), function(index){
  276. if(nlb_can)
  277. {
  278. nlb_can = false;
  279. $.ajax({
  280. url:s_url,
  281. type:'post',
  282. dataType:'json',
  283. data:{ids:ids_arr},
  284. success:function(info){
  285. if(info.status == 0)
  286. {
  287. layer.msg(info.result.message,{icon: 1,time: 2000});
  288. can_sb = true;
  289. }else if(info.status == 1){
  290. var go_url = location.href;
  291. if( info.result.hasOwnProperty("url") )
  292. {
  293. go_url = info.result.url;
  294. }
  295. layer.msg('操作成功',{time: 1000,
  296. end:function(){
  297. location.href = info.result.url;
  298. }
  299. });
  300. }
  301. }
  302. })
  303. }
  304. }, function(index){
  305. console.log('cancle confirm');
  306. can_sb = true;
  307. });
  308. }else{
  309. $.ajax({
  310. url:s_url,
  311. type:'post',
  312. dataType:'json',
  313. data:{ids:ids_arr},
  314. success:function(info){
  315. if(info.status == 0)
  316. {
  317. layer.msg(info.result.message,{icon: 1,time: 2000});
  318. can_sb = true;
  319. }else if(info.status == 1){
  320. var go_url = location.href;
  321. if( info.result.hasOwnProperty("url") )
  322. {
  323. go_url = info.result.url;
  324. }
  325. layer.msg('操作成功',{time: 1000,
  326. end:function(){
  327. location.href = info.result.url;
  328. }
  329. });
  330. }
  331. }
  332. })
  333. }
  334. }
  335. })
  336. form.on('switch(statewsitch)', function(data){
  337. var s_url = $(this).attr('data-href')
  338. var s_value = 1;
  339. if(data.elem.checked)
  340. {
  341. s_value = 1;
  342. }else{
  343. s_value = 0;
  344. }
  345. $.ajax({
  346. url:s_url,
  347. type:'post',
  348. dataType:'json',
  349. data:{value:s_value},
  350. success:function(info){
  351. if(info.status == 0)
  352. {
  353. layer.msg(info.result.message,{icon: 1,time: 2000});
  354. }else if(info.status == 1){
  355. var go_url = location.href;
  356. if( info.result.hasOwnProperty("url") )
  357. {
  358. go_url = info.result.url;
  359. }
  360. layer.msg('操作成功',{time: 1000,
  361. end:function(){
  362. location.href = info.result.url;
  363. }
  364. });
  365. }
  366. }
  367. })
  368. });
  369. form.on('checkbox(checkboxall)', function(data){
  370. if(data.elem.checked)
  371. {
  372. $("input[name=item_checkbox]").each(function() {
  373. $(this).prop("checked", true);
  374. });
  375. $("input[name=checkall]").each(function() {
  376. $(this).prop("checked", true);
  377. });
  378. }else{
  379. $("input[name=item_checkbox]").each(function() {
  380. $(this).prop("checked", false);
  381. });
  382. $("input[name=checkall]").each(function() {
  383. $(this).prop("checked", false);
  384. });
  385. }
  386. form.render('checkbox');
  387. });
  388. //监听提交
  389. form.on('submit(formDemo)', function(data){
  390. $.ajax({
  391. url: data.form.action,
  392. type: data.form.method,
  393. data: data.field,
  394. dataType:'json',
  395. success: function (info) {
  396. if(info.status == 0)
  397. {
  398. layer.msg(info.result.message,{icon: 1,time: 2000});
  399. }else if(info.status == 1){
  400. var go_url = location.href;
  401. if( info.result.hasOwnProperty("url") )
  402. {
  403. go_url = info.result.url;
  404. }
  405. layer.msg('操作成功',{time: 1000,
  406. end:function(){
  407. location.href = info.result.url;
  408. }
  409. });
  410. }
  411. }
  412. });
  413. return false;
  414. });
  415. })
  416. </script>
  417. <script>
  418. var ajax_url = "";
  419. $(function(){
  420. $(".head_ordergoods_detail").click(function () {
  421. var s_url = $(this).attr('data-href');
  422. ajax_url = s_url;
  423. $.ajax({
  424. url:s_url,
  425. type:"get",
  426. success:function(shtml){
  427. layer.open({
  428. type: 1,
  429. area: '50%',
  430. content: shtml //这里content是一个普通的String
  431. });
  432. }
  433. })
  434. });
  435. var sub_url = "{:U('delivery/sub_delivery_list')}";
  436. $(document).delegate(".modal-footer .btn-primary","click",function(){
  437. var s_data = $('#ajaxModal form').serialize();
  438. $.ajax({
  439. url: sub_url,
  440. type:'post',
  441. dataType:'json',
  442. data: s_data,
  443. success:function(info){
  444. if(info.status == 0)
  445. {
  446. layer.msg(info.result.message,{icon: 1,time: 2000});
  447. }else if(info.status == 1){
  448. var go_url = location.href;
  449. if( info.result.hasOwnProperty("url") )
  450. {
  451. go_url = info.result.url;
  452. }
  453. layer.msg('操作成功',{time: 1000,
  454. end:function(){
  455. location.href = info.result.url;
  456. }
  457. });
  458. }
  459. }
  460. })
  461. return false;
  462. })
  463. })
  464. </script>
  465. <div id="ajaxModal" class="modal fade" style="display: none;"></div>
  466. </body>
  467. </html>