123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175 |
- <%@ page contentType="text/html;charset=UTF-8" %>
- <%@ include file="/WEB-INF/views/include/taglib.jsp" %>
- <html>
- <head>
- <title>选择商品</title>
- <meta name="decorator" content="default"/>
- <style type="text/css">
- .table td i {
- margin: 0 2px;
- }
- .discount{
- display: inline;
- }
- </style>
- <script type="text/javascript">
- $(document).ready(function () {
- $("#searchForm").validate({
- submitHandler: function (form) {
- var isSubMitFlag = true;
- var productID = $("#productID").val();
- if (isNaN(productID) || productID.indexOf('0') == 0 ) {
- alertx("请输入正确的商品ID");
- isSubMitFlag = false;
- return false;
- }
- if (isSubMitFlag) {
- form.submit();
- }
- }
- })
- });
- </script>
- </head>
- <body>
- <form:form id="searchForm" modelAttribute="product" action="${ctx}/svip/cmSvipProduct/findProductPage" method="post"
- class="breadcrumb form-search">
- <input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
- <input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
- <form:hidden path="ids"/>
- <div class="ul-form">
- <label>商品ID:</label>
- <form:input path="productID" id="productID" htmlEscape="false" maxlength="8" class="input-mini" onkeyup="onlynum(this)"/>
- <label>商品名称:</label>
- <form:input path="name" htmlEscape="false" class="input-medium" maxlength="20"/>
- <label>供应商名称:</label>
- <form:input path="shopName" htmlEscape="false" class="input-medium" maxlength="20"/>
- <input id="btnSubmit" class="btn btn-primary" type="submit" value="搜索"/>
- <div class="clearfix"></div>
- </div>
- </form:form>
- <sys:message content="${message}"/>
- <table class="table table-striped table-bordered table-condensed table-hover">
- <tr>
- <th style="width:20px;"><input class="check-all" type="checkbox" onclick="clickAllSelect(this)"/> 全选</th>
- <th>商品ID</th>
- <th>商品图片</th>
- <th>商品名称</th>
- <th>供应商</th>
- <th>机构价</th>
- <th style="width: 140px !important;">会员折扣</th>
- <th style="width: 140px !important;">会员价</th>
- </tr>
- <tbody>
- <c:if test="${not empty page.list}">
- <c:forEach items="${page.list}" var="item">
- <tr id="${item.productID}" class="itemtr">
- <th>
- <input class="check-item" type="checkbox" name="info" ${item.existsFlag eq 1?'disabled':''} value='${item.productID}'/>
- </th>
- <td>${item.productID}</td>
- <td><img class="mainImage" src="${item.mainImage}" width="50px" height="50px"></td>
- <td class="productName">${item.name}</td>
- <td>${item.shopName}</td>
- <td>¥${item.price1}</td>
- <td><input class="discount" id="discount${item.productID}" onchange="changeDiscount(${item.productID},1)" type="number" maxlength="11" style="width: 100px"> %</td>
- <td><input class="discountPrice" id="discountPrice${item.productID}" onchange="changeDiscount(${item.productID},2)" type="number" maxlength="11" style="width: 100px"></td>
- </tr>
- </c:forEach>
- </c:if>
- </tbody>
- </table>
- <c:if test="${empty page.list}">
- <p style="text-align: center;"><font color="#1e90ff">暂无数据……</font></p>
- </c:if>
- <div class="pagination">${page}</div>
- <script type="text/javascript">
- $(document).ready(function () {
- //弹出框去滚动条
- top.$('#jbox-content').css("overflow-y", "hidden");
- show_title(30);
- });
- function page(n, s) {
- $("#pageNo").val(n);
- $("#pageSize").val(s);
- $("#searchForm").submit();
- return false;
- }
- function getCheckedItems() {
- debugger
- var items = new Array();
- var $items = $('.check-item:checked');
- var error = 0;
- $items.each(function () {
- let discount = $(this).parents(".itemtr").find(".discount").val();
- let discountPrice = $(this).parents(".itemtr").find(".discountPrice").val();
- if (discount == '' && discountPrice == '') {
- error = -1;
- }
- items.push({
- productId: $(this).val(),
- discount: discount,
- discountPrice: discountPrice
- });
- });
- return error == -1 ? error : items;
- }
- function clickAllSelect(ckb) {
- var isChecked = ckb.checked;
- var $items = $('.check-item');
- $items.each(function(){
- var disabled = $(this).attr('disabled');
- if (disabled != 'disabled') {
- $(this).attr('checked', isChecked)
- }
- });
- }
- /**
- * @param obj
- * jquery控制input只能输入数字
- */
- function onlynum(obj) {
- obj.value = obj.value.replace(/[^\d]/g, ""); //清除"数字"以外的字符
- }
- /**
- * 更改折扣/折扣价
- */
- function changeDiscount(productId,priceType) {
- debugger
- if (priceType == 1) {
- var val = $("#discount" + productId).val();
- if (val > 100 || val <0) {
- $.jBox.tip("请输入0-100之间的数字", 'info');
- val = '';
- $("#discount" + productId).val('');
- }else {
- val = Number(val).toFixed(2);
- $("#discount" + productId).val(val);
- }
- if (val != '' && val != undefined) {
- $("#discountPrice"+productId).attr('readonly', 'readonly');
- } else {
- $("#discountPrice"+productId).removeAttr('readonly');
- }
- } else {
- var val = $("#discountPrice" + productId).val();
- if (val != '' && val != undefined) {
- val = Number(val).toFixed(2);
- $("#discountPrice" + productId).val(val);
- $("#discount"+productId).attr('readonly', 'readonly');
- } else {
- $("#discount" + productId).removeAttr('readonly');
- }
- }
- }
- </script>
- </body>
- </html>
|