|
@@ -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') {
|