Quellcode durchsuchen

呵呵商城改版part3

Aslee vor 3 Jahren
Ursprung
Commit
cc46981e75

+ 11 - 0
src/main/java/com/caimei/modules/cmpage/web/CmPageCentreController.java

@@ -85,6 +85,10 @@ public class CmPageCentreController extends BaseController {
         if ("6".equals(cmPageCentre.getType()) || "7".equals(cmPageCentre.getType())) {
             return "modules/cmpage/cmPageActivityCentreList";
         }
+        //呵呵商城首页楼层
+        if ("8".equals(cmPageCentre.getType())) {
+            return "modules/hehe/cmHeheCentreList";
+        }
         return "modules/cmpage/cmPageCentreList";
     }
 
@@ -100,6 +104,10 @@ public class CmPageCentreController extends BaseController {
         if ("6".equals(cmPageCentre.getType()) || "7".equals(cmPageCentre.getType())) {
             return "modules/cmpage/cmPageActivityCentreForm";
         }
+        //呵呵商城商品楼层
+        if ("8".equals(cmPageCentre.getType())) {
+            return "modules/hehe/cmHeheCentreForm";
+        }
         return "modules/cmpage/cmPageCentreForm";
     }
 
@@ -229,6 +237,9 @@ public class CmPageCentreController extends BaseController {
         if ("7".equals(newPageFloorContent.getType())) {
             return "modules/newhome/beautyFloorContentForm";
         }
+        if ("8".equals(newPageFloorContent.getType())) {
+            return "modules/hehe/cmHeheFloorContentForm";
+        }
         return "modules/newhome/newPageFloorContentForm";
     }
 

+ 4 - 0
src/main/java/com/caimei/modules/hehe/dao/CmHeheProductDao.java

@@ -52,4 +52,8 @@ public interface CmHeheProductDao extends CrudDao<CmHeheProduct> {
     void addActivityProduct(@Param("productId") Integer productId, @Param("activityId") Integer activityId);
 
     void addFloorProduct(@Param("productId") String productId, @Param("floorId") String floorId);
+
+    List<Integer> findHeHeFloorProductIds();
+
+    List<Product> findAllHeheProduct(Product product);
 }

+ 23 - 1
src/main/java/com/caimei/modules/hehe/service/CmHeheProductService.java

@@ -7,15 +7,16 @@ import com.caimei.modules.product.entity.Product;
 import com.caimei.utils.AppUtils;
 import com.caimei.utils.MathUtil;
 import com.caimei.utils.StringUtil;
-import com.caimei.utils.StringUtils;
 import com.thinkgem.jeesite.common.config.Global;
 import com.thinkgem.jeesite.common.persistence.Page;
 import com.thinkgem.jeesite.common.service.CrudService;
+import com.thinkgem.jeesite.common.utils.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
 import java.math.BigDecimal;
+import java.util.ArrayList;
 import java.util.List;
 
 /**
@@ -112,4 +113,25 @@ public class CmHeheProductService extends CrudService<CmHeheProductDao, CmHehePr
         cmHeheProductDao.update(cmHeheProduct);
     }
 
+    public Page<Product> findHeheFloorProduct(Page<Product> productPage, Product product) {
+        product.setPage(productPage);
+        List<Integer> ids = new ArrayList<>();
+        if (com.thinkgem.jeesite.common.utils.StringUtils.isNotBlank(product.getProductIds())) {
+            String[] productIds = product.getProductIds().split(",");
+            for (String productId : productIds) {
+                if (StringUtils.isNotBlank(productId)) {
+                    ids.add(Integer.valueOf(productId));
+                }
+            }
+        }
+        product.setIds(ids);
+        List<Product> productList = cmHeheProductDao.findAllHeheProduct(product);
+        productList.forEach(item -> {
+            if (StringUtil.isNotBlank(item.getMainImage())) {
+                item.setMainImage(AppUtils.getImageURL("product", item.getMainImage(), 0, "https://www.caimei365.com/"));
+            }
+        });
+        productPage.setList(productList);
+        return productPage;
+    }
 }

+ 26 - 0
src/main/java/com/caimei/modules/newhome/entity/NewPageFloorImage.java

@@ -32,6 +32,11 @@ public class NewPageFloorImage implements Serializable {
      */
     private Integer productId;
 
+    /**
+     * 供应商名称
+     */
+    private String shopName;
+
     /**
      * 名称
      */
