take_spike.html 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  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. <tr>
  16. <td>活动名称:&nbsp;{$subject.name}</td>
  17. </tr>
  18. <tr>
  19. <td>开始时间:&nbsp;<?php echo date('Y-m-d H:i:s', $subject['begin_time']); ?></td>
  20. <td>
  21. 结束时间:&nbsp;
  22. <?php echo date('Y-m-d H:i:s', $subject['end_time']); ?>
  23. </td>
  24. </tr>
  25. </table>
  26. </div>
  27. <div class="row">
  28. <div class="col-xs-12">
  29. <div class="panel panel-info">
  30. <div class="panel-heading">添加活动商品</div>
  31. <div class="panel-body">
  32. <div class="col-xs-12 search-row">
  33. <div class="col-sm-4">
  34. <span class="form-label">商品名称:</span>
  35. <input type="text" id="goods_name" name="goods_name" value="">
  36. </div>
  37. <div class="col-sm-4">
  38. <button name="subtype" id="search" value="search" class="btn btn-white btn-search"> <i class="icon-search"></i> 检 索 </button>
  39. <button name="subtype" id="baom" value="search" class="btn btn-white btn-search">
  40. <i class="icon-ok"></i> 报名 </button>
  41. </div>
  42. </div>
  43. <div class="col-xs-12 search-row">
  44. <div class="tags" style="border:none;width:100%;">
  45. </div>
  46. </div>
  47. </div>
  48. </div>
  49. </div>
  50. <div class="col-xs-12" id="goods_result">
  51. </div>
  52. </div>
  53. </div>
  54. </block>
  55. <block name="javascript">
  56. <script src="__PUBLIC__/fileupload/jquery.ui.widget.js"></script>
  57. <script src="__PUBLIC__/fileupload/jquery.fileupload.js"></script>
  58. <script>
  59. var sub_url ="{:U('Spike/sub_spike', array('id' => $subject['id']))}";
  60. $(function(){
  61. $('#search').click(function(){
  62. var goods_name = $('#goods_name').val();
  63. $.ajax({
  64. url:"{:U('Goods/goods_search')}",
  65. type:'post',
  66. data:{goods_name:goods_name},
  67. dataType:'json',
  68. success:function(ret){
  69. $('#goods_result').html(ret.html);
  70. }
  71. })
  72. });
  73. $('#baom').click(function(){
  74. var arr = new Array();
  75. $('.tag').each(function(){
  76. arr.push($(this).attr('rel_goods_id'));
  77. })
  78. if(arr.length == 0)
  79. {
  80. alert('请选择需要参加活动的商品');
  81. return false;
  82. }
  83. var data_obj = {};
  84. data_obj.goods_ids_arr = arr;
  85. $.ajax({
  86. url:sub_url,
  87. type:'post',
  88. data:data_obj,
  89. dataType:'json',
  90. success:function(ret){
  91. if(ret.code == 1)
  92. {
  93. alert('报名成功');
  94. location.href = location.href;
  95. return false;
  96. } else {
  97. alert(ret.msg);
  98. return false;
  99. }
  100. }
  101. })
  102. })
  103. $('.close').live('click',function(){
  104. $(this).parent().remove();
  105. })
  106. $('.cgoods_id').live('click',function(){
  107. var rel_id = $(this).val();
  108. var goods_name = $(this).attr('rel_name');
  109. if($(this).is(':checked')) {
  110. if($('.tag'+rel_id).length ==0)
  111. {
  112. var rel_html = '<span class="tag tag'+rel_id+'" rel_goods_id="'+rel_id+'">'+goods_name+'<button type="button" class="close">×</button></span>';
  113. $('.tags').append(rel_html);
  114. }
  115. }else {
  116. $('.tag'+rel_id).remove();
  117. }
  118. })
  119. })
  120. </script>
  121. <script>
  122. $(function(){
  123. <present name="Think.get.id">
  124. Oscshop.setValue("a_status", {$data.a_status|default=1});
  125. </present>
  126. });
  127. </script>
  128. </block>