8fc054336a1046e05532693a85899be5.php 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566
  1. <?php if (!defined('THINK_PATH')) exit();?><!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': '<?php echo ($_W['uniacid']); ?>',<?php } ?>
  22. <?php if( !empty($_W['acid']) ){ ?>'acid': '<?php echo ($_W['acid']); ?>',<?php } ?>
  23. <?php if (!empty($_W['openid']) ) { ?>'openid': '<?php echo ($_W['openid']); ?>',<?php } ?>
  24. <?php if( !empty($_W['uid']) ) { ?>'uid': '<?php echo ($_W['uid']); ?>',<?php } ?>
  25. 'isfounder': <?php if (!empty($_W['isfounder']) ) { ?>1<?php }else{ ?>0<?php } ?>,
  26. 'siteroot': '<?php echo ($_W['siteroot']); ?>',
  27. 'siteurl': '<?php echo ($_W['siteurl']); ?>',
  28. 'attachurl': '<?php echo ($_W['attachurl']); ?>',
  29. 'attachurl_local': '<?php echo ($_W['attachurl_local']); ?>',
  30. 'attachurl_remote': '<?php echo ($_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': <?php echo 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 type="text/css">
  45. .layui-btn-sm { line-height: 34px;height: 34px; }
  46. .layui-btn-group .layui-btn:first-child {border-radius: 0;}
  47. .text-green { color: #15d2b9 !important; }
  48. .daterangepicker select.ampmselect, .daterangepicker select.hourselect, .daterangepicker select.minuteselect {
  49. width: auto!important;
  50. }
  51. </style>
  52. </head>
  53. <body layadmin-themealias="default">
  54. <div class="layui-fluid">
  55. <div class="layui-card">
  56. <div class="layui-card-header layui-elem-quote">当前位置:<span class="line-text">配送单管理</span></div>
  57. <div class="layui-card-body" style="padding:15px;">
  58. <div class="page-content">
  59. <form action="" method="get" class="form-horizontal form-search layui-form" role="form" id="search">
  60. <input type="hidden" name="c" value="delivery" />
  61. <input type="hidden" name="a" value="delivery" />
  62. <div class="page-toolbar">
  63. <div class="layui-form-item">
  64. <span class="layui-input-inline">
  65. <select name='searchtime' class='form-control' style="width:100px;padding:0 5px;" id="searchtime">
  66. <option value=''>不按时间</option>
  67. <option value='create_time' <?php if( $gpc['searchtime']=='create_time'){ ?>selected<?php } ?>>创建清单时间</option>
  68. <option value='express_time' <?php if( $gpc['searchtime']=='express_time'){ ?>selected<?php } ?>>配送时间</option>
  69. <option value='head_get_time' <?php if( $gpc['searchtime']=='head_get_time'){ ?>selected<?php } ?>>送达时间</option>
  70. </select>
  71. </span>
  72. <span class="layui-input-inline" style="width: 285px;">
  73. <?php echo tpl_form_field_daterange('time', array('starttime'=>date('Y-m-d H:i', $starttime),'endtime'=>date('Y-m-d H:i', $endtime)),true);;?>
  74. </span>
  75. <div class="layui-input-inline">
  76. <input type="hidden" name="export" id="export" value="0">
  77. </div>
  78. <div class="layui-input-inline" style="width: 400px;margin-right: 0px;">
  79. <input type="text" class="layui-input" name='keyword' id="keyword" value="<?php echo ($gpc['keyword']); ?>" placeholder="输入编号/团长姓名/团长手机/线路/配送名称/配送手机然后回车">
  80. </div>
  81. <div class="layui-btn-group">
  82. <button class="layui-btn btn-submit layui-btn-sm" data-export="0" type="submit"> 搜索</button>
  83. <button data-export="1" type="submit" class="layui-btn layui-btn-sm btn-submit layui-btn-primary">导出商品总单</button>
  84. <button data-export="2" type="submit" class="layui-btn layui-btn-sm btn-submit layui-btn-primary">导出配送总单(样式1)</button>
  85. <button data-export="3" type="submit" class="layui-btn layui-btn-sm btn-submit layui-btn-primary">导出配送总单(样式2)</button>
  86. <button style="display:none;" data-export="3" type="submit" class="btn btn-info-o btn-submit">导出团长旗下订单</button>
  87. <button style="display:none;" data-export="4" type="submit" class="btn btn-info-o btn-submit">导出配货单</button>
  88. </div>
  89. </div>
  90. </div>
  91. </form>
  92. <form action="" method="post" class="layui-form" role="form">
  93. <div class="row">
  94. <div class="col-md-12">
  95. <div class="page-table-header">
  96. <div class="btn-group">
  97. <a class='btn btn-default btn-sm btn-op ' data-sec="1" data-confirm='确认批量配送操作吗?' data-toggle="ajaxModal" href="javascript:;" data-href="<?php echo U('delivery/onekey_tosend', array('sec' => 1) );?>" >
  98. <i class="icow icow-yibiaoji" style="color: #999;display: inline-block;vertical-align: middle" title="批量配送操作" ></i>
  99. 批量配送操作
  100. </a>
  101. <a class='btn btn-default btn-sm btn-op ' data-sec="0" data-confirm='确认要将所有待配送,全部变更为已配送?' data-toggle="ajaxModal" href="javascript:;" data-href="<?php echo U('delivery/onekey_tosend', array('sec' => 0) );?>" >
  102. <i class="icow icow-yibiaoji" style="color: #999;display: inline-block;vertical-align: middle" title="确认要将所有待配送,全部变更为已配送?" ></i>
  103. 一键配送操作
  104. </a>
  105. <a class='btn btn-default btn-sm btn-op ' data-sec="1" data-confirm='确认批量送达操作吗?' data-toggle="ajaxModal" href="javascript:;" data-href="<?php echo U('delivery/onekey_tosendover', array('sec' => 1) );?>" >
  106. <i class="icow icow-yibiaoji" style="color: #999;display: inline-block;vertical-align: middle" title="批量送达操作" ></i>
  107. 批量送达操作
  108. </a>
  109. <a class='btn btn-default btn-sm btn-op ' data-sec="0" data-confirm='确认要将所有配送中,全部变更为送达?' data-toggle="ajaxModal" href="javascript:;" data-href="<?php echo U('delivery/onekey_tosendover', array('sec' => 0) );?>" >
  110. <i class="icow icow-yibiaoji" style="color: #999;display: inline-block;vertical-align: middle" title="确认要将所有配送中,全部变更为已送达?" ></i>
  111. 一键送达操作
  112. </a>
  113. </div>
  114. <span class="pull-right">
  115. <a class='btn layui-btn layui-btn-sm' id="delivery_allprint" data-target="_blank" href="javascript:;" data-href="<?php echo U('delivery/delivery_allprint');?>" >
  116. <span data-toggle="tooltip" data-placement="top" title="" data-original-title="一键打印所有团长配送清单">
  117. 一键打印所有团长配送清单
  118. </span>
  119. </a>
  120. <a class='btn layui-btn layui-btn-sm' id="delivery_allprint_order" data-target="_blank" data-href="<?php echo U('delivery/delivery_allprint_order');?>" >
  121. <span data-toggle="tooltip" data-placement="top" title="" data-original-title="一键打印所有团长提货单样式1">
  122. 一键打印所有团长提货单样式1
  123. </span>
  124. </a>
  125. <a class='btn layui-btn layui-btn-sm' id="delivery_allprint_order2" data-target="_blank" data-href="<?php echo U('delivery/delivery_allprint_order' , array('type' => 2) );?>" >
  126. <span data-toggle="tooltip" data-placement="top" title="" data-original-title="一键打印所有团长提货单样式2">
  127. 一键打印所有团长提货单样式2
  128. </span>
  129. </a>
  130. </span>
  131. </div>
  132. <table class="layui-table" lay-skin="line" lay-size="lg">
  133. <thead>
  134. <tr>
  135. <th style="width:25px;">
  136. <input type='checkbox' name="checkall" lay-skin="primary" lay-filter="checkboxall" />
  137. </th>
  138. <th style="width:50px;text-align:center;">ID</th>
  139. <th style="width: 200px;">清单编号</th>
  140. <th style="width: 180px;">小区</th>
  141. <th style="width: 100px;">团长/手机</th>
  142. <th style="width: 140px;">线路名称</th>
  143. <th style="width: 110px;">配送员/手机</th>
  144. <th style="width: 120px;">商品数量/订单数量</th>
  145. <th style="width: 160px;">生成时间/配送时间</th>
  146. <th style="text-align:right;">操作</th>
  147. </tr>
  148. </thead>
  149. <tbody>
  150. <?php foreach( $list as $item ){ ?>
  151. <tr>
  152. <td style="width:25px;">
  153. <input type='checkbox' value="<?php echo ($item['id']); ?>" name="item_checkbox" lay-skin="primary" />
  154. </td>
  155. <td style="width:100px;text-align:center;">
  156. <?php echo ($item['id']); ?>
  157. </td>
  158. <td>
  159. <?php echo ($item['list_sn']); ?>
  160. </td>
  161. <td>
  162. <?php echo ($item['community_name']); ?>
  163. </td>
  164. <td>
  165. <?php echo ($item['head_name']); ?><BR/>
  166. <?php echo ($item['head_mobile']); ?>
  167. </td>
  168. <td>
  169. <?php echo ($item['line_name']); ?>
  170. </td>
  171. <td>
  172. <?php echo ($item['clerk_name']); ?><br/>
  173. <?php echo ($item['clerk_mobile']); ?>
  174. </td>
  175. <td>
  176. <?php echo ($item['goods_count']); ?><br/>
  177. <span class="text-primary"><?php echo ($item['order_count']); ?></span>
  178. </td>
  179. <td>
  180. <span class="text-primary"><?php echo date('Y-m-d H:i:s', $item['create_time']);;?></span><br>
  181. <?php if( !empty($item['express_time']) && $item['express_time'] > 0 ){ ?>
  182. <?php echo date('Y-m-d H:i:s', $item['express_time']);;?><br>
  183. <?php } ?>
  184. </td>
  185. <td style="overflow:visible;position:relative;text-align:right;">
  186. <?php if($item['state'] == 0){ ?>
  187. <a class='layui-btn layui-btn-primary layui-btn-xs deldom' href="javascript:;" data-href="<?php echo U('delivery/sub_song',array('id' => $item['id'],'ok' => 1));?>" data-confirm='确认配送吗?'>
  188. <span data-toggle="tooltip" data-placement="top" title="" data-original-title="点击配送">
  189. 点击配送
  190. </span>
  191. </a>
  192. <?php }else if($item['state'] == 1){ ?>
  193. <label class="text-green">配送中</label>
  194. <?php }else if($item['state'] == 2){ ?>
  195. <label class="text-success">已送达</label>
  196. <?php } ?>
  197. <a class="layui-btn layui-btn-primary layui-btn-xs" href="<?php echo U('delivery/list_goodslist',array('list_id' => $item['id'],'ok'=>1));;?>">
  198. <span data-toggle="tooltip" data-placement="top" title="" data-original-title="查看商品清单">
  199. 查看商品清单
  200. </span>
  201. </a>
  202. <a class="layui-btn layui-btn-primary layui-btn-xs " href="<?php echo U('delivery/downexcel', array('list_id' => $item['id']));?>" target='_blank'>
  203. <span data-toggle="tooltip" data-placement="top" title="" data-original-title="导出配送清单">
  204. 导出配送清单
  205. </span>
  206. </a>
  207. <a class="layui-btn layui-btn-primary layui-btn-xs " href="<?php echo U('delivery/downorderexcel', array('list_id' => $item['id']));?>" target='_blank'>
  208. <span data-toggle="tooltip" data-placement="top" title="" data-original-title="导出相关订单">
  209. 导出相关订单
  210. </span>
  211. </a>
  212. </td>
  213. </tr>
  214. <?php } ?>
  215. </tbody>
  216. <tfoot>
  217. <tr>
  218. <td colspan="3" style="padding-left: 0;">
  219. <!-- <div class="page-table-header">
  220. <input type="checkbox">
  221. </div> -->
  222. </td>
  223. <td colspan="7" style="text-align: right">
  224. <?php echo ($pager); ?>
  225. </td>
  226. </tr>
  227. </tfoot>
  228. </table>
  229. </div>
  230. </div>
  231. </form>
  232. </div>
  233. </div>
  234. </div>
  235. <script src="/layuiadmin/layui/layui.js"></script>
  236. <script>
  237. layui.config({
  238. base: '/layuiadmin/' //静态资源所在路径
  239. }).extend({
  240. index: 'lib/index' //主入口模块
  241. }).use('index');
  242. </script>
  243. <script>
  244. var layer = layui.layer;
  245. var $;
  246. layui.use(['jquery', 'layer','form'], function(){
  247. $ = layui.$;
  248. var form = layui.form;
  249. $("[data-toggle='ajaxModal']").click(function () {
  250. var s_url = $(this).attr('data-href');
  251. ajax_url = s_url;
  252. var ids_arr = [];
  253. var obj = $(this);
  254. var sec = $(this).attr('data-sec');
  255. if( sec == 1 )
  256. {
  257. $("input[name=item_checkbox]").each(function() {
  258. if( $(this).prop('checked') )
  259. {
  260. ids_arr.push( $(this).val() );
  261. }
  262. })
  263. console.log(ids_arr.length);
  264. if(ids_arr.length < 1)
  265. {
  266. layer.msg('请选择要操作的内容');
  267. return false;
  268. }
  269. }
  270. layer.confirm($(this).attr('data-confirm'), function(index){
  271. $.post(ajax_url, {ids_arr:ids_arr,sec:sec}, function(shtml){
  272. layer.open({
  273. type: 1,
  274. area: '930px',
  275. content: shtml //注意,如果str是object,那么需要字符拼接。
  276. });
  277. });
  278. })
  279. });
  280. $('#delivery_allprint,#delivery_allprint_order,#delivery_allprint_order2').click(function(){
  281. var searchtime = $('#searchtime').val();
  282. var start = $('input[name="time[start]"]').val();
  283. var end = $('input[name="time[end]"]').val();
  284. var s_url= $(this).attr('data-href');
  285. s_url += '&searchtime='+searchtime+"&start="+start+"&end="+end;
  286. layer.confirm('确认对所有待配送状态的配送单进行统计和打印', function(index){
  287. window.open(s_url);
  288. layer.closeAll('dialog');
  289. });
  290. //console.log( start );
  291. //console.log(searchtime);
  292. //name="time[start]"
  293. //time[end]
  294. })
  295. $('.deldom').click(function(){
  296. var s_url = $(this).attr('data-href');
  297. layer.confirm($(this).attr('data-confirm'), function(index){
  298. $.ajax({
  299. url:s_url,
  300. type:'post',
  301. dataType:'json',
  302. success:function(info){
  303. if(info.status == 0)
  304. {
  305. layer.msg(info.result.message,{icon: 1,time: 2000});
  306. }else if(info.status == 1){
  307. var go_url = location.href;
  308. if( info.result.hasOwnProperty("url") )
  309. {
  310. go_url = info.result.url;
  311. }
  312. layer.msg('操作成功',{time: 1000,
  313. end:function(){
  314. location.href = info.result.url;
  315. }
  316. });
  317. }
  318. }
  319. })
  320. });
  321. })
  322. $('.btn-operation').click(function(){
  323. var ids_arr = [];
  324. var obj = $(this);
  325. var s_toggle = $(this).attr('data-toggle');
  326. var s_url = $(this).attr('data-href');
  327. $("input[name=item_checkbox]").each(function() {
  328. if( $(this).prop('checked') )
  329. {
  330. ids_arr.push( $(this).val() );
  331. }
  332. })
  333. if(ids_arr.length < 1)
  334. {
  335. layer.msg('请选择要操作的内容');
  336. }else{
  337. var can_sub = true;
  338. if( s_toggle == 'batch-remove' )
  339. {
  340. can_sub = false;
  341. layer.confirm($(obj).attr('data-confirm'), function(index){
  342. $.ajax({
  343. url:s_url,
  344. type:'post',
  345. dataType:'json',
  346. data:{ids:ids_arr},
  347. success:function(info){
  348. if(info.status == 0)
  349. {
  350. layer.msg(info.result.message,{icon: 1,time: 2000});
  351. }else if(info.status == 1){
  352. var go_url = location.href;
  353. if( info.result.hasOwnProperty("url") )
  354. {
  355. go_url = info.result.url;
  356. }
  357. layer.msg('操作成功',{time: 1000,
  358. end:function(){
  359. location.href = info.result.url;
  360. }
  361. });
  362. }
  363. }
  364. })
  365. });
  366. }else{
  367. $.ajax({
  368. url:s_url,
  369. type:'post',
  370. dataType:'json',
  371. data:{ids:ids_arr},
  372. success:function(info){
  373. if(info.status == 0)
  374. {
  375. layer.msg(info.result.message,{icon: 1,time: 2000});
  376. }else if(info.status == 1){
  377. var go_url = location.href;
  378. if( info.result.hasOwnProperty("url") )
  379. {
  380. go_url = info.result.url;
  381. }
  382. layer.msg('操作成功',{time: 1000,
  383. end:function(){
  384. location.href = info.result.url;
  385. }
  386. });
  387. }
  388. }
  389. })
  390. }
  391. }
  392. })
  393. form.on('switch(statewsitch)', function(data){
  394. var s_url = $(this).attr('data-href')
  395. var s_value = 1;
  396. if(data.elem.checked)
  397. {
  398. s_value = 1;
  399. }else{
  400. s_value = 0;
  401. }
  402. $.ajax({
  403. url:s_url,
  404. type:'post',
  405. dataType:'json',
  406. data:{state:s_value},
  407. success:function(info){
  408. if(info.status == 0)
  409. {
  410. layer.msg(info.result.message,{icon: 1,time: 2000});
  411. }else if(info.status == 1){
  412. var go_url = location.href;
  413. if( info.result.hasOwnProperty("url") )
  414. {
  415. go_url = info.result.url;
  416. }
  417. layer.msg('操作成功',{time: 1000,
  418. end:function(){
  419. location.href = info.result.url;
  420. }
  421. });
  422. }
  423. }
  424. })
  425. });
  426. form.on('checkbox(checkboxall)', function(data){
  427. if(data.elem.checked)
  428. {
  429. $("input[name=item_checkbox]").each(function() {
  430. $(this).prop("checked", true);
  431. });
  432. $("input[name=checkall]").each(function() {
  433. $(this).prop("checked", true);
  434. });
  435. }else{
  436. $("input[name=item_checkbox]").each(function() {
  437. $(this).prop("checked", false);
  438. });
  439. $("input[name=checkall]").each(function() {
  440. $(this).prop("checked", false);
  441. });
  442. }
  443. form.render('checkbox');
  444. });
  445. //监听提交
  446. form.on('submit(formDemo)', function(data){
  447. $.ajax({
  448. url: data.form.action,
  449. type: data.form.method,
  450. data: data.field,
  451. dataType:'json',
  452. success: function (info) {
  453. if(info.status == 0)
  454. {
  455. layer.msg(info.result.message,{icon: 1,time: 2000});
  456. }else if(info.status == 1){
  457. var go_url = location.href;
  458. if( info.result.hasOwnProperty("url") )
  459. {
  460. go_url = info.result.url;
  461. }
  462. layer.msg('操作成功',{time: 1000,
  463. end:function(){
  464. location.href = info.result.url;
  465. }
  466. });
  467. }
  468. }
  469. });
  470. return false;
  471. });
  472. })
  473. </script>
  474. <script>
  475. $(function () {
  476. $('.btn-submit').click(function () {
  477. var e = $(this).data('export');
  478. if(e>0 ){
  479. if($('#keyword').val() !='' ){
  480. $('#export').val(e);
  481. $('#search').submit();
  482. }else if($('#searchtime').val()!=''){
  483. $('#export').val(e);
  484. $('#search').submit();
  485. }else{
  486. layer.msg('请先选择时间段!');
  487. return false;
  488. }
  489. }else{
  490. $('#export').val(0);
  491. $('#search').submit();
  492. }
  493. })
  494. })
  495. </script>
  496. </body>
  497. </html>