take_subject.html 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  1. <extend name="Public:base" />
  2. <block name="content">
  3. <div class="page-header">
  4. <h1>
  5. {$breadcrumb2}
  6. </h1>
  7. </div>
  8. <div class="row">
  9. <div class="alert alert-info">
  10. <i class="icon-hand-right"></i>
  11. 平台添加的商品将直接参与活动,无须审核
  12. </button>
  13. </div>
  14. </div>
  15. <ul class="nav nav-tabs">
  16. <li class="active"><a href="#tab-member" data-toggle="tab">申请活动</a></li>
  17. </ul>
  18. <div class="tab-content">
  19. <div class="tab-pane active" id="tab-member">
  20. <h3 style="font-weight:bold;">活动信息</h3>
  21. <table class="table table-binfoed">
  22. <tr>
  23. <td>活动名称:&nbsp;{$subject.name}</td>
  24. <td>
  25. 活动类型:&nbsp;
  26. <?php
  27. switch($subject['type'])
  28. {
  29. case 'normal':echo '常规活动';break;
  30. case 'zeyuan':echo '0元试用';break;
  31. case 'niyuan':echo '9.9元活动';break;
  32. case 'oneyuan':echo '1元购物活动';break;
  33. }
  34. ?>
  35. </td>
  36. </tr>
  37. <tr>
  38. <td>开始时间:&nbsp;<?php echo date('Y-m-d H:i:s', $subject['begin_time']); ?></td>
  39. <td>
  40. 结束时间:&nbsp;
  41. <?php echo date('Y-m-d H:i:s', $subject['end_time']); ?>
  42. </td>
  43. <td>
  44. 限定价格:&nbsp;
  45. <?php
  46. if($subject['price'] == -1)
  47. {
  48. echo '不限制';
  49. } else {
  50. echo $subject['price'].'元';
  51. }
  52. ?>
  53. </td>
  54. </tr>
  55. </table>
  56. </div>
  57. <div class="row">
  58. <div class="col-xs-12">
  59. <div class="panel panel-info">
  60. <div class="panel-heading">添加活动商品</div>
  61. <div class="panel-body">
  62. <div class="col-xs-12 search-row">
  63. <div class="col-sm-4">
  64. <span class="form-label">商品名称:</span>
  65. <input type="text" id="goods_name" name="goods_name" value="">
  66. </div>
  67. <div class="col-sm-4">
  68. <button name="subtype" id="search" value="search" class="btn btn-white btn-search"> <i class="icon-search"></i> 检 索 </button>
  69. <button name="subtype" id="baom" value="search" class="btn btn-white btn-search">
  70. <i class="icon-ok"></i> 报名 </button>
  71. </div>
  72. </div>
  73. <div class="col-xs-12 search-row">
  74. <div class="tags" style="border:none;width:100%;">
  75. </div>
  76. </div>
  77. </div>
  78. </div>
  79. </div>
  80. <div class="col-xs-12" id="goods_result">
  81. </div>
  82. </div>
  83. </div>
  84. </block>
  85. <block name="javascript">
  86. <script src="__PUBLIC__/fileupload/jquery.ui.widget.js"></script>
  87. <script src="__PUBLIC__/fileupload/jquery.fileupload.js"></script>
  88. <script>
  89. var sub_url ="{:U('Subject/sub_subject', array('id' => $subject['id']))}";
  90. $(function(){
  91. $('#search').click(function(){
  92. var goods_name = $('#goods_name').val();
  93. $.ajax({
  94. url:"{:U('Goods/goods_search')}",
  95. type:'post',
  96. data:{goods_name:goods_name},
  97. dataType:'json',
  98. success:function(ret){
  99. $('#goods_result').html(ret.html);
  100. }
  101. })
  102. });
  103. $('#baom').click(function(){
  104. var arr = new Array();
  105. $('.tag').each(function(){
  106. arr.push($(this).attr('rel_goods_id'));
  107. })
  108. if(arr.length == 0)
  109. {
  110. alert('请选择需要参加活动的商品');
  111. return false;
  112. }
  113. var data_obj = {};
  114. data_obj.goods_ids_arr = arr;
  115. $.ajax({
  116. url:sub_url,
  117. type:'post',
  118. data:data_obj,
  119. dataType:'json',
  120. success:function(ret){
  121. if(ret.code == 1)
  122. {
  123. alert('报名成功');
  124. location.href = location.href;
  125. return false;
  126. } else {
  127. alert(ret.msg);
  128. return false;
  129. }
  130. }
  131. })
  132. })
  133. $('.close').live('click',function(){
  134. $(this).parent().remove();
  135. })
  136. $('.cgoods_id').live('click',function(){
  137. var rel_id = $(this).val();
  138. var goods_name = $(this).attr('rel_name');
  139. if($(this).is(':checked')) {
  140. if($('.tag'+rel_id).length ==0)
  141. {
  142. var rel_html = '<span class="tag tag'+rel_id+'" rel_goods_id="'+rel_id+'">'+goods_name+'<button type="button" class="close">×</button></span>';
  143. $('.tags').append(rel_html);
  144. }
  145. }else {
  146. $('.tag'+rel_id).remove();
  147. }
  148. })
  149. })
  150. </script>
  151. <script>
  152. $(function(){
  153. <present name="Think.get.id">
  154. Oscshop.setValue("a_status", {$data.a_status|default=1});
  155. </present>
  156. });
  157. </script>
  158. </block>