userlevel.html 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537
  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. </style>
  94. </head>
  95. <body layadmin-themealias="default">
  96. <table id="demo" lay-filter="test"></table>
  97. <div class="layui-fluid">
  98. <div class="layui-card">
  99. <div class="layui-card-header layui-elem-quote">当前位置:<span class="line-text">会员等级</span></div>
  100. <div class="layui-card-body" style="padding:15px;">
  101. <form action="" method="get" class="form-horizontal form-search layui-form" role="form">
  102. <input type="hidden" name="c" value="user" />
  103. <input type="hidden" name="a" value="userlevel" />
  104. <div class="layui-form-item">
  105. <div class="layui-inline">
  106. <div class="layui-input-inline">
  107. <input type="text" class="layui-input" name='keyword' value="{$gpc['keyword']}" placeholder="输入关键词然后回车">
  108. </div>
  109. <div class="layui-input-inline">
  110. <button class="layui-btn layui-btn-sm" type="submit"> 搜索</button>
  111. </div>
  112. </div>
  113. </div>
  114. </form>
  115. <form action="" class="layui-form" lay-filter="example" method="post" >
  116. <div class="row">
  117. <div class="col-md-12">
  118. <div class="page-table-header">
  119. <input type='checkbox' name="checkall" lay-skin="primary" lay-filter="checkboxall" />
  120. <span class="pull-right">
  121. <a href="javascript:;" data-href="{:U('user/adduserlevel',array('ok' => 1))}" class="layui-btn layui-btn-sm ajaxModal"><i class="fa fa-plus"></i> 添加会员等级</a>
  122. </span>
  123. <div class="btn-group">
  124. <button class="btn btn-default btn-sm btn-operation" type="button" data-toggle='batch-remove' data-confirm="确认要删除?" data-href="{:U('user/deleteuserlevel')}">
  125. 删除
  126. </button>
  127. </div>
  128. </div>
  129. <table class="table table-responsive" lay-even lay-skin="line" lay-size="lg">
  130. <thead>
  131. <tr>
  132. <th style="width:25px;"></th>
  133. <th style="width:60px;">ID</th>
  134. <th style="width:60px;">等级</th>
  135. <th>等级名称</th>
  136. <th style="width:100px;display:none;">等级logo</th>
  137. <th style="width:150px;">折扣</th>
  138. <th style="width:150px;">升级方式</th>
  139. <th style="width:300px;">升级条件</th>
  140. <th style="width:100px;">会员数量</th>
  141. <th style="width: 260px">操作</th>
  142. </tr>
  143. </thead>
  144. <tbody>
  145. <?php foreach( $list as $row ){ ?>
  146. <tr <?php if( $row['id']=='default'){ ?>style='background:#eee;'<?php } ?>>
  147. <td>
  148. <?php if( $row['id']!='default'){ ?>
  149. <input type='checkbox' name="item_checkbox" lay-skin="primary" value="{$row['id']}"/>
  150. <?php } ?>
  151. </td>
  152. <td>
  153. <?php if( $row['id']!='default'){ ?>
  154. {$row['id']}
  155. <?php }else{ ?>
  156. 0
  157. <?php } ?>
  158. </td>
  159. <td style="cursor: pointer;" onclick='location="{:U("user/user", array("level_id" =>$row["id"]) )}"'>{$row['level']}</td>
  160. <td style="cursor: pointer;" onclick='location="{:U("user/user", array("level_id" =>$row["id"]) )}"'>{$row['levelname']}
  161. <?php if( $row['id']=='default'){ ?>
  162. 【默认等级】
  163. <?php } ?>
  164. </td>
  165. <td style="cursor: pointer;display:none;" >
  166. <img src="{:tomedia($row['logo'])}" style="width:60px;" />
  167. </td>
  168. <td >{$row['discount']}%</td>
  169. <td >
  170. <?php
  171. if($row['id'] == 'default'){
  172. echo '无';
  173. }else if($row['is_auto_grade'] == 1){
  174. echo '自动';
  175. }else{
  176. echo '手动';
  177. }
  178. ?>
  179. </td>
  180. <td >
  181. <?php
  182. if($row['is_auto_grade'] == 1){
  183. echo "会员消费金额满".floatval($row['level_money'])."元";
  184. }else{
  185. echo '无';
  186. }
  187. ?>
  188. </td>
  189. <td >{$row['membercount']}</td>
  190. <td>
  191. <a class='btn btn-op ' href="{:U('user/index', array('level_id' => $row['id']))}">
  192. <span data-toggle="tooltip" data-placement="top" data-original-title="等级会员">
  193. <i class='icow icow-member'></i>等级会员
  194. </span>
  195. </a>
  196. <?php if( $row['id']!='default'){ ?>
  197. <a class="layui-btn layui-btn-xs ajaxModal" href="javascript:;" data-href="{:U('user/adduserlevel', array('id' => $row['id'] , 'ok' => 1))}">
  198. <i class="layui-icon layui-icon-edit"></i>编辑
  199. </a>
  200. <a class='layui-btn layui-btn-xs deldom' href="javascript:;" data-href="{:U('user/deleteuserlevel', array('id' => $row['id']))}" data-confirm='确认要删除?<br /><br /><p style="color:red;">该等级涉及的所有会员都会变成默认等级?</p>'>
  201. <i class="layui-icon">&#xe640;</i>删除
  202. </a>
  203. <?php } ?>
  204. </td>
  205. </tr>
  206. <?php } ?>
  207. </tbody>
  208. <tfoot>
  209. <tr>
  210. <td colspan="2">
  211. <div class="page-table-header">
  212. <input type="checkbox" name="checkall" lay-skin="primary" lay-filter="checkboxall">
  213. <div class="btn-group">
  214. <button class="btn btn-default btn-sm btn-operation" type="button" data-toggle='batch-remove' data-confirm="确认要删除?" data-href="{:U('user/deleteuserlevel')}">
  215. 删除
  216. </button>
  217. </div>
  218. </div>
  219. </td>
  220. <td colspan="7" style="text-align: right">
  221. {$pager}
  222. </td>
  223. </tr>
  224. </tfoot>
  225. </table>
  226. </div>
  227. </div>
  228. </form>
  229. </div>
  230. </div>
  231. </div>
  232. <script src="/layuiadmin/layui/layui.js"></script>
  233. <script>
  234. layui.config({
  235. base: '/layuiadmin/' //静态资源所在路径
  236. }).extend({
  237. index: 'lib/index' //主入口模块
  238. }).use('index');
  239. </script>
  240. <script>
  241. //由于模块都一次性加载,因此不用执行 layui.use() 来加载对应模块,直接使用即可:
  242. var layer = layui.layer;
  243. var $;
  244. layui.use(['jquery', 'layer','form'], function(){
  245. $ = layui.$;
  246. var form = layui.form;
  247. $('.deldom').click(function(){
  248. var s_url = $(this).attr('data-href');
  249. layer.confirm($(this).attr('data-confirm'), function(index){
  250. $.ajax({
  251. url:s_url,
  252. type:'post',
  253. dataType:'json',
  254. success:function(info){
  255. if(info.status == 0)
  256. {
  257. layer.msg(info.result.message,{icon: 1,time: 2000});
  258. }else if(info.status == 1){
  259. var go_url = location.href;
  260. if( info.result.hasOwnProperty("url") )
  261. {
  262. go_url = info.result.url;
  263. }
  264. layer.msg('操作成功',{time: 1000,
  265. end:function(){
  266. location.href = info.result.url;
  267. }
  268. });
  269. }
  270. }
  271. })
  272. });
  273. })
  274. $('.btn-operation').click(function(){
  275. var ids_arr = [];
  276. var obj = $(this);
  277. var s_toggle = $(this).attr('data-toggle');
  278. var s_url = $(this).attr('data-href');
  279. $("input[name=item_checkbox]").each(function() {
  280. if( $(this).prop('checked') )
  281. {
  282. ids_arr.push( $(this).val() );
  283. }
  284. })
  285. if(ids_arr.length < 1)
  286. {
  287. layer.msg('请选择要操作的内容');
  288. }else{
  289. var can_sub = true;
  290. if( s_toggle == 'batch-remove' )
  291. {
  292. can_sub = false;
  293. layer.confirm($(obj).attr('data-confirm'), function(index){
  294. $.ajax({
  295. url:s_url,
  296. type:'post',
  297. dataType:'json',
  298. data:{ids:ids_arr},
  299. success:function(info){
  300. if(info.status == 0)
  301. {
  302. layer.msg(info.result.message,{icon: 1,time: 2000});
  303. }else if(info.status == 1){
  304. var go_url = location.href;
  305. if( info.result.hasOwnProperty("url") )
  306. {
  307. go_url = info.result.url;
  308. }
  309. layer.msg('操作成功',{time: 1000,
  310. end:function(){
  311. location.href = info.result.url;
  312. }
  313. });
  314. }
  315. }
  316. })
  317. });
  318. }else{
  319. $.ajax({
  320. url:s_url,
  321. type:'post',
  322. dataType:'json',
  323. data:{ids:ids_arr},
  324. success:function(info){
  325. if(info.status == 0)
  326. {
  327. layer.msg(info.result.message,{icon: 1,time: 2000});
  328. }else if(info.status == 1){
  329. var go_url = location.href;
  330. if( info.result.hasOwnProperty("url") )
  331. {
  332. go_url = info.result.url;
  333. }
  334. layer.msg('操作成功',{time: 1000,
  335. end:function(){
  336. location.href = info.result.url;
  337. }
  338. });
  339. }
  340. }
  341. })
  342. }
  343. }
  344. })
  345. form.on('switch(statewsitch)', function(data){
  346. var s_url = $(this).attr('data-href')
  347. var s_value = 1;
  348. if(data.elem.checked)
  349. {
  350. s_value = 1;
  351. }else{
  352. s_value = 0;
  353. }
  354. $.ajax({
  355. url:s_url,
  356. type:'post',
  357. dataType:'json',
  358. data:{value:s_value},
  359. success:function(info){
  360. if(info.status == 0)
  361. {
  362. layer.msg(info.result.message,{icon: 1,time: 2000});
  363. }else if(info.status == 1){
  364. var go_url = location.href;
  365. if( info.result.hasOwnProperty("url") )
  366. {
  367. go_url = info.result.url;
  368. }
  369. layer.msg('操作成功',{time: 1000,
  370. end:function(){
  371. location.href = info.result.url;
  372. }
  373. });
  374. }
  375. }
  376. })
  377. });
  378. form.on('checkbox(checkboxall)', function(data){
  379. if(data.elem.checked)
  380. {
  381. $("input[name=item_checkbox]").each(function() {
  382. $(this).prop("checked", true);
  383. });
  384. $("input[name=checkall]").each(function() {
  385. $(this).prop("checked", true);
  386. });
  387. }else{
  388. $("input[name=item_checkbox]").each(function() {
  389. $(this).prop("checked", false);
  390. });
  391. $("input[name=checkall]").each(function() {
  392. $(this).prop("checked", false);
  393. });
  394. }
  395. form.render('checkbox');
  396. });
  397. //监听提交
  398. form.on('submit(formDemo)', function(data){
  399. $.ajax({
  400. url: data.form.action,
  401. type: data.form.method,
  402. data: data.field,
  403. dataType:'json',
  404. success: function (info) {
  405. if(info.status == 0)
  406. {
  407. layer.msg(info.result.message,{icon: 1,time: 2000});
  408. }else if(info.status == 1){
  409. var go_url = location.href;
  410. if( info.result.hasOwnProperty("url") )
  411. {
  412. go_url = info.result.url;
  413. }
  414. layer.msg('操作成功',{time: 1000,
  415. end:function(){
  416. location.href = info.result.url;
  417. }
  418. });
  419. }
  420. }
  421. });
  422. return false;
  423. });
  424. })
  425. </script>
  426. <script>
  427. var ajax_url = "";
  428. $(function(){
  429. $(".ajaxModal").click(function () {
  430. var s_url = $(this).attr('data-href');
  431. ajax_url = s_url;
  432. $.ajax({
  433. url:s_url,
  434. type:"get",
  435. success:function(shtml){
  436. $('#ajaxModal').html(shtml);
  437. $("#ajaxModal").modal();
  438. }
  439. })
  440. });
  441. $(document).delegate(".modal-footer .btn-primary","click",function(){
  442. var s_data = $('#ajaxModal form').serialize();
  443. $.ajax({
  444. url:ajax_url,
  445. type:'post',
  446. dataType:'json',
  447. data:s_data,
  448. success:function(info){
  449. if(info.status == 0)
  450. {
  451. layer.msg(info.result.message,{icon: 1,time: 2000});
  452. }else if(info.status == 1){
  453. var go_url = location.href;
  454. if( info.result.hasOwnProperty("url") )
  455. {
  456. go_url = info.result.url;
  457. }
  458. layer.msg('操作成功',{time: 1000,
  459. end:function(){
  460. location.href = info.result.url;
  461. }
  462. });
  463. }
  464. }
  465. })
  466. return false;
  467. })
  468. })
  469. </script>
  470. <div id="ajaxModal" class="modal fade" style="display: none;">
  471. </div>
  472. </body>