add.html 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. {extend name="common/common2" /}
  2. {block name="main"}
  3. <div class="row">
  4. <div class="col-sm-12">
  5. <div class="ibox float-e-margins">
  6. <div class="ibox-content">
  7. <form method="post" action="{:url('add')}" class="form-horizontal">
  8. <input type="hidden" name="id" value="{$info['id']|default='0'}">
  9. <div class="form-group">
  10. <label class="col-sm-2 control-label">商品名称<span class="text-danger">*</span></label>
  11. <div class="col-sm-6">
  12. <input type="text" class="form-control" name="title" value="{$info.title|default=''}">
  13. </div>
  14. </div>
  15. <div class="form-group">
  16. <label class="col-sm-2 control-label">商品价格<span class="text-danger">*</span></label>
  17. <div class="col-sm-6">
  18. <input type="number" class="form-control" name="price" value="{$info.price|default=''}">
  19. </div>
  20. </div>
  21. <!--<div class="form-group">-->
  22. <!--<label class="col-sm-2 control-label">库存</label>-->
  23. <!--<div class="col-sm-6">-->
  24. <!--<input type="number" class="form-control" name="stock" value="{$info.stock|default='0'}">-->
  25. <!--</div>-->
  26. <!--</div>-->
  27. <div class="form-group">
  28. <label class="col-sm-2 control-label">商品分类<span class="text-danger">*</span></label>
  29. <div class="col-sm-6">
  30. <select name="cate_id" class="form-control" onchange="setCate(this.value)">
  31. <option value="0">选择商品分类</option>
  32. {volist name='cateList' id='v'}
  33. <option value="{$v.id|default=''}">{$v['title']}</option>
  34. {/volist}
  35. </select>
  36. </div>
  37. </div>
  38. <div class="form-group" id="kt" {if (isset($info) && $info.barrel_id>0) || (isset($cateInfo) && $cateInfo.is_water==1)} style="display:block" {else} style="display:none" {/if}>
  39. <label class="col-sm-2 control-label">空桶<span class="text-danger">*</span></label>
  40. <div class="col-sm-6">
  41. {:widget('common/select',['name'=>'barrel_id','lists'=>$barrel,'value'=>isset($info)?$info.barrel_id:''])}
  42. </div>
  43. </div>
  44. <div class="form-group">
  45. <label class="col-sm-2 control-label">标签</label>
  46. <div class="col-sm-6">
  47. {:widget('common/select',['name'=>'label','lists'=>$label,'value'=>isset($info)?$info.label:''])}
  48. </div>
  49. </div>
  50. <div class="form-group">
  51. <label class="col-sm-2 control-label">商品图片<span class="text-danger">*</span></label>
  52. <div class="col-sm-6">
  53. {:widget_view('common/upimg',['name'=>'img','multi'=>0,'val'=>isset($info)?$info['img']:''])}
  54. </div>
  55. </div>
  56. <div class="form-group">
  57. <label class="col-sm-2 control-label">轮播图<span class="text-danger">*</span></label>
  58. <div class="col-sm-6">
  59. {:widget_view('common/upimg',['name'=>'imgs','multi'=>1,'val'=>isset($info)?$info['imgs']:''])}
  60. </div>
  61. </div>
  62. <div class="form-group">
  63. <label class="col-sm-2 control-label">排序</label>
  64. <div class="col-sm-6">
  65. <input type="number" class="form-control" name="sort" value="{$info.sort|default='0'}">
  66. </div>
  67. </div>
  68. <div class="form-group">
  69. <label class="col-sm-2 control-label">商品描述</label>
  70. <div class="col-sm-6">
  71. <input type="text" class="form-control" name="dec" value="{$info.dec|default=''}">
  72. </div>
  73. </div>
  74. <div class="form-group">
  75. <label class="col-sm-2 control-label">状态</label>
  76. <div class="col-sm-6">
  77. <label class="cr-inline">
  78. <input type="radio" value="1" name="enable">上架&nbsp;&nbsp;
  79. </label>
  80. <label class="cr-inline">
  81. <input type="radio" value="0" name="enable">下架
  82. </label>
  83. </div>
  84. </div>
  85. <div class="form-group">
  86. <label class="col-sm-2 control-label">是否推荐</label>
  87. <div class="col-sm-6">
  88. <label class="cr-inline">
  89. <input type="radio" value="0" name="is_tj">否&nbsp;&nbsp;
  90. </label>
  91. <label class="cr-inline">
  92. <input type="radio" value="1" name="is_tj">是
  93. </label>
  94. </div>
  95. </div>
  96. <div class="form-group">
  97. <label class="col-sm-2 control-label">详情<span class="text-danger">*</span></label>
  98. <div class="col-sm-6">
  99. {:widget_view('common/ueditor',['name'=>'content','height'=>300,'val'=>isset($info)?$info['content']:''])}
  100. </div>
  101. </div>
  102. <div class="hr-line-dashed"></div>
  103. <div class="form-group">
  104. <div class="col-sm-6 col-sm-offset-2">
  105. <button class="btn btn-primary ajax-post" data-layer="1" target-form="form-horizontal" type="submit">确 定</button>
  106. <button class="btn cancel-btn btn-default" type="button">取 消</button>
  107. </div>
  108. </div>
  109. </form>
  110. </div>
  111. </div>
  112. </div>
  113. </div>
  114. {/block}
  115. {block name="script"}
  116. <script>
  117. $(document).ready(function(){
  118. formSetValue("enable", {$info.enable|default=1});
  119. });
  120. $(document).ready(function(){
  121. formSetValue("cate_id", {$info.cate_id|default=0});
  122. });
  123. $(document).ready(function(){
  124. formSetValue("is_tj", {$info.is_tj|default=0});
  125. });
  126. function setCate(value) {
  127. $.post("{:url('WxGoods/checkIsWater')}",{id:value},function (res) {
  128. console.log(res);
  129. if(res.code==1 && res.data.is_water==1){
  130. $("#kt").attr('style','display:block');
  131. }else {
  132. $("#kt").attr('style','display:none');
  133. }
  134. })
  135. }
  136. </script>
  137. {/block}