截流自动化的商城平台
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

detail.html 15KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330
  1. {layout name="layout2" /}
  2. <style>
  3. .layui-form-label {
  4. color: #6a6f6c;
  5. width: 100px;
  6. }
  7. .layui-input-block {
  8. margin-left: 130px;
  9. }
  10. .tips{
  11. color: red;
  12. }
  13. .unit-tips{
  14. float: left;
  15. display: block;
  16. padding: 9px 0!important;
  17. line-height: 20px;
  18. margin-right: 10px;
  19. }
  20. .goods{
  21. display: none;
  22. }
  23. </style>
  24. <div class="layui-form" lay-filter="layuiadmin-form-coupon" id="layuiadmin-form-coupon" style="padding: 20px 30px 0 0;">
  25. <input type="hidden" name="id">
  26. <!-- 优惠券名称-->
  27. <div class="layui-form-item">
  28. <label class="layui-form-label"><span class="tips">*</span>优惠券名称:</label>
  29. <div class="layui-input-inline">
  30. <input type="text" name="name" lay-verify="required" lay-verType="tips" placeholder="请输入优惠券名称" autocomplete="off" class="layui-input" disabled>
  31. </div>
  32. </div>
  33. <!-- 发放时间-->
  34. <div class="layui-form-item">
  35. <label class="layui-form-label"><span class="tips">*</span>发放时间:</label>
  36. <div class="layui-input-inline">
  37. <input type="text" name="send_time_start" class="layui-input time" autocomplete="off" disabled>
  38. </div>
  39. <div class="unit-tips">至</div>
  40. <div class="layui-input-inline">
  41. <input type="text" name="send_time_end" class="layui-input time" autocomplete="off" disabled>
  42. </div>
  43. </div>
  44. <div class="layui-form-item">
  45. <label class="layui-form-label"></label><span style="color: #a3a3a3;font-size: 9px">优惠券开始发放和结束发放的时间</span>
  46. </div>
  47. <!-- 优惠券面额-->
  48. <div class="layui-form-item">
  49. <label class="layui-form-label"><span class="tips">*</span>优惠券面额:</label>
  50. <div class="layui-input-inline">
  51. <input type="text" lay-verify="required" lay-verType="tips" name="money" placeholder="请输入优惠券面额" class="layui-input" disabled>
  52. </div>
  53. <div class="layui-form-mid layui-word-aux">元</div>
  54. </div>
  55. <div class="layui-form-item">
  56. <label class="layui-form-label"></label><span
  57. style="color: #a3a3a3;font-size: 9px">面额需大于0元,支持两位小数</span>
  58. </div>
  59. <!-- 发放总量-->
  60. <div class="layui-form-item">
  61. <label class="layui-form-label"><span class="tips">*</span>发放总量:</label>
  62. <div class="layui-input-inline">
  63. <input type="radio" name="send_total_type" value="1" title="不限制数量" disabled>
  64. </div>
  65. <div class="layui-form-item">
  66. <label class="layui-form-label"></label>
  67. <div class="layui-input-inline" style="margin-right: 0px;width:auto">
  68. <input type="radio" name="send_total_type" value="2" title="发放" disabled>
  69. </div>
  70. <div class="layui-input-inline" style="width: 110px">
  71. <input type="number" name="send_total" class="layui-input" disabled>
  72. </div>
  73. <div class="unit-tips">张</div>
  74. </div>
  75. </div>
  76. <!-- 使用门槛-->
  77. <div class="layui-form-item">
  78. <label class="layui-form-label"><span class="tips">*</span>使用门槛:</label>
  79. <div class="layui-input-inline">
  80. <input type="radio" name="condition_type" value="1" title="无使用门槛" disabled >
  81. </div>
  82. <div class="layui-form-item">
  83. <label class="layui-form-label"></label>
  84. <div class="layui-input-inline" style="margin-right: 0px;width: auto">
  85. <input type="radio" name="condition_type" value="2" title="订单满" disabled>
  86. </div>
  87. <div class="layui-input-inline" style="width: 110px">
  88. <input type="number" name="condition_money" class="layui-input" disabled>
  89. </div>
  90. <div class="unit-tips">元可用</div>
  91. </div>
  92. </div>
  93. <!-- 用券时间-->
  94. <div class="layui-form-item">
  95. <label class="layui-form-label"><span class="tips">*</span>用券时间:</label>
  96. <div class="layui-input-inline" style="margin-right: 0px;width: auto">
  97. <input type="radio" name="use_time_type" value="1" title="固定时间" disabled >
  98. </div>
  99. <div class="layui-input-inline">
  100. <input type="text" name="use_time_start" class="layui-input time" disabled>
  101. </div>
  102. <div class="unit-tips">至</div>
  103. <div class="layui-input-inline">
  104. <input type="text" name="use_time_end" class="layui-input time" disabled>
  105. </div>
  106. <div class="unit-tips">可用</div>
  107. <div class="layui-form-item" style="padding-top: 10px">
  108. <label class="layui-form-label"></label>
  109. <div class="layui-input-inline" style="margin-right: 0px;width: auto">
  110. <input type="radio" name="use_time_type" value="2" title="领券当日起" disabled>
  111. </div>
  112. <div class="layui-input-inline" style="width: 110px">
  113. <input type="number" name="use_time" class="layui-input" disabled>
  114. </div>
  115. <div class="unit-tips">天内可用</div>
  116. </div>
  117. <div class="layui-form-item">
  118. <label class="layui-form-label"></label>
  119. <div class="layui-input-inline" style="margin-right: 0px;width: auto">
  120. <input type="radio" name="use_time_type" value="3" title="领券次日起" disabled>
  121. </div>
  122. <div class="layui-input-inline" style="width: 110px">
  123. <input type="number" name="tomorrow_use_time" class="layui-input" disabled>
  124. </div>
  125. <div class="unit-tips">天内可用</div>
  126. </div>
  127. </div>
  128. <!-- 领取方式-->
  129. <div class="layui-form-item">
  130. <label class="layui-form-label"><span class="tips">*</span>领取方式:</label>
  131. <div class="layui-input-inline" >
  132. <input type="radio" name="get_type" value="1" title="直接领取" disabled >
  133. <div style="color: #a3a3a3;font-size: 9px;">用户可在首页、每日领券直接领取</div>
  134. </div>
  135. <div class="layui-input-inline">
  136. <input type="radio" name="get_type" value="2" title="商家赠送" disabled>
  137. <div style="color: #a3a3a3;font-size: 9px;">通过商家后台指定赠送优惠券</div>
  138. </div>
  139. </div>
  140. <!-- 领取次数-->
  141. <div class="layui-form-item">
  142. <label class="layui-form-label"><span class="tips">*</span>领取次数:</label>
  143. <div class="layui-input-inline">
  144. <input type="radio" name="get_num_type" value="1" title="不限制领取次数" disabled >
  145. </div>
  146. <div class="layui-form-item" style="padding-top: 10px">
  147. <label class="layui-form-label"></label>
  148. <div class="layui-input-inline" style="margin-right: 0px;width: auto">
  149. <input type="radio" name="get_num_type" value="2" title="限制领取" disabled>
  150. </div>
  151. <div class="layui-input-inline" style="width: 110px">
  152. <input type="number" name="get_num" class="layui-input" disabled>
  153. </div>
  154. <div class="unit-tips">次</div>
  155. </div>
  156. <div class="layui-form-item">
  157. <label class="layui-form-label"></label>
  158. <div class="layui-input-inline" style="margin-right: 0px;width: auto">
  159. <input type="radio" name="get_num_type" value="3" title="每天限制领取" disabled>
  160. </div>
  161. <div class="layui-input-inline" style="width: 110px">
  162. <input type="number"name="day_get_num" class="layui-input" disabled>
  163. </div>
  164. <div class="unit-tips">次</div>
  165. </div>
  166. </div>
  167. <!-- 使用场景 -->
  168. <div class="layui-form-item">
  169. <label class="layui-form-label"><span class="tips">*</span>使用场景:</label>
  170. <div class="layui-input-block">
  171. <input type="radio" name="use_goods_type" lay-filter="use_goods_type" value="1" title="全部商品可用" checked disabled>
  172. <input type="radio" name="use_goods_type" lay-filter="use_goods_type" value="2" title="指定商品可用" disabled>
  173. <input type="radio" name="use_goods_type" lay-filter="use_goods_type" value="3" title="指定商品不可用" disabled>
  174. </div>
  175. </div>
  176. <div class="layui-form-item goods">
  177. <label class="layui-form-label"></label>
  178. <div class="layui-input-block ">
  179. <table id="goods_list" class="layui-table" lay-size="sm">
  180. <colgroup>
  181. <col width="60px">
  182. </colgroup>
  183. <thead>
  184. <tr style="background-color: #f3f5f9">
  185. <th style="width: 120px;text-align: center">商品信息</th>
  186. <th style="width: 80px;text-align: center">价格</th>
  187. <th style="width: 120px;text-align: center">库存</th>
  188. </tr>
  189. </thead>
  190. <tbody>
  191. </tbody>
  192. </table>
  193. </div>
  194. </div>
  195. <!-- 上架状态 -->
  196. <div class="layui-form-item">
  197. <label class="layui-form-label"><span class="tips">*</span>上架状态:</label>
  198. <div class="layui-input-inline" >
  199. <input type="radio" name="status" value="1" title="立即上架" disabled>
  200. </div>
  201. <div class="layui-input-inline" >
  202. <input type="radio" name="status" value="0" title="暂不上架" disabled>
  203. </div>
  204. </div>
  205. <div class="layui-form-item layui-hide">
  206. <input type="button" lay-submit lay-filter="edit-coupon-submit" id="edit-coupon-submit" value="确认">
  207. </div>
  208. </div>
  209. <script>
  210. var goods_ids = [];
  211. layui.config({
  212. version:"{$front_version}",
  213. base: '/static/plug/layui-admin/dist/layuiadmin/' //静态资源所在路径
  214. }).extend({
  215. index: 'lib/index' //主入口模块
  216. }).use(['index', 'form','laydate'], function(){
  217. var $ = layui.$
  218. ,form = layui.form
  219. ,laydate = layui.laydate;
  220. lay('.time').each(function() {
  221. laydate.render({
  222. elem : this,
  223. type:'datetime',
  224. trigger : 'click'
  225. });
  226. form.on('radio(use_goods_type)', function (data) {
  227. var value = data.value;
  228. $('.goods').hide();
  229. if(value != 1){
  230. layer.open({
  231. type: 2
  232. ,title: '选择商品'
  233. ,content: '{:url("coupon/selectGoods")}'
  234. ,area: ['90%', '90%']
  235. ,btn: ['确认', '取消']
  236. ,yes: function(index, layero){
  237. var data = window["layui-layer-iframe" + index].callbackdata();
  238. data.forEach(function(item,index,arr) {
  239. if(goods_ids.indexOf(item.id) == -1) {
  240. goods_ids.push(item.id);
  241. var goods_html = ' <tr>\n' +
  242. ' <td style="text-align: center">'+item.name+'</td>\n' +
  243. ' <td style="text-align: center">'+item.price+'</td>\n' +
  244. ' <td style="text-align: center">'+item.stock+'</td>\n' +
  245. ' </tr>';
  246. $('#goods_list').append(goods_html);
  247. }
  248. })
  249. $('.goods').show();
  250. }
  251. })
  252. }
  253. })
  254. //删除商品
  255. $(document).on('click','.layui-btn-danger',function () {
  256. var id = parseInt($(this).attr('data-id'));
  257. goods_ids.splice(goods_ids.indexOf(id),1);
  258. $(this).parent().parent().remove();
  259. })
  260. });
  261. {notempty name='detail'}
  262. var detail= {$detail|raw|default=''};
  263. $('input[name="id"]').val(detail['id']);
  264. $('input[name="name"]').val(detail['name']);
  265. $('input[name="send_time_start"]').val(detail['send_time_start']);
  266. $('input[name="send_time_end"]').val(detail['send_time_end']);
  267. $('input[name="money"]').val(detail['money']);
  268. $("input[name=send_total_type][value="+detail['send_total_type']+"]").prop('checked',"true");
  269. $("input[name=condition_type][value="+detail['condition_type']+"]").prop('checked',"true");
  270. $("input[name=use_time_type][value="+detail['use_time_type']+"]").prop('checked',"true");
  271. $("input[name=get_type][value="+detail['get_type']+"]").prop('checked',"true");
  272. $("input[name=get_num_type][value="+detail['get_num_type']+"]").prop('checked',"true");
  273. $("input[name=use_goods_type][value="+detail['use_goods_type']+"]").prop('checked',"true");
  274. $("input[name=status][value="+detail['status']+"]").prop('checked',"true");
  275. form.render();
  276. if(detail['send_total_type'] == 2){
  277. $('input[name="send_total"]').val(detail['send_total']);
  278. }
  279. if(detail['condition_type'] == 2){
  280. $('input[name="condition_money"]').val(detail['condition_money']);
  281. }
  282. if(detail['use_time_type'] == 1){
  283. $('input[name="use_time_start"]').val(detail['use_time_start']);
  284. $('input[name="use_time_end"]').val(detail['use_time_end']);
  285. }
  286. if(detail['use_time_type'] == 2){
  287. var radio = $("input[name=use_time_type][value="+detail['use_time_type']+"]");
  288. radio.parent().next().children('input[name="use_time"]').val(detail['use_time']);
  289. }
  290. if(detail['use_time_type'] == 3 ){
  291. var radio = $("input[name=use_time_type][value="+detail['use_time_type']+"]");
  292. radio.parent().next().children('input[name="tomorrow_use_time"]').val(detail['use_time']);
  293. }
  294. if(detail['get_num_type'] == 2){
  295. var radio = $("input[name=get_num_type][value="+detail['get_num_type']+"]");
  296. radio.parent().next().children('input[name="get_num"]').val(detail['get_num']);
  297. }
  298. if(detail['get_num_type'] == 3){
  299. var radio = $("input[name=get_num_type][value="+detail['get_num_type']+"]");
  300. radio.parent().next().children('input[name="day_get_num"]').val(detail['get_num']);
  301. }
  302. if(detail['goods_coupon'].length){
  303. $('.goods').show();
  304. detail['goods_coupon'].forEach(function(item,index,arr) {
  305. goods_ids.push(item.id);
  306. var goods_html = ' <tr>\n' +
  307. ' <td style="text-align: center">'+item.name+'</td>\n' +
  308. ' <td style="text-align: center">'+item.price+'</td>\n' +
  309. ' <td style="text-align: center">'+item.stock+'</td>\n' +
  310. ' </tr>';
  311. $('#goods_list').append(goods_html);
  312. })
  313. }
  314. {/notempty}
  315. });
  316. </script>