人人商城

enough.html 4.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. {template '_header'}
  2. <div class='page-heading'><h2>满额立减设置</h2></div>
  3. <form id="dataform" {ifp 'sale.enough'}action="" method="post"{/if} class="form-horizontal form-validate">
  4. <div class="form-group">
  5. <div class="col-sm-12">
  6. {ifp 'sale.enough'}
  7. <div class='input-group'>
  8. <span class="input-group-addon">单笔订单满</span>
  9. <input type="text" name="data[enoughmoney]" value="{$data['enoughmoney']}" class="form-control" />
  10. <span class='input-group-addon'>元 立减</span>
  11. <input type="text" name="data[enoughdeduct]" value="{$data['enoughdeduct']}" class="form-control" />
  12. <span class='input-group-addon'>元</span>
  13. <div class="input-group-btn"><button type='button' class="btn btn-default" ><i class="fa fa-minus"></i></button></div>
  14. </div>
  15. {else}
  16. <div class='form-control-static'>{if empty($data['enoughmoney'])}全场包邮{else}订单金额满{$data['enoughmoney']}元包邮{/if}</div>
  17. {/if}
  18. </div>
  19. </div>
  20. <div class="form-group">
  21. <div class="col-sm-12">
  22. <div class='recharge-items'>
  23. {loop $data['enoughs'] $item}
  24. <div class="input-group recharge-item" style="margin-top:5px">
  25. <span class="input-group-addon">单笔订单满</span>
  26. <input type="text" class="form-control" name='enough[]' value='{$item['enough']}' />
  27. <span class="input-group-addon">元 立减</span>
  28. <input type="text" class="form-control" name='give[]' value='{$item['give']}' />
  29. <span class="input-group-addon">元</span>
  30. <div class='input-group-btn'>
  31. <button class='btn btn-danger' type='button' onclick="removeConsumeItem(this)"><i class='fa fa-remove'></i></button>
  32. </div>
  33. </div>
  34. {/loop}
  35. </div>
  36. <div style="margin-top:5px">
  37. <button type='button' class="btn btn-default" onclick='addConsumeItem()' style="margin-bottom:5px"><i class='fa fa-plus'></i> 增加优惠项</button>
  38. </div>
  39. <span class="help-block">两项都填写才能生效</span>
  40. </div>
  41. </div>
  42. {ifp 'sale.enough'}
  43. <div class="form-group"></div>
  44. <div class="form-group">
  45. <div class="col-sm-9 col-xs-12">
  46. <input type="submit" value="保存设置" class="btn btn-primary"/>
  47. </div>
  48. </div>
  49. {/if}
  50. </form>
  51. <script language='javascript'>
  52. $(function () {
  53. $(":checkbox[name='data[enoughfree]']").click(function () {
  54. if ($(this).prop('checked')) {
  55. $("#enoughfree").show();
  56. }
  57. else {
  58. $("#enoughfree").hide();
  59. }
  60. })
  61. })
  62. function addConsumeItem(){
  63. var html= '<div class="input-group recharge-item" style="margin-top:5px">';
  64. html+='<span class="input-group-addon">单笔订单满</span>';
  65. html+='<input type="text" class="form-control" name="enough[]" />';
  66. html+='<span class="input-group-addon">元 立减</span>';
  67. html+='<input type="text" class="form-control" name="give[]" />';
  68. html+='<span class="input-group-addon">元</span>';
  69. html+='<div class="input-group-btn"><button class="btn btn-danger" onclick="removeConsumeItem(this)"><i class="fa fa-remove"></i></button></div>';
  70. html+='</div>';
  71. $('.recharge-items').append(html);
  72. }
  73. function removeConsumeItem(obj){
  74. $(obj).closest('.recharge-item').remove();
  75. }
  76. </script>
  77. {template '_footer'}