get_delivery_list.html 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512
  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. <form action="" method="get" class="form-horizontal form-search layui-form" role="form">
  57. <input type="hidden" name="c" value="delivery" />
  58. <input type="hidden" name="a" value="get_delivery_list" />
  59. <div class="page-toolbar">
  60. <div class="layui-form-item">
  61. <span class="layui-input-inline">
  62. <select name='searchtime' class='form-control' style="width:100px;padding:0 5px;" id="searchtime">
  63. <option value=''>不按时间</option>
  64. <option value='pay' <?php if( $gpc['searchtime']=='pay'){ ?>selected<?php } ?>>付款时间</option>
  65. <option value='create' <?php if( $gpc['searchtime']=='create' ){ ?>selected<?php } ?>>下单时间</option>
  66. </select>
  67. </span>
  68. <span class="layui-input-inline" style="width:280px;">
  69. {:tpl_form_field_daterange('time', array('starttime'=>date('Y-m-d H:i', $starttime),'endtime'=>date('Y-m-d H:i', $endtime)),true);}
  70. </span>
  71. <span class="layui-input-inline">
  72. <select name="line_id" class='form-control select2' style="width:200px;" data-placeholder="配送线路">
  73. <option value="-1" <?php if( empty($gpc['line_id'])){ ?>selected<?php } ?> >配送线路</option>
  74. <?php foreach($line_list as $line){ ?>
  75. <option value="<?php echo $line['id']; ?>" <?php if( $gpc['line_id']== $line['id'] ){ ?>selected<?php } ?> ><?php echo $line['name']; ?></option>
  76. <?php } ?>
  77. </select>
  78. </span>
  79. <div class="layui-input-inline">
  80. <input type="text" class="layui-input" name='keyword' value="{$gpc['keyword']}" placeholder="输入店铺名称然后回车">
  81. </div>
  82. <span class="layui-input-inline">
  83. <button class="btn btn-primary" type="submit"> 搜索</button>
  84. </span>
  85. </div>
  86. </div>
  87. </form>
  88. <form action="" method="post" class="layui-form" role="form" >
  89. <div class="row">
  90. <div class="col-md-12">
  91. <div class="page-table-header">
  92. <input type='checkbox' type='checkbox' name="checkall" lay-skin="primary" lay-filter="checkboxall" />
  93. <span class="pull-right">
  94. <a class='btn layui-btn layui-btn-sm' href="{:U('delivery/auto_get_delivery_list')}" >
  95. <span data-toggle="tooltip" data-placement="top" title="" data-original-title="打印配送单">
  96. 一键生成所有清单
  97. </span>
  98. </a>
  99. </span>
  100. <div class="btn-group">
  101. <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'] ) )}">
  102. <i class='icow icow-shanchu1'></i> 批量生成清单
  103. </button>
  104. </div>
  105. </div>
  106. <table class="table table-responsive">
  107. <thead>
  108. <tr>
  109. <th style="width:25px;"></th>
  110. <th style="width:100px;text-align:center;">社区ID</th>
  111. <th style="">社区名称</th>
  112. <th style="width: 300px;">配送线路</th>
  113. <th style="width: 100px;">商品总数</th>
  114. <th style="width: 200px;">操作</th>
  115. </tr>
  116. </thead>
  117. <tbody>
  118. <?php foreach( $list as $item ){ ?>
  119. <tr>
  120. <td style="width:25px;">
  121. <input type='checkbox' value="{$item['head_id']}" value="{$row['id']}" name="item_checkbox" lay-skin="primary"/>
  122. </td>
  123. <td style="width:100px;text-align:center;">
  124. {$item['head_id']}
  125. </td>
  126. <td>
  127. {$item['community_name']}
  128. </td>
  129. <td>
  130. {$item['line_name']}
  131. </td>
  132. <td>
  133. {$item['goods_count']}
  134. </td>
  135. <td style="overflow:visible;position:relative">
  136. <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'] ))}" >
  137. <span data-toggle="tooltip" data-placement="top" title="" data-original-title="生成清单">
  138. 生成清单
  139. </span>
  140. </a>
  141. <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 ))}" >
  142. <span data-toggle="tooltip" data-placement="top" title="" data-original-title="商品详情">
  143. <i class="icow icow-bianji2"></i>商品详情
  144. </span>
  145. </a>
  146. </td>
  147. </tr>
  148. <?php } ?>
  149. </tbody>
  150. <tfoot>
  151. <tr>
  152. <td colspan="3" style="padding-left: 0;">
  153. <div class="page-table-header">
  154. <input type="checkbox" type='checkbox' name="checkall" lay-skin="primary" lay-filter="checkboxall">
  155. <div class="btn-group">
  156. <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']) )}">
  157. <i class='icow icow-shanchu1'></i> 批量生成清单
  158. </button>
  159. </div>
  160. </div>
  161. </td>
  162. <td colspan="3" style="text-align: right">
  163. {$pager}
  164. </td>
  165. </tr>
  166. </tfoot>
  167. </table>
  168. </div>
  169. </div>
  170. </form>
  171. </div>
  172. </div>
  173. </div>
  174. </div>
  175. <script src="/layuiadmin/layui/layui.js"></script>
  176. <script>
  177. layui.config({
  178. base: '/layuiadmin/' //静态资源所在路径
  179. }).extend({
  180. index: 'lib/index' //主入口模块
  181. }).use('index');
  182. </script>
  183. <script>
  184. var layer = layui.layer;
  185. var $;
  186. var can_sb = true;
  187. layui.use(['jquery', 'layer', 'form'], function(){
  188. $ = layui.$;
  189. var form = layui.form;
  190. $('.create_list').click(function(){
  191. if(!can_sb)
  192. {
  193. return false;
  194. }
  195. can_sb = false;
  196. var s_url = $(this).attr('data-href');
  197. $.ajax({
  198. url:s_url,
  199. type:'post',
  200. dataType:'json',
  201. success:function(info){
  202. if(info.status == 0)
  203. {
  204. layer.msg(info.result.message,{icon: 1,time: 2000});
  205. can_sb = true;
  206. }else if(info.status == 1){
  207. var go_url = location.href;
  208. if( info.result.hasOwnProperty("url") )
  209. {
  210. go_url = info.result.url;
  211. }
  212. layer.msg('生成成功',{time: 1000,
  213. end:function(){
  214. location.href = info.result.url;
  215. }
  216. });
  217. }
  218. }
  219. })
  220. })
  221. $('.deldom').click(function(){
  222. var s_url = $(this).attr('data-href');
  223. layer.confirm($(this).attr('data-confirm'), function(index){
  224. $.ajax({
  225. url:s_url,
  226. type:'post',
  227. dataType:'json',
  228. success:function(info){
  229. if(info.status == 0)
  230. {
  231. layer.msg(info.result.message,{icon: 1,time: 2000});
  232. }else if(info.status == 1){
  233. var go_url = location.href;
  234. if( info.result.hasOwnProperty("url") )
  235. {
  236. go_url = info.result.url;
  237. }
  238. layer.msg('操作成功',{time: 1000,
  239. end:function(){
  240. location.href = info.result.url;
  241. }
  242. });
  243. }
  244. }
  245. })
  246. });
  247. })
  248. $('.btn-operation').click(function(){
  249. if(!can_sb)
  250. {
  251. return false;
  252. }
  253. can_sb = false;
  254. var ids_arr = [];
  255. var obj = $(this);
  256. var s_toggle = $(this).attr('data-toggle');
  257. var s_url = $(this).attr('data-href');
  258. $("input[name=item_checkbox]").each(function() {
  259. if( $(this).prop('checked') )
  260. {
  261. ids_arr.push( $(this).val() );
  262. }
  263. })
  264. if(ids_arr.length < 1)
  265. {
  266. layer.msg('请选择要操作的内容');
  267. can_sb = true;
  268. }else{
  269. var can_sub = true;
  270. if( s_toggle == 'batch-remove' )
  271. {
  272. var nlb_can = true;
  273. layer.confirm($(obj).attr('data-confirm'), function(index){
  274. if(nlb_can)
  275. {
  276. nlb_can = false;
  277. $.ajax({
  278. url:s_url,
  279. type:'post',
  280. dataType:'json',
  281. data:{ids:ids_arr},
  282. success:function(info){
  283. if(info.status == 0)
  284. {
  285. layer.msg(info.result.message,{icon: 1,time: 2000});
  286. can_sb = true;
  287. }else if(info.status == 1){
  288. var go_url = location.href;
  289. if( info.result.hasOwnProperty("url") )
  290. {
  291. go_url = info.result.url;
  292. }
  293. layer.msg('操作成功',{time: 1000,
  294. end:function(){
  295. location.href = info.result.url;
  296. }
  297. });
  298. }
  299. }
  300. })
  301. }
  302. }, function(index){
  303. console.log('cancle confirm');
  304. can_sb = true;
  305. });
  306. }else{
  307. $.ajax({
  308. url:s_url,
  309. type:'post',
  310. dataType:'json',
  311. data:{ids:ids_arr},
  312. success:function(info){
  313. if(info.status == 0)
  314. {
  315. layer.msg(info.result.message,{icon: 1,time: 2000});
  316. can_sb = true;
  317. }else if(info.status == 1){
  318. var go_url = location.href;
  319. if( info.result.hasOwnProperty("url") )
  320. {
  321. go_url = info.result.url;
  322. }
  323. layer.msg('操作成功',{time: 1000,
  324. end:function(){
  325. location.href = info.result.url;
  326. }
  327. });
  328. }
  329. }
  330. })
  331. }
  332. }
  333. })
  334. form.on('switch(statewsitch)', function(data){
  335. var s_url = $(this).attr('data-href')
  336. var s_value = 1;
  337. if(data.elem.checked)
  338. {
  339. s_value = 1;
  340. }else{
  341. s_value = 0;
  342. }
  343. $.ajax({
  344. url:s_url,
  345. type:'post',
  346. dataType:'json',
  347. data:{value:s_value},
  348. success:function(info){
  349. if(info.status == 0)
  350. {
  351. layer.msg(info.result.message,{icon: 1,time: 2000});
  352. }else if(info.status == 1){
  353. var go_url = location.href;
  354. if( info.result.hasOwnProperty("url") )
  355. {
  356. go_url = info.result.url;
  357. }
  358. layer.msg('操作成功',{time: 1000,
  359. end:function(){
  360. location.href = info.result.url;
  361. }
  362. });
  363. }
  364. }
  365. })
  366. });
  367. form.on('checkbox(checkboxall)', function(data){
  368. if(data.elem.checked)
  369. {
  370. $("input[name=item_checkbox]").each(function() {
  371. $(this).prop("checked", true);
  372. });
  373. $("input[name=checkall]").each(function() {
  374. $(this).prop("checked", true);
  375. });
  376. }else{
  377. $("input[name=item_checkbox]").each(function() {
  378. $(this).prop("checked", false);
  379. });
  380. $("input[name=checkall]").each(function() {
  381. $(this).prop("checked", false);
  382. });
  383. }
  384. form.render('checkbox');
  385. });
  386. //监听提交
  387. form.on('submit(formDemo)', function(data){
  388. $.ajax({
  389. url: data.form.action,
  390. type: data.form.method,
  391. data: data.field,
  392. dataType:'json',
  393. success: function (info) {
  394. if(info.status == 0)
  395. {
  396. layer.msg(info.result.message,{icon: 1,time: 2000});
  397. }else if(info.status == 1){
  398. var go_url = location.href;
  399. if( info.result.hasOwnProperty("url") )
  400. {
  401. go_url = info.result.url;
  402. }
  403. layer.msg('操作成功',{time: 1000,
  404. end:function(){
  405. location.href = info.result.url;
  406. }
  407. });
  408. }
  409. }
  410. });
  411. return false;
  412. });
  413. })
  414. </script>
  415. <script>
  416. var ajax_url = "";
  417. $(function(){
  418. $(".head_ordergoods_detail").click(function () {
  419. var s_url = $(this).attr('data-href');
  420. ajax_url = s_url;
  421. $.ajax({
  422. url:s_url,
  423. type:"get",
  424. success:function(shtml){
  425. layer.open({
  426. type: 1,
  427. area: '50%',
  428. content: shtml //这里content是一个普通的String
  429. });
  430. }
  431. })
  432. });
  433. var sub_url = "{:U('delivery/sub_delivery_list')}";
  434. $(document).delegate(".modal-footer .btn-primary","click",function(){
  435. var s_data = $('#ajaxModal form').serialize();
  436. $.ajax({
  437. url: sub_url,
  438. type:'post',
  439. dataType:'json',
  440. data: s_data,
  441. success:function(info){
  442. if(info.status == 0)
  443. {
  444. layer.msg(info.result.message,{icon: 1,time: 2000});
  445. }else if(info.status == 1){
  446. var go_url = location.href;
  447. if( info.result.hasOwnProperty("url") )
  448. {
  449. go_url = info.result.url;
  450. }
  451. layer.msg('操作成功',{time: 1000,
  452. end:function(){
  453. location.href = info.result.url;
  454. }
  455. });
  456. }
  457. }
  458. })
  459. return false;
  460. })
  461. })
  462. </script>
  463. <div id="ajaxModal" class="modal fade" style="display: none;"></div>
  464. </body>
  465. </html>