@@ -77,6 +82,11 @@ public class NewPageFloorImage implements Serializable {
      */
     private String appletsStatus;
 
+    /**
+     * 推荐状态:0不推荐 1推荐
+     */
+    private String recommend;
+
     /**
      * 排序
      */
@@ -227,4 +237,20 @@ public class NewPageFloorImage implements Serializable {
     public void setDisplaySort(Integer displaySort) {
         this.displaySort = displaySort;
     }
+
+    public String getRecommend() {
+        return recommend;
+    }
+
+    public void setRecommend(String recommend) {
+        this.recommend = recommend;
+    }
+
+    public String getShopName() {
+        return shopName;
+    }
+
+    public void setShopName(String shopName) {
+        this.shopName = shopName;
+    }
 }

+ 17 - 0
src/main/java/com/caimei/modules/newhome/web/NewPageFloorController.java

@@ -1,5 +1,7 @@
 package com.caimei.modules.newhome.web;
 
+import com.caimei.modules.hehe.entity.CmHeheProduct;
+import com.caimei.modules.hehe.service.CmHeheProductService;
 import com.caimei.modules.newhome.entity.NewPageFloor;
 import com.caimei.modules.newhome.entity.NewPageFloorContent;
 import com.caimei.modules.newhome.entity.NewPageFloorImage;
@@ -46,6 +48,9 @@ public class NewPageFloorController extends BaseController {
     @Autowired
     private ProductService productService;
 
+    @Autowired
+    private CmHeheProductService cmHeheProductService;
+
     @Autowired
     private RedisService redisService;
 
@@ -288,6 +293,18 @@ public class NewPageFloorController extends BaseController {
         }
     }
 
+    /**
+     * 呵呵商城首页楼层添加图片
+     */
+    @RequestMapping("/addHeheImage")
+    public String addHeheImage(Product product, Model model, HttpServletRequest request, HttpServletResponse response) {
+        Page<Product> page = cmHeheProductService.findHeheFloorProduct(new Page<Product>(request, response), product);
+        model.addAttribute("page", page);
+        model.addAttribute("productCategory", product.getProductCategory());
+        model.addAttribute("productIds", product.getProductIds());
+        return "modules/hehe/addHeheProductImage";
+    }
+
     /**
      * 添加其他图片
      */

+ 4 - 1
src/main/resources/mappings/modules/cmpage/CmPageCentreMapper.xml

@@ -189,13 +189,16 @@
 		  a.`label`,
 		  a.pcStatus,
 		  a.appletsStatus,
+		  a.recommend,
 		  a.sort,
 		  a.displaySort,
 		  DATE_FORMAT(a.createDate, '%Y-%m-%d %H:%i:%S') AS createDate,
-		  p.validFlag
+		  p.validFlag,
+		  s.name as shopName
 		FROM
 		  new_page_floor_image a
 		  LEFT JOIN product p ON a.productId = p.productID
+		  LEFT JOIN shop s on p.shopID = s.shopID
 		WHERE
 		  a.centreId = #{centreId}
 	</select>

+ 36 - 0
src/main/resources/mappings/modules/hehe/CmHeheProductMapper.xml

@@ -212,6 +212,42 @@
 	<select id="findProductActivity" resultType="java.lang.Integer">
 		select activityId from cm_hehe_activity_product where productId = #{productId}
 	</select>
+	<select id="findHeHeFloorProductIds" resultType="java.lang.Integer">
+		select i.productId from new_page_floor_image i left join cm_page_centre c on i.centreId = c.id
+		left join cm_page p on c.pageId = p.id
+		where p.type = 8
+	</select>
+	<select id="findAllHeheProduct" resultType="com.caimei.modules.product.entity.Product">
+		SELECT
+			a.*,s.name AS "shopName"
+		FROM cm_hehe_product chp left join product a on chp.productId = a.productID
+				 LEFT JOIN shop s on s.shopID = a.shopID
+		<where>
+			<if test="productID != null" >
+				AND a.productID = #{productID}
+			</if>
+			<if test="name != null and name != ''">
+				AND a.name LIKE concat('%',#{name},'%')
+			</if>
+			<if test="shopName != null and shopName != ''">
+				AND s.name LIKE concat('%',#{shopName},'%')
+			</if>
+			<if test="ids != null and ids.size() > 0 ">
+				AND a.productID NOT IN
+				<foreach collection="ids" open="(" close=")" item="id" separator=",">
+					#{id}
+				</foreach>
+			</if>
+		</where>
+		<choose>
+			<when test="page !=null and page.orderBy != null and page.orderBy != ''">
+				ORDER BY ${page.orderBy}
+			</when>
+			<otherwise>
+				order by a.productID
+			</otherwise>
+		</choose>
+	</select>
 
 
 	<update id="deleteActivityProduct">

+ 2 - 2
src/main/resources/mappings/modules/newhome/NewPageFloorMapper.xml

@@ -229,13 +229,13 @@
 	<insert id="insertFloorImage">
 		INSERT INTO `new_page_floor_image` (
 		  `floorId`, `productId`, `name`, `link`,
-		  `image`,`appletsImage`, `adsImage`, `label`, `content`, `pcStatus`, `appletsStatus`,
+		  `image`,`appletsImage`, `adsImage`, `label`, `content`, `pcStatus`, `appletsStatus`, `recommend`,
 		  `sort`, `createDate`, centreId, displaySort
 		)
 		VALUES
 		  (
 			#{floorId}, #{productId}, #{name}, #{link},
-			#{image},#{appletsImage}, #{adsImage}, #{label}, #{content}, #{pcStatus}, #{appletsStatus},
+			#{image},#{appletsImage}, #{adsImage}, #{label}, #{content}, #{pcStatus}, #{appletsStatus}, #{recommend},
 			#{sort}, #{createDate}, #{centreId}, #{displaySort}
 		  )
 	</insert>

+ 153 - 0
src/main/webapp/WEB-INF/views/modules/hehe/addHeheProductImage.jsp

@@ -0,0 +1,153 @@
+<%--
+  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="active"><a
+            href="${ctx}/newhome/newPageFloor/addHeheImage">添加商品</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>
+        &nbsp;&nbsp; <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;"></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="radio" name="info" value='${fns:toJson(item)}'/>
+                </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">
+    $(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();
+        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,
+            "shopName": product.shopName,
+            "link": link,
+            "sort": 1,
+            "pcStatus": "1",
+            "appletsStatus": "1",
+            "recommend": "0",
+            "label": "",
+            "createDate": ""
+        };
+        return items;
+    }
+
+    function clickAllSelect(ckb) {
+        var isChecked = ckb.checked;
+        $(".check-item").attr('checked', isChecked);
+    }
+
+    /**
+     * @param obj
+     * jquery控制input只能输入数字
+     */
+    function onlynum(obj) {
+        obj.value = obj.value.replace(/[^\d]/g, ""); //清除"数字"以外的字符
+    }
+</script>
+</body>
+</html>
+

+ 78 - 0
src/main/webapp/WEB-INF/views/modules/hehe/cmHeheCentreForm.jsp

@@ -0,0 +1,78 @@
+<%@ page contentType="text/html;charset=UTF-8" %>
+<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
+<html>
+<head>
+    <title>分类详情商品楼层添加</title>
+    <meta name="decorator" content="default"/>
+    <script type="text/javascript">
+        $(document).ready(function() {
+            //$("#name").focus();
+            $("#inputForm").validate({
+                submitHandler: function(form){
+                    loading('正在提交,请稍等...');
+                    form.submit();
+                },
+                errorContainer: "#messageBox",
+                errorPlacement: function(error, element) {
+                    $("#messageBox").text("输入有误,请先更正。");
+                    if (element.is(":checkbox")||element.is(":radio")||element.parent().is(".input-append")){
+                        error.appendTo(element.parent().parent());
+                    } else {
+                        error.insertAfter(element);
+                    }
+                }
+            });
+        });
+
+        /**
+         * @param obj
+         * jquery控制input只能输入数字
+         */
+        function onlynum(obj) {
+            obj.value = obj.value.replace(/[^\d]/g, ""); //清除"数字"以外的字符
+        }
+    </script>
+</head>
+<body>
+<ul class="nav nav-tabs">
+    <li><a href="${ctx}/cmpage/cmPageCentre/?pageId=${cmPageCentre.pageId}&type=${cmPageCentre.type}">商品楼层列表</a></li>
+    <li class="active"><a href="${ctx}/cmpage/cmPageCentre/form?pageId=${cmPageCentre.pageId}&type=${cmPageCentre.type}">${not empty cmPageCentre.id?'编辑':'添加'}</a></li>
+</ul><br/>
+<form:form id="inputForm" modelAttribute="cmPageCentre" action="${ctx}/cmpage/cmPageCentre/save" method="post" class="form-horizontal">
+    <form:hidden path="id"/>
+    <form:hidden path="pageId"/>
+    <form:hidden path="type"/>
+    <sys:message content="${message}"/>
+    <div class="control-group">
+        <label class="control-label"><span class="help-inline"><font color="red">*</font> </span>楼层标题:</label>
+        <div class="controls">
+            <form:input path="title" htmlEscape="false" maxlength="20" class="input-xlarge required"/>
+        </div>
+    </div>
+    <div class="control-group">
+        <label class="control-label"><span class="help-inline"><font color="red">*</font> </span>描述:</label>
+        <div class="controls">
+            <form:input path="description" htmlEscape="false" maxlength="255" class="input-xlarge required"/>
+        </div>
+    </div>
+    <div class="control-group">
+        <label class="control-label"><span class="help-inline"><font color="red">*</font> </span>排序:</label>
+        <div class="controls">
+            <form:input path="sort" onkeyup="onlynum(this)" htmlEscape="false" maxlength="11" class="input-xlarge required"/>
+        </div>
+    </div>
+    <div class="control-group crmstatus" style="" >
+        <label class="control-label"><span class="help-inline"><font color="red">*</font> </span>状态:</label>
+        <div class="controls">
+            <form:select path="crmEnabledStatus" class="input-xlarge required">
+                <form:options items="${fns:getDictList('enabled_status')}" itemLabel="label" itemValue="value" htmlEscape="false" label="${fns:getDictList('enabled_status')[0]}"/>
+            </form:select>
+        </div>
+    </div>
+    <div class="form-actions">
+        <shiro:hasPermission name="newhome:newPageFloor:edit"><input id="btnSubmit" class="btn btn-primary" type="submit" value="保 存"/>&nbsp;</shiro:hasPermission>
+        <input id="btnCancel" class="btn" type="button" value="返 回" onclick="history.go(-1)"/>
+    </div>
+</form:form>
+</body>
+</html>

+ 176 - 0
src/main/webapp/WEB-INF/views/modules/hehe/cmHeheCentreList.jsp

@@ -0,0 +1,176 @@
+<%@ 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 th {
+            text-align: center;
+        }
+
+        .table td {
+            text-align: center;
+        }
+    </style>
+    <script type="text/javascript">
+        $(document).ready(function () {
+
+        });
+
+        function page(n, s) {
+            $("#pageNo").val(n);
+            $("#pageSize").val(s);
+            $("#searchForm").submit();
+            return false;
+        }
+
+        //PC端状态修改
+        function updateEnabledStatus(status, ids) {
+            var msg = '确定启用该楼层吗?';
+            if ('0' == status) {
+                msg = '确定停用该楼层吗?';
+            }
+            top.$.jBox.confirm(msg, '系统提示', function (v, h, f) {
+                if (v == 'ok') {
+                    $.post("${ctx}/cmpage/cmPageCentre/updateEnabledStatus", {
+                        'enabledStatus': status,
+                        'ids': ids
+                    }, function (data) {
+                        if (true == data.success) {
+                            $.jBox.tip(data.msg, 'info');
+                        } else {
+                            $.jBox.tip(data.msg, 'error');
+                        }
+                        window.location = "${ctx}/cmpage/cmPageCentre/?pageId=${cmPageCentre.pageId}&type=${cmPageCentre.type}";
+                    }, "JSON");//这里返回的类型有:json,html,xml,text
+                }
+                return;
+            }, {buttonsFocus: 1, persistent: true});
+        }
+
+
+        //CRM端状态修改
+        function updateCrmEnabledStatusByIds(status, ids) {
+            var msg = '确定启用该楼层吗?';
+            if ('0' == status) {
+                msg = '确定停用该楼层吗?';
+            }
+            top.$.jBox.confirm(msg, '系统提示', function (v, h, f) {
+                if (v == 'ok') {
+                    $.post("${ctx}/cmpage/cmPageCentre/updateCrmEnabledStatusByIds", {
+                        'crmEnabledStatus': status,
+                        'ids': ids
+                    }, function (data) {
+                        if (true == data.success) {
+                            $.jBox.tip(data.msg, 'info');
+                        } else {
+                            $.jBox.tip(data.msg, 'error');
+                        }
+                        window.location = "${ctx}/cmpage/cmPageCentre/?pageId=${cmPageCentre.pageId}&type=${cmPageCentre.type}";
+                    }, "JSON");//这里返回的类型有:json,html,xml,text
+                }
+                return;
+            }, {buttonsFocus: 1, persistent: true});
+        }
+
+        /**
+         * @param obj
+         * jquery控制input只能输入数字
+         */
+        function onlynum(obj) {
+            obj.value = obj.value.replace(/[^\d]/g, ""); //清除"数字"以外的字符
+        }
+
+        //批量保存排序
+        function batchSaveSort() {
+            var items = new Array();
+            var $items = $('.check-item');
+            $items.each(function () {
+                items.push($(this).val());
+            });
+            //保存批量排序
+            $.post("${ctx}/cmpage/cmPageCentre/batchSaveSort?sortList=" + items, function (data) {
+                if (true == data.success) {
+                    $.jBox.tip(data.msg, 'info');
+                    window.location.href = "${ctx}/cmpage/cmPageCentre/?pageId=${cmPageCentre.pageId}&type=${cmPageCentre.type}";
+                } else {
+                    $.jBox.tip(data.msg, 'error');
+                }
+            }, "JSON");//这里返回的类型有:json,html,xml,text
+        }
+
+        //修改排序值
+        function changeSort(id, sortThis) {
+            var value = sortThis.value;
+            $("#preferredProductSort" + id).val(id + "-" + value);
+        }
+    </script>
+</head>
+<body>
+<ul class="nav nav-tabs">
+        <li class="active"><a href="${ctx}/cmpage/cmPageCentre/?pageId=${cmPageCentre.pageId}&type=${cmPageCentre.type}">商品楼层列表</a>
+    </li>
+</ul>
+<form:form action="" class="breadcrumb form-search">
+    <input class="btn btn-primary" style="width: 70px" onclick="batchSaveSort()" value="一键排序"/>&nbsp;&nbsp;&nbsp;&nbsp;
+    <input class="btn btn-primary" style="width: 70px"
+           onclick="window.location='${ctx}/cmpage/cmPageCentre/form?pageId=${cmPageCentre.pageId}&type=${cmPageCentre.type}'"
+           value="添加楼层"/>&nbsp;&nbsp;&nbsp;&nbsp;
+    <div style="margin-top: 10px">
+        <label><font color="#a9a9a9">注:排序值越小越靠前</font></label>
+    </div>
+</form:form>
+<sys:message content="${message}"/>
+<table id="contentTable" class="table table-striped table-bordered table-condensed">
+    <thead>
+    <tr>
+        <th>ID</th>
+        <th>楼层名称</th>
+        <th>描述</th>
+        <th>状态</th>
+        <th>排序</th>
+        <th>创建时间</th>
+        <shiro:hasPermission name="newhome:newPageFloor:edit">
+            <th>操作</th>
+        </shiro:hasPermission>
+    </tr>
+    </thead>
+    <tbody>
+    <c:forEach items="${page.list}" var="newPageFloor">
+        <tr>
+            <input class="check-item" type="hidden" id="preferredProductSort${newPageFloor.id}"
+                   value='${newPageFloor.id}-${newPageFloor.sort}'/>
+            <td>${newPageFloor.id}</td>
+            <td>${newPageFloor.title}</td>
+            <td>${newPageFloor.description}</td>
+            <td>
+                <c:if test="${newPageFloor.crmEnabledStatus eq 1 }">
+                    <font color="green">已启用</font>
+                    <a href="javascript:void(0);" onclick="updateCrmEnabledStatusByIds('0','${newPageFloor.id}');">
+                        停用
+                    </a>
+                </c:if>
+                <c:if test="${newPageFloor.crmEnabledStatus ne 1 }">
+                    <font color="red">已停用</font>
+                    <a href="javascript:void(0)" onclick="updateCrmEnabledStatusByIds('1','${newPageFloor.id}');">
+                        启用
+                    </a>
+                </c:if>
+            </td>
+            <td><input id="sort" name="sort" style="width:50px;" value="${newPageFloor.sort}" onkeyup="onlynum(this)"
+                       onchange="changeSort(${newPageFloor.id},this)"></td>
+            <td><fmt:formatDate value="${newPageFloor.createDate}" pattern="yyyy-MM-dd HH:mm:ss"/></td>
+            <td>
+                <a href="${ctx}/cmpage/cmPageCentre/form?pageId=${cmPageCentre.pageId}&type=${cmPageCentre.type}&id=${newPageFloor.id}">编辑</a>
+                <a href="${ctx}/cmpage/cmPageCentre/goContentPage?centreId=${newPageFloor.id}&pageId=${cmPageCentre.pageId}&type=${cmPageCentre.type}">内容</a>
+                <a href="${ctx}/cmpage/cmPageCentre/delete?id=${newPageFloor.id}&type=${cmPageCentre.type}"
+                   onclick="return confirmx('是否删除该数据,删除后,对应的楼层数据也将被全部删除,确认是否删除', this.href)">删除</a>
+            </td>
+        </tr>
+    </c:forEach>
+    </tbody>
+</table>
+<div class="pagination">${page}</div>
+</body>
+</html>

+ 964 - 0
src/main/webapp/WEB-INF/views/modules/hehe/cmHeheFloorContentForm.jsp

@@ -0,0 +1,964 @@
+<%@ page import="java.util.Date" %>
+<%@ 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>
+        .iconBox {
+            font-size: 0;
+            margin-left: 130px !important;
+        }
+
+        .controls .conList {
+            display: inline-block;
+            margin-right: 15px;
+        }
+
+        .conList .btn:nth-of-type(1) {
+            margin-left: 25px;
+        }
+
+        .upload-content {
+            margin-top: -100px;
+        }
+
+        .upload-content .conList .btn:nth-of-type(1) {
+            width: 90px;
+            height: 100px;
+            border: 2px solid #eee;
+            background: #fff;
+            position: relative;
+        }
+
+        .upload-content .conList .btn:nth-of-type(1) > div {
+            position: absolute;
+            top: 50%;
+            left: 50%;
+            transform: translate(-50%, -50%);
+            color: #666;
+        }
+
+        .upload-content .conList .btn:nth-of-type(1) span {
+            font-size: 35px;
+        }
+
+        .upload-content .conList .btn:nth-of-type(1) h5 {
+            color: #666;
+        }
+
+        .cancel-upload {
+            background: transparent;
+            border: none;
+            box-shadow: none;
+            position: relative;
+            top: -38px;
+            left: -25px;
+            cursor: pointer;
+            z-index: 100;
+        }
+
+        .upload-content .conList ol li {
+            width: 114px;
+            min-height: 80px;
+            text-align: center;
+            background: #fff;
+            position: relative;
+            top: 120px;
+            margin-left: 2px;
+        }
+
+        .hide-pic {
+            display: none !important;
+        }
+
+        td {
+            border: solid black;
+            border-width: 0px 1px 1px 0px;
+        }
+
+        table {
+            border-collapse: inherit;
+            border: solid black;
+            border-width: 1px 0px 0px 1px;
+        }
+
+        .table-striped {
+            margin-right: 10px;
+        }
+
+        .table-striped td {
+            border-collapse: inherit;
+            border: 1px solid #ddd;
+            border-width: 1px 0px 0px 1px;
+        }
+
+        .table-striped th, .table-striped td {
+            text-align: center !important;
+        }
+
+        select {
+            width: 85px;
+            line-height: 25px;
+            height: 25px
+        }
+
+        .tbMargin {
+            margin: 15px 17px;
+        }
+
+        em {
+            background: #d7d7d7;
+            color: black;
+            padding: 2px 8px;
+            font-style: normal;
+            font-size: 14px;
+            display: inline-block;
+            border-radius: 2px
+        }
+
+        .middleEm {
+            position: absolute;
+            left: 40%;
+            margin-top: 7px;
+        }
+
+        .rightEm {
+            float: right;
+            margin-top: 7px;
+            margin-right: 10px;
+        }
+
+        .templateButton {
+            margin: 15px 0 15px 15px !important;
+        }
+
+        .displayTemplate, .mallTemplate {
+            position: relative;
+        }
+
+        .templateImageTable {
+            margin-left: 20px;
+        }
+
+        .templateImageDiv {
+            padding: 5px 10px;
+            text-align: center;
+        }
+
+        #templateTd label {
+            font-weight: bolder;
+            font-size: 18px;
+        }
+
+        #displayDateDiv {
+            height: 30px;
+        }
+    </style>
+    <script type="text/javascript">
+        $(document).ready(function () {
+            //表单提交
+            $("#inputForm").validate({
+                submitHandler: function (form) {
+                    var templateType = $("input[name='templateType']:checked").val();
+                    if (templateType == '' || templateType == undefined) {
+                        alertx("请配置模板图片区域");
+                        return;
+                    }
+                    var displayDateNo = $("input[name='displayDateRadio']:checked").val();
+                    if (productImageList.length > 0) {
+                        var stringify = JSON.stringify(productImageList);
+                        $('#images').val(stringify);
+                    } else {
+                        alertx("至少上传一张图片");
+                        return;
+                    }
+                    var appletsIcon1 = $("#appletsIcon1").val();
+                    var appletsIcon2 = $("#appletsIcon2").val();
+                    var appletsIcon3 = $("#appletsIcon3").val();
+                    var appletsIcon4 = $("#appletsIcon4").val();
+                    var appletsIcon5 = $("#appletsIcon5").val();
+                    debugger
+                    if (templateType == 1 || templateType == 2 || templateType == 3 || templateType == 6 || templateType == 7) {
+                        if (appletsIcon1 == '') {
+                            alertx("请上传广告图1");
+                            return;
+                        }
+                        if (templateType == 2 || templateType == 3 || templateType == 6 || templateType == 7) {
+                            if (appletsIcon2 == '') {
+                                alertx("请上传广告图2");
+                                return;
+                            }
+                            if (templateType == 2 || templateType == 6 || templateType == 7) {
+                                if (appletsIcon3 == '') {
+                                    alertx("请上传广告图3");
+                                    return;
+                                }
+                                if ( templateType == 7) {
+                                    if (appletsIcon4 == '') {
+                                        alertx("请上传广告图4");
+                                        return;
+                                    }
+                                    if (appletsIcon5 == '') {
+                                        alertx("请上传广告图5");
+                                        return;
+                                    }
+                                } else {
+                                    $(".Image4 .cancel-upload").click();
+                                    $(".Image5 .cancel-upload").click();
+                                }
+                            } else {
+                                $(".Image3 .cancel-upload").click();
+                                $(".Image4 .cancel-upload").click();
+                                $(".Image5 .cancel-upload").click();
+                            }
+                        } else {
+                            $(".Image2 .cancel-upload").click();
+                            $(".Image3 .cancel-upload").click();
+                            $(".Image4 .cancel-upload").click();
+                            $(".Image5 .cancel-upload").click();
+                        }
+                    } else {
+                        $(".Image1 .cancel-upload").click();
+                        $(".Image2 .cancel-upload").click();
+                        $(".Image3 .cancel-upload").click();
+                        $(".Image4 .cancel-upload").click();
+                        $(".Image5 .cancel-upload").click();
+                    }
+                    $("#formType").val(8);
+                    loading('正在提交,请稍等...');
+                    form.submit();
+                },
+                errorContainer: "#messageBox",
+                errorPlacement: function (error, element) {
+                    $("#messageBox").text("输入有误,请先更正。");
+                    if (element.is(":checkbox") || element.is(":radio") || element.parent().is(".input-append")) {
+                        error.appendTo(element.parent().parent());
+                    } else {
+                        error.insertAfter(element);
+                    }
+                }
+            });
+        });
+    </script>
+</head>
+<body>
+<ul class="nav nav-tabs">
+    <c:if test="${not empty floorContent.floorId}">
+        <li><a href="${ctx}/newhome/newPageFloor/">楼层管理列表</a></li>
+        <li class="active"><a href="${ctx}/newhome/newPageFloor/goContentPage?floorId=${floorContent.floorId}">内容</a>
+        </li>
+    </c:if>
+    <c:if test="${empty floorContent.floorId}">
+        <li><a href="${ctx}/cmpage/cmPageCentre/?pageId=${floorContent.pageId}&type=8">商品楼层列表</a></li>
+        <li class="active"><a
+                href="${ctx}/cmpage/cmPageCentre/goContentPage?pageId=${floorContent.pageId}&centreId=${floorContent.centreId}&type=${floorContent.type}">内容</a>
+        </li>
+    </c:if>
+</ul>
+<br/>
+<form:form id="inputForm" modelAttribute="floorContent" action="${ctx}/newhome/newPageFloor/saveFloorContent"
+           method="post" class="form-horizontal">
+    <form:hidden path="id"/>
+    <form:hidden path="floorId"/>
+    <form:hidden path="centreId"/>
+    <form:hidden path="pageId"/>
+    <form:hidden path="images" id="images"/>
+    <form:hidden path="images2" id="images2"/>
+    <form:hidden path="images3" id="images3"/>
+    <form:hidden path="type"/>
+    <form:hidden path="formType"/>
+    <form:hidden path="redirectFlag"/>
+    <sys:message content="${message}"/>
+    <div class="control-group">
+        楼层名称:<a style="text-decoration:none;">${floorContent.floorTitle}</a>
+    </div>
+    <div class="control-group">
+        <table style="overflow:scroll;height: 400px !important;" class="templateTable">
+            <tr>
+                <td id="templateTd" style="display: block;height: 580px;overflow-y:scroll;width: 380px !important;">
+                    <div>
+                        <div id="pcTemplate" style="position: relative">
+                            <div id="pcTemplate1" class="displayTemplate" style="position: relative;">
+                                <form:radiobutton path="templateType" name="templateType" value="1" label="模板1" id="templateType1"
+                                                  cssClass="templateButton"
+                                                  onclick="showContent()"/>
+                                <div class="templateImageDiv">
+                                    <img src="/static/template/beauty/pc/1.png">
+                                </div>
+                            </div>
+                            <div id="pcTemplate2" class="displayTemplate">
+                                <form:radiobutton path="templateType" name="templateType" value="2" label="模板2" id="templateType2"
+                                                  cssClass="templateButton"
+                                                  onclick="showContent()"/>
+                                <div class="templateImageDiv">
+                                    <img src="/static/template/beauty/pc/2.png">
+                                </div>
+                            </div>
+                            <div id="pcTemplate3" class="displayTemplate">
+                                <form:radiobutton path="templateType" name="templateType" value="3" label="模板3" id="templateType3"
+                                                  cssClass="templateButton"
+                                                  onclick="showContent()"/>
+                                <div class="templateImageDiv">
+                                    <img src="/static/template/beauty/pc/3.png">
+                                </div>
+                            </div>
+                            <div id="pcTemplate4" class="displayTemplate">
+                                <form:radiobutton path="templateType" name="templateType" value="4" label="模板4" id="templateType4"
+                                                  cssClass="templateButton"
+                                                  onclick="showContent()"/>
+                                <div class="templateImageDiv">
+                                    <img src="/static/template/beauty/pc/4.png">
+                                </div>
+                            </div>
+                            <div id="pcTemplate5" class="displayTemplate">
+                                <form:radiobutton path="templateType" name="templateType" value="5" label="模板5" id="templateType5"
+                                                  cssClass="templateButton"
+                                                  onclick="showContent()"/>
+                                <div class="templateImageDiv">
+                                    <img src="/static/template/beauty/pc/5.png">
+                                </div>
+                            </div>
+                            <div id="pcTemplate6" class="displayTemplate">
+                                <form:radiobutton path="templateType" name="templateType" value="6" label="模板6" id="templateType6"
+                                                  cssClass="templateButton"
+                                                  onclick="showContent()"/>
+                                <div class="templateImageDiv">
+                                    <img src="/static/template/beauty/pc/6.png">
+                                </div>
+                            </div>
+                            <div id="pcTemplate7" class="displayTemplate">
+                                <form:radiobutton path="templateType" name="templateType" value="7" label="模板7" id="templateType7"
+                                                  cssClass="templateButton"
+                                                  onclick="showContent()"/>
+                                <div class="templateImageDiv">
+                                    <img src="/static/template/beauty/pc/7.png">
+                                </div>
+                            </div>
+                            <div id="pcTemplate8" class="displayTemplate">
+                                <form:radiobutton path="templateType" name="templateType" value="8" label="模板8" id="templateType8"
+                                                  cssClass="templateButton"
+                                                  onclick="showContent()"/>
+                                <div class="templateImageDiv">
+                                    <img src="/static/template/beauty/pc/8.png">
+                                </div>
+                            </div>
+                            <div id="pcTemplate9" class="displayTemplate">
+                                <form:radiobutton path="templateType" name="templateType" value="9" label="模板9" id="templateType9"
+                                                  cssClass="templateButton"
+                                                  onclick="showContent()"/>
+                                <div class="templateImageDiv">
+                                    <img src="/static/template/beauty/pc/9.png">
+                                </div>
+                            </div>
+                        </div>
+                    </div>
+                </td>
+                <td style=" width: 2800px;">
+                    <div style="height: 100%;overflow-y:scroll;">
+                        <label id="infoLabel"
+                               style="display: none; position: relative;left: 200px;top: 200px; font-weight: bolder;font-size: 30px">请先选择左边模板后,再编辑模板相关内容</label>
+                        <div class="control-group clear Image1" style="display: none">
+                            <div style="float: left">
+                                <span class="help-inline"><font color="red">*</font> </span>广告图1:
+                                <div class="controls upload-content iconBox" id="appletsAdsImage1">
+                                    <div class="conList">
+                                        <form:hidden id="appletsIcon1" path="appletsAdsImage1" htmlEscape="false" maxlength="255"
+                                                     class="input-xlarge required"/>
+                                        <sys:ckfinder input="appletsIcon1" type="images" uploadPath="/photo"
+                                                      selectMultiple="false"
+                                                      maxWidth="100" maxHeight="100"/> <br>
+                                        <label id="pcImageSize1">建议图片分辨率1184px*160px</label>
+                                    </div>
+                                </div>
+                            </div>
+                            <div style="float: left">
+                                <span class="help-inline"></span>链接:
+                                <div class="controls">
+                                    <form:input path="adsLink1" htmlEscape="false" maxlength="255"
+                                                class="input-xlarge"/>
+                                </div>
+                            </div>
+                        </div>
+                        <div class="control-group clear Image2" style="display: none">
+                            <div style="float: left">
+                                <span class="help-inline"><font color="red">*</font> </span>广告图2:
+                                <div class="controls upload-content iconBox" id="appletsAdsImage2">
+                                    <div class="conList">
+                                        <form:hidden id="appletsIcon2" path="appletsAdsImage2" htmlEscape="false" maxlength="255"
+                                                     class="input-xlarge required"/>
+                                        <sys:ckfinder input="appletsIcon2" type="images" uploadPath="/photo"
+                                                      selectMultiple="false"
+                                                      maxWidth="100" maxHeight="100"/><br>
+                                        <label id="pcImageSize2">建议图片分辨率344px*268px</label>
+                                    </div>
+                                </div>
+                            </div>
+                            <div style="float: left">
+                                <span class="help-inline"></span>链接:
+                                <div class="controls">
+                                    <form:input path="adsLink2" htmlEscape="false" maxlength="255"
+                                                class="input-xlarge"/>
+                                </div>
+                            </div>
+                        </div>
+                        <div class="control-group clear Image3" style="display: none">
+                            <div style="float: left">
+                                <span class="help-inline"><font color="red">*</font> </span>广告图3:
+                                <div class="controls upload-content iconBox" id="appletsAdsImage3">
+                                    <div class="conList">
+                                        <form:hidden id="appletsIcon3" path="appletsAdsImage3" htmlEscape="false" maxlength="255"
+                                                     class="input-xlarge required"/>
+                                        <sys:ckfinder input="appletsIcon3" type="images" uploadPath="/photo"
+                                                      selectMultiple="false"
+                                                      maxWidth="100" maxHeight="100"/><br>
+                                        <label id="pcImageSize3">建议图片分辨率344px*268px</label>
+                                    </div>
+                                </div>
+                            </div>
+                            <div style="float: left">
+                                <span class="help-inline"></span>链接:
+                                <div class="controls">
+                                    <form:input path="adsLink3" htmlEscape="false" maxlength="255"
+                                                class="input-xlarge"/>
+                                </div>
+                            </div>
+                        </div>
+                        <div class="control-group clear Image4" style="display: none">
+                            <div style="float: left">
+                                <span class="help-inline"><font color="red">*</font> </span>广告图4:
+                                <div class="controls upload-content iconBox" id="appletsAdsImage4">
+                                    <div class="conList">
+                                        <form:hidden id="appletsIcon4" path="appletsAdsImage4" htmlEscape="false" maxlength="255"
+                                                     class="input-xlarge required"/>
+                                        <sys:ckfinder input="appletsIcon4" type="images" uploadPath="/photo"
+                                                      selectMultiple="false"
+                                                      maxWidth="100" maxHeight="100"/><br>
+                                        <label id="pcImageSize4">建议图片分辨率344px*268px</label>
+                                    </div>
+                                </div>
+                            </div>
+                            <div style="float: left">
+                                <span class="help-inline"></span>链接:
+                                <div class="controls">
+                                    <form:input path="adsLink4" htmlEscape="false" maxlength="255"
+                                                class="input-xlarge"/>
+                                </div>
+                            </div>
+                        </div>
+                        <div class="control-group clear Image5" style="display: none">
+                            <div style="float: left">
+                                <span class="help-inline"><font color="red">*</font> </span>广告图5:
+                                <div class="controls upload-content iconBox" id="appletsAdsImage5">
+                                    <div class="conList">
+                                        <form:hidden id="appletsIcon5" path="appletsAdsImage5" htmlEscape="false" maxlength="255"
+                                                     class="input-xlarge required"/>
+                                        <sys:ckfinder input="appletsIcon5" type="images" uploadPath="/photo"
+                                                      selectMultiple="false"
+                                                      maxWidth="100" maxHeight="100"/><br>
+                                        <label id="pcImageSize5">建议图片分辨率344px*268px</label>
+                                    </div>
+                                </div>
+                            </div>
+                            <div style="float: left">
+                                <span class="help-inline"></span>链接:
+                                <div class="controls">
+                                    <form:input path="adsLink5" htmlEscape="false" maxlength="255"
+                                                class="input-xlarge"/>
+                                </div>
+                            </div>
+                        </div>
+                        <br>
+                        <div class="control-group templateImageTable">
+                            <br><br>
+                            <input class="btn" id="del" style="width: 50px" onclick="batchDeletion()" value="删除"/>&nbsp;&nbsp;&nbsp;&nbsp;
+                            <input class="btn btn-primary" id="sortBtn" style="width: 70px" onclick="batchSaveSort()"
+                                   value="一键排序"/>&nbsp;&nbsp;&nbsp;&nbsp;
+                            <input class="btn btn-primary" id="showSelectBtn" style="width: 70px"
+                                   onclick="showSelect('${ctx}/newhome/newPageFloor/addHeheImage')" value="上线商品"/>&nbsp;&nbsp;&nbsp;&nbsp;
+                            <br><br>
+                            <table id="productImageTable" class="table table-striped table-bordered table-condensed"
+                                   style="display: none">
+                                <thead>
+                                <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>排序</th>
+                                    <th>推荐状态</th>
+                                    <th>添加时间</th>
+                                    <th>操作</th>
+                                </tr>
+                                </thead>
+                                <tbody id="productImageTbody"></tbody>
+                            </table>
+                        </div>
+                    </div>
+                </td>
+            </tr>
+        </table>
+    </div>
+    <div class="form-actions">
+        <shiro:hasPermission name="newhome:newPageFloor:edit"><input id="btnSubmit" class="btn btn-primary"
+                                                                     type="submit" onclick="changeRedirectFlag(1)"
+                                                                     value="保 存"/>&nbsp;</shiro:hasPermission>
+        <input id="btnSubmit" class="btn btn-primary"
+               type="submit" onclick="changeRedirectFlag(0)"
+               value="保存并继续"/>&nbsp;
+        <input id="btnCancel" class="btn" type="button" value="返 回" onclick="history.go(-1)"/>
+    </div>
+</form:form>
+
+<script>
+    var productImageList = [];
+    var productIds = '';
+    $(function () {
+        $('.upload-content .conList .btn:nth-of-type(1)').html('<div><span>+</span><h5>选择图片</h5></div>');
+        $('.upload-content .conList .btn:nth-of-type(2)').after('<img class="cancel-upload" src="/static/images/close-btn1.png">').remove();
+        $('.upload-content .conList').find('.cancel-upload').hide();
+        var MutationObserver = window.MutationObserver || window.WebKitMutationObserver;
+        var MutationObserverConfig = {
+            childList: true,
+            subtree: true,
+            characterData: true
+        };
+        var observer = new MutationObserver(function (mutations) {
+            $.each(mutations, function (index, item) {
+                if (item.type === 'childList') {
+                    // 在创建新的 element 时调用
+                    var target = $(item.target),
+                        thisWrapper = target.closest('.conList'),
+                        nextEle = thisWrapper.next();
+                    thisWrapper.find('li').css('z-index', 99);
+                    thisWrapper.find('.cancel-upload').show();
+                    if (nextEle.hasClass('hide-pic')) {
+                        nextEle.removeClass('hide-pic');
+                    }
+                }
+            })
+        });
+        for (var i = 0; i < 5; i++) {
+            var observeEle = document.getElementsByClassName('upload-content')[i];
+            observer.observe(observeEle, MutationObserverConfig)
+        }
+        $('body').on('click', '.cancel-upload', function () {
+            var wrapper = $(this).closest('.conList');
+            wrapper.find('li').css('z-index', '-1');
+            wrapper.find('input').val('');
+            $(this).hide();
+            wrapper.removeClass("hide-pic");
+            wrapper.parent().append(wrapper.clone());
+            wrapper.remove();
+            $(".conList").each(function (i, ele) {
+                if ($(ele).find("input.input-xlarge").val()) {
+                    $(ele).next().removeClass("hide-pic")
+                }
+            })
+        });
+        $(window).on("load", function () {
+            setTimeout(showImage(), 100);
+        });
+
+        var templateType = $("input[name='templateType']:checked").val();
+        if (templateType != undefined) {
+            //数据填充
+            <c:forEach items="${floorContent.floorImageList}" var="floorImage" varStatus="index">
+            productImageList.push({
+                id: "${floorImage.id}",
+                productId: "${empty floorImage.productId ? "":floorImage.productId}",
+                image: "${floorImage.image}",
+                name: "${floorImage.name}",
+                shopName: "${floorImage.shopName}",
+                link: "${floorImage.link}",
+                sort: "${floorImage.sort}",
+                pcStatus: "${floorImage.pcStatus}",
+                appletsStatus: "${floorImage.appletsStatus}",
+                recommend: "${floorImage.recommend}",
+                label: "${floorImage.label}",
+                createDate: "${floorImage.createDate}"
+            });
+            </c:forEach>
+        }
+        showContent();
+    });
+
+
+    //展示选中模板对应的表单
+    function showContent() {
+        var list = [];
+        var type;
+        for (var i = 1; i <= 9; i++) {
+            list.push('#template' + i);
+        }
+        var templateType = parseInt($("input[name='templateType']:checked").val());
+        $('.Image1').hide();
+        $('.Image2').hide();
+        $('.Image3').hide();
+        $('.Image4').hide();
+        $('.Image5').hide();
+        if (!isNaN(templateType)) {
+            toTop(list, '#template', $("#template" + templateType))
+            //滚动条滚动到最上方
+            document.getElementById("templateTd").scrollTop = 0;
+            //展示模板内容表单
+            $("#infoLabel").hide();
+            $(".templateImageTable").show();
+            $("#displayDateDiv").css('display', 'none');
+            $("#productImageTable").hide();
+            //广告图
+            if (templateType === 1 || templateType === 2 || templateType === 3 || templateType === 6 || templateType === 7) {
+                $('.Image1').show();
+            }
+            if (templateType === 2 || templateType === 3 || templateType === 6 || templateType === 7) {
+                $('.Image2').show();
+            }
+            if (templateType === 2 || templateType === 6 || templateType === 7) {
+                $('.Image3').show();
+            }
+            if ( templateType === 7) {
+                $('.Image4').show();
+                $('.Image5').show();
+            }
+            //删除按钮和表格展示
+            //图片表格
+            if (productImageList.length == 0) {
+                $("#del").attr("disabled", "disabled");
+            } else {
+                $("#productImageTable").show();
+                $("#del").removeAttr("disabled");
+            }
+
+            //广告图建议尺寸
+            /*if (templateType == 11) {
+                $("#pcImageSize1").text("建议图片分辨率1140px*150px");
+                $("#appletsImageSize1").text("建议图片分辨率702px*240px");
+                $("#pcImageSize2").text("建议图片分辨率560px*220px");
+                $("#appletsImageSize2").text("建议图片分辨率339px*260px");
+                $("#pcImageSize3").text("建议图片分辨率560px*220px");
+                $("#appletsImageSize3").text("建议图片分辨率339px*260px");
+            } else if (templateType == 12) {
+                $("#pcImageSize1").text("建议图片分辨率660px*330px");
+                $("#appletsImageSize1").text("建议图片分辨率339px*516px");
+                $("#pcImageSize2").text("建议图片分辨率470px*160px");
+                $("#appletsImageSize2").text("建议图片分辨率339px*246px");
+                $("#pcImageSize3").text("建议图片分辨率470px*160px");
+                $("#appletsImageSize3").text("建议图片分辨率339px*246px");
+            } else if (templateType == 13) {
+                $("#pcImageSize1").text("建议图片分辨率640px*320px");
+                $("#appletsImageSize1").text("建议图片分辨率339px*516px");
+                $("#pcImageSize2").text("建议图片分辨率240px*150px");
+                $("#appletsImageSize2").text("建议图片分辨率339px*246px");
+                $("#pcImageSize3").text("建议图片分辨率240px*150px");
+                $("#appletsImageSize3").text("建议图片分辨率339px*246px");
+                $("#pcImageSize4").text("建议图片分辨率240px*150px");
+                $("#appletsImageSize4").text("建议图片分辨率339px*246px");
+                $("#pcImageSize5").text("建议图片分辨率240px*150px");
+                $("#appletsImageSize5").text("建议图片分辨率339px*246px");
+            } else if (templateType == 15 || templateType == 16 || templateType == 19 || templateType == 20) {
+                $("#pcImageSize1").text("建议图片分辨率1140px*150px");
+                $("#appletsImageSize1").text("建议图片分辨率702px*240px");
+                $("#pcImageSize2").text("建议图片分辨率660px*330px");
+                $("#appletsImageSize2").text("建议图片分辨率339px*516px");
+                $("#pcImageSize3").text("建议图片分辨率460px*330px");
+                $("#appletsImageSize3").text("建议图片分辨率339px*516px");
+            } else if (templateType == 17 || templateType == 18) {
+                $("#pcImageSize1").text("建议图片分辨率660px*330px");
+                $("#appletsImageSize1").text("建议图片分辨率339px*516px");
+                $("#pcImageSize2").text("建议图片分辨率460px*330px");
+                $("#appletsImageSize2").text("建议图片分辨率339px*516px");
+            }*/
+            showImage();
+            batchSaveSort();
+        } else {
+            $("#infoLabel").show();
+            $(".templateImageTable").hide();
+        }
+    }
+
+    //被选中的模板置顶
+    function toTop(list = [], parent, children) {
+        list.forEach(function (item, index) {
+            $(parent).append($(item))
+        })
+        $(parent).prepend($(children))
+    }
+
+    //展示图片
+    function showImage() {
+        for (var i = 0; i <= 5; i++) {
+            $("#appletsAdsImage" + i).find("input.input-xlarge").each(function (j, ele) {
+                if ($(ele).val() && $(ele).val() != '') {
+                    $(ele).next().find("li").css("z-index", "99");
+                    $(ele).parents(".conList").find(".cancel-upload").show();
+                    $(ele).parents(".conList").next().removeClass("hide-pic");
+                } else {
+                    $("#appletsAdsImage" + i + " .cancel-upload").click();
+                }
+            });
+        }
+    }
+
+    //点击添加
+    function showSelect(url) {
+        var title = '添加';
+        var width = $(top.document).width() - 800;
+        var height = $(top.document).height() - 160;
+        var templateType = $("input[name='templateType']:checked").val();
+        url = url + "?type=productImage&productCategory=1&productIds=" + productIds + "&templateType=" + templateType;
+        title = '商品图片';
+        width = $(top.document).width() - 400;
+        height = $(top.document).height() - 160;
+        top.$.jBox("iframe:" + url, {
+            iframeScrolling: 'yes',
+            width: width,
+            height: height,
+            persistent: true,
+            title: title,
+            buttons: {"确定": '1', "取消": '-1'},
+            submit: function (v, h, f) {
+                //确定
+                var $jboxFrame = top.$('#jbox-iframe');
+                var $mainFrame = top.$('#mainFrame');
+                if ('1' == v && 1 == $jboxFrame.size() && 1 == $mainFrame.size()) {
+                    var items = $jboxFrame[0].contentWindow.getCheckedItems();
+                    items.createDate = '<fmt:formatDate value="<%=new Date()%>" pattern="yyyy-MM-dd HH:mm:ss"/>';
+                    console.log(items);
+                    //商品图片活动
+                    if (items.productId == "") {
+                        if (items.image == '') {
+                            alertx("请上传图片");
+                            return false;
+                        }
+                        if (items.name == '') {
+                            alertx("请输入名称");
+                            return false;
+                        }
+                        if (items.link == '') {
+                            alertx("请输入跳转链接");
+                            return false;
+                        }
+                        if (items.sort == '') {
+                            alertx("请输入排序值");
+                            return false;
+                        }
+                        if (items.label == '') {
+                            alertx("请输入标签");
+                            return false;
+                        }
+                    }
+                    productImageList.push(items);
+                    $('#productImageTable').show();
+                    $("#del").removeAttr("disabled");
+                    batchSaveSort();
+                }
+                return true;
+            }
+        });
+    }
+
+    //相关图片列表数据
+    function appendShopOrderHead(data, index) {
+        var type = 'productImage';
+        var html = '<tr id ="ads' + index + '">' +
+            '<td>' +
+            '<input class="check-item" type="checkbox" name="info" value="' + index + '"/>' + (index + 1) +
+            '</td>' +
+            '<td>' + data.productId + '</td>' +
+            '<td>' +
+            '<img src="' + data.image + '" width="60px" border="none" title="启用">' +
+            '</td>' +
+            '<td>' + data.name +'</td>' +
+            '<td>' + data.shopName +'</td>' +
+            '<td>' +
+            (data.appletsStatus == 1 ?
+                '<font color="green">已上架</font>':'<font color="red">已下架</font>'
+            ) +
+            '</td>' +
+            '<td>' +
+            '<input name="sort" style="width:50px;" value="' + data.sort + '"  onkeyup="onlynum(this)"  onchange="changeSort(' + index + ',this)"></td>' +
+            '</td>' +
+            '<td>' +
+            '<img src="'+(data.recommend == 1?'/static/images/yes.gif':'/static/images/no.gif')+'" width="15px" border="none"/>' +
+            '</td>' +
+            '<td>' +
+            (data.createDate == '' ? (
+                '<fmt:formatDate value="<%=new Date()%>" pattern="yyyy-MM-dd HH:mm:ss"/>'
+            ) : (
+                data.createDate
+            )) +
+            '</td>' +
+            '<td>' +
+            '<a href="javascript:;" onclick="updateAppletsStatus('+(data.appletsStatus == 1?0:1)+',' + index + ');"">'+(data.appletsStatus == 1?"下架":"上架")+'</a>'+
+            '   <a href="javascript:;" onclick="updateRecommend('+(data.recommend == 1?0:1)+',' + index + ');"">'+(data.recommend == 1?"取消推荐":"设为推荐")+'</a>'+
+            '   <a href="javascript:;" onclick="delect(' + index + ')">删除</a>' +
+            '</td>' +
+            '</tr>';
+        return html;
+    }
+
+    function insertHtml(list) {
+        var html = '';
+        productIds = '';
+        list.forEach(function (item, index) {
+            html += appendShopOrderHead(item, index);
+            productIds += "," + item.productId;
+        });
+        $("#productImageTbody").html(html);
+    }
+
+    /**
+     * 一键排序
+     */
+    function batchSaveSort() {
+        productImageList.sort(sort);
+        insertHtml(productImageList);
+    }
+
+    //根据sort值 从小到大排序
+    function sort(a, b) {
+        return ((a.sort - b.sort) == 0 ? (a.createDate > b.createDate ? -1 : 1) : (a.sort - b.sort));
+    }
+
+    /**
+     * @param obj
+     * jquery控制input只能输入数字
+     */
+    function onlynum(obj) {
+        obj.value = obj.value.replace(/[^\d]/g, ""); //清除"数字"以外的字符
+    }
+
+    function changeSort(index, sortThis) {
+        var sort = sortThis.value;
+        var image = getImage(index);
+        image.sort = sort;
+    }
+
+    function changeName(index, nameThis) {
+        var name = nameThis.value;
+        var image = getImage(index);
+        image.name = name;
+    }
+
+    function changeContent(index, nameThis) {
+        var content = nameThis.value;
+        var image = infoImageList[index];
+        image.content = content;
+    }
+
+    function changeLink(index, linkThis) {
+        var link = linkThis.value;
+        var image = getImage(index);
+        image.link = link;
+    }
+
+    function changeLabel(index, labelThis) {
+        var label = labelThis.value;
+        var image = productImageList[index];
+        image.label = label;
+    }
+
+    /**
+     * 删除操作
+     */
+    function delect(index) {
+        var displayDateNo = $("input[name='displayDateRadio']:checked").val();
+        return confirmx("确定删除该数据吗?", function () {
+            var image = getImage(index);
+            if (image.productId != '') {
+                productIds = productIds.replace(image.productId, "");
+            }
+            productImageList.splice(index, 1);
+            insertHtml(productImageList);
+            if (productImageList.length == 0) {
+                $("#del").attr("disabled", "disabled");
+                $('#productImageTable').hide();
+            }
+        });
+    }
+
+    /**
+     * 批量删除
+     */
+    function batchDeletion() {
+        var index = -1;
+        var i = 1;
+        var length = $('input[name="info"]:checked').length;
+        if (length > 0) {
+            return confirmx("确定删除吗?", function () {
+                var displayDateNo = $("input[name='displayDateRadio']:checked").val();
+                $('input[name="info"]:checked').each(function () {
+                    var thisIndex = $(this).val();
+                    if (index >= 0 && index < thisIndex) {
+                        thisIndex = thisIndex - i;
+                        i++;
+                    } else {
+                        index = thisIndex;
+                    }
+                    var image = getImage(thisIndex);
+                    if (image.productId != '') {
+                        productIds = productIds.replace(image.productId, "");
+                    }
+                    productImageList.splice(thisIndex, 1);
+                });
+                insertHtml(productImageList);
+                if (productImageList.length == 0) {
+                    $('#productImageTable').hide();
+                    $("#del").attr("disabled", "disabled");
+                } else {
+                    $("#del").removeAttr("disabled");
+                }
+            });
+        } else {
+            alertx("请先选中要删除的数据")
+        }
+    }
+
+
+    function getImage(index) {
+        var image = productImageList[index];
+        return image;
+    }
+
+    function updatePcStatus(status, index) {
+        var image = getImage(index);
+        confirmx(status == 0 ? '确定停用吗?' : '确定启用吗?', function () {
+            image.pcStatus = status;
+            batchSaveSort();
+        })
+    }
+
+    function updateAppletsStatus(status, index) {
+        var image = getImage(index);
+        confirmx(status == 0 ? '确定下架该商品吗?' : '确定上架该商品吗?', function () {
+            image.appletsStatus = status;
+            batchSaveSort();
+        })
+    }
+
+    function updateRecommend(status, index) {
+        var image = getImage(index);
+        confirmx(status == 0 ? '确定取消推荐吗?' : '确定将该商品设为推荐商品吗?', function () {
+            image.recommend = status;
+            batchSaveSort();
+        })
+    }
+
+    function clickAllSelect(ckb) {
+        var isChecked = ckb.checked;
+        $(".check-item").attr('checked', isChecked);
+    }
+
+    // 保存完是否重定向到楼层列表
+    function changeRedirectFlag(redirectFlag) {
+        $("#redirectFlag").val(redirectFlag);
+    }
+
+</script>
+</body>
+</html>