newFloorcontentForm.jsp 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316
  1. <%@ page contentType="text/html;charset=UTF-8" %>
  2. <%@ include file="/WEB-INF/views/include/taglib.jsp"%>
  3. <%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
  4. <%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
  5. <html>
  6. <head>
  7. <title>固定楼层内容管理</title>
  8. <meta name="decorator" content="default"/>
  9. <style type="text/css">
  10. .table th{text-align: center;}
  11. .table td{text-align: center;}
  12. </style>
  13. <script type="text/javascript">
  14. $(document).ready(function() {
  15. var tb=document.getElementById('contentTable');
  16. // var rows=tb.rows;
  17. for(var j=1;j<tb.rows.length; j++){
  18. // te=(tb.rows[j].cells[4].innerHTML,tb.rows[j].cells[4].innerHTML);
  19. console.log(tb.rows[j].cells[4].innerHTML.slice(33))
  20. }
  21. // alert($("#span").text());
  22. });
  23. function page(n, s) {
  24. $("#pageNo").val(n);
  25. $("#pageSize").val(s);
  26. $("#searchForm").submit();
  27. return false;
  28. }
  29. //PC端状态修改
  30. function updateEnabledStatus(status,ids){
  31. var msg='确定启用该楼层吗?';
  32. if('0'==status){
  33. msg='确定停用该楼层吗?';
  34. }
  35. top.$.jBox.confirm(msg,'系统提示',function(v,h,f){
  36. if(v=='ok'){
  37. $.post("${ctx}/newhome/newPageFloor/updateEnabledStatus",{'enabledStatus':status,'ids':ids}, function(data) {
  38. if(true==data.success){
  39. $.jBox.tip(data.msg, 'info');
  40. } else {
  41. $.jBox.tip(data.msg,'error');
  42. }
  43. window.location = "${ctx}/newhome/newPageFloor/";
  44. },"JSON");//这里返回的类型有:json,html,xml,text
  45. }
  46. return;
  47. },{buttonsFocus:1,persistent: true});
  48. }
  49. function dateFormat(fmt, date) {
  50. let ret;
  51. const opt = {
  52. "Y+": date.getFullYear().toString(), // 年
  53. "m+": (date.getMonth() + 1).toString(), // 月
  54. "d+": date.getDate().toString(), // 日
  55. "H+": date.getHours().toString(), // 时
  56. "M+": date.getMinutes().toString(), // 分
  57. "S+": date.getSeconds().toString() // 秒
  58. // 有其他格式化字符需求可以继续添加,必须转化成字符串
  59. };
  60. for (let k in opt) {
  61. ret = new RegExp("(" + k + ")").exec(fmt);
  62. if (ret) {
  63. fmt = fmt.replace(ret[1], (ret[1].length == 1) ? (opt[k]) : (opt[k].padStart(ret[1].length, "0")))
  64. };
  65. };
  66. return fmt;
  67. }
  68. //CRM端状态修改
  69. function updateCrmEnabledStatusByIds(status,ids){
  70. var msg='确定启用该楼层吗?';
  71. if('0'==status){
  72. msg='确定停用该楼层吗?';
  73. }
  74. top.$.jBox.confirm(msg,'系统提示',function(v,h,f){
  75. if(v=='ok'){
  76. $.post("${ctx}/newhome/newPageFloor/updateCrmEnabledStatusByIds",{'crmEnabledStatus':status,'ids':ids}, function(data) {
  77. if(true==data.success){
  78. $.jBox.tip(data.msg, 'info');
  79. } else {
  80. $.jBox.tip(data.msg,'error');
  81. }
  82. window.location = "${ctx}/newhome/newPageFloor/";
  83. },"JSON");//这里返回的类型有:json,html,xml,text
  84. }
  85. return;
  86. },{buttonsFocus:1,persistent: true});
  87. }
  88. /**
  89. * @param obj
  90. * jquery控制input只能输入数字
  91. */
  92. function onlynum(obj) {
  93. obj.value = obj.value.replace(/[^\d]/g, ""); //清除"数字"以外的字符
  94. }
  95. function offoce(productID,date,ShowTime,addTime,floorTitle,floorType){
  96. var html = "<div id='auditBox'>"
  97. + "<div class='bd-row'>"
  98. + "<span style='margin-left: 5px;size: 30px'>更改时间后,将从此刻的时间开始重新计算</span>"
  99. + "<br>"
  100. + " <span><font color='red'>*</font>展示时间:</span>"
  101. + " <input type='text' onkeyup='onlynum(this)' class='input-mini' name='yat'/>"
  102. + "<span>天</span>"
  103. + "</div>"
  104. + "<span id='err' hidden=hidden style='color: red'>请输入天数</span>"
  105. + "</div>";
  106. var submit = function (v, h, f) {
  107. if(v==true){
  108. if (f.yat == '' || f.yat == null) {
  109. $("#err").show()
  110. return false;
  111. }else {
  112. $("#err").hide()
  113. }
  114. debugger
  115. var time = new Date();
  116. var y = time.getFullYear();
  117. var m = time.getMonth() + 1;
  118. m = m < 10 ? ('0' + m) : m;
  119. var d = time.getDate();
  120. d = d< 10 ? ('0' + d) : d;
  121. var h = time.getHours();
  122. var minute = time.getMinutes();
  123. minute = minute < 10 ? ('0' + minute) : minute;
  124. var s=time.getSeconds();
  125. d=time.getTime()+1000*60*60*24*f.yat;
  126. var unixTimestamp = new Date(d);
  127. commonTime =dateFormat("YYYY-mm-dd HH:MM:SS",unixTimestamp);
  128. var data=new Date(date);
  129. data.getTime()+1000*60*60*24;
  130. var dtime = new Date(data);
  131. commTime = dateFormat("YYYY-mm-dd HH:MM:SS",dtime);
  132. console.log(window.location.href="${ctx}/newhome/newPageFloor/updateshowTime?newshowTime="+commTime+"&productID="+productID+"&showTime="+commonTime+"&addTime="+addTime+"&floorTitle="+floorTitle+"&floorType="+floorType)
  133. window.location.href="${ctx}/newhome/newPageFloor/updateshowTime?newshowTime="+commTime+"&productID="+productID+"&showTime="+commonTime+"&addTime="+addTime+"&floorTitle="+floorTitle+"&floorType="+floorType;
  134. }
  135. };
  136. // $.jBox.confirm(html, {title: "提示",submit:submit});
  137. $.jBox.confirm(html, "提示", submit, {buttons: {'确认': true, '取消': false}});
  138. }
  139. //批量保存排序
  140. function batchSaveSort() {
  141. var items = new Array();
  142. var $items = $('.check-item');
  143. $items.each(function(){
  144. items.push($(this).val());
  145. });
  146. debugger
  147. //保存批量排序
  148. $.post("${ctx}/newhome/newPageFloor/batchSavesortIndex?sortList="+items, function(data) {
  149. window.location.href = "${ctx}/newhome/newPageFloor/ContentPage?floorId=${newPageFloor.id}&floorTitle=${newPageFloor.floorTitle}&floorType=${newPageFloor.floorType}";
  150. },"JSON");//这里返回的类型有:json,html,xml,text
  151. }
  152. //修改排序值
  153. function changeSort(id,sortThis) {
  154. var value = sortThis.value;
  155. $("#preferredProductSort"+id).val(id+"-"+value);
  156. }
  157. function offocea(productID,newshowTime,ShowTime,addTime,floorTitle,floorType) {
  158. $.jBox.confirm("确定上线该商品吗?","提示",function(v,h,f){
  159. if(v === 1){
  160. window.location.href="${ctx}/newhome/newPageFloor/updatshowFlag?showFlag=1&productID="+productID+"&newshowTime="+newshowTime+"&ShowTime="+ShowTime+"&addTime"+addTime+"&floorTitle="+floorTitle+"&floorType="+floorType;
  161. }
  162. } ,{ buttons: { '确定': 1,'取消':2}});
  163. }
  164. function offoceb(productID,newshowTime,ShowTime,addTime,floorTitle,floorType) {
  165. console.log(newshowTime)
  166. $.jBox.confirm("确定下线该商品吗?下线后该商品将不展示在商城新品区域","提示",function(v,h,f){
  167. if(v === 1){
  168. window.location.href="${ctx}/newhome/newPageFloor/updatshowFlag?showFlag=5&productID="+productID+"&newshowTime="+newshowTime+"&ShowTime="+ShowTime+"&addTime"+addTime+"&floorTitle="+floorTitle+"&floorType="+floorType;
  169. }
  170. } ,{ buttons: { '确定': 1,'取消':2}});
  171. }
  172. function offocec(productID,floorTitle,floorType) {
  173. $.jBox.confirm("确定取消重点推荐吗?","提示",function(v,h,f){
  174. if(v === 1){
  175. window.location.href="${ctx}/newhome/newPageFloor/addrecommend?recommend=0&productID="+productID+"&floorTitle="+floorTitle+"&floorType="+floorType;
  176. }
  177. } ,{ buttons: { '确定': 1,'取消':2}});
  178. }
  179. function offoced(productID,floorTitle,floorType) {
  180. $.jBox.confirm("确定将该商品设为重点推荐吗?推荐后商品将在商城新品区域重点展示","提示",function(v,h,f){
  181. if(v === 1){
  182. window.location.href="${ctx}/newhome/newPageFloor/addrecommend?recommend=1&productID="+productID+"&floorTitle="+floorTitle+"&floorType="+floorType;
  183. }
  184. } ,{ buttons: { '确定': 1,'取消':2}});
  185. }
  186. </script>
  187. </head>
  188. <body>
  189. <ul class="nav nav-tabs">
  190. <li><a href="${ctx}/newhome/newPageFloor/lists">固定楼层管理列表</a></li>
  191. <li class="active"><a href="${ctx}/newhome/newPageFloor/ContentPage?floorId=${newPageFloor.id}&floorTitle=${newPageFloor.floorTitle}&floorType=${newPageFloor.floorType}">内容</a></li>
  192. </ul>
  193. <form:form id="searchForm" modelAttribute="Product" action="${ctx}/newhome/newPageFloor/ContentPage?floorId=${newPageFloor.id}&floorTitle=${newPageFloor.floorTitle}&floorType=${newPageFloor.floorType}">
  194. <input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
  195. <input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
  196. <c:if test="${not empty floorTitle}">
  197. 楼层名称:&nbsp;<span style="color: #0bbbee">${floorTitle}</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span >楼层类型:</span>&nbsp;<span style="color: #0bbbee"><c:if test="${floorType eq 1}">新品橱窗</c:if></span>
  198. </c:if>
  199. <c:if test="${not empty newPageFloor.floorTitle}">
  200. 楼层名称:&nbsp;<span style="color: #0bbbee">${newPageFloor.floorTitle}</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span >楼层类型:</span>&nbsp;<span style="color: #0bbbee"><c:if test="${newPageFloor.floorType eq 1}">新品橱窗</c:if></span>
  201. </c:if>
  202. <div class="ul-form">
  203. <label>商品ID:</label>
  204. <form:input path="productID" onkeyup="onlynum(this)" name="productID" maxlength="50" class="input-medium"/>
  205. <label>商品名称:</label>
  206. <form:input path="name" name="name" maxlength="50" class="input-medium"/>
  207. <label>供应商:</label>
  208. <form:input path="shopName" name="shopName" maxlength="50" class="input-medium"/>
  209. <label>展示状态:</label>
  210. <form:select path="showFlag" class="input-small">
  211. <form:option value="0">请选择</form:option>
  212. <form:option value="1">已展示</form:option>
  213. <form:option value="2">展示过期</form:option>
  214. <form:option value="3">未参与</form:option>
  215. <form:option value="4">审核未通过</form:option>
  216. <form:option value="5">已下线</form:option>
  217. </form:select>
  218. <input id="btnSubmit" class="btn btn-primary" type="submit" value="查询"/>
  219. <input class="btn btn-primary" style="width: 70px" onclick="batchSaveSort()" value="一键排序"/>&nbsp;&nbsp;&nbsp;&nbsp;
  220. </div>
  221. </form:form>
  222. <sys:message content="${message}"/>
  223. <table id="contentTable" class="table table-striped table-bordered table-condensed">
  224. <thead>
  225. <tr>
  226. <th>商品ID</th>
  227. <th>商品名称</th>
  228. <th>供应商</th>
  229. <th>展示状态</th>
  230. <th>展示时间</th>
  231. <th>排序</th>
  232. <th>重点推荐</th>
  233. <th>操作</th>
  234. </tr>
  235. </thead>
  236. <tbody>
  237. <c:forEach items="${page.list}" var="list">
  238. <tr>
  239. <input class="check-item" type="hidden" id="preferredProductSort${list.productID}" value='${list.productID}-${list.sortIndex}'/>
  240. <td>${list.productID}</td>
  241. <td>${list.name}</td>
  242. <td>${list.shopName}</td>
  243. <td>
  244. <c:if test="${list.showFlag eq 1}">
  245. <font color="green">已展示</font>
  246. </c:if>
  247. <c:if test="${list.showFlag eq 2}">
  248. <font color="#ff8c00">展示过期</font>
  249. </c:if>
  250. <c:if test="${list.showFlag eq 3}">
  251. <font color="red">未参与</font>
  252. </c:if>
  253. <c:if test="${list.showFlag eq 4}">
  254. <font color="red">审核未通过</font>
  255. </c:if>
  256. <c:if test="${list.showFlag eq 5}">
  257. <font color="red">已下线</font>
  258. </c:if>
  259. </td>
  260. <td>
  261. <c:if test="${not empty list.newshowTime}">
  262. ${list.newshowTime}~${list.showTime}
  263. </c:if>
  264. <c:if test="${not empty list.addTime && list.newshowTime ==null}">
  265. ${list.addTime}~${list.showTime}
  266. </c:if>
  267. </td>
  268. <td>
  269. <c:if test="${not empty list.sortIndex && list.sortIndex!=0}">
  270. <input id="sort" type="text" name="sortIndex" style="width:50px;" value="${list.sortIndex}" onkeyup="onlynum(this)" onchange="changeSort(${list.productID},this)"></td>
  271. </c:if>
  272. <c:if test="${empty list.sortIndex || list.sortIndex==0}">
  273. <input id="sort" type="text" name="sortIndex" style="width:50px;" value="1" onkeyup="onlynum(this)" onchange="changeSort(${list.productID},this)"></td>
  274. </c:if>
  275. <td>
  276. <c:if test="${list.recommend eq 1}"><img src="/static/images/yes.gif" width="15px" border="none"/></c:if>
  277. </td>
  278. <td>
  279. <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>
  280. <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>
  281. <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>
  282. <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>
  283. <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>
  284. </td>
  285. </c:forEach>
  286. </tr>
  287. </tbody>
  288. </table>
  289. <div class="pagination">${page}</div>
  290. </body>
  291. </html>