cmDistributionAddProduct.jsp 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. <%@ page contentType="text/html;charset=UTF-8" %>
  2. <%@ include file="/WEB-INF/views/include/taglib.jsp" %>
  3. <html>
  4. <head>
  5. <title>选择商品</title>
  6. <meta name="decorator" content="default"/>
  7. <style type="text/css">
  8. .table td i {
  9. margin: 0 2px;
  10. }
  11. </style>
  12. <script type="text/javascript">
  13. $(document).ready(function () {
  14. $("#searchForm").validate({
  15. submitHandler: function (form) {
  16. var isSubMitFlag = true;
  17. var productID = $("#productID").val();
  18. if (isNaN(productID) || productID.indexOf('0') == 0) {
  19. alertx("请输入正确的商品ID");
  20. isSubMitFlag = false;
  21. return false;
  22. }
  23. if (isSubMitFlag) {
  24. form.submit();
  25. }
  26. }
  27. })
  28. });
  29. </script>
  30. </head>
  31. <body>
  32. <form:form id="searchForm" modelAttribute="product" action="${ctx}${url}" method="post"
  33. class="breadcrumb form-search">
  34. <input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
  35. <input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
  36. <input id="distributionId" name="distributionId" type="hidden" value="${distributionId}"/>
  37. <div class="ul-form">
  38. <label>商品ID:</label>
  39. <form:input path="productID" id="productID" htmlEscape="false" maxlength="8" class="input-mini"
  40. onkeyup="onlynum(this)"/>
  41. <label>商品名称:</label>
  42. <form:input path="name" htmlEscape="false" class="input-medium" maxlength="20"/>
  43. <label>供应商名称:</label>
  44. <form:input path="shopName" htmlEscape="false" class="input-medium" maxlength="20"/>
  45. &nbsp;&nbsp; <input id="btnSubmit" class="btn btn-primary" type="submit" value="搜索"/>
  46. <div class="clearfix"></div>
  47. </div>
  48. </form:form>
  49. <sys:message content="${message}"/>
  50. <table class="table table-striped table-bordered table-condensed table-hover">
  51. <tr>
  52. <th style="width:20px;"></th>
  53. <th>商品ID</th>
  54. <th>商品图片</th>
  55. <th>商品名称</th>
  56. <th>供应商名称</th>
  57. </tr>
  58. <tbody>
  59. <c:if test="${not empty page.list}">
  60. <c:forEach items="${page.list}" var="item" varStatus="index">
  61. <tr id="${item.productID}" class="itemtr">
  62. <th>
  63. <input class="check-item" type="radio" name="info" value='${item.productID}'/>
  64. </th>
  65. <td>${item.productID}</td>
  66. <td><img class="mainImage" src="${item.mainImage}" width="50px" height="50px"></td>
  67. <td class="name">${item.name}</td>
  68. <td id="shopName">${item.shopName}</td>
  69. <input type="hidden" value="${item.price}" id="price">
  70. <input type="hidden" value="${index.index}" id="index">
  71. <input type="hidden" value="${item.includedTax}" id="includedTax">
  72. <input type="hidden" value="${item.invoiceType}" id="invoiceType">
  73. <input type="hidden" value="${item.taxPoint}" id="clubTaxPoint">
  74. <input type="hidden" value="${item.supplierTaxPoint}" id="shopTaxPoint">
  75. <input type="hidden" value="${item.costCheckFlag}" id="costType">
  76. <input type="hidden" value="${item.costPrice}" id="costPrice">
  77. <input type="hidden" value="${item.shopPercent}" id="shopPercent">
  78. </tr>
  79. </c:forEach>
  80. </c:if>
  81. </tbody>
  82. </table>
  83. <c:if test="${empty page.list}">
  84. <p style="text-align: center;"><font color="#1e90ff">暂无数据……</font></p>
  85. </c:if>
  86. <div class="pagination">${page}</div>
  87. <script type="text/javascript">
  88. $(document).ready(function () {
  89. //弹出框去滚动条
  90. top.$('#jbox-content').css("overflow-y", "hidden");
  91. show_title(30);
  92. });
  93. function page(n, s) {
  94. $("#pageNo").val(n);
  95. $("#pageSize").val(s);
  96. $("#searchForm").submit();
  97. return false;
  98. }
  99. function getCheckedItems() {
  100. var items = new Array();
  101. var $items = $('.check-item:checked');
  102. $items.each(function () {
  103. var c={};
  104. c= ${productList};
  105. var index= $(this).parents(".itemtr").find("#index").val();
  106. var s=c[index].skuList;
  107. items.push({
  108. productId: $(this).val(),
  109. skuList: s,
  110. mainImage: $(this).parents(".itemtr").find(".mainImage").attr("src"),
  111. name: $(this).parents(".itemtr").find(".name").text(),
  112. shopName: $(this).parents(".itemtr").find("#shopName").text(),
  113. price: $(this).parents(".itemtr").find("#price").val(),
  114. includedTax: $(this).parents(".itemtr").find("#includedTax").val(),
  115. invoiceType: $(this).parents(".itemtr").find("#invoiceType").val(),
  116. clubTaxPoint: $(this).parents(".itemtr").find("#clubTaxPoint").val(),
  117. shopTaxPoint: $(this).parents(".itemtr").find("#shopTaxPoint").val(),
  118. costType: $(this).parents(".itemtr").find("#costType").val(),
  119. costPrice: $(this).parents(".itemtr").find("#costPrice").val(),
  120. shopPercent: $(this).parents(".itemtr").find("#shopPercent").val()
  121. })
  122. });
  123. return items;
  124. }
  125. function clickAllSelect(ckb) {
  126. var isChecked = ckb.checked;
  127. $(".check-item").attr('checked', isChecked);
  128. }
  129. /**
  130. * @param obj
  131. * jquery控制input只能输入数字
  132. */
  133. function onlynum(obj) {
  134. obj.value = obj.value.replace(/[^\d]/g, ""); //清除"数字"以外的字符
  135. }
  136. </script>
  137. </body>
  138. </html>