|
@@ -66,10 +66,12 @@
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- if (mode=="3" && ( ${cmPromotion.giftProducts==null or cmPromotion.giftProducts.size()==0})) {
|
|
|
|
- alertx("请至少选择1个赠送的商品");
|
|
|
|
- isSubMitFlag = false;
|
|
|
|
- return false;
|
|
|
|
|
|
+ if (mode=="3") {
|
|
|
|
+ if(document.getElementById("contentTbody1").rows.length<1){
|
|
|
|
+ alertx("请至少选择1个赠送的商品");
|
|
|
|
+ isSubMitFlag = false;
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
//将促销商品和赠品信息填充进数组
|
|
//将促销商品和赠品信息填充进数组
|
|
$('#contentTbody tr').each(function (index, item) {
|
|
$('#contentTbody tr').each(function (index, item) {
|
|
@@ -95,7 +97,7 @@
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
var obj = {
|
|
var obj = {
|
|
- productId: $itemProductID,
|
|
|
|
|
|
+ skuId: $itemProductID,
|
|
number: $giftNumber
|
|
number: $giftNumber
|
|
};
|
|
};
|
|
addGiftArray.push(obj)
|
|
addGiftArray.push(obj)
|
|
@@ -225,38 +227,56 @@
|
|
});
|
|
});
|
|
}
|
|
}
|
|
|
|
|
|
- function deleteProduct(obj, storeStatus,type) {
|
|
|
|
|
|
+ function deleteProduct(obj,type) {
|
|
//将该行数据取消勾选,若存在数据库中则将其存入delProductIds中
|
|
//将该行数据取消勾选,若存在数据库中则将其存入delProductIds中
|
|
$(".check-item[value=" + obj + "]").prop("checked", false);
|
|
$(".check-item[value=" + obj + "]").prop("checked", false);
|
|
- var delProductIds = $("#delProductIds").val();
|
|
|
|
- var delGiftIds = $("#delGiftIds").val();
|
|
|
|
- if (storeStatus && type == 1) {
|
|
|
|
- if (delProductIds != '') {
|
|
|
|
- delProductIds = delProductIds + "," + obj;
|
|
|
|
- }else delProductIds = obj;
|
|
|
|
|
|
+ if (type == 1) {
|
|
|
|
+ var product=$('#product'+obj);
|
|
|
|
+ $(product).remove();
|
|
}
|
|
}
|
|
- if (storeStatus && type == 2) {
|
|
|
|
- if (delGiftIds != '') {
|
|
|
|
- delGiftIds = delGiftIds + "," + obj;
|
|
|
|
- }else delGiftIds = obj;
|
|
|
|
|
|
+ if (type == 2) {
|
|
|
|
+ var gift= $('#gift'+obj);
|
|
|
|
+ $(gift).remove();
|
|
}
|
|
}
|
|
- window.setTimeout(function () {
|
|
|
|
- var productItems = getCheckedItems(1);
|
|
|
|
- var giftItems = getCheckedItems(2);
|
|
|
|
- var mode = $("input[name='mode']:checked").val();
|
|
|
|
- var reducedPrice = $("#reducedPrice").val();
|
|
|
|
- var touchPrice2 = $("#touchPrice2").val();
|
|
|
|
- var touchPrice3 = $("#touchPrice3").val();
|
|
|
|
- var status = $("input[name='status']:checked").val();
|
|
|
|
- var beginTime = $("#beginTime").val();
|
|
|
|
- var endTime = $("#endTime").val();
|
|
|
|
- var delFlag1 = $("input[name='delFlag1']:checked").val();
|
|
|
|
- var description = $("#description").val();
|
|
|
|
- window.location.href = "${ctx}/product/cmPromotions/form?type=2&productIds=" + productItems + "&giftIds=" + giftItems +
|
|
|
|
- "&delProductIds="+delProductIds+"&delGiftIds="+delGiftIds+"&mode=" + mode + "&description=" +description+
|
|
|
|
- "&reducedPrice=" + reducedPrice + "&touchPrice2=" + touchPrice2 + "&touchPrice3=" + touchPrice3 +
|
|
|
|
- "&status=" + status + "&beginTime=" + beginTime + "&endTime=" + endTime + "&delFlag1=" + delFlag1 + "&id=${cmPromotion.id}";
|
|
|
|
- },100)
|
|
|
|
|
|
+
|
|
|
|
+ $.ajax({
|
|
|
|
+ url: "${ctx}/product/cmPromotions/delPromotion",
|
|
|
|
+ data: {"id":${cmPromotion.id},"skuId":obj},
|
|
|
|
+ type: "POST",
|
|
|
|
+ async: false,
|
|
|
|
+ success: function(data){
|
|
|
|
+ flag=data.success;
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ <%--var delProductIds = $("#delProductIds").val();--%>
|
|
|
|
+ <%--var delGiftIds = $("#delGiftIds").val();--%>
|
|
|
|
+ <%--if (storeStatus && type == 1) {--%>
|
|
|
|
+ <%-- if (delProductIds != '') {--%>
|
|
|
|
+ <%-- delProductIds = delProductIds + "," + obj;--%>
|
|
|
|
+ <%-- }else delProductIds = obj;--%>
|
|
|
|
+ <%--}--%>
|
|
|
|
+ <%--if (storeStatus && type == 2) {--%>
|
|
|
|
+ <%-- if (delGiftIds != '') {--%>
|
|
|
|
+ <%-- delGiftIds = delGiftIds + "," + obj;--%>
|
|
|
|
+ <%-- }else delGiftIds = obj;--%>
|
|
|
|
+ <%--}--%>
|
|
|
|
+ <%--window.setTimeout(function () {--%>
|
|
|
|
+ <%-- var productItems = getCheckedItems(1);--%>
|
|
|
|
+ <%-- var giftItems = getCheckedItems(2);--%>
|
|
|
|
+ <%-- var mode = $("input[name='mode']:checked").val();--%>
|
|
|
|
+ <%-- var reducedPrice = $("#reducedPrice").val();--%>
|
|
|
|
+ <%-- var touchPrice2 = $("#touchPrice2").val();--%>
|
|
|
|
+ <%-- var touchPrice3 = $("#touchPrice3").val();--%>
|
|
|
|
+ <%-- var status = $("input[name='status']:checked").val();--%>
|
|
|
|
+ <%-- var beginTime = $("#beginTime").val();--%>
|
|
|
|
+ <%-- var endTime = $("#endTime").val();--%>
|
|
|
|
+ <%-- var delFlag1 = $("input[name='delFlag1']:checked").val();--%>
|
|
|
|
+ <%-- var description = $("#description").val();--%>
|
|
|
|
+ <%-- window.location.href = "${ctx}/product/cmPromotions/form?type=2&productIds=" + productItems + "&giftIds=" + giftItems +--%>
|
|
|
|
+ <%-- "&delProductIds="+delProductIds+"&delGiftIds="+delGiftIds+"&mode=" + mode + "&description=" +description+--%>
|
|
|
|
+ <%-- "&reducedPrice=" + reducedPrice + "&touchPrice2=" + touchPrice2 + "&touchPrice3=" + touchPrice3 +--%>
|
|
|
|
+ <%-- "&status=" + status + "&beginTime=" + beginTime + "&endTime=" + endTime + "&delFlag1=" + delFlag1 + "&id=${cmPromotion.id}";--%>
|
|
|
|
+ <%--},100)--%>
|
|
}
|
|
}
|
|
|
|
|
|
function getCheckedItems(type) {
|
|
function getCheckedItems(type) {
|
|
@@ -302,7 +322,7 @@
|
|
</thead>
|
|
</thead>
|
|
<tbody id="contentTbody">
|
|
<tbody id="contentTbody">
|
|
<c:forEach items="${cmPromotion.promotionProducts}" var="product">
|
|
<c:forEach items="${cmPromotion.promotionProducts}" var="product">
|
|
- <tr>
|
|
|
|
|
|
+ <tr id="product${product.productID}">
|
|
<th class="hide"><input class="check-item" type="checkbox" id="productCheckItem"
|
|
<th class="hide"><input class="check-item" type="checkbox" id="productCheckItem"
|
|
name="info" ${product.storeStatus?'':'checked'}
|
|
name="info" ${product.storeStatus?'':'checked'}
|
|
value='${product.productID}'/></th>
|
|
value='${product.productID}'/></th>
|
|
@@ -312,7 +332,7 @@
|
|
<td>${product.price}</td>
|
|
<td>${product.price}</td>
|
|
<td>
|
|
<td>
|
|
<a href="javaScript:;"
|
|
<a href="javaScript:;"
|
|
- onclick="deleteProduct('${product.productID}',${product.storeStatus},1)">删除</a>
|
|
|
|
|
|
+ onclick="deleteProduct('${product.productID}',1)">删除</a>
|
|
</td>
|
|
</td>
|
|
</tr>
|
|
</tr>
|
|
</c:forEach>
|
|
</c:forEach>
|
|
@@ -346,6 +366,7 @@
|
|
<th style="width:20px;" class="hide"></th>
|
|
<th style="width:20px;" class="hide"></th>
|
|
<th></th>
|
|
<th></th>
|
|
<th>商品图片</th>
|
|
<th>商品图片</th>
|
|
|
|
+ <th>skuId</th>
|
|
<th>商品名称</th>
|
|
<th>商品名称</th>
|
|
<th>供应商</th>
|
|
<th>供应商</th>
|
|
<th>数量</th>
|
|
<th>数量</th>
|
|
@@ -353,19 +374,20 @@
|
|
</thead>
|
|
</thead>
|
|
<tbody id="contentTbody1">
|
|
<tbody id="contentTbody1">
|
|
<c:forEach items="${cmPromotion.giftProducts}" var="product">
|
|
<c:forEach items="${cmPromotion.giftProducts}" var="product">
|
|
- <tr>
|
|
|
|
|
|
+ <tr id="gift${product.skuId}">
|
|
<td>赠</td>
|
|
<td>赠</td>
|
|
<th class="hide"><input class="check-item" type="checkbox" id="giftCheckItem"
|
|
<th class="hide"><input class="check-item" type="checkbox" id="giftCheckItem"
|
|
name="gift" ${product.storeStatus?'':'checked'}
|
|
name="gift" ${product.storeStatus?'':'checked'}
|
|
- value='${product.productID}'/></th>
|
|
|
|
|
|
+ value='${product.skuId}'/></th>
|
|
<td><img src="${product.mainImage}" width="50px" height="50px"></td>
|
|
<td><img src="${product.mainImage}" width="50px" height="50px"></td>
|
|
|
|
+ <td>${product.skuId}</td>
|
|
<td>${product.name}</td>
|
|
<td>${product.name}</td>
|
|
<td>${product.shopName}</td>
|
|
<td>${product.shopName}</td>
|
|
<td><input id="actPrice1" name="giftNumber" style="width:50px;"
|
|
<td><input id="actPrice1" name="giftNumber" style="width:50px;"
|
|
value="${product.giftNumber}" type="number" maxlength="7" step="1"></td>
|
|
value="${product.giftNumber}" type="number" maxlength="7" step="1"></td>
|
|
<td>
|
|
<td>
|
|
<a href="javaScript:;"
|
|
<a href="javaScript:;"
|
|
- onclick="deleteProduct('${product.productID}',${product.storeStatus},2)">删除</a>
|
|
|
|
|
|
+ onclick="deleteProduct('${product.skuId}',2)">删除</a>
|
|
</td>
|
|
</td>
|
|
</tr>
|
|
</tr>
|
|
</c:forEach>
|
|
</c:forEach>
|