소스 검색

相关推荐

plf 3 년 전
부모
커밋
8c7d0a65dd

+ 18 - 16
src/main/java/com/caimei/modules/product/dao/ProductDao.java

@@ -3,13 +3,9 @@ package com.caimei.modules.product.dao;
 import com.caimei.modules.brand.entity.BrandAndProductType;
 import com.caimei.modules.brand.entity.BrandAndProductType;
 import com.caimei.modules.product.entity.*;
 import com.caimei.modules.product.entity.*;
 import com.caimei.po.ProductLadderPrice;
 import com.caimei.po.ProductLadderPrice;
-import com.caimei.po.TinyType;
 import com.thinkgem.jeesite.common.persistence.CrudDao;
 import com.thinkgem.jeesite.common.persistence.CrudDao;
-import com.thinkgem.jeesite.common.persistence.Page;
 import com.thinkgem.jeesite.common.persistence.annotation.MyBatisDao;
 import com.thinkgem.jeesite.common.persistence.annotation.MyBatisDao;
-import jdk.nashorn.internal.ir.IdentNode;
 import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Param;
-import org.springframework.transaction.annotation.Transactional;
 
 
 import java.util.List;
 import java.util.List;
 import java.util.Map;
 import java.util.Map;
@@ -20,12 +16,13 @@ public interface ProductDao extends CrudDao<Product> {
     List<ActType> getAllActType();
     List<ActType> getAllActType();
 
 
 
 
-    int saveSort(@Param("sort") String sort ,@Param("id") String id );
+    int saveSort(@Param("sort") String sort, @Param("id") String id);
 
 
     int findLadderPriceByNum(@Param("productID") String productID);
     int findLadderPriceByNum(@Param("productID") String productID);
 
 
     /**
     /**
      * 获取供应商旗下的商品
      * 获取供应商旗下的商品
+     *
      * @param product
      * @param product
      * @return
      * @return
      */
      */
@@ -33,6 +30,7 @@ public interface ProductDao extends CrudDao<Product> {
 
 
     /**
     /**
      * 获取所有已添加存在的小程序商品集合
      * 获取所有已添加存在的小程序商品集合
+     *
      * @return
      * @return
      */
      */
     public List<Integer> getAllExistsProductList(@Param("organizeID") String organizeID);
     public List<Integer> getAllExistsProductList(@Param("organizeID") String organizeID);
@@ -40,14 +38,15 @@ public interface ProductDao extends CrudDao<Product> {
     List<Product> findListBuyMall(Product product);
     List<Product> findListBuyMall(Product product);
 
 
 
 
-    void deleteProduct(@Param("id") String id ,@Param("DateTime") Long DateTime );
+    void deleteProduct(@Param("id") String id, @Param("DateTime") Long DateTime);
 
 
-    public  List<Product> getrecommendProductList(Product product);
+    public List<Product> getrecommendProductList(Product product);
 
 
-    int insertAddProduct(@Param("productID") Integer productID,@Param("tinyTypeID") Integer tinyTypeID);
+    int insertAddProduct(@Param("productID") Integer productID, @Param("tinyTypeID") Integer tinyTypeID);
 
 
     /**
     /**
      * 获取商品购买信息
      * 获取商品购买信息
+     *
      * @param giftProduct
      * @param giftProduct
      * @return
      * @return
      */
      */
@@ -55,19 +54,22 @@ public interface ProductDao extends CrudDao<Product> {
 
 
     /**
     /**
      * 后去商品购买库存
      * 后去商品购买库存
+     *
      * @param productId
      * @param productId
      * @return
      * @return
      */
      */
-    public Sku getProductSku(@Param("productId")Integer productId);
+    public Sku getProductSku(@Param("productId") Integer productId);
 
 
     /**
     /**
      * 更新赠送
      * 更新赠送
+     *
      * @return
      * @return
      */
      */
     public int updateGiftProudct(GiftProduct giftProduct);
     public int updateGiftProudct(GiftProduct giftProduct);
 
 
     /**
     /**
      * 删除赠送
      * 删除赠送
+     *
      * @return
      * @return
      */
      */
     public int insertGiftProudct(GiftProduct giftProduct);
     public int insertGiftProudct(GiftProduct giftProduct);
@@ -83,7 +85,7 @@ public interface ProductDao extends CrudDao<Product> {
 
 
     List<ProductBigType> getBigTypeList(@Param("bigTypeID") Integer bigTypeID);
     List<ProductBigType> getBigTypeList(@Param("bigTypeID") Integer bigTypeID);
 
 
-    List<ProductSmallType> getSmallTypeList(@Param("bigTypeID")Integer bigTypeID, @Param("smallTypeID") Integer smallTypeID);
+    List<ProductSmallType> getSmallTypeList(@Param("bigTypeID") Integer bigTypeID, @Param("smallTypeID") Integer smallTypeID);
 
 
     List<ProducTinyType> getTinyTypeList(@Param("smallTypeID") Integer smallTypeID, @Param("tinyTypeID") Integer tinyTypeID);
     List<ProducTinyType> getTinyTypeList(@Param("smallTypeID") Integer smallTypeID, @Param("tinyTypeID") Integer tinyTypeID);
 
 
@@ -119,9 +121,9 @@ public interface ProductDao extends CrudDao<Product> {
 
 
     void updateTinyType(Product product);
     void updateTinyType(Product product);
 
 
-    void  updateProductByBrandId(@Param("brandId") Integer brandId);
+    void updateProductByBrandId(@Param("brandId") Integer brandId);
 
 
-    List<BrandAndProductType> getProductByTypeName(@Param("name")String name,@Param("name1")String name1,@Param("name2")String name2);
+    List<BrandAndProductType> getProductByTypeName(@Param("name") String name, @Param("name1") String name1, @Param("name2") String name2);
 
 
     List<Product> findRecommendPage(Product product);
     List<Product> findRecommendPage(Product product);
 
 
@@ -131,9 +133,9 @@ public interface ProductDao extends CrudDao<Product> {
 
 
     List<CmProductRecommend> findProductRecommendList(@Param("productID") Integer productID);
     List<CmProductRecommend> findProductRecommendList(@Param("productID") Integer productID);
 
 
-    List<CmProductRecommend> findProductList(@Param("bigTypeID")Integer bigTypeID, @Param("smallTypeID")Integer smallTypeID,
-                                             @Param("tinyTypeID")Integer tinyTypeID,
-                                             @Param("productName")String productName, @Param("shopName")String shopName);
+    List<CmProductRecommend> findProductList(@Param("commodityType") Integer commodityType, @Param("bigTypeID") Integer bigTypeID,
+                                             @Param("smallTypeID") Integer smallTypeID, @Param("tinyTypeID") Integer tinyTypeID,
+                                             @Param("productName") String productName, @Param("shopName") String shopName);
 
 
     void updateRecommendType(@Param("productID") String productID, @Param("recommendType") String recommendType);
     void updateRecommendType(@Param("productID") String productID, @Param("recommendType") String recommendType);
 
 
@@ -143,7 +145,7 @@ public interface ProductDao extends CrudDao<Product> {
 
 
     CmSecondHandRecommendVo getSecondHandRecommend(@Param("productID") String productID);
     CmSecondHandRecommendVo getSecondHandRecommend(@Param("productID") String productID);
 
 
-    List<CmSecondHandRecommendVo> querySecondHandRecommend(@Param("productID")String queryProductID, @Param("productName")String queryProductName,@Param("queryProductType")String queryProductType);
+    List<CmSecondHandRecommendVo> querySecondHandRecommend(@Param("productID") String queryProductID, @Param("productName") String queryProductName, @Param("queryProductType") String queryProductType);
 
 
     ProductDetailInfo queryProductDetailInfo(@Param("productID") Integer productID);
     ProductDetailInfo queryProductDetailInfo(@Param("productID") Integer productID);
 
 

+ 4 - 4
src/main/java/com/caimei/modules/product/service/ProductService.java

@@ -305,14 +305,14 @@ public class ProductService extends CrudService<ProductDao, Product> {
         return productDao.findProductRecommendList(productID);
         return productDao.findProductRecommendList(productID);
     }
     }
 
 
-    public List<CmProductRecommend> findProductList(Integer bigTypeID, Integer smallTypeID, Integer tinyTypeID,
+    public List<CmProductRecommend> findProductList(Integer commodityType, Integer bigTypeID, Integer smallTypeID, Integer tinyTypeID,
                                                     String productName, String shopName) {
                                                     String productName, String shopName) {
-        if (bigTypeID == null && smallTypeID == null && tinyTypeID == null
+        if (commodityType == null && bigTypeID == null && smallTypeID == null && tinyTypeID == null
                 && StringUtils.isEmpty(productName) && StringUtils.isEmpty(shopName)) //没有输入搜索条件时 展示一个空列表
                 && StringUtils.isEmpty(productName) && StringUtils.isEmpty(shopName)) //没有输入搜索条件时 展示一个空列表
         {
         {
             return new ArrayList<>();
             return new ArrayList<>();
         }
         }
-        return productDao.findProductList(bigTypeID, smallTypeID, tinyTypeID, productName, shopName);
+        return productDao.findProductList(commodityType, bigTypeID, smallTypeID, tinyTypeID, productName, shopName);
     }
     }
 
 
     public void updateRecommendType(String productID, String recommendType) {
     public void updateRecommendType(String productID, String recommendType) {
@@ -388,7 +388,7 @@ public class ProductService extends CrudService<ProductDao, Product> {
         ProductDetailInfo queryProductDetailInfo = productDao.queryProductDetailInfo(product.getProductID());
         ProductDetailInfo queryProductDetailInfo = productDao.queryProductDetailInfo(product.getProductID());
         if (queryProductDetailInfo != null) {
         if (queryProductDetailInfo != null) {
             productDao.updateproductDetailInfo(productDetailInfo);
             productDao.updateproductDetailInfo(productDetailInfo);
-        }else {
+        } else {
             productDao.insertProductDetailInfo(productDetailInfo);
             productDao.insertProductDetailInfo(productDetailInfo);
         }
         }
         User user = UserUtils.getUser();
         User user = UserUtils.getUser();

+ 2 - 3
src/main/java/com/caimei/modules/product/web/ProductNewController.java

@@ -807,7 +807,7 @@ public class ProductNewController extends BaseController {
      */
      */
     @RequiresPermissions("product:product:view")
     @RequiresPermissions("product:product:view")
     @RequestMapping(value = "recommend")
     @RequestMapping(value = "recommend")
-    public String recommend(Product product, Integer bigTypeID, Integer smallTypeID, Integer tinyTypeID,
+    public String recommend(Product product, Integer commodityType, Integer bigTypeID, Integer smallTypeID, Integer tinyTypeID,
                             String productName, String shopName, String recommendType,
                             String productName, String shopName, String recommendType,
                             HttpServletRequest request, HttpServletResponse response, Model model) {
                             HttpServletRequest request, HttpServletResponse response, Model model) {
         List<CmProductRecommend> recommendList;
         List<CmProductRecommend> recommendList;
@@ -819,8 +819,7 @@ public class ProductNewController extends BaseController {
             recommendList = productService.findRecommendBySys(product);
             recommendList = productService.findRecommendBySys(product);
             manualRecommend = productService.findProductRecommendCount(product.getProductID());
             manualRecommend = productService.findProductRecommendCount(product.getProductID());
         }
         }
-        List<CmProductRecommend> list = productService.findProductList(bigTypeID, smallTypeID,
-                tinyTypeID, productName, shopName);
+        List<CmProductRecommend> list = productService.findProductList(commodityType, bigTypeID, smallTypeID, tinyTypeID, productName, shopName);
         for (CmProductRecommend l : list) {
         for (CmProductRecommend l : list) {
             l.setImg(AppUtils.getImageURL("product", l.getImg(), 0, ""));
             l.setImg(AppUtils.getImageURL("product", l.getImg(), 0, ""));
             for (CmProductRecommend cpr : recommendList) {
             for (CmProductRecommend cpr : recommendList) {

+ 12 - 6
src/main/resources/mappings/modules/product/ProductMapper.xml

@@ -148,7 +148,10 @@
 		LEFT JOIN shop s on s.shopID = a.shopID
 		LEFT JOIN shop s on s.shopID = a.shopID
 	</sql>
 	</sql>
 	<sql id="ActivityJoins">
 	<sql id="ActivityJoins">
-		LEFT JOIN shop s on s.shopID = a.shopID INNER JOIN tinytype AS b ON a.`tinyTypeID` = b.`tinyTypeID` INNER JOIN smalltype AS c ON b.`smallTypeID` = c.`smallTypeID` INNER JOIN bigtype AS d ON c.`bigTypeID` = d.`bigTypeID`
+		LEFT JOIN shop s on s.shopID = a.shopID
+		INNER JOIN tinytype AS b ON a.`tinyTypeID` = b.`tinyTypeID`
+		INNER JOIN smalltype AS c ON a.`smallTypeID` = c.`smallTypeID`
+		INNER JOIN bigtype AS d ON a.`bigTypeID` = d.`bigTypeID`
 	</sql>
 	</sql>
 
 
 	<update id="saveSort">
 	<update id="saveSort">
@@ -1689,14 +1692,17 @@
 		<include refid="ActivityJoins"/>
 		<include refid="ActivityJoins"/>
 		<where>
 		<where>
 			<choose>
 			<choose>
-				<when test="tinyTypeID != null and tinyTypeID != ''">
-					AND b.tinyTypeID = #{tinyTypeID}
+				<when test="commodityType != null and commodityType != ''">
+					AND a.commodityType = #{commodityType}
+				</when>
+				<when test="bigTypeID != null and bigTypeID != ''">
+					AND a.bigTypeID = #{bigTypeID}
 				</when>
 				</when>
 				<when test="smallTypeID != null and smallTypeID != ''">
 				<when test="smallTypeID != null and smallTypeID != ''">
-					AND c.smallTypeID = #{smallTypeID}
+					AND a.smallTypeID = #{smallTypeID}
 				</when>
 				</when>
-				<when test="bigTypeID != null and bigTypeID != ''">
-					AND d.bigTypeID = #{bigTypeID}
+				<when test="tinyTypeID != null and tinyTypeID != ''">
+					AND a.tinyTypeID = #{tinyTypeID}
 				</when>
 				</when>
 			</choose>
 			</choose>
 			<if test="productName != null and productName != ''">
 			<if test="productName != null and productName != ''">

+ 192 - 50
src/main/webapp/WEB-INF/views/modules/product-new/recommend.jsp

@@ -82,32 +82,28 @@
 	<div class="flex-wrap">
 	<div class="flex-wrap">
 		<div class="item">
 		<div class="item">
 			<label><font color="red">*</font><b>设置类型:</b></label>
 			<label><font color="red">*</font><b>设置类型:</b></label>
-			<input type="radio" name="recommendType" value="1"  onchange="changeRecommendType()" ${recommendType == "1" ? "checked" : ""} />手动选择${recommendType}11 <b class="line">|</b>
+			<input type="radio" name="recommendType" value="1"  onchange="changeRecommendType()" ${recommendType == "1" ? "checked" : ""} />手动选择<b class="line">|</b>
 			<input type="radio" name="recommendType" value="0" onchange="changeRecommendType()" ${(recommendType == "0" || recommendType == ""|| recommendType == null) ? "checked" : ""} />自动选择
 			<input type="radio" name="recommendType" value="0" onchange="changeRecommendType()" ${(recommendType == "0" || recommendType == ""|| recommendType == null) ? "checked" : ""} />自动选择
-			<span style="color:#D0D0D0;">(设置自动选择后,系统将会选择该商品所属相同三级分类里的销量前7名商品)<span/>
+			<span style="color:#D0D0D0;">(设置自动选择后,系统将会选择该商品所属相同二级分类中销量前7名的商品进行推荐)<span/>
 		</div>
 		</div>
 	</div>
 	</div>
 	<div id="p-list" style="display:none;">
 	<div id="p-list" style="display:none;">
     	<div class="flex-wrap">
     	<div class="flex-wrap">
 			<div class="item">
 			<div class="item">
 				<label>商品分类:</label>
 				<label>商品分类:</label>
-				<select id="bigType" class="input-small" onchange="loadSmallType('', '#bigType', '#smallType', '#tinyType')">
+				<select id="commodityType" class="input-small" onchange="loadBigType()">
 					<option value="">请选择</option>
 					<option value="">请选择</option>
-					<c:forEach items="${classify.bigTypeList}" var="item">
-						<option value="${item.bigTypeID}">${item.name}</option>
-					</c:forEach>
+					<option value="1">产品</option>
+					<option value="2">仪器</option>
 				</select>
 				</select>
-				<select id="smallType" class="input-small" onchange="loadTinyType('', '#smallType', '#tinyType')">
+				<select id="bigType" class="input-small" onchange="loadSmallType()">
+					<option value="">请选择</option>
+				</select>
+				<select id="smallType" class="input-small" onchange="loadTinyType()">
 					<option value="">请选择</option>
 					<option value="">请选择</option>
-					<c:forEach items="${classify.smalltypeList}" var="item">
-						<option value="${item.smallTypeID}"  bigTypeID="${item.bigTypeID}">${item.name}</option>
-					</c:forEach>
 				</select>
 				</select>
 				<select id="tinyType" class="input-small">
 				<select id="tinyType" class="input-small">
 					<option value="">请选择</option>
 					<option value="">请选择</option>
-					<c:forEach items="${classify.tinytypeList}" var="item">
-						<option value="${item.tinyTypeID}" smallTypeID="${item.smallTypeID}">${item.name}</option>
-					</c:forEach>
 				</select>
 				</select>
 			</div>
 			</div>
 			<div class="item">
 			<div class="item">
@@ -188,9 +184,12 @@
         $('body').on('click','#queryBtn', function () {
         $('body').on('click','#queryBtn', function () {
             var recommendType = $("input[name='recommendType']:checked").val();
             var recommendType = $("input[name='recommendType']:checked").val();
             var url = "${ctx}//product/new/recommend?id=" + $("#productID").val() + "&recommendType=" + recommendType;
             var url = "${ctx}//product/new/recommend?id=" + $("#productID").val() + "&recommendType=" + recommendType;
-            if ($("#bigType").val() != '' && $("#bigType").val() != '请选择') {
-                url += "&bigTypeID=" + $("#bigType").val();
+            if ($("#commodityType").val() != '' && $("#commodityType").val() != '请选择') {
+                url += "&commodityType=" + $("#commodityType").val();
             }
             }
+			if ($("#bigType").val() != '' && $("#bigType").val() != '请选择') {
+				url += "&bigTypeID=" + $("#bigType").val();
+			}
             if ($("#smallType").val() != '' && $("#smallType").val() != '请选择') {
             if ($("#smallType").val() != '' && $("#smallType").val() != '请选择') {
                 url += "&smallTypeID=" + $("#smallType").val();
                 url += "&smallTypeID=" + $("#smallType").val();
             }
             }
@@ -260,37 +259,9 @@
 		});
 		});
     });
     });
     // 初始化
     // 初始化
-    var currentTinytype = ${product.tinyTypeID};
+/*    var currentTinytype = ${product.tinyTypeID};
     var currentSmalltype, currentBigType;
     var currentSmalltype, currentBigType;
-    var bigTypeList = [
-        <c:forEach items="${classify.bigTypeList}" var="bigType" varStatus="index">
-            <c:if test="${index.index > 0}">,</c:if>
-            {
-                bigTypeID: ${bigType.bigTypeID},
-                name: "${bigType.name}"
-            }
-        </c:forEach>
-    ];
-    var smalltypeList = [
-        <c:forEach items="${classify.smalltypeList}" var="smalltype" varStatus="index">
-            <c:if test="${index.index > 0}">,</c:if>
-            {
-                smallTypeID: ${smalltype.smallTypeID},
-                name: "${smalltype.name}",
-                bigTypeID: ${smalltype.bigTypeID},
-            }
-        </c:forEach>
-    ];
-    var tinytypeList = [
-        <c:forEach items="${classify.tinytypeList}" var="tinytype" varStatus="index">
-            <c:if test="${index.index > 0}">,</c:if>
-            {
-                tinyTypeID: ${tinytype.tinyTypeID},
-                name: "${tinytype.name}",
-                smallTypeID: ${tinytype.smallTypeID}
-            }
-        </c:forEach>
-    ];
+
     // 初始分类
     // 初始分类
     function loadInitType(){
     function loadInitType(){
         for(var i=0; i<tinytypeList.length; i++){
         for(var i=0; i<tinytypeList.length; i++){
@@ -314,9 +285,180 @@
                 $('#tinyType').prev().find('.select2-chosen').text(tinyTypeText);
                 $('#tinyType').prev().find('.select2-chosen').text(tinyTypeText);
             },500)
             },500)
         }
         }
-    }
+    }*/
+	// 网站分类
+	var currentBigtype = ${product.bigTypeID};
+	var currentSmalltype = ${product.smallTypeID};
+	var currentTinytype = ${product.tinyTypeID};
+	var currentCommodityType = ${product.commodityType};    //商品属性
+	var bigTypeList = [
+		<c:forEach items="${classify.bigTypeList}" var="bigType" varStatus="index">
+		<c:if test="${index.index > 0}">,</c:if>
+		{
+			bigTypeID: ${bigType.bigTypeID},
+			name: "${bigType.name}",
+			typeSort: ${bigType.typeSort}
+		}
+		</c:forEach>
+	];
+	var smalltypeList = [
+		<c:forEach items="${classify.smalltypeList}" var="smalltype" varStatus="index">
+		<c:if test="${index.index > 0}">,</c:if>
+		{
+			smallTypeID: ${smalltype.smallTypeID},
+			name: "${smalltype.name}",
+			bigTypeID: ${smalltype.bigTypeID},
+		}
+		</c:forEach>
+	];
+	var tinytypeList = [
+		<c:forEach items="${classify.tinytypeList}" var="tinytype" varStatus="index">
+		<c:if test="${index.index > 0}">,</c:if>
+		{
+			tinyTypeID: ${tinytype.tinyTypeID},
+			name: "${tinytype.name}",
+			smallTypeID: ${tinytype.smallTypeID}
+		}
+		</c:forEach>
+	];
+
+	// 初始分类
+	function loadInitType(){
+		if (currentCommodityType == null || typeof (currentCommodityType) == "undefined" || currentCommodityType == '0') {
+			$("#bigType").html("");
+			$("#bigType").prev().find(".select2-chosen").text("请选择");
+			$("#bigType").append("<option value=''>请选择</option>");
+			$("#smallType").html("");
+			$("#smallType").prev().find(".select2-chosen").text("请选择");
+			$("#smallType").append("<option value=''>请选择</option>");
+			$("#tinyType").html("");
+			$("#tinyType").prev().find(".select2-chosen").text("请选择");
+			$("#tinyType").append("<option value=''>请选择</option>");
+			document.getElementById("s2id_tinyType").style.cssText = "display: none";
+		}else if(currentBigtype != null && typeof(currentBigtype) != "undefined"){
+			setTimeout(function(){
+				loadBigType();
+			},0);
+		}
+	}
+
     // 分类联动
     // 分类联动
-    function loadSmallType(id, big, small, tiny){
+	function loadBigType(){
+		var commodityType = $("#commodityType").val();
+		$("#bigType").html("");
+		$("#bigType").prev().find(".select2-chosen").text("请选择");
+		$("#bigType").append("<option value=''>请选择</option>");
+		$("#smallType").html("");
+		$("#smallType").prev().find(".select2-chosen").text("请选择");
+		$("#smallType").append("<option value=''>请选择</option>");
+		$("#tinyType").html("");
+		$("#tinyType").prev().find(".select2-chosen").text("请选择");
+		$("#tinyType").append("<option value=''>请选择</option>");
+		if(typeof(commodityType) != "undefined") {
+			$("#bigType").html("");
+			$("#bigType").prev().find(".select2-chosen").text("请选择");
+			$("#bigType").append("<option value=''>请选择</option>");
+			$("#smallType").html("");
+			$("#smallType").prev().find(".select2-chosen").text("请选择");
+			$("#smallType").append("<option value=''>请选择</option>");
+			$("#tinyType").html("");
+			$("#tinyType").prev().find(".select2-chosen").text("请选择");
+			$("#tinyType").append("<option value=''>请选择</option>");
+			for(var i=0; i<bigTypeList.length; i++){
+				if (commodityType == bigTypeList[i].typeSort) {
+					if (currentBigtype != null && typeof (currentBigtype) != "undefined" && currentBigtype == bigTypeList[i].bigTypeID) {
+						$("#bigType").append("<option selected value='"+bigTypeList[i].bigTypeID+"'>"+bigTypeList[i].name+"</option>");
+						$("#bigType").prev().find(".select2-chosen").text(bigTypeList[i].name);
+						setTimeout(function(){
+							loadSmallType();
+						},500);
+					}else{
+						$("#bigType").append("<option value='"+bigTypeList[i].bigTypeID+"'>"+bigTypeList[i].name+"</option>");
+					}
+				}
+			}
+		}
+		loadSmallType();
+	}
+
+	function loadSmallType(id){
+		if(id){
+			$("#bigType").val(id);
+			$("#bigType").prev().find(".select2-chosen").text($("#bigType option:selected").text());
+		}
+		var bigType = $("#bigType").val();
+		$("#smallType").html("");
+		$("#smallType").prev().find(".select2-chosen").text("请选择");
+		$("#smallType").append("<option value=''>请选择</option>");
+		$("#tinyType").html("");
+		$("#tinyType").prev().find(".select2-chosen").text("请选择");
+		$("#tinyType").append("<option value=''>请选择</option>");
+		if(typeof(bigType) != "undefined" && bigType != "") {
+			var smallTypeNum = 0;
+			for(var i=0; i<smalltypeList.length; i++){
+				if (bigType == smalltypeList[i].bigTypeID) {
+					smallTypeNum = smallTypeNum + 1;
+					if(currentSmalltype != null && typeof(currentSmalltype) != "undefined" && currentSmalltype == smalltypeList[i].smallTypeID) {
+						$("#smallType").append("<option selected value='"+smalltypeList[i].smallTypeID+"'>"+smalltypeList[i].name+"</option>");
+						$("#smallType").prev().find(".select2-chosen").text(smalltypeList[i].name);
+						setTimeout(function(){
+							loadTinyType(currentSmalltype);
+						},500);
+					}else{
+						$("#smallType").append("<option value='"+smalltypeList[i].smallTypeID+"'>"+smalltypeList[i].name+"</option>");
+					}
+				}
+			}
+			if (smallTypeNum == 0) {
+				$("#smallType").removeClass("required");
+				document.getElementById("s2id_smallType").style.cssText = "display: none";
+			}else {
+				$("#smallType").addClass("required");
+				document.getElementById("s2id_smallType").style.cssText = "display: inline-block";
+			}
+		} else {
+			$("#smallType").removeClass("required");
+			document.getElementById("s2id_smallType").style.cssText = "display: none";
+		}
+		loadTinyType();
+	}
+
+	function loadTinyType(id) {
+		if(id){
+			$("#smallType").val(id);
+			$("#smallType").prev().find(".select2-chosen").text($("#smallType option:selected").text());
+		}
+		var smallType = $("#smallType option:selected").val();
+		$("#tinyType").html("");
+		$("#tinyType").prev().find(".select2-chosen").text("请选择");
+		$("#tinyType").append("<option value=''>请选择</option>");
+		if(typeof(smallType) != "undefined" && smallType != "") {
+			var tinyTypeNum = 0;
+			for(var i=0; i<tinytypeList.length; i++){
+				if (smallType == tinytypeList[i].smallTypeID) {
+					tinyTypeNum = tinyTypeNum + 1;
+					if(currentTinytype != null && typeof(currentTinytype) != "undefined" && currentTinytype == tinytypeList[i].tinyTypeID) {
+						$("#tinyType").append("<option selected value='"+tinytypeList[i].tinyTypeID+"'>"+tinytypeList[i].name+"</option>");
+						$("#tinyType").prev().find(".select2-chosen").text(tinytypeList[i].name);
+					}else{
+						$("#tinyType").append("<option value='"+tinytypeList[i].tinyTypeID+"'>"+tinytypeList[i].name+"</option>");
+					}
+				}
+			}
+			if (tinyTypeNum == 0) {
+				$("#tinyType").removeClass("required");
+				document.getElementById("s2id_tinyType").style.cssText = "display: none";
+			}else {
+				$("#tinyType").addClass("required");
+				document.getElementById("s2id_tinyType").style.cssText = "display: inline-block";
+			}
+		} else {
+			document.getElementById("s2id_tinyType").style.cssText = "display: none";
+			$("#tinyType").removeClass("required");
+		}
+	}
+
+    /*function loadSmallType(id, big, small, tiny){
         if(id){
         if(id){
             $(big).val(id);
             $(big).val(id);
             var text = $(big).find('option:selected').text();
             var text = $(big).find('option:selected').text();
@@ -351,8 +493,8 @@
             $(tiny).prev().find(".select2-chosen").text("请选择");
             $(tiny).prev().find(".select2-chosen").text("请选择");
             $(tiny).append("<option value=''>请选择</option>");
             $(tiny).append("<option value=''>请选择</option>");
         }
         }
-    }
-    function loadTinyType(id, small, tiny){
+    }*/
+    /*function loadTinyType(id, small, tiny){
         if(id){
         if(id){
             $(small).val(id);
             $(small).val(id);
             var text = $(small).find('option:selected').text();
             var text = $(small).find('option:selected').text();
@@ -378,7 +520,7 @@
             $(tiny).prev().find(".select2-chosen").text("请选择");
             $(tiny).prev().find(".select2-chosen").text("请选择");
             $(tiny).append("<option value=''>请选择</option>");
             $(tiny).append("<option value=''>请选择</option>");
         }
         }
-    }
+    }*/
     function changeRecommendType(){
     function changeRecommendType(){
 		var recommendType = $("input[name='recommendType']:checked").val();
 		var recommendType = $("input[name='recommendType']:checked").val();
 		if (recommendType == '0') {
 		if (recommendType == '0') {