special.html 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455
  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. </head>
  45. <body layadmin-themealias="default">
  46. <div class="layui-fluid">
  47. <div class="layui-card">
  48. <div class="layui-card-header layui-elem-quote">当前位置:<span class="line-text">专题管理</span></div>
  49. <div class="layui-card-body" style="padding:15px;">
  50. <div class="page-content">
  51. <form action="" method="get" class="form-horizontal form-search layui-form" role="form" id="form1">
  52. <input type="hidden" name="c" value="marketing" />
  53. <input type="hidden" name="a" value="special" />
  54. <div class="layui-form-item">
  55. <span class="layui-input-inline" style="width:120px;">
  56. <select name='gettype' class="layui-input layui-unselect" >
  57. <option value=''>是否开启</option>
  58. <option value='0' <?php if($_GPC['gettype']=='0'){ ?>selected<?php } ?>>关闭</option>
  59. <option value='1' <?php if($_GPC['gettype']=='1'){ ?>selected<?php } ?>>开启</option>
  60. </select>
  61. </span>
  62. <div class="layui-input-inline" style="width:280px;">
  63. {:tpl_form_field_daterange('time', array('starttime'=>date('Y-m-d H:i', $starttime),'endtime'=>date('Y-m-d H:i', $endtime)),true);}
  64. </div>
  65. <div class="layui-input-inline" style="width:250px;">
  66. <input type="text" class="form-control" name='keyword' value="{$_GPC['keyword']}" placeholder="专题名称">
  67. </div>
  68. <span class="layui-input-inline">
  69. <button class="btn btn-primary" type="submit"> 搜索</button>
  70. </span>
  71. </div>
  72. </form>
  73. <form action="" class="layui-form" lay-filter="example" method="post" >
  74. <div class="page-table-header">
  75. <span class="pull-right">
  76. <a href="{:U('marketing/addspecial', array('ok' => 1))}" class="layui-btn layui-btn-sm"><i class="fa fa-plus"></i> 添加专题</a>
  77. </span>
  78. <span class="btn-group">
  79. <button class="btn btn-default btn-sm dropdown-toggle btn-operation" type="button" data-toggle='batch-remove' data-confirm="确认要删除?" data-href="{:U('marketing/deletespecial')}">
  80. <i class="layui-icon">&#xe640;</i>删除
  81. </button>
  82. </span>
  83. </div>
  84. <?php if(count($list)>0){ ?>
  85. <table class="layui-table" lay-skin="line" lay-size="lg">
  86. <thead class="navbar-inner" >
  87. <tr>
  88. <th style="width:25px;"><input type='checkbox' name="checkall" lay-skin="primary" lay-filter="checkboxall" /></th>
  89. <th style="width:50px;">ID</th>
  90. <th style="">活动名称</th>
  91. <th style="width:160px; text-align:center;">关联商品数量</th>
  92. <th style="">活动时间</th>
  93. <th style="">创建时间</th>
  94. <th style="width:130px;">首页显示</th>
  95. <th style="width:100px; text-align:center;">排序</th>
  96. <th style="width:130px;">活动状态</th>
  97. <th style="width: 200px;">操作</th>
  98. </tr>
  99. </thead>
  100. <tbody>
  101. <?php foreach($list as $row){ ?>
  102. <tr>
  103. <td>
  104. <input type='checkbox' value="{$row['id']}" name="item_checkbox" lay-skin="primary"/>
  105. </td>
  106. <td>
  107. {$row['id']}
  108. </td>
  109. <td>
  110. {$row['name']}
  111. </td>
  112. <td style="text-align: center;">
  113. <?php $goodsids = explode(",", $row['goodsids']); ?>
  114. <?php $num = count($goodsids); ?>
  115. <?php echo $num; ?>
  116. </td>
  117. <td>
  118. {:date('Y-m-d H:i',$row['begin_time'])} <br/>
  119. {:date('Y-m-d H:i',$row['end_time'])} <br />
  120. <?php if($row['end_time'] <= time()){ ?>
  121. <span class="text-danger">活动已结束</span>
  122. <?php } ?>
  123. <?php if( $row['begin_time'] <= time() && $row['end_time'] > time() ){ ?>
  124. <span class="text-danger">正在进行中</span>
  125. <?php } ?>
  126. <?php if( $row['begin_time'] > time() ){ ?>
  127. <span class="text-danger">活动未开始</span>
  128. <?php } ?>
  129. </td>
  130. <td>{:date('Y-m-d H:i',$row['addtime'])}</td>
  131. <td>
  132. <input type="checkbox" name="" lay-filter="statewsitch" data-href="{:U('marketing/changespecial',array('type'=>'is_index','id'=>$row['id']))}" <?php if($row['is_index']==1){ ?>checked<?php } ?> lay-skin="switch" lay-text="是|否">
  133. </td>
  134. <td style="text-align: center;">
  135. <a href='javascript:;' class="setOrder" data-id="{$row['id']}" data-value="{$row['displayorder']}" data-href="{:U('marketing/displayordercoupon',array('id'=>$row['id']))}" >{$row['displayorder']}</a>
  136. </td>
  137. <td>
  138. <input type="checkbox" name="" lay-filter="statewsitch" data-href="{:U('marketing/changespecial',array('type'=>'enabled','id'=>$row['id']))}" <?php if( $row['enabled']==1 ){ ?>checked<?php } ?> lay-skin="switch" lay-text="开启|关闭">
  139. </td>
  140. <td>
  141. <div class="btn-group">
  142. <a class="layui-btn layui-btn-xs" href="{:U('marketing/addspecial',array('id'=> $row['id'],'ok'=>1));}">
  143. <i class="layui-icon layui-icon-edit"></i>编辑</a>
  144. <a class="layui-btn layui-btn-danger layui-btn-xs deldom" href="javascript:;" data-href="{:U('marketing/deletespecial',array('id' => $row['id']))}" data-confirm="确定要删除该专题吗?"><i class="layui-icon">&#xe640;</i>删除</a>
  145. </div>
  146. </td>
  147. </tr>
  148. <?php } ?>
  149. </tbody>
  150. <tfoot>
  151. <tr>
  152. <td colspan="3">
  153. <input type="checkbox" name="checkall" lay-skin="primary" lay-filter="checkboxall" />
  154. <span class="btn-group">
  155. <button class="btn btn-default btn-sm dropdown-toggle btn-operation" type="button" data-toggle='batch-remove' data-confirm="确认要删除?" data-href="{:U('marketing/deletespecial')}">
  156. <i class="layui-icon">&#xe640;</i>删除
  157. </button>
  158. </span>
  159. </td>
  160. <td colspan="5" style="text-align: right">{$pager}</td>
  161. </tr>
  162. </tfoot>
  163. </table>
  164. <?php }else{ ?>
  165. <div class='panel panel-default'>
  166. <div class='panel-body' style='text-align: center;padding:30px;'>
  167. 暂时没有任何专题!
  168. </div>
  169. </div>
  170. <?php } ?>
  171. </form>
  172. </div>
  173. </div>
  174. </div>
  175. </div>
  176. <script src="/layuiadmin/layui/layui.js"></script>
  177. <script>
  178. layui.config({
  179. base: '/layuiadmin/' //静态资源所在路径
  180. }).extend({
  181. index: 'lib/index' //主入口模块
  182. }).use('index');
  183. </script>
  184. <script>
  185. var layer = layui.layer;
  186. var $;
  187. layui.use(['jquery', 'layer', 'form'], function(){
  188. $ = layui.$;
  189. var form = layui.form;
  190. $('.deldom').click(function(){
  191. var s_url = $(this).attr('data-href');
  192. layer.confirm($(this).attr('data-confirm'), function(index){
  193. $.ajax({
  194. url:s_url,
  195. type:'post',
  196. dataType:'json',
  197. success:function(info){
  198. if(info.status == 0)
  199. {
  200. layer.msg(info.result.message,{icon: 1,time: 2000});
  201. }else if(info.status == 1){
  202. var go_url = location.href;
  203. if( info.result.hasOwnProperty("url") )
  204. {
  205. go_url = info.result.url;
  206. }
  207. layer.msg('操作成功',{time: 1000,
  208. end:function(){
  209. location.href = info.result.url;
  210. }
  211. });
  212. }
  213. }
  214. })
  215. });
  216. })
  217. $('.btn-operation').click(function(){
  218. var ids_arr = [];
  219. var obj = $(this);
  220. var s_toggle = $(this).attr('data-toggle');
  221. var s_url = $(this).attr('data-href');
  222. $("input[name=item_checkbox]").each(function() {
  223. if( $(this).prop('checked') )
  224. {
  225. ids_arr.push( $(this).val() );
  226. }
  227. })
  228. if(ids_arr.length < 1)
  229. {
  230. layer.msg('请选择要操作的内容');
  231. }else{
  232. var can_sub = true;
  233. if( s_toggle == 'batch-remove' )
  234. {
  235. can_sub = false;
  236. layer.confirm($(obj).attr('data-confirm'), function(index){
  237. $.ajax({
  238. url:s_url,
  239. type:'post',
  240. dataType:'json',
  241. data:{ids:ids_arr},
  242. success:function(info){
  243. if(info.status == 0)
  244. {
  245. layer.msg(info.result.message,{icon: 1,time: 2000});
  246. }else if(info.status == 1){
  247. var go_url = location.href;
  248. if( info.result.hasOwnProperty("url") )
  249. {
  250. go_url = info.result.url;
  251. }
  252. layer.msg('操作成功',{time: 1000,
  253. end:function(){
  254. location.href = info.result.url;
  255. }
  256. });
  257. }
  258. }
  259. })
  260. });
  261. }else{
  262. $.ajax({
  263. url:s_url,
  264. type:'post',
  265. dataType:'json',
  266. data:{ids:ids_arr},
  267. success:function(info){
  268. if(info.status == 0)
  269. {
  270. layer.msg(info.result.message,{icon: 1,time: 2000});
  271. }else if(info.status == 1){
  272. var go_url = location.href;
  273. if( info.result.hasOwnProperty("url") )
  274. {
  275. go_url = info.result.url;
  276. }
  277. layer.msg('操作成功',{time: 1000,
  278. end:function(){
  279. location.href = info.result.url;
  280. }
  281. });
  282. }
  283. }
  284. })
  285. }
  286. }
  287. })
  288. form.on('switch(statewsitch)', function(data){
  289. var s_url = $(this).attr('data-href')
  290. var s_value = 1;
  291. if(data.elem.checked)
  292. {
  293. s_value = 1;
  294. }else{
  295. s_value = 0;
  296. }
  297. $.ajax({
  298. url:s_url,
  299. type:'post',
  300. dataType:'json',
  301. data:{value:s_value},
  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. form.on('checkbox(checkboxall)', function(data){
  322. if(data.elem.checked)
  323. {
  324. $("input[name=item_checkbox]").each(function() {
  325. $(this).prop("checked", true);
  326. });
  327. $("input[name=checkall]").each(function() {
  328. $(this).prop("checked", true);
  329. });
  330. }else{
  331. $("input[name=item_checkbox]").each(function() {
  332. $(this).prop("checked", false);
  333. });
  334. $("input[name=checkall]").each(function() {
  335. $(this).prop("checked", false);
  336. });
  337. }
  338. form.render('checkbox');
  339. });
  340. //监听提交
  341. form.on('submit(formDemo)', function(data){
  342. $.ajax({
  343. url: data.form.action,
  344. type: data.form.method,
  345. data: data.field,
  346. dataType:'json',
  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. return false;
  366. });
  367. $('.setOrder').click(function(e){
  368. var _this = $(this);
  369. var id = _this.data('id');
  370. var value = _this.data('value');
  371. layer.prompt({
  372. formType: 2
  373. ,title: '修改 ID 为 ['+ id +'] 的排序'
  374. ,value: value
  375. }, function(value, index){
  376. layer.close(index);
  377. var s_url = _this.data('href');
  378. $.ajax({
  379. url:s_url,
  380. type:'post',
  381. dataType:'json',
  382. data: {value: value},
  383. success:function(info){
  384. if(info.status == 0)
  385. {
  386. layer.msg(info.result.message,{icon: 1,time: 2000});
  387. }else if(info.status == 1){
  388. var go_url = location.href;
  389. if( info.result.hasOwnProperty("url") )
  390. {
  391. go_url = info.result.url;
  392. }
  393. layer.msg('操作成功',{time: 1000,
  394. end:function(){
  395. location.href = info.result.url;
  396. }
  397. });
  398. }
  399. }
  400. })
  401. });
  402. })
  403. })
  404. </script>
  405. </body>
  406. </html>