config.html 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. <!-- 商品列表 -->
  2. <form onchange="changeForm($(this),6)">
  3. <input type="hidden" name="model_id" value="6" />
  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="ds-icon-radio">
  17. <input type="hidden" name="show_format" value="{$config_info.show_format|default='1'}" />
  18. <ul class="ds-icon">
  19. <li{if !isset($config_info['show_format']) || $config_info['show_format']==1} class="ds-icon-active"{/if} data-val="1" onclick="setRadio($(this))">
  20. <img src="{$Think.HOME_SITE_ROOT}/images/editable_page/rubik_cube_row1_of2.png">
  21. <div class="text">两列</div>
  22. </li>
  23. <li{if isset($config_info['show_format']) && $config_info['show_format']==2} class="ds-icon-active"{/if} data-val="2" onclick="setRadio($(this))">
  24. <img src="{$Think.HOME_SITE_ROOT}/images/editable_page/rubik_cube_row1_of1.png">
  25. <div class="text">一列</div>
  26. </li>
  27. </ul>
  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="onoff">
  35. <label for="if_fixed_goods_6_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>
  36. <label for="if_fixed_goods_6_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>
  37. <input id="if_fixed_goods_6_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">
  38. <input id="if_fixed_goods_6_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">
  39. </div>
  40. </div>
  41. </div>
  42. <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}>
  43. <label class="layui-form-label sm">选择商品</label>
  44. <div class="layui-input-block">
  45. <div class="select-wrapper" data-select="goods">
  46. <span class="text" data-count>请选择</span>
  47. <span class="icon iconfont">&#xe687;</span>
  48. </div>
  49. <div data-content="goods_ids" style="display:none">
  50. {if isset($config_info['goods_id']) && !empty($config_info['goods_id'])}
  51. {foreach name='config_info.goods_id' item='item' key='key'}
  52. <input data-goods="{$key}" type="number" min="0" max="255" size="1" name="goods_id[{$key}][sort]" value="{$item.sort}" />
  53. {/foreach}
  54. {/if}
  55. </div>
  56. </div>
  57. </div>
  58. <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}>
  59. <label class="layui-form-label sm">商品数量</label>
  60. <div class="layui-input-block">
  61. <div class="range-wrapper">
  62. <input type="range" name="goods_count" value="{$config_info.goods_count|default='1'}" min="1" onchange="$(this).next().text($(this).val())">
  63. <span>{$config_info.goods_count|default='1'}</span>
  64. </div>
  65. </div>
  66. </div>
  67. <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}>
  68. <label class="layui-form-label sm">商品分类</label>
  69. <div class="layui-input-block">
  70. <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>
  71. </div>
  72. </div>
  73. <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}>
  74. <label class="layui-form-label sm">商品排序</label>
  75. <div class="layui-input-block">
  76. <select name="goods_sort">
  77. <option value="1"{if !isset($config_info.goods_sort) || $config_info.goods_sort==1} selected="selected"{/if}>按新品</option>
  78. <option value="2"{if isset($config_info.goods_sort) && $config_info.goods_sort==2} selected="selected"{/if}>按热销</option>
  79. <option value="3"{if isset($config_info.goods_sort) && $config_info.goods_sort==3} selected="selected"{/if}>按好评</option>
  80. </select>
  81. </div>
  82. </div>
  83. <div class="layui-form-item">
  84. <label class="layui-form-label sm">显示角标</label>
  85. <div class="layui-input-block">
  86. <div class="onoff">
  87. <label for="if_show_goods_icon_1" class="cb-enable{if !isset($config_info.if_show_goods_icon) || $config_info.if_show_goods_icon==1} selected{/if}">{$Think.lang.ds_yes}</label>
  88. <label for="if_show_goods_icon_0" class="cb-disable{if isset($config_info.if_show_goods_icon) && $config_info.if_show_goods_icon==0} selected{/if}">{$Think.lang.ds_no}</label>
  89. <input id="if_show_goods_icon_1"{if !isset($config_info.if_show_goods_icon) || $config_info.if_show_goods_icon==1} checked="checked"{/if} name="if_show_goods_icon" value="1" type="radio">
  90. <input id="if_show_goods_icon_0"{if isset($config_info.if_show_goods_icon) && $config_info.if_show_goods_icon==0} checked="checked"{/if} name="if_show_goods_icon" value="0" type="radio">
  91. </div>
  92. </div>
  93. </div>
  94. <div class="layui-form-item">
  95. <label class="layui-form-label sm">角标图片</label>
  96. <div class="layui-input-block">
  97. <div class="uploader-wrapper">
  98. <div class="uploader-image-wrapper" {if !isset($config_info.goods_icon) || !$config_info.goods_icon}style="display:none" {/if}>
  99. <img class='uploader-image' src='{$config_info.goods_icon|default=""}' />
  100. <div class="iconfont uploader-image-btn" onclick="delFile($(this))">&#xe696;</div>
  101. </div>
  102. <div class='uploader-content' {if isset($config_info.goods_icon) && $config_info.goods_icon}style="display:none" {/if}>
  103. <div class="uploader-icon iconfont">&#xe6bf;</div>
  104. <div class="uploader-text">点击上传</div>
  105. <div class="uploader-notice">100×100</div>
  106. <input type='file' class='uploader-file' onchange='uploadFile($(this))'>
  107. <input type='hidden' name='goods_icon' value='{$config_info.goods_icon|default=""}'>
  108. </div>
  109. </div>
  110. </div>
  111. </div>
  112. </form>
  113. <script>
  114. if(typeof(loadConfig6)=='undefined'){
  115. function loadConfig6(obj){
  116. obj.find('[data-js="color"]').colorpicker({showOn: 'both'});
  117. var id=obj.attr('data-id')
  118. obj.find('[data-js="goods_class"]').attr('id','goods_class_'+id)
  119. var gc_id=parseInt(obj.find('*[data-input]').val())
  120. if(gc_id){
  121. getGoodsClass(gc_id,'goods_class_'+id)
  122. }else{
  123. loadGoodsClass(1,0,'goods_class_'+id)
  124. }
  125. var i=0
  126. obj.find('[data-select="goods"]').each(function(){
  127. $(this).attr('id','select_goods_'+i+'_'+id)
  128. i++
  129. })
  130. obj.find('*[data-select="goods"]').click(function(){
  131. var goods_id=''
  132. $(this).parent().find('*[data-content="goods_ids"] input').each(function(){
  133. goods_id+='&goods_id['+$(this).attr('data-goods')+'][sort]='+$(this).val()
  134. })
  135. dsLayerOpen('{:url(request()->controller()."/search_goods")}?id='+$(this).attr('id')+goods_id,'选择商品')
  136. })
  137. obj.find('.onoff').each(function(){
  138. $(this).find(".cb-enable").click(function() {
  139. var parent = $(this).parents('.onoff');
  140. $('.cb-disable', parent).removeClass('selected');
  141. $(this).addClass('selected');
  142. $('.checkbox', parent).prop('checked', true);
  143. });
  144. $(this).find(".cb-disable").click(function() {
  145. var parent = $(this).parents('.onoff');
  146. $('.cb-enable', parent).removeClass('selected');
  147. $(this).addClass('selected');
  148. $('.checkbox', parent).prop('checked', false);
  149. });
  150. })
  151. }
  152. }
  153. if(typeof(saveGoods)=='undefined'){
  154. function saveGoods(html,id,count){
  155. $('#'+id).parent().find('[data-content="goods_ids"]').html(html)
  156. $('#'+id).parent().find('[data-count]').text(count?('已选择'+count+'个'):'请选择')
  157. $('#'+id).parents('form').change()
  158. }
  159. }
  160. </script>