123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232 |
- <%--
- Created by IntelliJ IDEA.
- User: Administrator
- Date: 2020/4/9
- Time: 19:54
- To change this template use File | Settings | File Templates.
- --%>
- <%@ 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;
- }
- </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>
- <ul class="nav nav-tabs">
- <li class="${productCategory eq 1 ? 'active':''}"><a
- href="${ctx}/newhome/newPageFloor/addProductImage?productCategory=1">添加商品</a></li>
- <li class="${productCategory eq 2 ? 'active':''}"><a
- href="${ctx}/newhome/newPageFloor/addProductImage?productCategory=2&productIds=${productIds}">添加二手商品</a>
- </li>
- <li><a href="${ctx}/newhome/newPageFloor/addOtherImage">添加其他图片</a></li>
- </ul>
- <br/>
- <form:form id="searchForm" modelAttribute="product" action="" 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="productIds"/>
- <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"/>
- <c:if test="${productCategory eq 1}">
- <label>供应商名称:</label>
- <form:input path="shopName" htmlEscape="false" class="input-medium" maxlength="20"/>
- </c:if>
- <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="handleClickAllSelect()"/> 全选 </th>
- <th>商品ID</th>
- <th>商品图片</th>
- <th>商品名称</th>
- <c:if test="${productCategory eq 1}">
- <th>供应商名称</th>
- </c:if>
- </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" value='${fns:toJson(item)}' onclick="ClickSelect()"/>
- </th>
- <td>${item.productID}</td>
- <td><img src="${item.mainImage}" width="50px" height="50px"></td>
- <td>${item.name}</td>
- <c:if test="${productCategory eq 1}">
- <td>${item.shopName}</td>
- </c:if>
- </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">
- var isCheckedAll = false;
- $(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() {
- var item = $('.check-item:checked').val();
- if(!item){
- alertx("请勾选商品~");
- return;
- }
- var imageArray = [];
- $(".check-item:checked").each(function (index,el) {
- var item = $(this).val();
- var product = JSON.parse(item);
- var link = '';
- if (${productCategory eq 1}) {
- link = "${fns:getConfig('wwwServer')}product-" + product.productID + ".html";
- } else {
- link = "${fns:getConfig('wwwServer')}flea-market-" + product.productID + ".html";
- }
- var items = {
- "id": "",
- "productId": product.productID,
- "validFlag": product.validFlag,
- "image": product.mainImage,
- "name": product.name,
- "link": link,
- "sort": 1,
- "pcStatus": "1",
- "appletsStatus": "1",
- "label": "",
- "createDate": ""
- };
- imageArray.push(items);
- })
- return imageArray;
- }
- function handleClickAllSelect() {
- var inputIsCheckedAll = $('.check-all').attr('checked');
- var imageArray = [];
- if(inputIsCheckedAll){
- isCheckedAll = 'true';
- $(".check-item").attr('checked', true);
- $(".check-item").each(function (index,el) {
- var item = $(this).val();
- var product = JSON.parse(item);
- var link ='';
- if (${productCategory eq 1}) {
- link = "${fns:getConfig('wwwServer')}product-" + product.productID + ".html";
- } else {
- link = "${fns:getConfig('wwwServer')}flea-market-" + product.productID + ".html";
- }
- var items = {
- "id": "",
- "productId": product.productID,
- "validFlag": product.validFlag,
- "image": product.mainImage,
- "name": product.name,
- "link": link,
- "sort": 1,
- "pcStatus": "1",
- "appletsStatus": "1",
- "label": "",
- "createDate": ""
- };
- imageArray.push(items);
- })
- }else{
- isCheckedAll = 'false';
- $(".check-item").attr('checked', false);
- imageArray = [];
- }
- return imageArray;
- }
- function ClickSelect(){
- isCheckedAll = 'checkedData';
- $(".check-all").attr('checked', false);
- var imageArray = [];
- $(".check-item:checked").each(function (index,el) {
- // console.log('*****');
- var item = $(this).val();
- var product = JSON.parse(item);
- var link ='';
- if (${productCategory eq 1}) {
- link = "${fns:getConfig('wwwServer')}product-" + product.productID + ".html";
- } else {
- link = "${fns:getConfig('wwwServer')}flea-market-" + product.productID + ".html";
- }
- var items = {
- "id": "",
- "productId": product.productID,
- "validFlag": product.validFlag,
- "image": product.mainImage,
- "name": product.name,
- "link": link,
- "sort": 1,
- "pcStatus": "1",
- "appletsStatus": "1",
- "label": "",
- "createDate": ""
- };
- imageArray.push(items);
- })
- // console.log(imageArray);
- return imageArray;
- }
- function handleCheckedAll() {
- return isCheckedAll;
- }
- /**
- /**
- * @param obj
- * jquery控制input只能输入数字
- */
- function onlynum(obj) {
- obj.value = obj.value.replace(/[^\d]/g, ""); //清除"数字"以外的字符
- }
- </script>
- </body>
- </html>
|