cmHeheDiscountActivityList.jsp 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. <%@ page contentType="text/html;charset=UTF-8" %>
  2. <%@ include file="/WEB-INF/views/include/taglib.jsp"%>
  3. <html>
  4. <head>
  5. <title>活动管理</title>
  6. <meta name="decorator" content="default"/>
  7. <style type="text/css">
  8. .table th{text-align: center;}
  9. .table td{text-align: center;}
  10. </style>
  11. <script type="text/javascript">
  12. $(document).ready(function() {
  13. });
  14. function page(n,s){
  15. $("#pageNo").val(n);
  16. $("#pageSize").val(s);
  17. $("#searchForm").submit();
  18. return false;
  19. }
  20. </script>
  21. </head>
  22. <body>
  23. <ul class="nav nav-tabs">
  24. <li class="active"><a href="${ctx}/hehe/cmHeheDiscountActivity/">活动列表</a></li>
  25. <li><a href="${ctx}/hehe/cmHeheDiscountActivity/form">活动添加</a></li>
  26. </ul>
  27. <form:form id="searchForm" modelAttribute="cmHeheDiscountActivity" action="${ctx}/hehe/cmHeheDiscountActivity/" method="post" class="breadcrumb form-search">
  28. <input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
  29. <input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
  30. <div class="ul-form">
  31. <label>活动名称:</label>
  32. <form:input path="name" htmlEscape="false" maxlength="60" class="input-medium"/>
  33. <label>状态:</label>
  34. <form:select path="status" class="input-medium">
  35. <form:option value="" label="全部"/>
  36. <form:option value="1" label="待上架"/>
  37. <form:option value="2" label="已上架"/>
  38. <form:option value="3" label="已下架"/>
  39. </form:select>
  40. &nbsp;&nbsp;<input id="btnSubmit" class="btn btn-primary" type="submit" value="查询"/>
  41. <div class="clearfix"></div>
  42. </div>
  43. </form:form>
  44. <sys:message content="${message}"/>
  45. <table id="contentTable" class="table table-striped table-bordered table-condensed">
  46. <thead>
  47. <tr>
  48. <th>序号</th>
  49. <th>活动名称</th>
  50. <th>上架时间</th>
  51. <th>下架时间</th>
  52. <th>状态</th>
  53. <th>创建时间</th>
  54. <th>操作</th>
  55. </tr>
  56. </thead>
  57. <tbody>
  58. <c:forEach items="${page.list}" var="cmHeheDiscountActivity">
  59. <tr>
  60. <td>
  61. ${cmHeheDiscountActivity.id}
  62. </td>
  63. <td>
  64. ${cmHeheDiscountActivity.name}
  65. </td>
  66. <td>
  67. <fmt:formatDate value="${cmHeheDiscountActivity.onlineTime}" pattern="yyyy-MM-dd HH:mm:ss"/>
  68. </td>
  69. <td>
  70. <fmt:formatDate value="${cmHeheDiscountActivity.offlineTime}" pattern="yyyy-MM-dd HH:mm:ss"/>
  71. </td>
  72. <td>
  73. <font color="${cmHeheDiscountActivity.status eq 1?'#40ABE9':(cmHeheDiscountActivity.status eq 2?'red':'#666666')}">
  74. ${cmHeheDiscountActivity.status eq 1?'待上架':(cmHeheDiscountActivity.status eq 2?'已上架':'已下架')}
  75. </font>
  76. </td>
  77. <td>
  78. <fmt:formatDate value="${cmHeheDiscountActivity.addTime}" pattern="yyyy-MM-dd HH:mm:ss"/>
  79. </td>
  80. <td>
  81. <a href="javascript:;" onclick="updateStatus(${cmHeheDiscountActivity.id},${cmHeheDiscountActivity.status})">
  82. ${cmHeheDiscountActivity.status eq 2?'下架':'上架'}
  83. </a>
  84. <a href="${ctx}/hehe/cmHeheDiscountActivity/form?id=${cmHeheDiscountActivity.id}">编辑</a>
  85. <a href="${ctx}/hehe/cmHeheDiscountActivity/delete?id=${cmHeheDiscountActivity.id}" onclick="return confirmx('确认要删除该活动吗?', this.href)">删除</a>
  86. </td>
  87. </tr>
  88. </c:forEach>
  89. </tbody>
  90. </table>
  91. <div class="pagination">${page}</div>
  92. <script>
  93. function updateStatus(activityId,status) {
  94. if (status !== 3) {
  95. if (status === 2) {
  96. status = 3;
  97. // 已上架活动下架
  98. var submit = function (v, h, f) {
  99. if (v == true) {
  100. $.post("${ctx}/hehe/cmHeheDiscountActivity/updateStatus?id="+activityId+"&status="+status,function (data) {
  101. top.$.jBox.tip('下架活动成功');
  102. setTimeout(function () {
  103. $("#searchForm").submit();
  104. }, 1000);
  105. });
  106. }
  107. };
  108. $.jBox.confirm("确定下架该活动吗?", "提示", submit, {buttons: {'确认': true, '取消': false}});
  109. } else {
  110. status = 2;
  111. // 待上架活动上架
  112. var submit = function (v, h, f) {
  113. if (v == true) {
  114. $.post("${ctx}/hehe/cmHeheDiscountActivity/updateStatus?id=" + activityId + "&status=" + status, function (data) {
  115. top.$.jBox.tip('上架活动成功');
  116. setTimeout(function () {
  117. $("#searchForm").submit();
  118. }, 1000);
  119. });
  120. }
  121. };
  122. $.jBox.confirm("确定立即上架该活动吗?", "提示", submit, {buttons: {'确认': true, '取消': false}});
  123. }
  124. } else {
  125. //已下架活动上架需重新设置上下架时间
  126. var url = "${ctx}/hehe/cmHeheReduction/resetTimePage";
  127. var title = "提示";
  128. top.$.jBox("iframe:"+url, {
  129. iframeScrolling: 'yes',
  130. width: 800,
  131. height: 350,
  132. persistent: true,
  133. title: title,
  134. buttons: {"确定": '1', "取消": '-1'},
  135. submit: function (v, h, f) {
  136. //确定
  137. var $jboxFrame = top.$('#jbox-iframe');
  138. var $mainFrame = top.$('#mainFrame');
  139. if ('1' == v && 1 == $jboxFrame.size() && 1 == $mainFrame.size()) {
  140. var items = $jboxFrame[0].contentWindow.getCheckedItems(0);
  141. if (items.length > 0) {
  142. var startTime = items[0].startTime;
  143. var endTime = items[0].endTime;
  144. if (startTime === '') {
  145. top.$.jBox.tip("请选择上架时间");
  146. return false;
  147. }
  148. if (endTime === '') {
  149. top.$.jBox.tip("请选择下架时间");
  150. return false;
  151. }
  152. $.post("${ctx}/hehe/cmHeheDiscountActivity/updateTime?id=" + activityId + "&onlineTime=" + startTime + "&offlineTime=" + endTime, function (data) {
  153. top.$.jBox.tip("修改成功");
  154. setTimeout(function () {
  155. $("#searchForm").submit();
  156. }, 1000);
  157. });
  158. } else {
  159. top.$.jBox.tip("请先勾选商品...");
  160. return false;
  161. }
  162. }
  163. return true;
  164. }
  165. });
  166. }
  167. }
  168. </script>
  169. </body>
  170. </html>