index.html 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517
  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. tbody tr td{
  46. position: relative;
  47. }
  48. tbody tr .icow-weibiaoti--{
  49. visibility: hidden;
  50. display: inline-block;
  51. color: #fff;
  52. height:18px;
  53. width:18px;
  54. background: #e0e0e0;
  55. text-align: center;
  56. line-height: 18px;
  57. vertical-align: middle;
  58. }
  59. tbody tr:hover .icow-weibiaoti--{
  60. visibility: visible;
  61. }
  62. tbody tr .icow-weibiaoti--.hidden{
  63. visibility: hidden !important;
  64. }
  65. .full .icow-weibiaoti--{
  66. margin-left:10px;
  67. }
  68. .full>span{
  69. display: -webkit-box;
  70. display: -webkit-flex;
  71. display: -ms-flexbox;
  72. display: flex;
  73. vertical-align: middle;
  74. align-items: center;
  75. }
  76. tbody tr .label{
  77. margin: 5px 0;
  78. }
  79. .goods_attribute a{
  80. cursor: pointer;
  81. }
  82. .newgoodsflag{
  83. width: 22px;height: 16px;
  84. background-color: #ff0000;
  85. color: #fff;
  86. text-align: center;
  87. position: absolute;
  88. bottom: 70px;
  89. left: 57px;
  90. font-size: 12px;
  91. }
  92. .a{cursor: pointer;}
  93. .img-40 {
  94. width: 40px;
  95. height: 40px;
  96. }
  97. </style>
  98. </head>
  99. <body layadmin-themealias="default">
  100. <table id="demo" lay-filter="test"></table>
  101. <div class="layui-fluid">
  102. <div class="layui-card">
  103. <div class="layui-card-header layui-elem-quote">当前位置:<span class="line-text">配送员管理</span></div>
  104. <div class="layui-card-body" style="padding:15px;">
  105. <form action="" method="get" class="form-horizontal form-search layui-form" role="form">
  106. <input type="hidden" name="c" value="orderdistribution" />
  107. <input type="hidden" name="a" value="index" />
  108. <div class="layui-form-item">
  109. <div class="layui-inline">
  110. <div class="layui-input-inline">
  111. <input type="text" class="layui-input" name='keyword' value="{$keyword}" placeholder="输入关键词然后回车">
  112. </div>
  113. <div class="layui-input-inline">
  114. <button class="layui-btn layui-btn-sm" type="submit"> 搜索</button>
  115. </div>
  116. </div>
  117. </div>
  118. </form>
  119. <form action="" class="layui-form" lay-filter="example" method="post" >
  120. <div class="row">
  121. <div class="col-md-12">
  122. <div class="page-table-header">
  123. <input type='checkbox' name="checkall" lay-skin="primary" lay-filter="checkboxall" />
  124. <span class="pull-right">
  125. <a href="{:U('Orderdistribution/adddistribution', array('ok' => 1))}" class="layui-btn layui-btn-sm "><i class="fa fa-plus"></i> 添加配送员
  126. </a>
  127. </span>
  128. <div class="btn-group">
  129. <button class="btn btn-default btn-sm btn-operation" type="button" data-toggle='batch-remove' data-confirm="确认要删除,有配送单的不可删除?" data-href="{:U('orderdistribution/deletedistribution')}">
  130. 删除
  131. </button>
  132. </div>
  133. </div>
  134. <table class="table table-responsive" lay-even lay-skin="line" lay-size="lg">
  135. <thead>
  136. <tr>
  137. <th style="width:25px;"></th>
  138. <th style="width:60px;">ID</th>
  139. <th style="width:200px;">配送员姓名</th>
  140. <th>关联会员</th>
  141. <th style="width:120px;">手机号</th>
  142. <th style="width:200px;">常驻地址</th>
  143. <th style="width:140px;">配送商品总量</th>
  144. <th style="width:100px;">所属供应商</th>
  145. <th style="">状态</th>
  146. <th style="width: 260px">操作</th>
  147. </tr>
  148. </thead>
  149. <tbody>
  150. <?php foreach( $list as $row ){ ?>
  151. <tr>
  152. <td>
  153. <input type='checkbox' name="item_checkbox" lay-skin="primary" value="{$row['id']}"/>
  154. </td>
  155. <td>
  156. {$row['id']}
  157. </td>
  158. <td style="cursor: pointer;" >{$row['username']}</td>
  159. <td style="cursor: pointer;" >
  160. <div rel="pop" style="display: flex" >
  161. <img class="img-40" src="{:tomedia($row['mb_info']['avatar'])}" style='border-radius:50%;border:1px solid #efefef;' />
  162. <span style="display: flex;flex-direction: column;justify-content: center;align-items: flex-start;padding-left: 5px">
  163. <span class="nickname">
  164. {$row['mb_info']['nickname']}
  165. </span>
  166. </span>
  167. </div>
  168. </td>
  169. <td >{$row['mobile']}</td>
  170. <td >{$row['always_address']}</td>
  171. <td >{$row['has_send_count']}</td>
  172. <td >{$row['storename']}</td>
  173. <td>
  174. <input type="checkbox" name="" lay-filter="statewsitch" data-href="{:U('orderdistribution/change',array('type'=>'state','id'=>$row['id']))}" <?php if( $row['state']==1){ ?>checked<?php }else{ ?><?php } ?> lay-skin="switch" lay-text="启用|禁用">
  175. </td>
  176. <td>
  177. <a class="layui-btn layui-btn-xs " href="{:U('orderdistribution/adddistribution', array('id' => $row['id'] , 'ok' => 1))}">
  178. <i class="layui-icon layui-icon-edit"></i>编辑
  179. </a>
  180. <a class='layui-btn layui-btn-xs deldom' href="javascript:;" data-href="{:U('orderdistribution/deletedistribution', array('id' => $row['id']))}" data-confirm='确认要删除,有配送单的不可删除?'>
  181. <i class="layui-icon">&#xe640;</i>删除
  182. </a>
  183. <a class="layui-btn layui-btn-xs " href="{:U('orderdistribution/distribution_list', array('id' => $row['id'] , 'ok' => 1))}">
  184. 配送记录
  185. </a>
  186. </td>
  187. </tr>
  188. <?php } ?>
  189. </tbody>
  190. <tfoot>
  191. <tr>
  192. <td colspan="2">
  193. <div class="page-table-header">
  194. <input type="checkbox" name="checkall" lay-skin="primary" lay-filter="checkboxall">
  195. <div class="btn-group">
  196. <button class="btn btn-default btn-sm btn-operation" type="button" data-toggle='batch-remove' data-confirm="确认要删除,有配送单的不可删除?" data-href="{:U('user/deletedistribution')}">
  197. 删除
  198. </button>
  199. </div>
  200. </div>
  201. </td>
  202. <td colspan="8" style="text-align: right">
  203. {$pager}
  204. </td>
  205. </tr>
  206. </tfoot>
  207. </table>
  208. </div>
  209. </div>
  210. </form>
  211. </div>
  212. </div>
  213. </div>
  214. <script src="/layuiadmin/layui/layui.js"></script>
  215. <script>
  216. layui.config({
  217. base: '/layuiadmin/' //静态资源所在路径
  218. }).extend({
  219. index: 'lib/index' //主入口模块
  220. }).use('index');
  221. </script>
  222. <script>
  223. //由于模块都一次性加载,因此不用执行 layui.use() 来加载对应模块,直接使用即可:
  224. var layer = layui.layer;
  225. var $;
  226. layui.use(['jquery', 'layer','form'], function(){
  227. $ = layui.$;
  228. var form = layui.form;
  229. $('.deldom').click(function(){
  230. var s_url = $(this).attr('data-href');
  231. layer.confirm($(this).attr('data-confirm'), function(index){
  232. $.ajax({
  233. url:s_url,
  234. type:'post',
  235. dataType:'json',
  236. success:function(info){
  237. if(info.status == 0)
  238. {
  239. layer.msg(info.result.message,{icon: 1,time: 2000});
  240. }else if(info.status == 1){
  241. var go_url = location.href;
  242. if( info.result.hasOwnProperty("url") )
  243. {
  244. go_url = info.result.url;
  245. }
  246. layer.msg('操作成功',{time: 1000,
  247. end:function(){
  248. location.href = info.result.url;
  249. }
  250. });
  251. }
  252. }
  253. })
  254. });
  255. })
  256. $('.btn-operation').click(function(){
  257. var ids_arr = [];
  258. var obj = $(this);
  259. var s_toggle = $(this).attr('data-toggle');
  260. var s_url = $(this).attr('data-href');
  261. $("input[name=item_checkbox]").each(function() {
  262. if( $(this).prop('checked') )
  263. {
  264. ids_arr.push( $(this).val() );
  265. }
  266. })
  267. if(ids_arr.length < 1)
  268. {
  269. layer.msg('请选择要操作的内容');
  270. }else{
  271. var can_sub = true;
  272. if( s_toggle == 'batch-remove' )
  273. {
  274. can_sub = false;
  275. layer.confirm($(obj).attr('data-confirm'), function(index){
  276. $.ajax({
  277. url:s_url,
  278. type:'post',
  279. dataType:'json',
  280. data:{ids:ids_arr},
  281. success:function(info){
  282. if(info.status == 0)
  283. {
  284. layer.msg(info.result.message,{icon: 1,time: 2000});
  285. }else if(info.status == 1){
  286. var go_url = location.href;
  287. if( info.result.hasOwnProperty("url") )
  288. {
  289. go_url = info.result.url;
  290. }
  291. layer.msg('操作成功',{time: 1000,
  292. end:function(){
  293. location.href = info.result.url;
  294. }
  295. });
  296. }
  297. }
  298. })
  299. });
  300. }else{
  301. $.ajax({
  302. url:s_url,
  303. type:'post',
  304. dataType:'json',
  305. data:{ids:ids_arr},
  306. success:function(info){
  307. if(info.status == 0)
  308. {
  309. layer.msg(info.result.message,{icon: 1,time: 2000});
  310. }else if(info.status == 1){
  311. var go_url = location.href;
  312. if( info.result.hasOwnProperty("url") )
  313. {
  314. go_url = info.result.url;
  315. }
  316. layer.msg('操作成功',{time: 1000,
  317. end:function(){
  318. location.href = info.result.url;
  319. }
  320. });
  321. }
  322. }
  323. })
  324. }
  325. }
  326. })
  327. form.on('switch(statewsitch)', function(data){
  328. var s_url = $(this).attr('data-href')
  329. var s_value = 1;
  330. if(data.elem.checked)
  331. {
  332. s_value = 1;
  333. }else{
  334. s_value = 0;
  335. }
  336. $.ajax({
  337. url:s_url,
  338. type:'post',
  339. dataType:'json',
  340. data:{value:s_value},
  341. success:function(info){
  342. if(info.status == 0)
  343. {
  344. layer.msg(info.result.message,{icon: 1,time: 2000});
  345. }else if(info.status == 1){
  346. var go_url = location.href;
  347. if( info.result.hasOwnProperty("url") )
  348. {
  349. go_url = info.result.url;
  350. }
  351. layer.msg('操作成功',{time: 1000,
  352. end:function(){
  353. location.href = info.result.url;
  354. }
  355. });
  356. }
  357. }
  358. })
  359. });
  360. form.on('checkbox(checkboxall)', function(data){
  361. if(data.elem.checked)
  362. {
  363. $("input[name=item_checkbox]").each(function() {
  364. $(this).prop("checked", true);
  365. });
  366. $("input[name=checkall]").each(function() {
  367. $(this).prop("checked", true);
  368. });
  369. }else{
  370. $("input[name=item_checkbox]").each(function() {
  371. $(this).prop("checked", false);
  372. });
  373. $("input[name=checkall]").each(function() {
  374. $(this).prop("checked", false);
  375. });
  376. }
  377. form.render('checkbox');
  378. });
  379. //监听提交
  380. form.on('submit(formDemo)', function(data){
  381. $.ajax({
  382. url: data.form.action,
  383. type: data.form.method,
  384. data: data.field,
  385. dataType:'json',
  386. success: function (info) {
  387. if(info.status == 0)
  388. {
  389. layer.msg(info.result.message,{icon: 1,time: 2000});
  390. }else if(info.status == 1){
  391. var go_url = location.href;
  392. if( info.result.hasOwnProperty("url") )
  393. {
  394. go_url = info.result.url;
  395. }
  396. layer.msg('操作成功',{time: 1000,
  397. end:function(){
  398. location.href = info.result.url;
  399. }
  400. });
  401. }
  402. }
  403. });
  404. return false;
  405. });
  406. })
  407. </script>
  408. <script>
  409. var ajax_url = "";
  410. $(function(){
  411. $(".ajaxModal").click(function () {
  412. var s_url = $(this).attr('data-href');
  413. ajax_url = s_url;
  414. $.ajax({
  415. url:s_url,
  416. type:"get",
  417. success:function(shtml){
  418. $('#ajaxModal').html(shtml);
  419. $("#ajaxModal").modal();
  420. }
  421. })
  422. });
  423. $(document).delegate(".modal-footer .btn-primary","click",function(){
  424. var s_data = $('#ajaxModal form').serialize();
  425. $.ajax({
  426. url:ajax_url,
  427. type:'post',
  428. dataType:'json',
  429. data:s_data,
  430. success:function(info){
  431. if(info.status == 0)
  432. {
  433. layer.msg(info.result.message,{icon: 1,time: 2000});
  434. }else if(info.status == 1){
  435. var go_url = location.href;
  436. if( info.result.hasOwnProperty("url") )
  437. {
  438. go_url = info.result.url;
  439. }
  440. layer.msg('操作成功',{time: 1000,
  441. end:function(){
  442. location.href = info.result.url;
  443. }
  444. });
  445. }
  446. }
  447. })
  448. return false;
  449. })
  450. })
  451. </script>
  452. <div id="ajaxModal" class="modal fade" style="display: none;">
  453. </div>
  454. </body>