lottery.html 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264
  1. <extend name="Public:base" />
  2. <block name="content">
  3. <div class="page-header">
  4. <h1>
  5. {$breadcrumb2}
  6. </h1>
  7. </div>
  8. <ul class="nav nav-tabs">
  9. <li class="active"><a href="#tab-member" data-toggle="tab">申请抽奖活动</a></li>
  10. </ul>
  11. <div class="tab-content">
  12. <div class="tab-pane active" id="tab-member">
  13. <h3 style="font-weight:bold;">第一步:选择退款时赠送的优惠券(注意均是平台券)</h3>
  14. <table class="table table-binfoed">
  15. <?php foreach($voucher_list as $voucher){ ?>
  16. <tr>
  17. <td>
  18. <label>
  19. <input type="radio" name="voucher_id" value="<?php echo $voucher['id']; ?>" />
  20. 优惠券:&nbsp;<?php echo $voucher['voucher_title'] ?>
  21. </label>
  22. </td>
  23. <td>
  24. 剩余数量:&nbsp;
  25. <?php echo $voucher['total_count']-$voucher['send_count']; ?>
  26. </td>
  27. </tr>
  28. <?php } ?>
  29. <tr>
  30. <td>中奖人数:&nbsp;<input type="text" name="win_quantity" value="" /></td>
  31. <td>
  32. 真实中奖人数:&nbsp;
  33. <input type="text" name="real_win_quantity" value="" />
  34. </td>
  35. <td>
  36. 是否自动开奖:&nbsp;
  37. <label><input type="radio" name="is_auto_open" value="1" />是</label>
  38. <label><input type="radio" checked name="is_auto_open" value="0" />否</label>
  39. </td>
  40. </tr>
  41. <tr>
  42. <td>开始时间:&nbsp;
  43. <input type="text" name="date_added_begin" value="" id="begin_time" class="datetimepicker data_input">
  44. </td>
  45. <td>
  46. 结束时间:&nbsp;
  47. <input type="text" name="date_added_end" value="" id="end_time" class="datetimepicker data_input">
  48. </td>
  49. </tr>
  50. </table>
  51. </div>
  52. <div class="row">
  53. <div class="col-xs-12">
  54. <div class="panel panel-info">
  55. <div class="panel-heading">添加活动商品</div>
  56. <div class="panel-body">
  57. <div class="col-xs-12 search-row">
  58. <div class="col-sm-4">
  59. <span class="form-label">商品名称:</span>
  60. <input type="text" id="goods_name" name="goods_name" value="">
  61. </div>
  62. <div class="col-sm-4">
  63. <button name="subtype" id="search" value="search" class="btn btn-white btn-search"> <i class="icon-search"></i> 检 索 </button>
  64. <button name="subtype" id="baom" value="search" class="btn btn-white btn-search">
  65. <i class="icon-ok"></i> 报名 </button>
  66. </div>
  67. </div>
  68. <div class="col-xs-12 search-row">
  69. <div class="tags" style="border:none;width:100%;">
  70. </div>
  71. </div>
  72. </div>
  73. </div>
  74. </div>
  75. <div class="col-xs-12" id="goods_result">
  76. </div>
  77. </div>
  78. </div>
  79. </block>
  80. <block name="javascript">
  81. <script src="__PUBLIC__/fileupload/jquery.ui.widget.js"></script>
  82. <script src="__PUBLIC__/fileupload/jquery.fileupload.js"></script>
  83. <script src="__PUBLIC__/js/moment/moment.js"></script>
  84. <script src="__PUBLIC__/js/moment/locale/zh-cn.js"></script>
  85. <script src="__PUBLIC__/js/eonasdan-bootstrap-datetimepicker/src/js/bootstrap-datetimepicker.js"></script>
  86. <link rel="stylesheet" href="__PUBLIC__/js/bootstrap-timepicker/css/bootstrap-timepicker.css" />
  87. <script>
  88. var sub_url ="{:U('Lottery/sub_lottery', array('id' => $subject['id']))}";
  89. $(function(){
  90. $('#begin_time').datetimepicker({
  91. format: 'YYYY-MM-DD H:mm:ss',//use this option to display seconds
  92. icons: {
  93. time: 'btn btn-lg icon-time',
  94. date: 'btn btn-lg icon-calendar',
  95. up: 'fa icon-chevron-up',
  96. down: 'fa icon-chevron-down',
  97. previous: 'fa icon-chevron-left',
  98. next: 'fa icon-chevron-right',
  99. today: 'fa icon-arrows ',
  100. clear: 'fa icon-trash',
  101. close: 'fa icon-times'
  102. }
  103. }).next().on(ace.click_event, function(){
  104. $(this).prev().focus();
  105. });
  106. $('#end_time').datetimepicker({
  107. format: 'YYYY-MM-DD H:mm:ss',//use this option to display seconds
  108. icons: {
  109. time: 'btn btn-lg icon-time',
  110. date: 'btn btn-lg icon-calendar',
  111. up: 'fa icon-chevron-up',
  112. down: 'fa icon-chevron-down',
  113. previous: 'fa icon-chevron-left',
  114. next: 'fa icon-chevron-right',
  115. today: 'fa icon-arrows ',
  116. clear: 'fa icon-trash',
  117. close: 'fa icon-times'
  118. }
  119. }).next().on(ace.click_event, function(){
  120. $(this).prev().focus();
  121. });
  122. $('#search').click(function(){
  123. var goods_name = $('#goods_name').val();
  124. $.ajax({
  125. url:"{:U('Goods/goods_search')}",
  126. type:'post',
  127. data:{goods_name:goods_name},
  128. dataType:'json',
  129. success:function(ret){
  130. $('#goods_result').html(ret.html);
  131. }
  132. })
  133. });
  134. $('#baom').click(function(){
  135. var arr = new Array();
  136. $('.tag').each(function(){
  137. arr.push($(this).attr('rel_goods_id'));
  138. })
  139. if(arr.length == 0)
  140. {
  141. alert('请选择需要参加活动的商品');
  142. return false;
  143. }
  144. if($('input[name="voucher_id"]:checked').length == 0)
  145. {
  146. alert('请选择退款时赠送的优惠券');
  147. return false;
  148. }
  149. var voucher_id = $('input[name="voucher_id"]:checked').val();
  150. var win_quantity = $('input[name="win_quantity"]').val();
  151. var real_win_quantity = $('input[name="real_win_quantity"]').val();
  152. var begin_time = $('#begin_time').val();
  153. var end_time = $('#end_time').val();
  154. if(win_quantity == '')
  155. {
  156. alert('请填写中奖人数');
  157. return false;
  158. }
  159. if(real_win_quantity == '')
  160. {
  161. alert('请填写真实中奖人数');
  162. return false;
  163. }
  164. if(begin_time == '')
  165. {
  166. alert('请填写活动开始时间');
  167. return false;
  168. }
  169. if(end_time == '')
  170. {
  171. alert('请填写活动结束时间');
  172. return false;
  173. }
  174. var is_auto_open = $('input[name="is_auto_open"]:checked').val();
  175. var data_obj = {};
  176. data_obj.goods_ids_arr = arr;
  177. data_obj.voucher_id = voucher_id;
  178. data_obj.win_quantity = win_quantity;
  179. data_obj.real_win_quantity = real_win_quantity;
  180. data_obj.is_auto_open = is_auto_open;
  181. data_obj.begin_time = begin_time;
  182. data_obj.end_time = end_time;
  183. $.ajax({
  184. url:sub_url,
  185. type:'post',
  186. data:data_obj,
  187. dataType:'json',
  188. success:function(ret){
  189. if(ret.code == 1)
  190. {
  191. alert('报名成功');
  192. location.href = location.href;
  193. return false;
  194. } else {
  195. alert(ret.msg);
  196. return false;
  197. }
  198. }
  199. })
  200. })
  201. $('.close').live('click',function(){
  202. $(this).parent().remove();
  203. })
  204. $('.cgoods_id').live('click',function(){
  205. var rel_id = $(this).val();
  206. var goods_name = $(this).attr('rel_name');
  207. if($(this).is(':checked')) {
  208. if($('.tag'+rel_id).length ==0)
  209. {
  210. var rel_html = '<span class="tag tag'+rel_id+'" rel_goods_id="'+rel_id+'">'+goods_name+'<button type="button" class="close">×</button></span>';
  211. $('.tags').append(rel_html);
  212. }
  213. }else {
  214. $('.tag'+rel_id).remove();
  215. }
  216. })
  217. })
  218. </script>
  219. <script>
  220. $(function(){
  221. <present name="Think.get.id">
  222. Oscshop.setValue("a_status", {$data.a_status|default=1});
  223. </present>
  224. });
  225. </script>
  226. </block>