|
@@ -348,6 +348,23 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
+ <div class="control-group">
|
|
|
+ <label class="control-label"><font color="red">*</font>商品分类:</label>
|
|
|
+ <div class="controls">
|
|
|
+ <form:select path="bigTypeId" class="input-small required" id="bigType" onchange="loadSmallType()">
|
|
|
+ <form:option value="" label="请选择"/>
|
|
|
+ <form:options items="${classify.bigTypeList}" itemLabel="name" itemValue="bigTypeID"
|
|
|
+ htmlEscape="false"/>
|
|
|
+ </form:select>
|
|
|
+ <form:select path="smallTypeId" class="input-small required" id="smallType">
|
|
|
+ <form:option value="" label="请选择"/>
|
|
|
+ <c:forEach items="${classify.smalltypeList}" var="smallType">
|
|
|
+ <form:option value="${smallType.smallTypeID}" label="${smallType.name}"
|
|
|
+ bigTypeId="${smallType.bigTypeID}"/>
|
|
|
+ </c:forEach>
|
|
|
+ </form:select>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
<div class="control-group">
|
|
|
<label class="control-label"><font color="red">*</font>商品状态:</label>
|
|
|
<div class="controls">
|
|
@@ -537,6 +554,98 @@
|
|
|
obj.value = '';
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ $(window).load(function () {
|
|
|
+ loadInitType();
|
|
|
+ });
|
|
|
+
|
|
|
+ // 网站分类
|
|
|
+ var currentBigtype = ${cmHeheProduct.bigTypeId};
|
|
|
+ var currentSmalltype = ${cmHeheProduct.smallTypeId};
|
|
|
+ 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>
|
|
|
+ ];
|
|
|
+
|
|
|
+
|
|
|
+ // 初始分类
|
|
|
+ function loadInitType() {
|
|
|
+ if (currentBigtype != null && typeof (currentBigtype) != "undefined") {
|
|
|
+ setTimeout(function () {
|
|
|
+ loadBigType();
|
|
|
+ }, 0);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 分类联动
|
|
|
+ function loadBigType() {
|
|
|
+ $("#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 (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);
|
|
|
+ } else {
|
|
|
+ $("#smallType").append("<option value='" + smalltypeList[i].smallTypeId + "'>" + smalltypeList[i].name + "</option>");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ document.getElementById("s2id_smallType").style.cssText = "display: inline-block";
|
|
|
+ }
|
|
|
+ }
|
|
|
</script>
|
|
|
</body>
|
|
|
</html>
|