config.html 8.6 KB

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