config.html 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. <!-- 一个商品 -->
  2. <form>
  3. <input type="hidden" name="model_id" value="4" />
  4. <h2 class="attr-title">一个商品</h2>
  5. <div class="layui-form-item">
  6. <label class="layui-form-label sm">背景颜色</label>
  7. <div class="layui-input-block">
  8. <div class="color-wrapper">
  9. <input data-js="color" type="text" name="back_color" value="{$config_info.back_color|default=''}" />
  10. </div>
  11. </div>
  12. </div>
  13. <div class="layui-form-item">
  14. <label class="layui-form-label sm">广告</label>
  15. <div class="layui-input-block">
  16. <div class="uploader-wrapper">
  17. <div class="uploader-image-wrapper" {if !isset($config_info['adv']['image']) || !$config_info['adv']['image']}style="display:none"{/if}>
  18. <img class='uploader-image' src='{$config_info['adv']['image']|default=""}' />
  19. <div class="iconfont uploader-image-btn" onclick="delFile($(this))">&#xe696;</div>
  20. </div>
  21. <div class='uploader-content' {if isset($config_info['adv']['image']) && $config_info['adv']['image']}style="display:none"{/if}>
  22. <div class="uploader-icon iconfont">&#xe6bf;</div>
  23. <div class="uploader-text">点击上传</div>
  24. <div class="uploader-notice">1200×450</div>
  25. <input type='file' class='uploader-file' onchange='uploadFile($(this))'>
  26. <input type='hidden' name='adv[image]' value="{$config_info['adv']['image']|default=""}">
  27. </div>
  28. </div>
  29. </div>
  30. </div>
  31. <div class="layui-form-item">
  32. <label class="layui-form-label sm">上边距</label>
  33. <div class="layui-input-block">
  34. <div class="range-wrapper">
  35. <input type="range" name="padding_top" value="{$config_info.padding_top|default='0'}" onchange="$(this).next().text($(this).val())">
  36. <span>{$config_info.padding_top|default='0'}</span>
  37. </div>
  38. </div>
  39. </div>
  40. <div class="layui-form-item">
  41. <label class="layui-form-label sm">下边距</label>
  42. <div class="layui-input-block">
  43. <div class="range-wrapper">
  44. <input type="range" name="padding_bottom" value="{$config_info.padding_bottom|default='0'}" onchange="$(this).next().text($(this).val())">
  45. <span>{$config_info.padding_bottom|default='0'}</span>
  46. </div>
  47. </div>
  48. </div>
  49. <div class="layui-form-item">
  50. <label class="layui-form-label sm">固定商品</label>
  51. <div class="layui-input-block">
  52. <div class="onoff">
  53. <label for="if_fixed_goods_4_1" class="cb-enable{if !isset($config_info.if_fixed_goods) || $config_info.if_fixed_goods==1} selected{/if}" onclick="$(this).parents('form').find('[data-fixed=0]').hide();$(this).parents('form').find('[data-fixed=1]').show()">{$Think.lang.ds_yes}</label>
  54. <label for="if_fixed_goods_4_0" class="cb-disable{if isset($config_info.if_fixed_goods) && $config_info.if_fixed_goods==0} selected{/if}" onclick="$(this).parents('form').find('[data-fixed=0]').show();$(this).parents('form').find('[data-fixed=1]').hide()">{$Think.lang.ds_no}</label>
  55. <input id="if_fixed_goods_4_1"{if !isset($config_info.if_fixed_goods) || $config_info.if_fixed_goods==1} checked="checked"{/if} name="if_fixed_goods" value="1" type="radio">
  56. <input id="if_fixed_goods_4_0"{if isset($config_info.if_fixed_goods) && $config_info.if_fixed_goods==0} checked="checked"{/if} name="if_fixed_goods" value="0" type="radio">
  57. </div>
  58. </div>
  59. </div>
  60. <div class="layui-form-item" data-fixed="1"{if isset($config_info.if_fixed_goods) && $config_info.if_fixed_goods==0} style="display:none"{/if}>
  61. <label class="layui-form-label sm">选择商品</label>
  62. <div class="layui-input-block">
  63. <div class="select-wrapper" data-select="goods">
  64. <span class="text" data-count>请选择</span>
  65. <span class="icon iconfont">&#xe687;</span>
  66. </div>
  67. <div data-content="goods_ids" style="display:none">
  68. {if isset($config_info['goods_id']) && !empty($config_info['goods_id'])}
  69. {foreach name='config_info.goods_id' item='item' key='key'}
  70. <input data-goods="{$key}" type="number" min="0" max="255" size="1" name="goods_id[{$key}][sort]" value="{$item.sort}" />
  71. {/foreach}
  72. {/if}
  73. </div>
  74. </div>
  75. </div>
  76. <div class="layui-form-item" data-fixed="0"{if !isset($config_info.if_fixed_goods) || $config_info.if_fixed_goods==1} style="display:none"{/if}>
  77. <label class="layui-form-label sm">商品数量</label>
  78. <div class="layui-input-block">
  79. <div class="range-wrapper">
  80. <input type="range" name="goods_count" value="{$config_info.goods_count|default='1'}" min="1" onchange="$(this).next().text($(this).val())">
  81. <span>{$config_info.goods_count|default='1'}</span>
  82. </div>
  83. </div>
  84. </div>
  85. <div class="layui-form-item" data-fixed="0"{if !isset($config_info.if_fixed_goods) || $config_info.if_fixed_goods==1} style="display:none"{/if}>
  86. <label class="layui-form-label sm">商品分类</label>
  87. <div class="layui-input-block">
  88. <div data-js="goods_class"><div data-select></div><input type="hidden" name="goods_class" data-input value="{$config_info.goods_class|default='0'}" /></div>
  89. </div>
  90. </div>
  91. <div class="layui-form-item" data-fixed="0"{if !isset($config_info.if_fixed_goods) || $config_info.if_fixed_goods==1} style="display:none"{/if}>
  92. <label class="layui-form-label sm">商品排序</label>
  93. <div class="layui-input-block">
  94. <select name="goods_sort">
  95. <option value="1"{if !isset($config_info.goods_sort) || $config_info.goods_sort==1} selected="selected"{/if}>按新品</option>
  96. <option value="2"{if isset($config_info.goods_sort) && $config_info.goods_sort==2} selected="selected"{/if}>按热销</option>
  97. <option value="3"{if isset($config_info.goods_sort) && $config_info.goods_sort==3} selected="selected"{/if}>按好评</option>
  98. </select>
  99. </div>
  100. </div>
  101. </form>
  102. <script>
  103. if(typeof(loadConfig4)=='undefined'){
  104. function loadConfig4(obj){
  105. obj.find('[data-js="color"]').colorpicker({showOn: 'both'});
  106. var id=obj.attr('data-id')
  107. obj.find('[data-js="goods_class"]').attr('id','goods_class_'+id)
  108. var gc_id=parseInt(obj.find('*[data-input]').val())
  109. if(gc_id){
  110. getGoodsClass(gc_id,'goods_class_'+id)
  111. }else{
  112. loadGoodsClass(1,0,'goods_class_'+id)
  113. }
  114. var i=0
  115. obj.find('[data-select="goods"]').each(function(){
  116. $(this).attr('id','select_goods_'+i+'_'+id)
  117. i++
  118. })
  119. obj.find('*[data-select="goods"]').click(function(){
  120. var goods_id=''
  121. $(this).parent().find('*[data-content="goods_ids"] input').each(function(){
  122. goods_id+='&goods_id['+$(this).attr('data-goods')+'][sort]='+$(this).val()
  123. })
  124. dsLayerOpen('{:url(request()->controller()."/search_goods")}?id='+$(this).attr('id')+goods_id,'选择商品')
  125. })
  126. obj.find('.onoff').each(function(){
  127. $(this).find(".cb-enable").click(function() {
  128. var parent = $(this).parents('.onoff');
  129. $('.cb-disable', parent).removeClass('selected');
  130. $(this).addClass('selected');
  131. $('.checkbox', parent).prop('checked', true);
  132. });
  133. $(this).find(".cb-disable").click(function() {
  134. var parent = $(this).parents('.onoff');
  135. $('.cb-enable', parent).removeClass('selected');
  136. $(this).addClass('selected');
  137. $('.checkbox', parent).prop('checked', false);
  138. });
  139. })
  140. }
  141. }
  142. if(typeof(saveGoods)=='undefined'){
  143. function saveGoods(html,id,count){
  144. $('#'+id).parent().find('[data-content="goods_ids"]').html(html)
  145. $('#'+id).parent().find('[data-count]').text(count?('已选择'+count+'个'):'请选择')
  146. $('#'+id).parents('form').change()
  147. }
  148. }
  149. </script>