8fad575b6f5b906180efe7fcb2be641c.php 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451
  1. <?php if (!defined('THINK_PATH')) exit();?><!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': '<?php echo ($_W['uniacid']); ?>',<?php } ?>
  22. <?php if( !empty($_W['acid']) ){ ?>'acid': '<?php echo ($_W['acid']); ?>',<?php } ?>
  23. <?php if (!empty($_W['openid']) ) { ?>'openid': '<?php echo ($_W['openid']); ?>',<?php } ?>
  24. <?php if( !empty($_W['uid']) ) { ?>'uid': '<?php echo ($_W['uid']); ?>',<?php } ?>
  25. 'isfounder': <?php if (!empty($_W['isfounder']) ) { ?>1<?php }else{ ?>0<?php } ?>,
  26. 'siteroot': '<?php echo ($_W['siteroot']); ?>',
  27. 'siteurl': '<?php echo ($_W['siteurl']); ?>',
  28. 'attachurl': '<?php echo ($_W['attachurl']); ?>',
  29. 'attachurl_local': '<?php echo ($_W['attachurl_local']); ?>',
  30. 'attachurl_remote': '<?php echo ($_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' : <?php echo 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="goods" />
  103. <input type="hidden" name="a" value="goodstag" />
  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="<?php echo ($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="<?php echo U('goods/addtags', array('ok' => 1));?>" class="layui-btn layui-btn-sm"><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' data-href="<?php echo U('goods/tagsstate',array('state'=>1));?>">
  125. 启用
  126. </button>
  127. <button class="btn btn-default btn-sm btn-operation" type="button" data-toggle='batch' data-href="<?php echo U('goods/tagsstate',array('state'=>0));?>">
  128. 禁用
  129. </button>
  130. <button class="btn btn-default btn-sm btn-operation" type="button" data-toggle='batch-remove' data-confirm="确认要删除吗?" data-href="<?php echo U('goods/deletetags');?>">
  131. 删除
  132. </button>
  133. </div>
  134. </div>
  135. <table class="table table-responsive" lay-even lay-skin="line" lay-size="lg">
  136. <thead>
  137. <tr>
  138. <th style="width:25px;"></th>
  139. <th>标签名称</th>
  140. <th>标签内容</th>
  141. <th style="width:100px;">状态</th>
  142. <th style="width:165px;text-align: center;">操作</th>
  143. </tr>
  144. </thead>
  145. <tbody>
  146. <?php foreach( $label as $row ){ ?>
  147. <tr>
  148. <td>
  149. <?php if( $row['id']!='default'){ ?>
  150. <input type='checkbox' name="item_checkbox" lay-skin="primary" value="<?php echo ($row['id']); ?>"/>
  151. <?php } ?>
  152. </td>
  153. <td><?php echo ($row['tagname']); ?></td>
  154. <?php if( $row['type']==0){ ?>
  155. <td><?php echo ($row['tagcontent']); ?></td>
  156. <?php }else{ ?>
  157. <td><img style="width: 30px;" src="<?php echo tomedia($row['tagcontent']);?>"></td>
  158. <?php } ?>
  159. <td>
  160. <input type="checkbox" name="" lay-filter="statewsitch" data-href="<?php echo U('goods/tagsstate',array('id'=>$row['id']));?>" <?php if( $row['state']==1){ ?>checked<?php }else{ } ?> lay-skin="switch" lay-text="启用|禁用">
  161. </td>
  162. <td style="text-align: center;">
  163. <a class='layui-btn layui-btn-xs' href="<?php echo U('goods/edittags', array('id' => $row['id'], 'ok' => 1));?>" >
  164. <i class="layui-icon">&#xe608;</i>编辑
  165. </a>
  166. <?php if( $row['id']!='default'){ ?>
  167. <a class='layui-btn layui-btn-xs deldom' href="javascript:;" data-href="<?php echo U('goods/deletetags', array('id' => $row['id']));?>" data-confirm='确认要删除此标签组吗?'>
  168. <i class="layui-icon">&#xe640;</i>删除
  169. </a>
  170. <?php } ?>
  171. </td>
  172. </tr>
  173. <?php } ?>
  174. </tbody>
  175. <tfoot>
  176. <tr>
  177. <td colspan="2">
  178. <div class="page-table-header">
  179. <input type="checkbox" name="checkall" lay-skin="primary" lay-filter="checkboxall">
  180. <button class="btn btn-default btn-sm btn-operation" type="button" data-toggle='batch' data-href="<?php echo U('goods/tagsstate',array('state'=>1));?>">
  181. 启用
  182. </button>
  183. <button class="btn btn-default btn-sm btn-operation" type="button" data-toggle='batch' data-href="<?php echo U('goods/tagsstate',array('state'=>0));?>">
  184. 禁用
  185. </button>
  186. <button class="btn btn-default btn-sm btn-operation" type="button" data-toggle='batch-remove' data-confirm="确认要删除吗?" data-href="<?php echo U('goods/deletetags');?>">
  187. 删除
  188. </button>
  189. </div>
  190. </td>
  191. <td colspan="3" style="text-align: right">
  192. <?php echo ($pager); ?>
  193. </td>
  194. </tr>
  195. </tfoot>
  196. </table>
  197. </div>
  198. </div>
  199. </form>
  200. </div>
  201. </div>
  202. </div>
  203. <script src="/layuiadmin/layui/layui.js"></script>
  204. <script>
  205. layui.config({
  206. base: '/layuiadmin/' //静态资源所在路径
  207. }).extend({
  208. index: 'lib/index' //主入口模块
  209. }).use('index');
  210. </script>
  211. <script>
  212. //由于模块都一次性加载,因此不用执行 layui.use() 来加载对应模块,直接使用即可:
  213. var layer = layui.layer;
  214. var $;
  215. layui.use(['jquery', 'layer','form'], function(){
  216. $ = layui.$;
  217. var form = layui.form;
  218. $('.deldom').click(function(){
  219. var s_url = $(this).attr('data-href');
  220. layer.confirm($(this).attr('data-confirm'), function(index){
  221. $.ajax({
  222. url:s_url,
  223. type:'post',
  224. dataType:'json',
  225. success:function(info){
  226. if(info.status == 0)
  227. {
  228. layer.msg(info.result.message,{icon: 1,time: 2000});
  229. }else if(info.status == 1){
  230. var go_url = location.href;
  231. if( info.result.hasOwnProperty("url") )
  232. {
  233. go_url = info.result.url;
  234. }
  235. layer.msg('操作成功',{time: 1000,
  236. end:function(){
  237. location.href = info.result.url;
  238. }
  239. });
  240. }
  241. }
  242. })
  243. });
  244. })
  245. $('.btn-operation').click(function(){
  246. var ids_arr = [];
  247. var obj = $(this);
  248. var s_toggle = $(this).attr('data-toggle');
  249. var s_url = $(this).attr('data-href');
  250. $("input[name=item_checkbox]").each(function() {
  251. if( $(this).prop('checked') )
  252. {
  253. ids_arr.push( $(this).val() );
  254. }
  255. })
  256. if(ids_arr.length < 1)
  257. {
  258. layer.msg('请选择要操作的内容');
  259. }else{
  260. var can_sub = true;
  261. if( s_toggle == 'batch-remove' )
  262. {
  263. can_sub = false;
  264. layer.confirm($(obj).attr('data-confirm'), function(index){
  265. $.ajax({
  266. url:s_url,
  267. type:'post',
  268. dataType:'json',
  269. data:{ids:ids_arr},
  270. success:function(info){
  271. if(info.status == 0)
  272. {
  273. layer.msg(info.result.message,{icon: 1,time: 2000});
  274. }else if(info.status == 1){
  275. var go_url = location.href;
  276. if( info.result.hasOwnProperty("url") )
  277. {
  278. go_url = info.result.url;
  279. }
  280. layer.msg('操作成功',{time: 1000,
  281. end:function(){
  282. location.href = info.result.url;
  283. }
  284. });
  285. }
  286. }
  287. })
  288. });
  289. }else{
  290. $.ajax({
  291. url:s_url,
  292. type:'post',
  293. dataType:'json',
  294. data:{ids:ids_arr},
  295. success:function(info){
  296. if(info.status == 0)
  297. {
  298. layer.msg(info.result.message,{icon: 1,time: 2000});
  299. }else if(info.status == 1){
  300. var go_url = location.href;
  301. if( info.result.hasOwnProperty("url") )
  302. {
  303. go_url = info.result.url;
  304. }
  305. layer.msg('操作成功',{time: 1000,
  306. end:function(){
  307. location.href = info.result.url;
  308. }
  309. });
  310. }
  311. }
  312. })
  313. }
  314. }
  315. })
  316. form.on('switch(statewsitch)', function(data){
  317. var s_url = $(this).attr('data-href')
  318. var s_value = 1;
  319. if(data.elem.checked)
  320. {
  321. s_value = 1;
  322. }else{
  323. s_value = 0;
  324. }
  325. $.ajax({
  326. url:s_url,
  327. type:'post',
  328. dataType:'json',
  329. data:{state:s_value},
  330. success:function(info){
  331. if(info.status == 0)
  332. {
  333. layer.msg(info.result.message,{icon: 1,time: 2000});
  334. }else if(info.status == 1){
  335. var go_url = location.href;
  336. if( info.result.hasOwnProperty("url") )
  337. {
  338. go_url = info.result.url;
  339. }
  340. layer.msg('操作成功',{time: 1000,
  341. end:function(){
  342. location.href = info.result.url;
  343. }
  344. });
  345. }
  346. }
  347. })
  348. });
  349. form.on('checkbox(checkboxall)', function(data){
  350. if(data.elem.checked)
  351. {
  352. $("input[name=item_checkbox]").each(function() {
  353. $(this).prop("checked", true);
  354. });
  355. $("input[name=checkall]").each(function() {
  356. $(this).prop("checked", true);
  357. });
  358. }else{
  359. $("input[name=item_checkbox]").each(function() {
  360. $(this).prop("checked", false);
  361. });
  362. $("input[name=checkall]").each(function() {
  363. $(this).prop("checked", false);
  364. });
  365. }
  366. form.render('checkbox');
  367. });
  368. //监听提交
  369. form.on('submit(formDemo)', function(data){
  370. $.ajax({
  371. url: data.form.action,
  372. type: data.form.method,
  373. data: data.field,
  374. dataType:'json',
  375. success: function (info) {
  376. if(info.status == 0)
  377. {
  378. layer.msg(info.result.message,{icon: 1,time: 2000});
  379. }else if(info.status == 1){
  380. var go_url = location.href;
  381. if( info.result.hasOwnProperty("url") )
  382. {
  383. go_url = info.result.url;
  384. }
  385. layer.msg('操作成功',{time: 1000,
  386. end:function(){
  387. location.href = info.result.url;
  388. }
  389. });
  390. }
  391. }
  392. });
  393. return false;
  394. });
  395. })
  396. </script>
  397. </body>