index.html 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379
  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. .layui-table[lay-size=lg] td, .layui-table[lay-size=lg] th {
  46. padding: 15px 10px;
  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-tab layui-tab-brief">
  55. <ul class="layui-tab-title">
  56. <li <?php if(empty($state)){ ?>class="layui-this"<?php } ?>><a href="{:U('salesroom_member/index')}">全部</a></li>
  57. <li <?php if(!empty($state) && $state == 1){ ?>class="layui-this"<?php } ?>><a href="{:U('salesroom_member/index', array('state' => 1))}">已启用</a></li>
  58. <li <?php if(!empty($state) && $state == 2){ ?>class="layui-this"<?php } ?>><a href="{:U('salesroom_member/index', array('state' => 2))}">已禁用</a></li>
  59. </ul>
  60. </div>
  61. <div class="layui-card-body" style="padding:15px;">
  62. <form action="" method="get" class="form-horizontal form-search layui-form" role="form">
  63. <input type="hidden" name="c" value="salesroom_member" />
  64. <input type="hidden" name="type" value="{$type}" />
  65. <input type="hidden" name="state" value="{$state}" />
  66. <div class="layui-form-item">
  67. <div class="layui-inline">
  68. <div class="layui-input-inline">
  69. <input type="text" class="layui-input" name='keyword' value="{$keyword}" placeholder="请输入姓名/手机号/会员名">
  70. </div>
  71. <div class="layui-input-inline">
  72. <select name="room_id" id="room_id">
  73. <option value="">请选择门店</option>
  74. <?php foreach($room_list as $rk=>$rv){ ?>
  75. <option value="{$rv['id']}" <?php if($room_id == $rv['id']){ ?>selected="selected"<?php } ?> >{$rv['room_name']}({$rv['supply_name']})</option>
  76. <?php } ?>
  77. </select>
  78. </div>
  79. <div class="layui-input-inline">
  80. <button class="layui-btn layui-btn-sm" type="submit"> 搜索</button>
  81. </div>
  82. </div>
  83. </div>
  84. </form>
  85. <form action="" class="layui-form" lay-filter="example" method="post" >
  86. <div class="row">
  87. <div class="col-md-12">
  88. <div class="page-table-header">
  89. <span class="pull-right">
  90. <a href="{:U('salesroom_member/add', array('ok' => 1))}" class="layui-btn layui-btn-sm"><i class="fa fa-plus"></i> 新增核销人员</a>
  91. </span>
  92. <div class="btn-group">
  93. <button class="btn btn-default btn-sm btn-operation" type="button" data-toggle='batch' data-href="{:U('salesroom_member/change',array('type'=>'state','value'=>1))}">启用</button>
  94. <button class="btn btn-default btn-sm btn-operation" type="button" data-toggle='batch' data-href="{:U('salesroom_member/change',array('type'=>'state','value'=>0))}">禁用</button>
  95. <button class="btn btn-default btn-sm btn-operation" type="button" data-toggle='batch-remove' data-confirm="确认要删除吗?" data-href="{:U('salesroom_member/delete')}">删除</button>
  96. </div>
  97. </div>
  98. <table class="layui-table" lay-skin="line" lay-size="lg">
  99. <thead>
  100. <tr>
  101. <th style="width:25px;"><input type='checkbox' name="checkall" lay-skin="primary" lay-filter="checkboxall" /></th>
  102. <th style="width:10%;">姓名</th>
  103. <th style="width:10%;">手机号</th>
  104. <th style="width:10%;">会员名</th>
  105. <th style="width:10%;">所属门店</th>
  106. <th style="width:10%;">创建时间</th>
  107. <th style="width: 200px;">状态</th>
  108. <th style="width: 250px;">操作</th>
  109. </tr>
  110. </thead>
  111. <tbody>
  112. <?php foreach( $list as $item ){ ?>
  113. <tr>
  114. <td style="width:25px;">
  115. <input type='checkbox' name="item_checkbox" lay-skin="primary" value="{$item['id']}"/>
  116. </td>
  117. <td>
  118. {$item['username']}
  119. </td>
  120. <td>
  121. {$item['mobile']}
  122. </td>
  123. <td>
  124. {$item['member_name']}
  125. </td>
  126. <td>
  127. <?php foreach($item['room_list'] as $rk=>$rv){ ?>
  128. {$item['supply_name']}-{$rv['room_name']}<br/>
  129. <?php }?>
  130. </td>
  131. <td>
  132. {$item['addtime']}
  133. </td>
  134. <td>
  135. <input type="checkbox" name="" lay-filter="statewsitch" data-href="{:U('salesroom_member/change',array('type'=>'state','id'=>$item['id']))}" <?php if( $item['state']==1){ ?>checked<?php }else{ ?><?php } ?> lay-skin="switch" lay-text="启用|禁用">
  136. <?php if($item['state'] == 0){ ?>
  137. <br/><span style="font-size: 12px;color: #c3c3c3;">禁用时间:{$item['disable_time']}</span>
  138. <?php } ?>
  139. </td>
  140. <td style="overflow:visible;position:relative">
  141. <a class='layui-btn layui-btn-xs' href="{:U('salesroom_order/member_orders', array('smember_id'=>$item['id']))}" >
  142. 查看核销记录
  143. </a>
  144. <a class='layui-btn layui-btn-xs' href="{:U('salesroom_member/add', array('id'=>$item['id'],'ok' => 1))}" >
  145. <i class="layui-icon layui-icon-edit"></i>编辑
  146. </a>
  147. <a class='layui-btn layui-btn-xs deldom' href="javascript:;" data-href="{:U('salesroom_member/delete',array('id'=>$item['id']))}" data-confirm='确认要删除吗?'>
  148. <i class="layui-icon">&#xe640;</i>删除
  149. </a>
  150. </td>
  151. </tr>
  152. <?php } ?>
  153. </tbody>
  154. <tfoot>
  155. <tr>
  156. <td colspan="8" style="text-align: right">
  157. {$pager}
  158. </td>
  159. </tr>
  160. </tfoot>
  161. </table>
  162. </div>
  163. </div>
  164. </form>
  165. </div>
  166. </div>
  167. </div>
  168. <script src="/layuiadmin/layui/layui.js"></script>
  169. <script>
  170. layui.config({
  171. base: '/layuiadmin/' //静态资源所在路径
  172. }).extend({
  173. index: 'lib/index' //主入口模块
  174. }).use('index');
  175. </script>
  176. <script>
  177. //由于模块都一次性加载,因此不用执行 layui.use() 来加载对应模块,直接使用即可:
  178. var layer = layui.layer;
  179. var $;
  180. layui.use(['jquery', 'layer','form'], function(){
  181. $ = layui.$;
  182. var form = layui.form;
  183. form.on('checkbox(checkboxall)', function(data){
  184. if(data.elem.checked)
  185. {
  186. $("input[name=item_checkbox]").each(function() {
  187. $(this).prop("checked", true);
  188. });
  189. $("input[name=checkall]").each(function() {
  190. $(this).prop("checked", true);
  191. });
  192. }else{
  193. $("input[name=item_checkbox]").each(function() {
  194. $(this).prop("checked", false);
  195. });
  196. $("input[name=checkall]").each(function() {
  197. $(this).prop("checked", false);
  198. });
  199. }
  200. form.render('checkbox');
  201. });
  202. $('.btn-operation').click(function(){
  203. var ids_arr = [];
  204. var obj = $(this);
  205. var s_toggle = $(this).attr('data-toggle');
  206. var s_url = $(this).attr('data-href');
  207. $("input[name=item_checkbox]").each(function() {
  208. if( $(this).prop('checked') )
  209. {
  210. ids_arr.push( $(this).val() );
  211. }
  212. })
  213. if(ids_arr.length < 1)
  214. {
  215. layer.msg('请选择要操作的内容');
  216. }else{
  217. var can_sub = true;
  218. if( s_toggle == 'batch-remove' )
  219. {
  220. can_sub = false;
  221. layer.confirm($(obj).attr('data-confirm'), function(index){
  222. $.ajax({
  223. url:s_url,
  224. type:'post',
  225. dataType:'json',
  226. data:{ids:ids_arr},
  227. success:function(info){
  228. if(info.status == 0)
  229. {
  230. layer.msg(info.result.message,{icon: 1,time: 2000});
  231. }else if(info.status == 1){
  232. var go_url = location.href;
  233. if( info.result.hasOwnProperty("url") )
  234. {
  235. go_url = info.result.url;
  236. }
  237. layer.msg('操作成功',{time: 1000,
  238. end:function(){
  239. location.href = info.result.url;
  240. }
  241. });
  242. }
  243. }
  244. })
  245. });
  246. }else{
  247. $.ajax({
  248. url:s_url,
  249. type:'post',
  250. dataType:'json',
  251. data:{ids:ids_arr},
  252. success:function(info){
  253. if(info.status == 0)
  254. {
  255. layer.msg(info.result.message,{icon: 1,time: 2000});
  256. }else if(info.status == 1){
  257. var go_url = location.href;
  258. if( info.result.hasOwnProperty("url") )
  259. {
  260. go_url = info.result.url;
  261. }
  262. layer.msg('操作成功',{time: 1000,
  263. end:function(){
  264. location.href = info.result.url;
  265. }
  266. });
  267. }
  268. }
  269. })
  270. }
  271. }
  272. })
  273. $('.deldom').click(function(){
  274. var s_url = $(this).attr('data-href');
  275. layer.confirm($(this).attr('data-confirm'), function(index){
  276. $.ajax({
  277. url:s_url,
  278. type:'post',
  279. dataType:'json',
  280. success:function(info){
  281. if(info.status == 0)
  282. {
  283. layer.msg(info.result.message,{icon: 1,time: 2000});
  284. }else if(info.status == 1){
  285. var go_url = location.href;
  286. if( info.result.hasOwnProperty("url") )
  287. {
  288. go_url = info.result.url;
  289. }
  290. layer.msg('操作成功',{time: 1000,
  291. end:function(){
  292. location.href = info.result.url;
  293. }
  294. });
  295. }
  296. }
  297. })
  298. });
  299. })
  300. form.on('switch(statewsitch)', function(data){
  301. var s_url = $(this).attr('data-href')
  302. var s_value = 1;
  303. if(data.elem.checked)
  304. {
  305. s_value = 1;
  306. }else{
  307. s_value = 0;
  308. }
  309. $.ajax({
  310. url:s_url,
  311. type:'post',
  312. dataType:'json',
  313. data:{value:s_value},
  314. success:function(info){
  315. if(info.status == 0)
  316. {
  317. layer.msg(info.result.message,{icon: 1,time: 2000});
  318. }else if(info.status == 1){
  319. var go_url = location.href;
  320. if( info.result.hasOwnProperty("url") )
  321. {
  322. go_url = info.result.url;
  323. }
  324. layer.msg('操作成功',{time: 1000,
  325. end:function(){
  326. location.href = info.result.url;
  327. }
  328. });
  329. }
  330. }
  331. })
  332. });
  333. })
  334. </script>
  335. </body>
  336. </html>