index.html 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436
  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. <div class="layui-fluid">
  97. <div class="layui-card">
  98. <div class="layui-card-header layui-elem-quote">当前位置:<span class="line-text">会员卡管理</span></div>
  99. <div class="layui-card-body" style="padding:15px;">
  100. <form action="" method="get" class="form-horizontal form-search layui-form" role="form">
  101. <input type="hidden" name="c" value="vipcard" />
  102. <input type="hidden" name="a" value="index" />
  103. <div class="layui-form-item">
  104. <div class="layui-inline">
  105. <div class="layui-input-inline">
  106. <input type="text" class="layui-input" name='keyword' value="{$_GPC['keyword']}" placeholder="输入关键词然后回车">
  107. </div>
  108. <div class="layui-input-inline">
  109. <button class="layui-btn layui-btn-sm" type="submit"> 搜索</button>
  110. </div>
  111. </div>
  112. </div>
  113. </form>
  114. <form action="" class="layui-form" lay-filter="example" method="post" >
  115. <div class="row">
  116. <div class="col-md-12">
  117. <div class="page-table-header">
  118. <span class="pull-right">
  119. <a href="{:U('vipcard/add', array('ok' => 1))}" class="layui-btn layui-btn-sm"><i class="fa fa-plus"></i> 添加会员卡</a>
  120. </span>
  121. <div class="btn-group">
  122. <button class="btn btn-default btn-sm btn-operation" type="button" data-toggle='batch-remove' data-confirm="确认要删除吗?" data-href="{:U('vipcard/delete')}">删除</button>
  123. </div>
  124. </div>
  125. <table class="layui-table" lay-skin="line" lay-size="lg">
  126. <thead>
  127. <tr>
  128. <th style="width:25px;"><input type='checkbox' name="checkall" lay-skin="primary" lay-filter="checkboxall" /></th>
  129. <th style="width:80px;">ID</th>
  130. <th style="">会员卡名称</th>
  131. <th style="width: 150px;">原价</th>
  132. <th style="width: 150px;">现价</th>
  133. <th style="width: 150px;">有效时间</th>
  134. <th style="width: 200px;">操作</th>
  135. </tr>
  136. </thead>
  137. <tbody>
  138. <?php foreach($list as $item){ ?>
  139. <tr>
  140. <td style="width:25px;">
  141. <input type='checkbox' name="item_checkbox" lay-skin="primary" value="{$item['id']}"/>
  142. </td>
  143. <td>
  144. {$item['id']}
  145. </td>
  146. <td>
  147. {$item['cardname']}
  148. </td>
  149. <td>
  150. {$item['orignprice']}
  151. </td>
  152. <td>
  153. {$item['price']}
  154. </td>
  155. <td>
  156. {$item['expire_day']}天
  157. </td>
  158. <td style="overflow:visible;position:relative">
  159. <a class='layui-btn layui-btn-xs' href="{:U('vipcard/add', array('id'=>$item['id'],'ok' => 1))}" >
  160. <i class="layui-icon layui-icon-edit"></i>编辑
  161. </a>
  162. <a class='layui-btn layui-btn-xs deldom' href="javascript:;" data-href="{:U('vipcard/delete',array('id'=>$item['id']))}" data-confirm='确认要删除吗?'>
  163. <i class="layui-icon">&#xe640;</i>删除
  164. </a>
  165. </td>
  166. </tr>
  167. <?php } ?>
  168. </tbody>
  169. <tfoot>
  170. <tr>
  171. <td colspan="4">
  172. <div class="page-table-header">
  173. <input type="checkbox" name="checkall" lay-skin="primary" lay-filter="checkboxall">
  174. <div class="btn-group">
  175. <button class="btn btn-default btn-sm btn-operation" type="button" data-toggle='batch-remove' data-confirm="确认要删除吗?" data-href="{:U('vipcard/delete')}">删除</button>
  176. </div>
  177. </div>
  178. </td>
  179. <td colspan="2" style="text-align: right">
  180. {$pager}
  181. </td>
  182. </tr>
  183. </tfoot>
  184. </table>
  185. </div>
  186. </div>
  187. </form>
  188. </div>
  189. </div>
  190. </div>
  191. <script src="/layuiadmin/layui/layui.js"></script>
  192. <script>
  193. layui.config({
  194. base: '/layuiadmin/' //静态资源所在路径
  195. }).extend({
  196. index: 'lib/index' //主入口模块
  197. }).use('index');
  198. </script>
  199. <script>
  200. //由于模块都一次性加载,因此不用执行 layui.use() 来加载对应模块,直接使用即可:
  201. var layer = layui.layer;
  202. var $;
  203. layui.use(['jquery', 'layer','form'], function(){
  204. $ = layui.$;
  205. var form = layui.form;
  206. $('.deldom').click(function(){
  207. var s_url = $(this).attr('data-href');
  208. layer.confirm($(this).attr('data-confirm'), function(index){
  209. $.ajax({
  210. url:s_url,
  211. type:'post',
  212. dataType:'json',
  213. success:function(info){
  214. if(info.status == 0)
  215. {
  216. layer.msg(info.result.message,{icon: 1,time: 2000});
  217. }else if(info.status == 1){
  218. var go_url = location.href;
  219. if( info.result.hasOwnProperty("url") )
  220. {
  221. go_url = info.result.url;
  222. }
  223. layer.msg('操作成功',{time: 1000,
  224. end:function(){
  225. location.href = info.result.url;
  226. }
  227. });
  228. }
  229. }
  230. })
  231. });
  232. })
  233. $('.btn-operation').click(function(){
  234. var ids_arr = [];
  235. var obj = $(this);
  236. var s_toggle = $(this).attr('data-toggle');
  237. var s_url = $(this).attr('data-href');
  238. $("input[name=item_checkbox]").each(function() {
  239. if( $(this).prop('checked') )
  240. {
  241. ids_arr.push( $(this).val() );
  242. }
  243. })
  244. if(ids_arr.length < 1)
  245. {
  246. layer.msg('请选择要操作的内容');
  247. }else{
  248. var can_sub = true;
  249. if( s_toggle == 'batch-remove' )
  250. {
  251. can_sub = false;
  252. layer.confirm($(obj).attr('data-confirm'), function(index){
  253. $.ajax({
  254. url:s_url,
  255. type:'post',
  256. dataType:'json',
  257. data:{ids:ids_arr},
  258. success:function(info){
  259. if(info.status == 0)
  260. {
  261. layer.msg(info.result.message,{icon: 1,time: 2000});
  262. }else if(info.status == 1){
  263. var go_url = location.href;
  264. if( info.result.hasOwnProperty("url") )
  265. {
  266. go_url = info.result.url;
  267. }
  268. layer.msg('操作成功',{time: 1000,
  269. end:function(){
  270. location.href = info.result.url;
  271. }
  272. });
  273. }
  274. }
  275. })
  276. });
  277. }else{
  278. $.ajax({
  279. url:s_url,
  280. type:'post',
  281. dataType:'json',
  282. data:{ids:ids_arr},
  283. success:function(info){
  284. if(info.status == 0)
  285. {
  286. layer.msg(info.result.message,{icon: 1,time: 2000});
  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. }
  303. })
  304. form.on('switch(statewsitch)', function(data){
  305. var s_url = $(this).attr('data-href')
  306. var s_value = 1;
  307. if(data.elem.checked)
  308. {
  309. s_value = 1;
  310. }else{
  311. s_value = 0;
  312. }
  313. $.ajax({
  314. url:s_url,
  315. type:'post',
  316. dataType:'json',
  317. data:{value:s_value},
  318. success:function(info){
  319. if(info.status == 0)
  320. {
  321. layer.msg(info.result.message,{icon: 1,time: 2000});
  322. }else if(info.status == 1){
  323. var go_url = location.href;
  324. if( info.result.hasOwnProperty("url") )
  325. {
  326. go_url = info.result.url;
  327. }
  328. layer.msg('操作成功',{time: 1000,
  329. end:function(){
  330. location.href = info.result.url;
  331. }
  332. });
  333. }
  334. }
  335. })
  336. });
  337. form.on('checkbox(checkboxall)', function(data){
  338. if(data.elem.checked)
  339. {
  340. $("input[name=item_checkbox]").each(function() {
  341. $(this).prop("checked", true);
  342. });
  343. $("input[name=checkall]").each(function() {
  344. $(this).prop("checked", true);
  345. });
  346. }else{
  347. $("input[name=item_checkbox]").each(function() {
  348. $(this).prop("checked", false);
  349. });
  350. $("input[name=checkall]").each(function() {
  351. $(this).prop("checked", false);
  352. });
  353. }
  354. form.render('checkbox');
  355. });
  356. //监听提交
  357. form.on('submit(formDemo)', function(data){
  358. $.ajax({
  359. url: data.form.action,
  360. type: data.form.method,
  361. data: data.field,
  362. dataType:'json',
  363. success: function (info) {
  364. if(info.status == 0)
  365. {
  366. layer.msg(info.result.message,{icon: 1,time: 2000});
  367. }else if(info.status == 1){
  368. var go_url = location.href;
  369. if( info.result.hasOwnProperty("url") )
  370. {
  371. go_url = info.result.url;
  372. }
  373. layer.msg('操作成功',{time: 1000,
  374. end:function(){
  375. location.href = info.result.url;
  376. }
  377. });
  378. }
  379. }
  380. });
  381. return false;
  382. });
  383. })
  384. </script>
  385. </body>