123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316 |
- <%@ page contentType="text/html;charset=UTF-8" %>
- <%@ include file="/WEB-INF/views/include/taglib.jsp"%>
- <%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
- <%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
- <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() {
- var tb=document.getElementById('contentTable');
- // var rows=tb.rows;
- for(var j=1;j<tb.rows.length; j++){
- // te=(tb.rows[j].cells[4].innerHTML,tb.rows[j].cells[4].innerHTML);
- console.log(tb.rows[j].cells[4].innerHTML.slice(33))
- }
- // alert($("#span").text());
- });
- function page(n, s) {
- $("#pageNo").val(n);
- $("#pageSize").val(s);
- $("#searchForm").submit();
- return false;
- }
- //PC端状态修改
- function updateEnabledStatus(status,ids){
- var msg='确定启用该楼层吗?';
- if('0'==status){
- msg='确定停用该楼层吗?';
- }
- top.$.jBox.confirm(msg,'系统提示',function(v,h,f){
- if(v=='ok'){
- $.post("${ctx}/newhome/newPageFloor/updateEnabledStatus",{'enabledStatus':status,'ids':ids}, function(data) {
- if(true==data.success){
- $.jBox.tip(data.msg, 'info');
- } else {
- $.jBox.tip(data.msg,'error');
- }
- window.location = "${ctx}/newhome/newPageFloor/";
- },"JSON");//这里返回的类型有:json,html,xml,text
- }
- return;
- },{buttonsFocus:1,persistent: true});
- }
- function dateFormat(fmt, date) {
- let ret;
- const opt = {
- "Y+": date.getFullYear().toString(), // 年
- "m+": (date.getMonth() + 1).toString(), // 月
- "d+": date.getDate().toString(), // 日
- "H+": date.getHours().toString(), // 时
- "M+": date.getMinutes().toString(), // 分
- "S+": date.getSeconds().toString() // 秒
- // 有其他格式化字符需求可以继续添加,必须转化成字符串
- };
- for (let k in opt) {
- ret = new RegExp("(" + k + ")").exec(fmt);
- if (ret) {
- fmt = fmt.replace(ret[1], (ret[1].length == 1) ? (opt[k]) : (opt[k].padStart(ret[1].length, "0")))
- };
- };
- return fmt;
- }
- //CRM端状态修改
- function updateCrmEnabledStatusByIds(status,ids){
- var msg='确定启用该楼层吗?';
- if('0'==status){
- msg='确定停用该楼层吗?';
- }
- top.$.jBox.confirm(msg,'系统提示',function(v,h,f){
- if(v=='ok'){
- $.post("${ctx}/newhome/newPageFloor/updateCrmEnabledStatusByIds",{'crmEnabledStatus':status,'ids':ids}, function(data) {
- if(true==data.success){
- $.jBox.tip(data.msg, 'info');
- } else {
- $.jBox.tip(data.msg,'error');
- }
- window.location = "${ctx}/newhome/newPageFloor/";
- },"JSON");//这里返回的类型有:json,html,xml,text
- }
- return;
- },{buttonsFocus:1,persistent: true});
- }
- /**
- * @param obj
- * jquery控制input只能输入数字
- */
- function onlynum(obj) {
- obj.value = obj.value.replace(/[^\d]/g, ""); //清除"数字"以外的字符
- }
- function offoce(productID,date,ShowTime,addTime,floorTitle,floorType){
- var html = "<div id='auditBox'>"
- + "<div class='bd-row'>"
- + "<span style='margin-left: 5px;size: 30px'>更改时间后,将从此刻的时间开始重新计算</span>"
- + "<br>"
- + " <span><font color='red'>*</font>展示时间:</span>"
- + " <input type='text' onkeyup='onlynum(this)' class='input-mini' name='yat'/>"
- + "<span>天</span>"
- + "</div>"
- + "<span id='err' hidden=hidden style='color: red'>请输入天数</span>"
- + "</div>";
- var submit = function (v, h, f) {
- if(v==true){
- if (f.yat == '' || f.yat == null) {
- $("#err").show()
- return false;
- }else {
- $("#err").hide()
- }
- debugger
- var time = new Date();
- var y = time.getFullYear();
- var m = time.getMonth() + 1;
- m = m < 10 ? ('0' + m) : m;
- var d = time.getDate();
- d = d< 10 ? ('0' + d) : d;
- var h = time.getHours();
- var minute = time.getMinutes();
- minute = minute < 10 ? ('0' + minute) : minute;
- var s=time.getSeconds();
- d=time.getTime()+1000*60*60*24*f.yat;
- var unixTimestamp = new Date(d);
- commonTime =dateFormat("YYYY-mm-dd HH:MM:SS",unixTimestamp);
- var data=new Date(date);
- data.getTime()+1000*60*60*24;
- var dtime = new Date(data);
- commTime = dateFormat("YYYY-mm-dd HH:MM:SS",dtime);
- console.log(window.location.href="${ctx}/newhome/newPageFloor/updateshowTime?newshowTime="+commTime+"&productID="+productID+"&showTime="+commonTime+"&addTime="+addTime+"&floorTitle="+floorTitle+"&floorType="+floorType)
- window.location.href="${ctx}/newhome/newPageFloor/updateshowTime?newshowTime="+commTime+"&productID="+productID+"&showTime="+commonTime+"&addTime="+addTime+"&floorTitle="+floorTitle+"&floorType="+floorType;
- }
- };
- // $.jBox.confirm(html, {title: "提示",submit:submit});
- $.jBox.confirm(html, "提示", submit, {buttons: {'确认': true, '取消': false}});
- }
- //批量保存排序
- function batchSaveSort() {
- var items = new Array();
- var $items = $('.check-item');
- $items.each(function(){
- items.push($(this).val());
- });
- debugger
- //保存批量排序
- $.post("${ctx}/newhome/newPageFloor/batchSavesortIndex?sortList="+items, function(data) {
- window.location.href = "${ctx}/newhome/newPageFloor/ContentPage?floorId=${newPageFloor.id}&floorTitle=${newPageFloor.floorTitle}&floorType=${newPageFloor.floorType}";
- },"JSON");//这里返回的类型有:json,html,xml,text
- }
- //修改排序值
- function changeSort(id,sortThis) {
- var value = sortThis.value;
- $("#preferredProductSort"+id).val(id+"-"+value);
- }
- function offocea(productID,newshowTime,ShowTime,addTime,floorTitle,floorType) {
- $.jBox.confirm("确定上线该商品吗?","提示",function(v,h,f){
- if(v === 1){
- window.location.href="${ctx}/newhome/newPageFloor/updatshowFlag?showFlag=1&productID="+productID+"&newshowTime="+newshowTime+"&ShowTime="+ShowTime+"&addTime"+addTime+"&floorTitle="+floorTitle+"&floorType="+floorType;
- }
- } ,{ buttons: { '确定': 1,'取消':2}});
- }
- function offoceb(productID,newshowTime,ShowTime,addTime,floorTitle,floorType) {
- console.log(newshowTime)
- $.jBox.confirm("确定下线该商品吗?下线后该商品将不展示在商城新品区域","提示",function(v,h,f){
- if(v === 1){
- window.location.href="${ctx}/newhome/newPageFloor/updatshowFlag?showFlag=5&productID="+productID+"&newshowTime="+newshowTime+"&ShowTime="+ShowTime+"&addTime"+addTime+"&floorTitle="+floorTitle+"&floorType="+floorType;
- }
- } ,{ buttons: { '确定': 1,'取消':2}});
- }
- function offocec(productID,floorTitle,floorType) {
- $.jBox.confirm("确定取消重点推荐吗?","提示",function(v,h,f){
- if(v === 1){
- window.location.href="${ctx}/newhome/newPageFloor/addrecommend?recommend=0&productID="+productID+"&floorTitle="+floorTitle+"&floorType="+floorType;
- }
- } ,{ buttons: { '确定': 1,'取消':2}});
- }
- function offoced(productID,floorTitle,floorType) {
- $.jBox.confirm("确定将该商品设为重点推荐吗?推荐后商品将在商城新品区域重点展示","提示",function(v,h,f){
- if(v === 1){
- window.location.href="${ctx}/newhome/newPageFloor/addrecommend?recommend=1&productID="+productID+"&floorTitle="+floorTitle+"&floorType="+floorType;
- }
- } ,{ buttons: { '确定': 1,'取消':2}});
- }
- </script>
- </head>
- <body>
- <ul class="nav nav-tabs">
- <li><a href="${ctx}/newhome/newPageFloor/lists">固定楼层管理列表</a></li>
- <li class="active"><a href="${ctx}/newhome/newPageFloor/ContentPage?floorId=${newPageFloor.id}&floorTitle=${newPageFloor.floorTitle}&floorType=${newPageFloor.floorType}">内容</a></li>
- </ul>
- <form:form id="searchForm" modelAttribute="Product" action="${ctx}/newhome/newPageFloor/ContentPage?floorId=${newPageFloor.id}&floorTitle=${newPageFloor.floorTitle}&floorType=${newPageFloor.floorType}">
- <input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
- <input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
- <c:if test="${not empty floorTitle}">
- 楼层名称: <span style="color: #0bbbee">${floorTitle}</span> <span >楼层类型:</span> <span style="color: #0bbbee"><c:if test="${floorType eq 1}">新品橱窗</c:if></span>
- </c:if>
- <c:if test="${not empty newPageFloor.floorTitle}">
- 楼层名称: <span style="color: #0bbbee">${newPageFloor.floorTitle}</span> <span >楼层类型:</span> <span style="color: #0bbbee"><c:if test="${newPageFloor.floorType eq 1}">新品橱窗</c:if></span>
- </c:if>
- <div class="ul-form">
- <label>商品ID:</label>
- <form:input path="productID" onkeyup="onlynum(this)" name="productID" maxlength="50" class="input-medium"/>
- <label>商品名称:</label>
- <form:input path="name" name="name" maxlength="50" class="input-medium"/>
- <label>供应商:</label>
- <form:input path="shopName" name="shopName" maxlength="50" class="input-medium"/>
- <label>展示状态:</label>
- <form:select path="showFlag" class="input-small">
- <form:option value="0">请选择</form:option>
- <form:option value="1">已展示</form:option>
- <form:option value="2">展示过期</form:option>
- <form:option value="3">未参与</form:option>
- <form:option value="4">审核未通过</form:option>
- <form:option value="5">已下线</form:option>
- </form:select>
- <input id="btnSubmit" class="btn btn-primary" type="submit" value="查询"/>
- <input class="btn btn-primary" style="width: 70px" onclick="batchSaveSort()" value="一键排序"/>
- </div>
- </form:form>
- <sys:message content="${message}"/>
- <table id="contentTable" class="table table-striped table-bordered table-condensed">
- <thead>
- <tr>
- <th>商品ID</th>
- <th>商品名称</th>
- <th>供应商</th>
- <th>展示状态</th>
- <th>展示时间</th>
- <th>排序</th>
- <th>重点推荐</th>
- <th>操作</th>
- </tr>
- </thead>
- <tbody>
- <c:forEach items="${page.list}" var="list">
- <tr>
- <input class="check-item" type="hidden" id="preferredProductSort${list.productID}" value='${list.productID}-${list.sortIndex}'/>
- <td>${list.productID}</td>
- <td>${list.name}</td>
- <td>${list.shopName}</td>
- <td>
- <c:if test="${list.showFlag eq 1}">
- <font color="green">已展示</font>
- </c:if>
- <c:if test="${list.showFlag eq 2}">
- <font color="#ff8c00">展示过期</font>
- </c:if>
- <c:if test="${list.showFlag eq 3}">
- <font color="red">未参与</font>
- </c:if>
- <c:if test="${list.showFlag eq 4}">
- <font color="red">审核未通过</font>
- </c:if>
- <c:if test="${list.showFlag eq 5}">
- <font color="red">已下线</font>
- </c:if>
- </td>
- <td>
- <c:if test="${not empty list.newshowTime}">
- ${list.newshowTime}~${list.showTime}
- </c:if>
- <c:if test="${not empty list.addTime && list.newshowTime ==null}">
- ${list.addTime}~${list.showTime}
- </c:if>
- </td>
- <td>
- <c:if test="${not empty list.sortIndex && list.sortIndex!=0}">
- <input id="sort" type="text" name="sortIndex" style="width:50px;" value="${list.sortIndex}" onkeyup="onlynum(this)" onchange="changeSort(${list.productID},this)"></td>
- </c:if>
- <c:if test="${empty list.sortIndex || list.sortIndex==0}">
- <input id="sort" type="text" name="sortIndex" style="width:50px;" value="1" onkeyup="onlynum(this)" onchange="changeSort(${list.productID},this)"></td>
- </c:if>
- <td>
- <c:if test="${list.recommend eq 1}"><img src="/static/images/yes.gif" width="15px" border="none"/></c:if>
- </td>
- <td>
- <c:if test="${list.showFlag eq 5}"><a class="red" href="javascript:void(0);" onclick="offocea(${list.productID},'${list.newshowTime}','${list.showTime}','${list.addTime}','${newPageFloor.floorTitle}','${newPageFloor.floorType}')">上线商品</a></c:if>
- <c:if test="${list.showFlag eq 1 }"><a class="red" href="javascript:void(0);" onclick="offoceb(${list.productID},'${list.newshowTime}','${list.showTime}','${list.addTime}','${newPageFloor.floorTitle}','${newPageFloor.floorType}')">下线商品</a> </c:if>
- <c:if test="${list.recommend eq 1}"><a class="red" href="javascript:void(0);" onclick="offocec(${list.productID},'${newPageFloor.floorTitle}','${newPageFloor.floorType}')">取消重点推荐</a> </c:if>
- <c:if test="${list.recommend != 1 && count<5 && list.showFlag != 5}"><a class="red" href="javascript:void(0);" onclick="offoced('${list.productID}','${newPageFloor.floorTitle}','${newPageFloor.floorType}')">设为重点推荐</a></c:if>
- <c:if test="${list.showFlag !=5}"> <a class="red" href="javascript:void(0);" onclick="offoce('${list.productID}',new Date,'${list.newshowTime}','${list.addTime}','${newPageFloor.floorTitle}','${newPageFloor.floorType}')">更改展示时间</a></c:if>
- </td>
- </c:forEach>
- </tr>
- </tbody>
- </table>
- <div class="pagination">${page}</div>
- </body>
- </html>
|