addHeheProductImage.jsp 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  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="active"><a
  41. href="${ctx}/newhome/newPageFloor/addHeheImage">添加商品</a></li>
  42. </ul>
  43. <br/>
  44. <form:form id="searchForm" modelAttribute="product" action="" method="post" class="breadcrumb form-search">
  45. <input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
  46. <input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
  47. <form:hidden path="productIds"/>
  48. <div class="ul-form">
  49. <label>商品ID:</label>
  50. <form:input path="productID" id="productID" htmlEscape="false" maxlength="8" class="input-mini"
  51. onkeyup="onlynum(this)"/>
  52. <label>商品名称:</label>
  53. <form:input path="name" htmlEscape="false" class="input-medium" maxlength="20"/>
  54. <c:if test="${productCategory eq 1}">
  55. <label>供应商名称:</label>
  56. <form:input path="shopName" htmlEscape="false" class="input-medium" maxlength="20"/>
  57. </c:if>
  58. &nbsp;&nbsp; <input id="btnSubmit" class="btn btn-primary" type="submit" value="搜索"/>
  59. <div class="clearfix"></div>
  60. </div>
  61. </form:form>
  62. <sys:message content="${message}"/>
  63. <table class="table table-striped table-bordered table-condensed table-hover">
  64. <tr>
  65. <th style="width:20px;"></th>
  66. <th>商品ID</th>
  67. <th>商品图片</th>
  68. <th>商品名称</th>
  69. <c:if test="${productCategory eq 1}">
  70. <th>供应商名称</th>
  71. </c:if>
  72. </tr>
  73. <tbody>
  74. <c:if test="${not empty page.list}">
  75. <c:forEach items="${page.list}" var="item">
  76. <tr id="${item.productID}" class="itemtr">
  77. <th>
  78. <input class="check-item" type="radio" name="info" value='${fns:toJson(item)}'/>
  79. </th>
  80. <td>${item.productID}</td>
  81. <td><img src="${item.mainImage}" width="50px" height="50px"></td>
  82. <td>${item.name}</td>
  83. <c:if test="${productCategory eq 1}">
  84. <td>${item.shopName}</td>
  85. </c:if>
  86. </tr>
  87. </c:forEach>
  88. </c:if>
  89. </tbody>
  90. </table>
  91. <c:if test="${empty page.list}">
  92. <p style="text-align: center;"><font color="#1e90ff">暂无数据……</font></p>
  93. </c:if>
  94. <div class="pagination">${page}</div>
  95. <script type="text/javascript">
  96. $(document).ready(function () {
  97. //弹出框去滚动条
  98. top.$('#jbox-content').css("overflow-y", "hidden");
  99. show_title(30);
  100. });
  101. function page(n, s) {
  102. $("#pageNo").val(n);
  103. $("#pageSize").val(s);
  104. $("#searchForm").submit();
  105. return false;
  106. }
  107. function getCheckedItems() {
  108. var item = $('.check-item:checked').val();
  109. var product = JSON.parse(item);
  110. var link = '';
  111. if (${productCategory eq 1}) {
  112. link = "${fns:getConfig('wwwServer')}product-" + product.productID + ".html";
  113. } else {
  114. link = "${fns:getConfig('wwwServer')}flea-market-" + product.productID + ".html";
  115. }
  116. var items = {
  117. "id": "",
  118. "productId": product.productID,
  119. "validFlag": product.validFlag,
  120. "image": product.mainImage,
  121. "name": product.name,
  122. "shopName": product.shopName,
  123. "link": link,
  124. "sort": 1,
  125. "pcStatus": "1",
  126. "appletsStatus": "1",
  127. "recommend": "0",
  128. "label": "",
  129. "createDate": ""
  130. };
  131. return items;
  132. }
  133. function clickAllSelect(ckb) {
  134. var isChecked = ckb.checked;
  135. $(".check-item").attr('checked', isChecked);
  136. }
  137. /**
  138. * @param obj
  139. * jquery控制input只能输入数字
  140. */
  141. function onlynum(obj) {
  142. obj.value = obj.value.replace(/[^\d]/g, ""); //清除"数字"以外的字符
  143. }
  144. </script>
  145. </body>
  146. </html>