94125a3b5a4e854f51b8d0fe6e2d3ff2.php 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303
  1. <?php /*a:3:{s:60:"/data/web/pl.valimart.net/app/admin/view/type/type_form.html";i:1657785098;s:59:"/data/web/pl.valimart.net/app/admin/view/public/header.html";i:1657785098;s:64:"/data/web/pl.valimart.net/app/admin/view/public/admin_items.html";i:1657785098;}*/ ?>
  2. <!DOCTYPE html>
  3. <html>
  4. <head>
  5. <meta charset="utf-8">
  6. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  7. <title><?php echo htmlentities((isset($html_title) && ($html_title !== '')?$html_title:config('ds_config.site_name'))); ?><?php echo htmlentities(lang('system_backend')); ?></title>
  8. <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
  9. <link rel="stylesheet" href="<?php echo htmlentities(ADMIN_SITE_ROOT); ?>/css/admin.css">
  10. <link rel="stylesheet" href="<?php echo htmlentities(PLUGINS_SITE_ROOT); ?>/js/jquery-ui/jquery-ui.min.css">
  11. <script src="<?php echo htmlentities(PLUGINS_SITE_ROOT); ?>/jquery-2.1.4.min.js"></script>
  12. <script src="<?php echo htmlentities(PLUGINS_SITE_ROOT); ?>/jquery.validate.min.js"></script>
  13. <script src="<?php echo htmlentities(PLUGINS_SITE_ROOT); ?>/jquery.cookie.js"></script>
  14. <script src="<?php echo htmlentities(PLUGINS_SITE_ROOT); ?>/common.js"></script>
  15. <script src="<?php echo htmlentities(ADMIN_SITE_ROOT); ?>/js/admin.js"></script>
  16. <script src="<?php echo htmlentities(PLUGINS_SITE_ROOT); ?>/js/jquery-ui/jquery-ui.min.js"></script>
  17. <script src="<?php echo htmlentities(PLUGINS_SITE_ROOT); ?>/js/jquery-ui/jquery.ui.datepicker-zh-CN.js"></script>
  18. <script src="<?php echo htmlentities(PLUGINS_SITE_ROOT); ?>/perfect-scrollbar.min.js"></script>
  19. <script src="<?php echo htmlentities(PLUGINS_SITE_ROOT); ?>/layer/layer.js"></script>
  20. <script type="text/javascript">
  21. var BASESITEROOT = "<?php echo htmlentities(BASE_SITE_ROOT); ?>";
  22. var ADMINSITEROOT = "<?php echo htmlentities(ADMIN_SITE_ROOT); ?>";
  23. var BASESITEURL = "<?php echo htmlentities(BASE_SITE_URL); ?>";
  24. var HOMESITEURL = "<?php echo htmlentities(HOME_SITE_URL); ?>";
  25. var ADMINSITEURL = "<?php echo htmlentities(ADMIN_SITE_URL); ?>";
  26. </script>
  27. </head>
  28. <body>
  29. <div id="append_parent"></div>
  30. <div id="ajaxwaitid"></div>
  31. <style>
  32. tr.disable{-webkit-opacity: 0.3;
  33. /* Netscape and Older than Firefox 0.9 */
  34. -moz-opacity: 0.3;
  35. /* Safari 1.x (pre WebKit!) 老式khtml内核的Safari浏览器*/
  36. -khtml-opacity: 0.3;
  37. /* IE9 + etc...modern browsers */
  38. opacity: .3;
  39. /* IE 4-9 */
  40. filter:alpha(opacity=30);
  41. /*This works in IE 8 & 9 too*/
  42. -ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=30)";
  43. /*IE4-IE9*/
  44. filter:progid:DXImageTransform.Microsoft.Alpha(Opacity=30);}
  45. </style>
  46. <div class="page">
  47. <div class="fixed-bar">
  48. <div class="item-title">
  49. <div class="subject">
  50. <h3><?php echo htmlentities(lang('ds_type')); ?></h3>
  51. <h5></h5>
  52. </div>
  53. <?php if($admin_item): ?>
  54. <ul class="tab-base ds-row">
  55. <?php if(is_array($admin_item) || $admin_item instanceof \think\Collection || $admin_item instanceof \think\Paginator): if( count($admin_item)==0 ) : echo "" ;else: foreach($admin_item as $key=>$item): ?>
  56. <li><a href="<?php echo htmlentities($item['url']); ?>" <?php if($item['name'] == $curitem): ?>class="current"<?php endif; ?>><span><?php echo htmlentities($item['text']); ?></span></a></li>
  57. <?php endforeach; endif; else: echo "" ;endif; ?>
  58. </ul>
  59. <?php endif; ?>
  60. </div>
  61. </div>
  62. <form class="" id="type_form" method="post">
  63. <div class="ncap-form-default">
  64. <dl>
  65. <dt></dt>
  66. <dd>
  67. <div id="gcategory" class="default_select">
  68. <input type="hidden" name="class_id" value="<?php echo htmlentities($type['class_id']); ?>" class="mls_id" />
  69. <input type="hidden" name="class_name" value="<?php echo htmlentities((isset($type['class_name']) && ($type['class_name'] !== '')?$type['class_name']:'')); ?>" class="mls_name" />
  70. <?php if($type['class_id']): ?>
  71. <span><?php echo htmlentities((isset($type['class_name']) && ($type['class_name'] !== '')?$type['class_name']:'')); ?></span>
  72. <input type="button" value="<?php echo htmlentities(lang('ds_edit')); ?>" class="edit_gcategory" />
  73. <?php endif; ?>
  74. <select <?php if($type['class_id']): ?>style="display:none"<?php endif; ?>>
  75. <option value="0"><?php echo htmlentities(lang('type_common_belong_class')); ?></option>
  76. <?php if(is_array($gc_list) || $gc_list instanceof \think\Collection || $gc_list instanceof \think\Paginator): if( count($gc_list)==0 ) : echo "" ;else: foreach($gc_list as $key=>$gc): ?>
  77. <option value="<?php echo htmlentities($gc['gc_id']); ?>"><?php echo htmlentities($gc['gc_name']); ?></option>
  78. <?php endforeach; endif; else: echo "" ;endif; ?>
  79. </select>
  80. </div>
  81. </dd>
  82. </dl>
  83. <dl>
  84. <dt><?php echo htmlentities(lang('type_name')); ?></dt>
  85. <dd>
  86. <input type="text" name="type_name" id="type_name" value="<?php echo htmlentities((isset($type['type_name']) && ($type['type_name'] !== '')?$type['type_name']:'')); ?>" />
  87. <span class="err"></span>
  88. <p class="notic"></p>
  89. </dd>
  90. </dl>
  91. <dl>
  92. <dt><?php echo htmlentities(lang('type_sort')); ?></dt>
  93. <dd>
  94. <input type="text" name="type_sort" id="type_sort" value="<?php echo htmlentities((isset($type['type_sort']) && ($type['type_sort'] !== '')?$type['type_sort']:'255')); ?>" />
  95. <span class="err"></span>
  96. <p class="notic"></p>
  97. </dd>
  98. </dl>
  99. <dl data-brand="title">
  100. <dt><?php echo htmlentities(lang('type_add_related_brand')); ?></dt>
  101. <dd>
  102. </dd>
  103. </dl>
  104. <?php if(!(empty($brand_list) || (($brand_list instanceof \think\Collection || $brand_list instanceof \think\Paginator ) && $brand_list->isEmpty()))): if(is_array($brand_list) || $brand_list instanceof \think\Collection || $brand_list instanceof \think\Paginator): if( count($brand_list)==0 ) : echo "" ;else: foreach($brand_list as $key=>$brand_gc): ?>
  105. <dl data-brand="content">
  106. <dt><?php echo htmlentities($brand_gc['name']); ?></dt>
  107. <dd>
  108. <?php if(is_array($brand_gc['brand']) || $brand_gc['brand'] instanceof \think\Collection || $brand_gc['brand'] instanceof \think\Paginator): if( count($brand_gc['brand'])==0 ) : echo "" ;else: foreach($brand_gc['brand'] as $key=>$brand): ?>
  109. <input type="checkbox" id="brand_<?php echo htmlentities($brand['brand_id']); ?>" value="<?php echo htmlentities($brand['brand_id']); ?>" name="brand_id[]" <?php if($brand['checked']): ?>checked="checked"<?php endif; ?> />
  110. <label for="brand_<?php echo htmlentities($brand['brand_id']); ?>"><?php echo htmlentities($brand['brand_name']); ?></label>
  111. <?php endforeach; endif; else: echo "" ;endif; ?>
  112. </dd>
  113. </dl>
  114. <?php endforeach; endif; else: echo "" ;endif; ?>
  115. <?php endif; ?>
  116. <dl data-spec="title">
  117. <dt><?php echo htmlentities(lang('type_add_related_spec')); ?></dt>
  118. <dd>
  119. </dd>
  120. </dl>
  121. <?php if(!(empty($spec_list) || (($spec_list instanceof \think\Collection || $spec_list instanceof \think\Paginator ) && $spec_list->isEmpty()))): if(is_array($spec_list) || $spec_list instanceof \think\Collection || $spec_list instanceof \think\Paginator): if( count($spec_list)==0 ) : echo "" ;else: foreach($spec_list as $key=>$spec_gc): ?>
  122. <dl data-spec="content">
  123. <dt><?php echo htmlentities($spec_gc['name']); ?></dt>
  124. <dd>
  125. <?php if(is_array($spec_gc['spec']) || $spec_gc['spec'] instanceof \think\Collection || $spec_gc['spec'] instanceof \think\Paginator): if( count($spec_gc['spec'])==0 ) : echo "" ;else: foreach($spec_gc['spec'] as $key=>$spec): ?>
  126. <input type="checkbox" id="spec_<?php echo htmlentities($spec['sp_id']); ?>" value="<?php echo htmlentities($spec['sp_id']); ?>" name="spec_id[]" <?php if(!(empty($spec['checked']) || (($spec['checked'] instanceof \think\Collection || $spec['checked'] instanceof \think\Paginator ) && $spec['checked']->isEmpty()))): ?>checked="checked"<?php endif; ?>/>
  127. <label for="spec_<?php echo htmlentities($spec['sp_id']); ?>"><?php echo htmlentities($spec['sp_name']); ?></label>
  128. <?php endforeach; endif; else: echo "" ;endif; ?>
  129. </dd>
  130. </dl>
  131. <?php endforeach; endif; else: echo "" ;endif; ?>
  132. <?php endif; ?>
  133. </div>
  134. <table class="ds-default-table">
  135. <thead>
  136. <tr>
  137. <th width="100"><?php echo htmlentities(lang('ds_sort')); ?></th>
  138. <th width="200"><?php echo htmlentities(lang('type_add_attr_name')); ?></th>
  139. <th><?php echo htmlentities(lang('type_add_attr_value')); ?></th>
  140. <th width="100"><?php echo htmlentities(lang('ds_display')); ?></th>
  141. <th width="100"><?php echo htmlentities(lang('ds_handle')); ?></th>
  142. </tr>
  143. </thead>
  144. <tbody id="tr_model">
  145. <tr></tr>
  146. <?php if(!(empty($attr_list) || (($attr_list instanceof \think\Collection || $attr_list instanceof \think\Paginator ) && $attr_list->isEmpty()))): if(is_array($attr_list) || $attr_list instanceof \think\Collection || $attr_list instanceof \think\Paginator): if( count($attr_list)==0 ) : echo "" ;else: foreach($attr_list as $key=>$attr): ?>
  147. <tr data-attr="old">
  148. <td><input type="text" class="form-control" name="at_value[<?php echo htmlentities($attr['attr_id']); ?>][sort]" value="<?php echo htmlentities($attr['attr_sort']); ?>"/></td>
  149. <td><input type="text" class="form-control" name="at_value[<?php echo htmlentities($attr['attr_id']); ?>][name]" value="<?php echo htmlentities($attr['attr_name']); ?>"/></td>
  150. <td><?php echo htmlentities($attr['attr_value']); ?></td>
  151. <td><input type="checkbox" name="at_value[<?php echo htmlentities($attr['attr_id']); ?>][show]" <?php if($attr['attr_show']): ?> checked="checked" <?php endif; ?> /></td>
  152. <td>
  153. <input type="hidden" value="" name="at_value[<?php echo htmlentities($attr['attr_id']); ?>][form_submit]" />
  154. <input type="hidden" value="<?php echo htmlentities($attr['attr_id']); ?>" name="at_value[<?php echo htmlentities($attr['attr_id']); ?>][attr_id]" />
  155. <input type="checkbox" data-attr="del" name="a_del[<?php echo htmlentities($attr['attr_id']); ?>]" value="<?php echo htmlentities($attr['attr_id']); ?>" style="display:none" />
  156. <a href="javascript:dsLayerOpen('<?php echo url('Type/attr_edit',['attr_id'=>$attr['attr_id']]); ?>','<?php echo htmlentities(lang('ds_edit')); ?>-<?php echo htmlentities($attr['attr_name']); ?>')"><?php echo htmlentities(lang('ds_edit')); ?></a>
  157. <a onclick="remove_tr($(this));" href="JavaScript:void(0);"><?php echo htmlentities(lang('ds_del')); ?></a>
  158. </td>
  159. </tr>
  160. <?php endforeach; endif; else: echo "" ;endif; else: ?>
  161. <tr data-attr="new">
  162. <td><input type="text" class="form-control" name="at_value[key][sort]" value="0"/></td>
  163. <td><input type="text" class="form-control" name="at_value[key][name]" value=""/></td>
  164. <td><textarea rows="5" cols="80" class="form-control" name="at_value[key][value]"></textarea></td>
  165. <td><input type="checkbox" name="at_value[key][show]" checked="checked" /></td>
  166. <td>
  167. <a onclick="remove_tr($(this));" href="JavaScript:void(0);"><?php echo htmlentities(lang('ds_del')); ?></a>
  168. </td>
  169. </tr>
  170. <?php endif; ?>
  171. </tbody>
  172. <tbody>
  173. <tr>
  174. <td>
  175. <a id="add_type" class="btn-add-nofloat marginleft" href="JavaScript:void(0);"> <span><?php echo htmlentities(lang('type_add_attr_add_one')); ?></span> </a>
  176. </td>
  177. </tr>
  178. </tbody>
  179. </table>
  180. <input class="btn" type="submit" value="<?php echo htmlentities(lang('ds_submit')); ?>"/>
  181. </form>
  182. </div>
  183. <!--载入-->
  184. <script src="<?php echo htmlentities(PLUGINS_SITE_ROOT); ?>/mlselection.js"></script>
  185. <script>
  186. $(function () {
  187. gcategoryInit("gcategory");
  188. $(function () {
  189. gcategoryInit("gcategory");
  190. var i = 0;
  191. var tr_model = '<tr data-attr="new">' +
  192. '<td><input type="text" class="form-control" name="at_value[key][sort]" value="0" /></td>' +
  193. '<td><input type="text" class="form-control" name="at_value[key][name]" value="" /></td>' +
  194. '<td><textarea rows="5" cols="80" class="form-control" name="at_value[key][value]"></textarea></td>' +
  195. '<td><input type="checkbox" name="at_value[key][show]" checked="checked" /></td>' +
  196. '<td><a onclick="remove_tr($(this));" href="JavaScript:void(0);"><?php echo htmlentities(lang('ds_del')); ?></a></td>' +
  197. '</tr>';
  198. $("#add_type").click(function () {
  199. $('#tr_model > tr:last').after(tr_model.replace(/key/g, i));
  200. i++;
  201. });
  202. });
  203. $('#gcategory').click(function(){
  204. $.getJSON("<?php echo url('Type/ajaxGetSpecAndBrand'); ?>"+"?type_id=<?php echo htmlentities((isset($type['type_id']) && ($type['type_id'] !== '')?$type['type_id']:0)); ?>&class_id="+$('[name=class_id]').val(),function(data){
  205. $('[data-spec=content]').remove();
  206. var s_list=data.s_list;
  207. var html='';
  208. for(var i in s_list){
  209. var html_spec='';
  210. var spec=s_list[i].spec;
  211. for(var j in spec){
  212. html_spec+='<input type="checkbox" id="spec_'+spec[j].sp_id+'" value="'+spec[j].sp_id+'" name="spec_id[]" '+((spec[j].checked=='1')?'checked="checked"':"")+' />'+
  213. '<label for="spec_'+spec[j].sp_id+'">'+spec[j].sp_name+'</label>';
  214. }
  215. html+='<dl data-spec="content">'+
  216. '<dt>'+s_list[i].name+'</dt>'+
  217. '<dd>'+
  218. html_spec+
  219. '</dd>'+
  220. '</dl>';
  221. }
  222. $('[data-spec=title]').after(html);
  223. $('[data-brand=content]').remove();
  224. var b_list=data.b_list;
  225. var html='';
  226. for(var i in b_list){
  227. var html_brand='';
  228. var brand=b_list[i].brand;
  229. for(var j in brand){
  230. html_brand+='<input type="checkbox" id="brand_'+brand[j].brand_id+'" value="'+brand[j].brand_id+'" name="brand_id[]" '+((brand[j].checked=='1')?'checked="checked"':"")+' />'+
  231. '<label for="brand_'+brand[j].brand_id+'">'+brand[j].brand_name+'</label>';
  232. }
  233. html+='<dl data-brand="content">'+
  234. '<dt>'+b_list[i].name+'</dt>'+
  235. '<dd>'+
  236. html_brand+
  237. '</dd>'+
  238. '</dl>';
  239. }
  240. $('[data-brand=title]').after(html);
  241. })
  242. });
  243. $('#type_form').submit(function(){
  244. $('tr[data-attr=old].disable').find('[data-attr=del]').prop('checked',true);
  245. $('tr[data-attr=new].disable').find('input').prop('disabled',true);
  246. });
  247. });
  248. function remove_tr(o) {
  249. if(o.parents('tr:first').hasClass('disable')){
  250. o.parents('tr:first').removeClass('disable');
  251. o.text('<?php echo htmlentities(lang('ds_del')); ?>');
  252. }else{
  253. o.parents('tr:first').addClass('disable');
  254. o.text('<?php echo htmlentities(lang('type_reduction')); ?>');
  255. }
  256. };
  257. $(document).ready(function() {
  258. $("#type_form").validate({
  259. errorPlacement: function(error, element) {
  260. error.appendTo(element.nextAll('span.err'));
  261. },
  262. rules: {
  263. type_name : {
  264. required : true
  265. },
  266. type_sort : {
  267. required : true,
  268. number : true,
  269. range : [0,255]
  270. },
  271. },
  272. messages: {
  273. type_name : {
  274. required : '<?php echo htmlentities(lang('type_name_required')); ?>',
  275. },
  276. type_sort : {
  277. required : '<?php echo htmlentities(lang('type_edit_type_attr_sort_no_null')); ?>',
  278. number : '<?php echo htmlentities(lang('type_edit_type_attr_sort_no_digits')); ?>',
  279. range : '<?php echo htmlentities(lang('class_sort_explain')); ?>'
  280. },
  281. }
  282. });
  283. });
  284. </script>