b3a24391584f0707c71e3d1139ae041c.php 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519
  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. <script type="text/javascript" src="{php echo SNAILFISH_LOCAL}/static/js/dist/jquery/nestable/jquery.nestable.js"></script>
  45. <link href="/static/js/dist/jquery/nestable/nestable.css" rel="stylesheet">
  46. <style type='text/css'>
  47. .dd-handle { height: 40px; line-height: 30px}
  48. .dd-list { width:860px;}
  49. .dd-handle span {
  50. font-weight: normal;
  51. }
  52. .cate_sort{width: 35px;height: 20px;text-align:center;
  53. border:1px solid #ebebeb;}
  54. </style>
  55. </head>
  56. <body layadmin-themealias="default">
  57. <div class="layui-fluid">
  58. <div class="layui-card">
  59. <div class="layui-card-header layui-elem-quote">当前位置:<span class="line-text">商品分类</span></div>
  60. <div class="layui-card-body" style="padding:15px;">
  61. <div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief">
  62. <ul class="layui-tab-title">
  63. <li class="layui-this">商品分类</li>
  64. <li>分类设置</li>
  65. </ul>
  66. <div class="layui-tab-content">
  67. <div class="layui-tab-item layui-show">
  68. <div class="page-table-header">
  69. <span class="pull-right">
  70. <a href="<?php echo U('goods/addcategory', array('ok' => 1));?>" class="layui-btn layui-btn-sm"><i class="fa fa-plus"></i> 添加分类</a>
  71. </span>
  72. </div>
  73. <form action="" method="post" class="layui-form" lay-filter="component-layui-form-item" enctype="multipart/form-data" >
  74. <div class="dd" id="div_nestable">
  75. <ol class="dd-list">
  76. <?php foreach( $category as $row ){ ?>
  77. <?php if( empty($row['pid']) ){ ?>
  78. <li class="dd-item full" data-id="<?php echo ($row['id']); ?>">
  79. <div class="dd-handle" >
  80. [<input type="text" class="cate_sort" name="cate_sort" id="cate_sort_<?php echo ($row['id']); ?>" cate_id="<?php echo ($row['id']); ?>" value="<?php echo ($row['sort_order']); ?>" onchange="updateSort(this)"/>] <?php echo ($row['name']); ?>
  81. <span class="pull-right">
  82. <input type="checkbox" name="" lay-filter="enabledwsitch" data-href="<?php echo U('goods/category_enabled',array('id'=>$row['id']));?>" <?php if( $row['is_show']==1 ){ ?>checked<?php } ?> lay-skin="switch" lay-text="社区首页显示|社区首页隐藏">
  83. <input type="checkbox" name="" lay-filter="enabledtypewsitch" data-href="<?php echo U('goods/category_typeenabled',array('id'=>$row['id']));?>" <?php if( $row['is_type_show']==1 ){ ?>checked<?php } ?> lay-skin="switch" lay-text="独立分类页显示|独立分类页隐藏">
  84. <!--<input type="checkbox" name="" lay-filter="enabledexpresswsitch" data-href="<?php echo U('goods/category_expressenabled',array('id'=>$row['id']));?>" <?php if( $row['is_express_show']==1 ){ ?>checked<?php } ?> lay-skin="switch" lay-text="仅快递商品页显示|仅快递商品页隐藏"> -->
  85. <a class='btn btn-default btn-sm btn-operation btn-op' data-toggle="ajaxModal" href="<?php echo U('goods/addcategory', array('pid' => $row['id'], 'ok' => 1));?>" title='' >
  86. <span data-toggle="tooltip" data-placement="top" title="" data-original-title="添加子分类">
  87. 添加子分类
  88. </span>
  89. </a>
  90. <a class='btn btn-default btn-sm btn-operation btn-op' data-toggle="ajaxModal" href="<?php echo U('goods/addcategory', array('id' => $row['id'] , 'ok' => 1));?>" >
  91. <span data-toggle="tooltip" data-placement="top" data-original-title="修改">
  92. 修改
  93. </span>
  94. </a>
  95. <a class='btn btn-default btn-sm btn-operation btn-op deldom' href="javascript:;" data-href="<?php echo U('goods/category_delete', array('id' => $row['id']));?>" data-confirm='确认删除此分类吗?'>删除</a>
  96. </span>
  97. </div>
  98. <?php if( count($children[$row['id']])>0 ){ ?>
  99. <ol class="dd-list">
  100. <?php foreach( $children[$row['id']] as $child ){ ?>
  101. <li class="dd-item full" data-id="<?php echo ($child['id']); ?>">
  102. <div class="dd-handle" style="width:100%;">
  103. <img src="{php echo tomedia($child['thumb']);}" width='30' height="30" onerror="$(this).remove()" style='padding:1px;border: 1px solid #ccc;float:left;' />&nbsp;&nbsp;&nbsp;&nbsp;
  104. [<input type="text" class="cate_sort" name="cate_sort" id="cate_sort_<?php echo ($child['id']); ?>" cate_id="<?php echo ($child['id']); ?>" value="<?php echo ($child['sort_order']); ?>" onchange="updateSort(this)"/>] <?php echo ($child['name']); ?>
  105. <span class="pull-right">
  106. <input type="checkbox" name="" lay-filter="enabledwsitch" data-href="<?php echo U('goods/category_enabled',array('id'=>$child['id']));?>" <?php if( $child['is_show']==1 ){ ?>checked<?php } ?> lay-skin="switch" lay-text="社区首页显示|社区首页隐藏">
  107. <input type="checkbox" name="" lay-filter="enabledtypewsitch" data-href="<?php echo U('goods/category_typeenabled',array('id'=>$child['id']));?>" <?php if( $child['is_type_show']==1 ){ ?>checked<?php } ?> lay-skin="switch" lay-text="独立分类页显示|独立分类页隐藏">
  108. <!--<input type="checkbox" name="" lay-filter="enabledexpresswsitch" data-href="<?php echo U('goods/category_expressenabled',array('id'=>$child['id']));?>" <?php if( $child['is_express_show']==1 ){ ?>checked<?php } ?> lay-skin="switch" lay-text="仅快递商品页显示|仅快递商品页隐藏">-->
  109. <a class='btn btn-default btn-sm btn-operation btn-op' data-toggle="ajaxModal" href="<?php echo U('goods/addcategory', array('pid' => $child['id']));?>" title='添加子分类' >
  110. <span data-toggle="tooltip" data-placement="top" title="" data-original-title="添加子分类">
  111. 添加子分类
  112. </span>
  113. </a>
  114. <a class='btn btn-default btn-sm btn-operation btn-op' data-toggle="ajaxModal" href="<?php echo U('goods/addcategory', array('id' => $child['id']));?>" title="修改" >
  115. <span data-toggle="tooltip" data-placement="top" title="" data-original-title="修改">
  116. 修改
  117. </span>
  118. </a>
  119. <a class='btn btn-default btn-sm btn-operation btn-op deldom' href="javascript:;" data-href="<?php echo U('goods/category_delete', array('id' => $child['id']));?>" data-confirm="确认删除此分类吗?">
  120. <span data-toggle="tooltip" data-placement="top" data-original-title="删除">
  121. 删除
  122. </span>
  123. </a>
  124. </span>
  125. </div>
  126. <?php if( count($children[$child['id']])>0 ){ ?>
  127. <ol class="dd-list" >
  128. <?php foreach( $children[$child['id']] as $third ){ ?>
  129. <li class="dd-item full" data-id="<?php echo ($third['id']); ?>" style="width: 715px;">
  130. <div class="dd-handle" style="width:100%;>
  131. <img src="{php echo tomedia($third['thumb']);}" width='30' height="30" onerror="$(this).remove()" style='padding:1px;border: 1px solid #ccc;float:left;' /> &nbsp;
  132. [<input type="text" class="cate_sort" name="cate_sort" id="cate_sort_<?php echo ($third['id']); ?>" cate_id="<?php echo ($third['id']); ?>" value="<?php echo ($third['sort_order']); ?>" onchange="updateSort(this)"/>] <?php echo ($third['name']); ?>
  133. <span class="pull-right" >
  134. <input type="checkbox" name="" lay-filter="enabledwsitch" data-href="<?php echo U('goods/category_enabled',array('id'=>$third['id']));?>" <?php if( $third['is_show']==1 ){ ?>checked<?php } ?> lay-skin="switch" lay-text="社区首页显示|社区首页隐藏">
  135. <input type="checkbox" name="" lay-filter="enabledtypewsitch" data-href="<?php echo U('goods/category_typeenabled',array('id'=>$third['id']));?>" <?php if( $third['is_type_show']==1 ){ ?>checked<?php } ?> lay-skin="switch" lay-text="独立分类页显示|独立分类页隐藏">
  136. <!--<input type="checkbox" name="" lay-filter="enabledexpresswsitch" data-href="<?php echo U('goods/category_expressenabled',array('id'=>$third['id']));?>" <?php if( $third['is_express_show']==1 ){ ?>checked<?php } ?> lay-skin="switch" lay-text="仅快递商品页显示|仅快递商品页隐藏">-->
  137. <a class='btn btn-default btn-sm btn-operation btn-op' href="<?php echo U('goods/addcategory', array('id' => $third['id']));?>" title="修改" >
  138. <span data-toggle="tooltip" data-placement="top" title="" data-original-title="修改">
  139. <i class="icow icow-bianji2"></i>修改
  140. </span>
  141. </a>
  142. <a class='btn btn-default btn-sm btn-operation btn-op deldom' href="javascript:;" data-href="<?php echo U('goods/category_delete', array('id' => $third['id']));?>" data-confirm="确认删除此分类吗?">
  143. 删除
  144. </a>
  145. </span>
  146. </div>
  147. </li>
  148. <?php } ?>
  149. </ol>
  150. <?php } ?>
  151. </li>
  152. <?php } ?>
  153. </ol>
  154. <?php } ?>
  155. </li>
  156. <?php } ?>
  157. <?php } ?>
  158. </ol>
  159. </div>
  160. </form>
  161. </div>
  162. <div class="layui-tab-item">
  163. <form action="" method="post" class="layui-form" lay-filter="component-layui-form-item" enctype="multipart/form-data" >
  164. <div class="layui-form-item">
  165. <label class="layui-form-label">显示底部菜单</label>
  166. <div class="layui-input-block">
  167. <input type='radio' name='parameter[is_show_cate_tabbar]' value='0' <?php if( empty($data) || $data['is_show_cate_tabbar'] ==0 ){ ?>checked <?php } ?> title="否" />
  168. <input type='radio' name='parameter[is_show_cate_tabbar]' value='1' <?php if( !empty($data) && $data['is_show_cate_tabbar'] ==1 ){ ?>checked <?php } ?> title="是" />
  169. </div>
  170. <span class="layui-form-mid" style="margin-left: 35px;">控制具体某个分类页面,底部导航栏是否显示</span>
  171. </div>
  172. <div class="layui-form-item">
  173. <label class="layui-form-label">首页文字分类</label>
  174. <div class="layui-input-block">
  175. <input type="radio" name="parameter[hide_index_type]" value="1" title="隐藏" <?php if( !empty($data) && $data['hide_index_type']==1 ){ ?>checked <?php } ?> />
  176. <input type="radio" name="parameter[hide_index_type]" value="0" title="显示" <?php if( empty($data) || $data['hide_index_type']==0 ){ ?>checked <?php } ?> />
  177. </div>
  178. </div>
  179. <div class="layui-form-item">
  180. <label class="layui-form-label"></label>
  181. <div class="layui-input-block">
  182. <input type="submit" value="提交" lay-submit lay-filter="formDemo" class="btn btn-primary" />
  183. </div>
  184. </div>
  185. </form>
  186. </div>
  187. </div>
  188. </div>
  189. </div>
  190. </div>
  191. </div>
  192. <script src="/layuiadmin/layui/layui.js"></script>
  193. <script>
  194. layui.config({
  195. base: '/layuiadmin/' //静态资源所在路径
  196. }).extend({
  197. index: 'lib/index' //主入口模块
  198. }).use('index');
  199. </script>
  200. <script>
  201. //由于模块都一次性加载,因此不用执行 layui.use() 来加载对应模块,直接使用即可:
  202. var layer = layui.layer;
  203. var $;
  204. var cur_open_div;
  205. layui.use(['jquery', 'layer','form', 'element'], function(){
  206. $ = layui.$;
  207. var form = layui.form;
  208. form.on('radio(linktype)', function(data){
  209. if (data.value == 2) {
  210. $('#typeGroup').show();
  211. } else {
  212. $('#typeGroup').hide();
  213. }
  214. });
  215. form.on('switch(enabledwsitch)', function(data){
  216. var s_url = $(this).attr('data-href')
  217. var s_value = 1;
  218. if(data.elem.checked)
  219. {
  220. s_value = 1;
  221. }else{
  222. s_value = 0;
  223. }
  224. $.ajax({
  225. url:s_url,
  226. type:'post',
  227. dataType:'json',
  228. data:{enabled:s_value},
  229. success:function(info){
  230. if(info.status == 0)
  231. {
  232. layer.msg(info.result.message,{icon: 1,time: 2000});
  233. }else if(info.status == 1){
  234. var go_url = location.href;
  235. if( info.result.hasOwnProperty("url") )
  236. {
  237. go_url = info.result.url;
  238. }
  239. layer.msg('操作成功',{time: 1000,
  240. end:function(){
  241. location.href = info.result.url;
  242. }
  243. });
  244. }
  245. }
  246. })
  247. });
  248. form.on('switch(enabledtypewsitch)', function(data){
  249. var s_url = $(this).attr('data-href')
  250. var s_value = 1;
  251. if(data.elem.checked)
  252. {
  253. s_value = 1;
  254. }else{
  255. s_value = 0;
  256. }
  257. $.ajax({
  258. url:s_url,
  259. type:'post',
  260. dataType:'json',
  261. data:{enabled:s_value},
  262. success:function(info){
  263. if(info.status == 0)
  264. {
  265. layer.msg(info.result.message,{icon: 1,time: 2000});
  266. }else if(info.status == 1){
  267. var go_url = location.href;
  268. if( info.result.hasOwnProperty("url") )
  269. {
  270. go_url = info.result.url;
  271. }
  272. layer.msg('操作成功',{time: 1000,
  273. end:function(){
  274. location.href = info.result.url;
  275. }
  276. });
  277. }
  278. }
  279. })
  280. });
  281. form.on('switch(enabledexpresswsitch)', function(data){
  282. var s_url = $(this).attr('data-href')
  283. var s_value = 1;
  284. if(data.elem.checked)
  285. {
  286. s_value = 1;
  287. }else{
  288. s_value = 0;
  289. }
  290. $.ajax({
  291. url:s_url,
  292. type:'post',
  293. dataType:'json',
  294. data:{enabled:s_value},
  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. $('.deldom').click(function(){
  315. var s_url = $(this).attr('data-href');
  316. layer.confirm($(this).attr('data-confirm'), function(index){
  317. $.ajax({
  318. url:s_url,
  319. type:'post',
  320. dataType:'json',
  321. success:function(info){
  322. if(info.status == 0)
  323. {
  324. layer.msg(info.result.message,{icon: 1,time: 2000});
  325. }else if(info.status == 1){
  326. var go_url = location.href;
  327. if( info.result.hasOwnProperty("url") )
  328. {
  329. go_url = info.result.url;
  330. }
  331. layer.msg('操作成功',{time: 1000,
  332. end:function(){
  333. location.href = info.result.url;
  334. }
  335. });
  336. }
  337. }
  338. })
  339. });
  340. })
  341. $('#chose_link').click(function(){
  342. cur_open_div = $(this).attr('data-input');
  343. $.post("<?php echo U('util.selecturl', array('ok' => 1));?>", {}, function(shtml){
  344. layer.open({
  345. type: 1,
  346. area: '930px',
  347. content: shtml //注意,如果str是object,那么需要字符拼接。
  348. });
  349. });
  350. })
  351. //监听提交
  352. form.on('submit(formDemo)', function(data){
  353. $.ajax({
  354. url: data.form.action,
  355. type: data.form.method,
  356. data: data.field,
  357. dataType:'json',
  358. success: function (info) {
  359. if(info.status == 0)
  360. {
  361. layer.msg(info.result.message,{icon: 1,time: 2000});
  362. }else if(info.status == 1){
  363. var go_url = location.href;
  364. if( info.result.hasOwnProperty("url") )
  365. {
  366. go_url = info.result.url;
  367. }
  368. layer.msg('操作成功',{time: 1000,
  369. end:function(){
  370. location.href = info.result.url;
  371. }
  372. });
  373. }
  374. }
  375. });
  376. return false;
  377. });
  378. })
  379. </script>
  380. <script language='javascript'>
  381. $(function () {
  382. $('#btnExpand').click(function () {
  383. var action = $(this).data('action');
  384. if (action === 'expand') {
  385. $('#div_nestable').nestable('collapseAll');
  386. $(this).data('action', 'collapse').html('<i class="fa fa-angle-up"></i> 展开所有');
  387. } else {
  388. $('#div_nestable').nestable('expandAll');
  389. $(this).data('action', 'expand').html('<i class="fa fa-angle-down"></i> 折叠所有');
  390. }
  391. })
  392. var depth = <?php echo intval($_W['shopset']['category']['level']);?>;
  393. if (depth <= 0) {
  394. depth = 3;
  395. }
  396. $('.dd-item').addClass('full');
  397. $(".dd-handle a,.dd-handle div").mousedown(function (e) {
  398. e.stopPropagation();
  399. });
  400. var $expand = false;
  401. $('#nestableMenu').on('click', function (e)
  402. {
  403. if ($expand) {
  404. $expand = false;
  405. $('.dd').nestable('expandAll');
  406. } else {
  407. $expand = true;
  408. $('.dd').nestable('collapseAll');
  409. }
  410. });
  411. $('form').submit(function(){
  412. var json = window.JSON.stringify($('#div_nestable').nestable("serialize"));
  413. $(':input[name=datas]').val(json);
  414. });
  415. })
  416. function updateSort(obj){
  417. var cate_id = $(obj).attr('cate_id');
  418. var sort_order = $(obj).val();
  419. $.ajax({
  420. url: "<?php echo U('goods/update_catesort');?>",
  421. type: "post",
  422. data: {cate_id:cate_id,sort_order:sort_order},
  423. dataType:'json',
  424. success: function (info) {
  425. if(info.status == 1){
  426. var go_url = location.href;
  427. if( info.result.hasOwnProperty("url") )
  428. {
  429. go_url = info.result.url;
  430. }
  431. location.href = info.result.url;
  432. }else {
  433. layer.msg(info.result.message,{icon: 1,time: 2000});
  434. }
  435. }
  436. });
  437. }
  438. </script>
  439. </body>