addProductImage.jsp 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. <%--
  2. Created by IntelliJ IDEA.
  3. User: Administrator
  4. Date: 2020/4/9
  5. Time: 19:54
  6. To change this template use File | Settings | File Templates.
  7. --%>
  8. <%@ page contentType="text/html;charset=UTF-8" %>
  9. <%@ include file="/WEB-INF/views/include/taglib.jsp" %>
  10. <html>
  11. <head>
  12. <title>选择商品图片</title>
  13. <meta name="decorator" content="default"/>
  14. <style type="text/css">
  15. .table td i {
  16. margin: 0 2px;
  17. }
  18. </style>
  19. <script type="text/javascript">
  20. $(document).ready(function () {
  21. $("#searchForm").validate({
  22. submitHandler: function (form) {
  23. var isSubMitFlag = true;
  24. var productID = $("#productID").val();
  25. if (isNaN(productID) || productID.indexOf('0') == 0) {
  26. alertx("请输入正确的商品ID");
  27. isSubMitFlag = false;
  28. return false;
  29. }
  30. if (isSubMitFlag) {
  31. form.submit();
  32. }
  33. }
  34. })
  35. });
  36. </script>
  37. </head>
  38. <body>
  39. <ul class="nav nav-tabs">
  40. <li class="${productCategory eq 1 ? 'active':''}"><a
  41. href="${ctx}/newhome/newPageFloor/addProductImage?productCategory=1">添加商品</a></li>
  42. <li class="${productCategory eq 2 ? 'active':''}"><a
  43. href="${ctx}/newhome/newPageFloor/addProductImage?productCategory=2&productIds=${productIds}">添加二手商品</a>
  44. </li>
  45. <li><a href="${ctx}/newhome/newPageFloor/addOtherImage">添加其他图片</a></li>
  46. </ul>
  47. <br/>
  48. <form:form id="searchForm" modelAttribute="product" action="" method="post" class="breadcrumb form-search">
  49. <input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
  50. <input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
  51. <form:hidden path="productIds"/>
  52. <div class="ul-form">
  53. <label>商品ID:</label>
  54. <form:input path="productID" id="productID" htmlEscape="false" maxlength="8" class="input-mini"
  55. onkeyup="onlynum(this)"/>
  56. <label>商品名称:</label>
  57. <form:input path="name" htmlEscape="false" class="input-medium" maxlength="20"/>
  58. <c:if test="${productCategory eq 1}">
  59. <label>供应商名称:</label>
  60. <form:input path="shopName" htmlEscape="false" class="input-medium" maxlength="20"/>
  61. </c:if>
  62. &nbsp;&nbsp; <input id="btnSubmit" class="btn btn-primary" type="submit" value="搜索"/>
  63. <div class="clearfix"></div>
  64. </div>
  65. </form:form>
  66. <sys:message content="${message}"/>
  67. <table class="table table-striped table-bordered table-condensed table-hover">
  68. <tr>
  69. <th style="width:20px;"></th>
  70. <th>商品ID</th>
  71. <th>商品图片</th>
  72. <th>商品名称</th>
  73. <c:if test="${productCategory eq 1}">
  74. <th>供应商名称</th>
  75. </c:if>
  76. </tr>
  77. <tbody>
  78. <c:if test="${not empty page.list}">
  79. <c:forEach items="${page.list}" var="item">
  80. <tr id="${item.productID}" class="itemtr">
  81. <th>
  82. <input class="check-item" type="radio" name="info" value='${fns:toJson(item)}'/>
  83. </th>
  84. <td>${item.productID}</td>
  85. <td><img src="${item.mainImage}" width="50px" height="50px"></td>
  86. <td>${item.name}</td>
  87. <c:if test="${productCategory eq 1}">
  88. <td>${item.shopName}</td>
  89. </c:if>
  90. </tr>
  91. </c:forEach>
  92. </c:if>
  93. </tbody>
  94. </table>
  95. <c:if test="${empty page.list}">
  96. <p style="text-align: center;"><font color="#1e90ff">暂无数据……</font></p>
  97. </c:if>
  98. <div class="pagination">${page}</div>
  99. <script type="text/javascript">
  100. $(document).ready(function () {
  101. //弹出框去滚动条
  102. top.$('#jbox-content').css("overflow-y", "hidden");
  103. show_title(30);
  104. });
  105. function page(n, s) {
  106. $("#pageNo").val(n);
  107. $("#pageSize").val(s);
  108. $("#searchForm").submit();
  109. return false;
  110. }
  111. function getCheckedItems() {
  112. var item = $('.check-item:checked').val();
  113. var product = JSON.parse(item);
  114. var link = '';
  115. if (${productCategory eq 1}) {
  116. link = "${fns:getConfig('wwwServer')}product-" + product.productID + ".html";
  117. } else {
  118. link = "${fns:getConfig('wwwServer')}flea-market-" + product.productID + ".html";
  119. }
  120. var items = {
  121. "id": "",
  122. "productId": product.productID,
  123. "validFlag": product.validFlag,
  124. "image": product.mainImage,
  125. "name": product.name,
  126. "link": link,
  127. "sort": 1,
  128. "pcStatus": "1",
  129. "appletsStatus": "1",
  130. "label": "",
  131. "createDate": ""
  132. };
  133. return items;
  134. }
  135. function clickAllSelect(ckb) {
  136. var isChecked = ckb.checked;
  137. $(".check-item").attr('checked', isChecked);
  138. }
  139. /**
  140. * @param obj
  141. * jquery控制input只能输入数字
  142. */
  143. function onlynum(obj) {
  144. obj.value = obj.value.replace(/[^\d]/g, ""); //清除"数字"以外的字符
  145. }
  146. </script>
  147. </body>
  148. </html>