activity.html 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282
  1. <extend name="Public:base" />
  2. <block name="content">
  3. <div class="page-header">
  4. </div>
  5. <table class="table table-striped table-bordered table-hover search-form">
  6. <thead>
  7. <th><input name="name" type="text" placeholder="输入商品名称" value="{:I('name')}" /></th>
  8. <th>
  9. <select name="store_id">
  10. <option value="">-选择商家-</option>
  11. <volist name="seller_list" id="v" >
  12. <option <?php if(isset($get_store)&&($get_store==$v['s_id'])){echo ' selected="selected"';} ?> value="{$v.s_id}">{$v.s_true_name}</option>
  13. </volist>
  14. </select>
  15. </th>
  16. <th>
  17. <select name="category">
  18. <option value="">-选择分类-</option>
  19. <volist name="category" id="v" >
  20. <option <?php if(isset($get_category)&&($get_category==$v['id'])){echo ' selected="selected"';} ?> value="{$v.id}">{$v.name}</option>
  21. <volist name="v.children" id="vv" >
  22. <option <?php if(isset($get_category)&&($get_category==$vv['id'])){echo ' selected="selected"';} ?> value="{$vv.id}">  {$vv.name}</option>
  23. <volist name="vv.children" id="vvv" >
  24. <option <?php if(isset($get_category)&&($get_category==$vvv['id'])){echo ' selected="selected"';} ?> value="{$vvv.id}">    {$vvv.name}</option>
  25. </volist>
  26. </volist>
  27. </volist>
  28. </select>
  29. </th>
  30. <th>
  31. <select name="type">
  32. <option value="activity">-全部活动类型-</option>
  33. <option <?php if(isset($type)&&($type=='pintuan')){echo ' selected="selected"';} ?> value="pintuan">拼团活动</option>
  34. <option <?php if(isset($type)&&($type=='lottery')){echo ' selected="selected"';} ?> value="lottery">抽奖</option>
  35. <option <?php if(isset($type)&&($type=='subject')){echo ' selected="selected"';} ?> value="subject">主题活动</option>
  36. <option <?php if(isset($type)&&($type=='spike')){echo ' selected="selected"';} ?> value="spike">限时秒杀</option>
  37. </select>
  38. </th>
  39. <th>
  40. <select name="status">
  41. <option value="">-选择状态-</option>
  42. <option <?php if(isset($get_status)&&($get_status==1)){echo ' selected="selected"';} ?> value="1">启用</option>
  43. <option <?php if(isset($get_status)&&($get_status==0)){echo ' selected="selected"';} ?> value="0">停用</option>
  44. </select>
  45. </th>
  46. <th>
  47. <a class="btn btn-primary" href="javascript:;" id="search" url="{:U('Goods/activity')}">查询</a>
  48. </th>
  49. </thead>
  50. </table>
  51. <div class="row">
  52. <div class="alert alert-info" id="alert_info">
  53. <button type="button" class="close" data-dismiss="alert">
  54. <i class="ace-icon fa fa-times"></i>
  55. </button>
  56. <p id="alert_content">
  57. </p>
  58. </div>
  59. </div>
  60. <div class="row">
  61. <div class="col-xs-12">
  62. <div class="table-responsive">
  63. <table id="table" class="table table-striped table-bordered table-hover">
  64. <thead>
  65. <tr>
  66. <th class="center">
  67. <label>
  68. <input type="checkbox" class="ace check-all" />
  69. <span class="lbl"></span>
  70. </label>
  71. </th>
  72. <th>ID</th>
  73. <th>图片</th>
  74. <th>商品名称</th>
  75. <th>分类</th>
  76. <th>首页推荐</th>
  77. <th>首页排序</th>
  78. <th>价格</th>
  79. <th>库存数量</th>
  80. <th>所属商家</th>
  81. <th>状态</th>
  82. <th>操作</th>
  83. </tr>
  84. </thead>
  85. <tbody>
  86. <volist name="list" id="v" empty="$empty">
  87. <tr>
  88. <td class="center">
  89. <label>
  90. <input class="ace ids" type="checkbox" name="id[]" value="{$v.goods_id}"/>
  91. <span class="lbl"></span>
  92. </label>
  93. </td>
  94. <td>{$v.goods_id}</td>
  95. <td>
  96. <?php if($v['image']){ ?>
  97. <img src="__ROOT__/{$v.image}" />
  98. <?php }else{ ?>
  99. <img src="__ROOT__/Common/image/no_image_50x50.jpg" />
  100. <?php } ?>
  101. </td>
  102. <td>{$v.name}</td>
  103. <td>{$v.class_name1}&nbsp;{$v.class_name2}&nbsp;{$v.class_name3}
  104. <br/>
  105. <?php
  106. switch($v['type'])
  107. {
  108. case 'pintuan':
  109. echo '<b class="red">拼团活动</b>';
  110. break;
  111. case 'lottery':
  112. echo '<b class="red">抽奖活动</b>';
  113. break;
  114. case 'subject':
  115. echo '<b class="red">主题活动</b>';
  116. break;
  117. case 'spike':
  118. echo '<b class="red">限时秒杀</b>';
  119. break;
  120. }
  121. ?>
  122. </td>
  123. <td>
  124. <label class="inline">
  125. <input gid="{$v.goods_id}" <?php if($v['is_index_show'] == 1){ ?> checked <?php } ?> type="checkbox" class="id-pills-stacked ace ace-switch ace-switch-5">
  126. <span class="lbl middle"></span>
  127. </label>
  128. </td>
  129. <td>
  130. <input type="text" gid="{$v.goods_id}" name="index_sort" value="{$v.index_sort}" class="index_sort" />
  131. </td>
  132. <td>{$v.price}</td>
  133. <td>{$v.quantity}</td>
  134. <td>
  135. <?php echo $seller_key_list[$v['store_id']]; ?>
  136. </td>
  137. <td>
  138. <switch name="v.status">
  139. <case value="1"><span class="green bold">启用</span></case>
  140. <case value="0"><span class="red">停用</span></case>
  141. </switch>
  142. </td>
  143. <td>
  144. <a class="btn btn-xs btn-info" href='{:U("Goods/edit",array("id"=>$v["goods_id"]))}'>
  145. <i class="icon-edit bigger-120"></i>编辑
  146. </a>
  147. <?php if($v['status'] != 4) { ?>
  148. <a class="btn btn-xs btn-info backhuiche" href="javascript:;" rel='{:U("Goods/backhuiche",array("id"=>$v["goods_id"]))}'>
  149. 删除
  150. </a>
  151. <?php } ?>
  152. </td>
  153. </tr>
  154. </volist>
  155. <tr>
  156. <td colspan="20" class="page">{$page}</td>
  157. </tr>
  158. </tbody>
  159. </table>
  160. </div>
  161. </div>
  162. </div>
  163. </block>
  164. <block name="javascript">
  165. <script>
  166. function alert_show(msg)
  167. {
  168. $('#alert_content').html(msg);
  169. $('#alert_info').show();
  170. setTimeout("$('#alert_info').hide();",2000);
  171. }
  172. $(function(){
  173. $('.backhuiche').click(function(){
  174. var rel_url = $(this).attr('rel');
  175. if(!confirm('确认删除吗?'))
  176. {
  177. return false;
  178. }
  179. $.ajax({
  180. url:rel_url,
  181. type:'get',
  182. dataType:'json',
  183. success:function(ret){
  184. if(ret.code == 1)
  185. {
  186. alert('删除成功,您的商品已下架!');
  187. location.href = location.href;
  188. return false;
  189. } else {
  190. alert(ret.msg);
  191. return false;
  192. }
  193. }
  194. })
  195. })
  196. $('.index_sort').blur(function(){
  197. var gid = $(this).attr('gid');
  198. var index_sort = $(this).val();
  199. $.ajax({
  200. url:"{:U('Goods/toggle_index_sort')}",
  201. type:'post',
  202. data:{gid:gid,index_sort:index_sort},
  203. dataType:'json',
  204. success:function(res){
  205. alert_show('修改排序成功')
  206. }
  207. })
  208. console.log($(this).val());
  209. })
  210. $('.id-pills-stacked').on('click', function(){
  211. var gid = $(this).attr('gid');
  212. $.ajax({
  213. url:"{:U('Goods/toggle_index_show')}",
  214. type:'post',
  215. data:{gid:gid},
  216. dataType:'json',
  217. success:function(res){
  218. //code
  219. }
  220. })
  221. });
  222. $("#search").click(function () {
  223. var url = $(this).attr('url');
  224. var query = $('.search-form').find('input,select').serialize();
  225. query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g, '');
  226. query = query.replace(/^&/g, '');
  227. if (url.indexOf('?') > 0) {
  228. url += '&' + query;
  229. } else {
  230. url += '?' + query;
  231. }
  232. window.location.href = url;
  233. });
  234. $('.copy').click(function(){
  235. $.ajax({
  236. url: "{:U('Goods/copy_goods')}",
  237. type: 'post',
  238. data: $('input:checked'),
  239. dataType: 'json',
  240. beforeSend: function() {
  241. $('.copy').attr('disabled', true);
  242. $('.copy').after('<span class="wait">&nbsp;<img src="__IMG__/loading.gif" alt="" /></span>');
  243. },
  244. complete: function() {
  245. $('.copy').attr('disabled', false);
  246. $('.wait').remove();
  247. },
  248. success: function(json) {
  249. $('.warning, .error').remove();
  250. if (json['redirect']) {
  251. location = json['redirect']
  252. }
  253. },
  254. error: function(xhr, ajaxOptions, thrownError) {
  255. alert('修改失败');
  256. }
  257. });
  258. });
  259. });
  260. </script>
  261. </block>