addcategory.html 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241
  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. <link rel="stylesheet" href="/layuiadmin/layui/css/layui.css" media="all">
  42. <link href="/static/css/snailfish.css" rel="stylesheet">
  43. <style>
  44. .recharge_info{
  45. display: -webkit-box;
  46. display: -webkit-flex;
  47. display: -ms-flexbox;
  48. display: flex;
  49. justify-content: space-around;
  50. margin-bottom: 10px;
  51. }
  52. .recharge_info>div{
  53. -webkit-box-flex: 1;
  54. -webkit-flex: 1;
  55. -ms-flex: 1;
  56. flex: 1;
  57. border:1px solid #efefef;
  58. margin: 0 10px;
  59. padding:10px 22px;
  60. line-height: 25px;
  61. color: #333;
  62. }
  63. </style>
  64. </head>
  65. <body layadmin-themealias="default">
  66. <div class="layui-fluid">
  67. <div class="layui-card">
  68. <div class="layui-card-header layui-elem-quote">当前位置:<span class="line-text"><?php if(!empty($data['id'])){ ?>编辑<?php }else{ ?>添加<?php } ?>分类</span></div>
  69. <div class="layui-card-body" style="padding:15px;">
  70. <form action="" method="post" class="layui-form" lay-filter="component-layui-form-item" enctype="multipart/form-data" >
  71. <input type="hidden" name="data[id]" value="{$data[id]}" />
  72. <input type="hidden" name="data[pid]" value="{$pid}" />
  73. <div class="layui-form-item">
  74. <label class="layui-form-label mustl">分类名称</label>
  75. <div class="layui-input-block">
  76. <input type="text" name="data[name]" class="form-control" value="{$data[name]}" lay-verify='true' />
  77. </div>
  78. </div>
  79. <div class="layui-form-item">
  80. <label class="layui-form-label mustl">分类排序</label>
  81. <div class="layui-input-block">
  82. <input type="text" name="data[sort_order]" class="form-control" value="<?php if( !empty($data)){ ?>{$data['sort_order']}<?php }else{ ?><?php } ?>" data-rule-required='true' />
  83. </div>
  84. </div>
  85. <div class="layui-form-item" style="display: none;">
  86. <label class="layui-form-label">首页推荐</label>
  87. <div class="layui-input-block">
  88. <input type='radio' name='data[is_hot]' value='1' checked />
  89. <!-- <label class='radio-inline'>
  90. <input type='radio' name='data[is_hot]' value='0' <?php if( empty($data) || $data['is_hot'] ==0 ){ ?>checked <?php } ?> /> 否
  91. </label>
  92. <label class='radio-inline'>
  93. <input type='radio' name='data[is_hot]' value='1' <?php if( !empty($data) && $data['is_hot'] ==1 ){ ?>checked <?php } ?> /> 是
  94. </label> -->
  95. </div>
  96. </div>
  97. <div class="layui-form-item">
  98. <label class="layui-form-label">是否显示</label>
  99. <div class="layui-input-block">
  100. <input type="checkbox" name="data[is_show]" lay-skin="primary" value="1" title="首页显示" <?php if( !isset($data['is_show']) || $data['is_show']==1 ){ ?>checked<?php } ?>>
  101. <input type="checkbox" name="data[is_type_show]" lay-skin="primary" value="1" title="独立分类页显示" <?php if( !isset($data['is_type_show']) || $data['is_type_show']==1 ){ ?>checked<?php } ?>>
  102. <!--<input type="checkbox" name="data[is_express_show]" lay-skin="primary" value="1" title="仅快递商品页显示" <?php if( !isset($data['is_express_show']) || $data['is_express_show']==1 ){ ?>checked<?php } ?>> -->
  103. </div>
  104. </div>
  105. <div class="layui-form-item">
  106. <label class="layui-form-label">主题图</label>
  107. <div class="layui-input-block">
  108. {:tpl_form_field_image2('data[banner]', $data['banner'])}
  109. <span class='help-block'>首页分类、分类列表顶部主题图</span>
  110. </div>
  111. </div>
  112. <div class="layui-form-item" >
  113. <label class="layui-form-label"></label>
  114. <div class="layui-input-block ">
  115. <input type="checkbox" lay-skin="primary" name="data[is_show_topic]" class="form-control valid" <?php if( isset($data) && $data['is_show_topic'] ==1 ){ ?>checked<?php } ?> value="1" title="首页3*3调用" lay-filter="checkedSwitch" />
  116. </div>
  117. </div>
  118. <div class="layui-form-item">
  119. <label class="layui-form-label">LOGO</label>
  120. <div class="layui-input-block">
  121. {:tpl_form_field_image2('data[logo]', $data['logo'])}
  122. <span class='help-block'>分类logo,建议尺寸400*400</span>
  123. </div>
  124. </div>
  125. <div class="layui-form-item">
  126. <label class="layui-form-label"> </label>
  127. <div class="layui-input-block">
  128. <input type="submit" value="提交" lay-submit lay-filter="formDemo" class="btn btn-primary" />
  129. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  130. <a class="btn btn-default" style='margin-left:10px;' href="{:U('goods/goodscategory',array('ok'=>'1'))}">返回列表</a>
  131. </div>
  132. </div>
  133. </form>
  134. </div>
  135. </div>
  136. </div>
  137. <script src="/layuiadmin/layui/layui.js"></script>
  138. <script>
  139. layui.config({
  140. base: '/layuiadmin/' //静态资源所在路径
  141. }).extend({
  142. index: 'lib/index' //主入口模块
  143. }).use('index');
  144. </script>
  145. <script>
  146. //由于模块都一次性加载,因此不用执行 layui.use() 来加载对应模块,直接使用即可:
  147. var layer = layui.layer;
  148. var $;
  149. var cur_open_div;
  150. layui.use(['jquery', 'layer','form'], function(){
  151. $ = layui.$;
  152. var form = layui.form;
  153. form.on('radio(linktype)', function(data){
  154. if (data.value == 2) {
  155. $('#typeGroup').show();
  156. } else {
  157. $('#typeGroup').hide();
  158. }
  159. });
  160. form.on('checkbox(checkedSwitch)', function(data){
  161. console.log(data.elem.checked)
  162. // $(this).attr('checked', data.elem.checked);
  163. // form.render('checkbox');
  164. })
  165. $('#chose_link').click(function(){
  166. cur_open_div = $(this).attr('data-input');
  167. $.post("{:U('util.selecturl', array('ok' => 1))}", {}, function(shtml){
  168. layer.open({
  169. type: 1,
  170. area: '930px',
  171. content: shtml //注意,如果str是object,那么需要字符拼接。
  172. });
  173. });
  174. })
  175. //监听提交
  176. form.on('submit(formDemo)', function(data){
  177. var loadingIndex = layer.load();
  178. $.ajax({
  179. url: data.form.action,
  180. type: data.form.method,
  181. data: data.field,
  182. dataType:'json',
  183. success: function (info) {
  184. if(info.status == 0)
  185. {
  186. layer.msg(info.result.message,{icon: 1,time: 2000});
  187. layer.close(loadingIndex);
  188. }else if(info.status == 1){
  189. var go_url = location.href;
  190. if( info.result.hasOwnProperty("url") )
  191. {
  192. go_url = info.result.url;
  193. }
  194. layer.msg('操作成功',{time: 1000,
  195. end:function(){
  196. location.href = info.result.url;
  197. }
  198. });
  199. }
  200. }
  201. });
  202. return false;
  203. });
  204. })
  205. </script>
  206. </body>