123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171 |
- <%@ page contentType="text/html;charset=UTF-8" %>
- <%@ include file="/WEB-INF/views/include/taglib.jsp"%>
- <html>
- <head>
- <title>活动管理</title>
- <meta name="decorator" content="default"/>
- <style type="text/css">
- .table th{text-align: center;}
- .table td{text-align: center;}
- </style>
- <script type="text/javascript">
- $(document).ready(function() {
-
- });
- function page(n,s){
- $("#pageNo").val(n);
- $("#pageSize").val(s);
- $("#searchForm").submit();
- return false;
- }
- </script>
- </head>
- <body>
- <ul class="nav nav-tabs">
- <li class="active"><a href="${ctx}/hehe/cmHeheDiscountActivity/">活动列表</a></li>
- <li><a href="${ctx}/hehe/cmHeheDiscountActivity/form">活动添加</a></li>
- </ul>
- <form:form id="searchForm" modelAttribute="cmHeheDiscountActivity" action="${ctx}/hehe/cmHeheDiscountActivity/" method="post" class="breadcrumb form-search">
- <input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
- <input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
- <div class="ul-form">
- <label>活动名称:</label>
- <form:input path="name" htmlEscape="false" maxlength="60" class="input-medium"/>
- <label>状态:</label>
- <form:select path="status" class="input-medium">
- <form:option value="" label="全部"/>
- <form:option value="1" label="待上架"/>
- <form:option value="2" label="已上架"/>
- <form:option value="3" label="已下架"/>
- </form:select>
- <input id="btnSubmit" class="btn btn-primary" type="submit" value="查询"/>
- <div class="clearfix"></div>
- </div>
- </form:form>
- <sys:message content="${message}"/>
- <table id="contentTable" class="table table-striped table-bordered table-condensed">
- <thead>
- <tr>
- <th>序号</th>
- <th>活动名称</th>
- <th>上架时间</th>
- <th>下架时间</th>
- <th>状态</th>
- <th>创建时间</th>
- <th>操作</th>
- </tr>
- </thead>
- <tbody>
- <c:forEach items="${page.list}" var="cmHeheDiscountActivity">
- <tr>
- <td>
- ${cmHeheDiscountActivity.id}
- </td>
- <td>
- ${cmHeheDiscountActivity.name}
- </td>
- <td>
- <fmt:formatDate value="${cmHeheDiscountActivity.onlineTime}" pattern="yyyy-MM-dd HH:mm:ss"/>
- </td>
- <td>
- <fmt:formatDate value="${cmHeheDiscountActivity.offlineTime}" pattern="yyyy-MM-dd HH:mm:ss"/>
- </td>
- <td>
- <font color="${cmHeheDiscountActivity.status eq 1?'#40ABE9':(cmHeheDiscountActivity.status eq 2?'red':'#666666')}">
- ${cmHeheDiscountActivity.status eq 1?'待上架':(cmHeheDiscountActivity.status eq 2?'已上架':'已下架')}
- </font>
- </td>
- <td>
- <fmt:formatDate value="${cmHeheDiscountActivity.addTime}" pattern="yyyy-MM-dd HH:mm:ss"/>
- </td>
- <td>
- <a href="javascript:;" onclick="updateStatus(${cmHeheDiscountActivity.id},${cmHeheDiscountActivity.status})">
- ${cmHeheDiscountActivity.status eq 2?'下架':'上架'}
- </a>
- <a href="${ctx}/hehe/cmHeheDiscountActivity/form?id=${cmHeheDiscountActivity.id}">编辑</a>
- <a href="${ctx}/hehe/cmHeheDiscountActivity/delete?id=${cmHeheDiscountActivity.id}" onclick="return confirmx('确认要删除该活动吗?', this.href)">删除</a>
- </td>
- </tr>
- </c:forEach>
- </tbody>
- </table>
- <div class="pagination">${page}</div>
- <script>
- function updateStatus(activityId,status) {
- if (status !== 3) {
- if (status === 2) {
- status = 3;
- // 已上架活动下架
- var submit = function (v, h, f) {
- if (v == true) {
- $.post("${ctx}/hehe/cmHeheDiscountActivity/updateStatus?id="+activityId+"&status="+status,function (data) {
- top.$.jBox.tip('下架活动成功');
- setTimeout(function () {
- $("#searchForm").submit();
- }, 1000);
- });
- }
- };
- $.jBox.confirm("确定下架该活动吗?", "提示", submit, {buttons: {'确认': true, '取消': false}});
- } else {
- status = 2;
- // 待上架活动上架
- var submit = function (v, h, f) {
- if (v == true) {
- $.post("${ctx}/hehe/cmHeheDiscountActivity/updateStatus?id=" + activityId + "&status=" + status, function (data) {
- top.$.jBox.tip('上架活动成功');
- setTimeout(function () {
- $("#searchForm").submit();
- }, 1000);
- });
- }
- };
- $.jBox.confirm("确定立即上架该活动吗?", "提示", submit, {buttons: {'确认': true, '取消': false}});
- }
- } else {
- //已下架活动上架需重新设置上下架时间
- var url = "${ctx}/hehe/cmHeheReduction/resetTimePage";
- var title = "提示";
- top.$.jBox("iframe:"+url, {
- iframeScrolling: 'yes',
- width: 800,
- height: 350,
- persistent: true,
- title: title,
- buttons: {"确定": '1', "取消": '-1'},
- submit: function (v, h, f) {
- //确定
- var $jboxFrame = top.$('#jbox-iframe');
- var $mainFrame = top.$('#mainFrame');
- if ('1' == v && 1 == $jboxFrame.size() && 1 == $mainFrame.size()) {
- var items = $jboxFrame[0].contentWindow.getCheckedItems(0);
- if (items.length > 0) {
- var startTime = items[0].startTime;
- var endTime = items[0].endTime;
- if (startTime === '') {
- top.$.jBox.tip("请选择上架时间");
- return false;
- }
- if (endTime === '') {
- top.$.jBox.tip("请选择下架时间");
- return false;
- }
- $.post("${ctx}/hehe/cmHeheDiscountActivity/updateTime?id=" + activityId + "&onlineTime=" + startTime + "&offlineTime=" + endTime, function (data) {
- top.$.jBox.tip("修改成功");
- setTimeout(function () {
- $("#searchForm").submit();
- }, 1000);
- });
- } else {
- top.$.jBox.tip("请先勾选商品...");
- return false;
- }
- }
- return true;
- }
- });
- }
- }
- </script>
- </body>
- </html>
|