|
@@ -607,12 +607,17 @@ function resetProductList(setData) {
|
|
$('.productTable tbody tr:not(.gift)').each(function (index, element) {
|
|
$('.productTable tbody tr:not(.gift)').each(function (index, element) {
|
|
var data = JSON.parse($(this).attr("data-value"));
|
|
var data = JSON.parse($(this).attr("data-value"));
|
|
productList.push(data);
|
|
productList.push(data);
|
|
- if(data.skuStr){
|
|
|
|
|
|
+ if (data.skuStr) {
|
|
var strings = data.skuStr.split("/");
|
|
var strings = data.skuStr.split("/");
|
|
var skuId = strings[0];
|
|
var skuId = strings[0];
|
|
skuIds.push(skuId);
|
|
skuIds.push(skuId);
|
|
- }else{
|
|
|
|
- var skuId=data.skuList[0].skuId;
|
|
|
|
|
|
+ } else {
|
|
|
|
+ var skuId = "";
|
|
|
|
+ if (data.skuList) {
|
|
|
|
+ skuId = data.skuList[0].skuId;
|
|
|
|
+ } else {
|
|
|
|
+ skuId = data.skuId;
|
|
|
|
+ }
|
|
skuIds.push(skuId);
|
|
skuIds.push(skuId);
|
|
}
|
|
}
|
|
productIdList.push(data.productId);
|
|
productIdList.push(data.productId);
|
|
@@ -630,11 +635,11 @@ function resetProductList(setData) {
|
|
});
|
|
});
|
|
} else {
|
|
} else {
|
|
var skuId;
|
|
var skuId;
|
|
- if(setData.skuStr){
|
|
|
|
|
|
+ if (setData.skuStr) {
|
|
var strings = setData.skuStr.split("/");
|
|
var strings = setData.skuStr.split("/");
|
|
skuId = strings[0];
|
|
skuId = strings[0];
|
|
- }else{
|
|
|
|
- skuId=setData.skuList[0].skuId;
|
|
|
|
|
|
+ } else {
|
|
|
|
+ skuId = setData.skuList[0].skuId;
|
|
}
|
|
}
|
|
if (skuIds.indexOf(skuId) >= 0) {
|
|
if (skuIds.indexOf(skuId) >= 0) {
|
|
//设置
|
|
//设置
|
|
@@ -822,6 +827,29 @@ function showSencondHandSelect(iframe) {
|
|
*/
|
|
*/
|
|
function setProductList(data) {
|
|
function setProductList(data) {
|
|
console.log("设置" + JSON.stringify(data));
|
|
console.log("设置" + JSON.stringify(data));
|
|
|
|
+ var skuStr = "";
|
|
|
|
+ var skuIdStr = "";
|
|
|
|
+ var price = "";
|
|
|
|
+ if (data.skuList) {
|
|
|
|
+ skuStr = "<td>" + data.skuList[0].unit + "</td>";
|
|
|
|
+ skuIdStr = "<td>" + data.skuList[0].skuId + "</td>";
|
|
|
|
+ price = data.skuList[0].price;
|
|
|
|
+ } else {
|
|
|
|
+ skuStr = "<td>" + data.unit + "</td>";
|
|
|
|
+ skuIdStr = "<td>" + data.skuId + "</td>";
|
|
|
|
+ price = data.price;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //未选择sku,默认sku[0],选择了sku,skustr不为空
|
|
|
|
+ if (data.skuStr) {
|
|
|
|
+ var strings = data.skuStr.split("/");
|
|
|
|
+ var skuId = strings[0];
|
|
|
|
+ var index = strings[1] * 1;
|
|
|
|
+ skuStr = "<td>" + data.skuList[index].unit + "</td>";
|
|
|
|
+ skuIdStr = "<td>" + skuId + "</td>";
|
|
|
|
+ //price
|
|
|
|
+ price = data.skuList[index].price;
|
|
|
|
+ }
|
|
var userId = $("#inputForm").find("[name*='bpOrderUserinfo.userId']").val();
|
|
var userId = $("#inputForm").find("[name*='bpOrderUserinfo.userId']").val();
|
|
var orderStatus = $("#orderStatus").val() ? $("#orderStatus").val() * 1 : 0;
|
|
var orderStatus = $("#orderStatus").val() ? $("#orderStatus").val() * 1 : 0;
|
|
data.productType = 0;
|
|
data.productType = 0;
|
|
@@ -837,7 +865,8 @@ function setProductList(data) {
|
|
var tempProduct = {
|
|
var tempProduct = {
|
|
shopId: data.shopId,
|
|
shopId: data.shopId,
|
|
productId: data.productId,
|
|
productId: data.productId,
|
|
- price: data.price,
|
|
|
|
|
|
+ //有skuid后不能直传price,从选中项中取
|
|
|
|
+ price: price,
|
|
number: data.num,
|
|
number: data.num,
|
|
totalTax: data.totalAddedValueTax
|
|
totalTax: data.totalAddedValueTax
|
|
};
|
|
};
|
|
@@ -901,21 +930,6 @@ function setProductList(data) {
|
|
cmCouponBtn = '<a href="javascript:;" onclick="showCouponDetail(' + userId + ',' + data.productId + ')">查看</a>';
|
|
cmCouponBtn = '<a href="javascript:;" onclick="showCouponDetail(' + userId + ',' + data.productId + ')">查看</a>';
|
|
}
|
|
}
|
|
|
|
|
|
- var skuStr = "<td>" + data.skuList[0].unit + "</td>";
|
|
|
|
- var skuIdStr = "<td>" + data.skuList[0].skuId + "</td>";
|
|
|
|
-
|
|
|
|
- var price = data.skuList[0].price;
|
|
|
|
- //未选择sku,默认sku[0],选择了sku,skustr不为空
|
|
|
|
- if (data.skuStr) {
|
|
|
|
- var strings = data.skuStr.split("/");
|
|
|
|
- var skuId = strings[0];
|
|
|
|
- var index = strings[1] * 1;
|
|
|
|
- skuStr = "<td>" + data.skuList[index].unit + "</td>";
|
|
|
|
- skuIdStr = "<td>" + skuId + "</td>";
|
|
|
|
- //price
|
|
|
|
- price = data.skuList[index].price;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
var str =
|
|
var str =
|
|
"<tr id='product_" + data.productId + "' data-value='" + JSON.stringify(data) + "' data-index='" +
|
|
"<tr id='product_" + data.productId + "' data-value='" + JSON.stringify(data) + "' data-index='" +
|
|
product_index + "'>" +
|
|
product_index + "'>" +
|
|
@@ -941,7 +955,6 @@ function setProductList(data) {
|
|
"不含税-不能开票" : "") +
|
|
"不含税-不能开票" : "") +
|
|
((data.svipPriceFlag == 1 || (data.includedTax != null && data.includedTax != '' && data.includedTax != 2)) ? ")</label>" : "") +
|
|
((data.svipPriceFlag == 1 || (data.includedTax != null && data.includedTax != '' && data.includedTax != 2)) ? ")</label>" : "") +
|
|
"</td>" +
|
|
"</td>" +
|
|
-
|
|
|
|
"<td>" + data.discount + "</td>" +
|
|
"<td>" + data.discount + "</td>" +
|
|
(data.discount * 1 === 100 && data.cmPromotion && data.cmPromotion.mode == 1 ? ("<td><del>" + data
|
|
(data.discount * 1 === 100 && data.cmPromotion && data.cmPromotion.mode == 1 ? ("<td><del>" + data
|
|
.discountPrice + "</del></td>") : ("<td>" + data.discountPrice +
|
|
.discountPrice + "</del></td>") : ("<td>" + data.discountPrice +
|
|
@@ -977,21 +990,23 @@ function appendProductList(str, data, cmPromotion) {
|
|
var strings = data.skuStr.split("/");
|
|
var strings = data.skuStr.split("/");
|
|
skuId = strings[0];
|
|
skuId = strings[0];
|
|
} else {
|
|
} else {
|
|
- skuId = data.skuList[0].skuId;
|
|
|
|
|
|
+ if (data.skuList) {
|
|
|
|
+ skuId = data.skuList[0].skuId;
|
|
|
|
+ } else {
|
|
|
|
+ skuId = data.skuId;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
- console.log("skuId---------------->" + skuId);
|
|
|
|
|
|
|
|
$('.productTable tbody tr:not(.gift)').each(function (index, element) {
|
|
$('.productTable tbody tr:not(.gift)').each(function (index, element) {
|
|
- console.log("我看看-------------" + $(this).find("td:nth-child(2)").html());
|
|
|
|
if ($(this).find("td:nth-child(2)").html() == skuId) {
|
|
if ($(this).find("td:nth-child(2)").html() == skuId) {
|
|
removeEle = $(this).parent();
|
|
removeEle = $(this).parent();
|
|
$(this).remove();
|
|
$(this).remove();
|
|
removeBeforeSoon = true;
|
|
removeBeforeSoon = true;
|
|
}
|
|
}
|
|
});
|
|
});
|
|
|
|
+
|
|
if (removeBeforeSoon) {
|
|
if (removeBeforeSoon) {
|
|
//走到这里 说明是修改
|
|
//走到这里 说明是修改
|
|
- console.log("修改------------");
|
|
|
|
removeEle.append(str);
|
|
removeEle.append(str);
|
|
} else {
|
|
} else {
|
|
//这里就是新加了 //先看有没有这个 当前这个商品的供应商的table
|
|
//这里就是新加了 //先看有没有这个 当前这个商品的供应商的table
|
|
@@ -1001,6 +1016,7 @@ function appendProductList(str, data, cmPromotion) {
|
|
appendShopOrderHead(data, str, cmPromotion);
|
|
appendShopOrderHead(data, str, cmPromotion);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
setShopOrderFee(data.shopId);
|
|
setShopOrderFee(data.shopId);
|
|
// setOrderFee(); //设置底部订单金额
|
|
// setOrderFee(); //设置底部订单金额
|
|
product_index++;
|
|
product_index++;
|
|
@@ -1057,7 +1073,7 @@ function setGiftHtmlList(data, cmPromotion) {
|
|
console.log("设置赠品" + JSON.stringify(data));
|
|
console.log("设置赠品" + JSON.stringify(data));
|
|
if (data.presentNum > 0) {
|
|
if (data.presentNum > 0) {
|
|
// 已经添加的,重新添加
|
|
// 已经添加的,重新添加
|
|
- $('.productTable tbody tr.gift_' + data.productId).each(function (index, element) {
|
|
|
|
|
|
+ $('.productTable tbody tr.gift_' + data.skuId).each(function (index, element) {
|
|
$(this).remove();
|
|
$(this).remove();
|
|
});
|
|
});
|
|
var present = JSON.parse(JSON.stringify(data));
|
|
var present = JSON.parse(JSON.stringify(data));
|
|
@@ -1070,11 +1086,13 @@ function setGiftHtmlList(data, cmPromotion) {
|
|
var giftStr = "<tr id='product_gift_" + present.productId + "' class='gift gift_" + present.productId +
|
|
var giftStr = "<tr id='product_gift_" + present.productId + "' class='gift gift_" + present.productId +
|
|
"' data-value='" + JSON.stringify(present) + "' data-index='" + product_index + "'>" +
|
|
"' data-value='" + JSON.stringify(present) + "' data-index='" + product_index + "'>" +
|
|
"<td>" + present.productId + "</td>" +
|
|
"<td>" + present.productId + "</td>" +
|
|
|
|
+ "<td>" + 0 + "</td>" +
|
|
"<td hidden><input type='hidden' name='orderProduct[" + product_index +
|
|
"<td hidden><input type='hidden' name='orderProduct[" + product_index +
|
|
"].enabledStatus' id='orderProduct" + product_index + ".enabledStatus' value='" + JSON.stringify(present) +
|
|
"].enabledStatus' id='orderProduct" + product_index + ".enabledStatus' value='" + JSON.stringify(present) +
|
|
"'/>" + present.shopId + "</td>" +
|
|
"'/>" + present.shopId + "</td>" +
|
|
"<td hidden>" + present.shopName + "</td>" +
|
|
"<td hidden>" + present.shopName + "</td>" +
|
|
"<td class='fix-width'><i class='red'>协商赠品:</i>" + present.name + "</td><td hidden></td>" +
|
|
"<td class='fix-width'><i class='red'>协商赠品:</i>" + present.name + "</td><td hidden></td>" +
|
|
|
|
+ "<td>规格</td>"
|
|
"<td>" + present.num + "</td>" +
|
|
"<td>" + present.num + "</td>" +
|
|
"<td>0</td>" +
|
|
"<td>0</td>" +
|
|
"<td>100</td>" +
|
|
"<td>100</td>" +
|
|
@@ -1091,6 +1109,7 @@ function setGiftHtmlList(data, cmPromotion) {
|
|
product_index++;
|
|
product_index++;
|
|
appendGiftsList(present, giftStr, cmPromotion);
|
|
appendGiftsList(present, giftStr, cmPromotion);
|
|
}
|
|
}
|
|
|
|
+
|
|
if (data.cmPromotion && data.cmPromotion.mode == 3) {
|
|
if (data.cmPromotion && data.cmPromotion.mode == 3) {
|
|
var thisTouchPrice = 0;
|
|
var thisTouchPrice = 0;
|
|
totalPromotions.forEach(function (item) {
|
|
totalPromotions.forEach(function (item) {
|
|
@@ -1144,6 +1163,7 @@ function setGiftHtmlList(data, cmPromotion) {
|
|
"' data-value='" + JSON.stringify(gift) + "' gift-index='" +
|
|
"' data-value='" + JSON.stringify(gift) + "' gift-index='" +
|
|
product_index + "'>" +
|
|
product_index + "'>" +
|
|
"<td>" + gift.productId + "</td>" +
|
|
"<td>" + gift.productId + "</td>" +
|
|
|
|
+ "<td>" + 0 + "</td>" +
|
|
"<td hidden><input type='hidden' name='orderProduct[" + product_index +
|
|
"<td hidden><input type='hidden' name='orderProduct[" + product_index +
|
|
"].enabledStatus' id='orderProduct" + product_index +
|
|
"].enabledStatus' id='orderProduct" + product_index +
|
|
".enabledStatus' value='" + JSON.stringify(gift) + "'/>" + gift.shopId +
|
|
".enabledStatus' value='" + JSON.stringify(gift) + "'/>" + gift.shopId +
|
|
@@ -1151,6 +1171,7 @@ function setGiftHtmlList(data, cmPromotion) {
|
|
"<td class='fix-width'><i class='red'>促销赠品:</i>" + gift.name +
|
|
"<td class='fix-width'><i class='red'>促销赠品:</i>" + gift.name +
|
|
"<td>" + gift.shopName + "</td>" +
|
|
"<td>" + gift.shopName + "</td>" +
|
|
"</td><td hidden></td>" +
|
|
"</td><td hidden></td>" +
|
|
|
|
+ "<td>无</td>" +
|
|
"<td>" + gift.num + "</td>" +
|
|
"<td>" + gift.num + "</td>" +
|
|
"<td>0</td>" +
|
|
"<td>0</td>" +
|
|
"<td>100</td>" +
|
|
"<td>100</td>" +
|
|
@@ -1289,7 +1310,8 @@ function setSeondHandProductList(data) {
|
|
|
|
|
|
|
|
|
|
//设置订单金额信息
|
|
//设置订单金额信息
|
|
-function setOrderFee() { //不考虑经理折扣、运费,此时 商品总金额=订单总额=应付总额
|
|
|
|
|
|
+function setOrderFee() {
|
|
|
|
+ //不考虑经理折扣、运费,此时 商品总金额=订单总额=应付总额
|
|
var productTotalFee = 0, //商品总金额
|
|
var productTotalFee = 0, //商品总金额
|
|
productCount = 0, // 商品总数
|
|
productCount = 0, // 商品总数
|
|
presentCount = 0, //协商赠送商品数
|
|
presentCount = 0, //协商赠送商品数
|
|
@@ -1300,6 +1322,7 @@ function setOrderFee() { //不考虑经理折扣、运费,此时 商品总金
|
|
svipFullReduction = 0; //超级会员优惠
|
|
svipFullReduction = 0; //超级会员优惠
|
|
var couponPrice = $("#couponAmount").val() ? $("#couponAmount").val() * 1 : 0;
|
|
var couponPrice = $("#couponAmount").val() ? $("#couponAmount").val() * 1 : 0;
|
|
$('.productTable tbody tr:not(.gift)').each(function (index, element) {
|
|
$('.productTable tbody tr:not(.gift)').each(function (index, element) {
|
|
|
|
+ debugger;
|
|
var obj = JSON.parse($(this).attr("data-value"));
|
|
var obj = JSON.parse($(this).attr("data-value"));
|
|
productTotalFee = ((Number(productTotalFee) * 100 + Number(obj.num * obj.price) * 100 + Number(obj
|
|
productTotalFee = ((Number(productTotalFee) * 100 + Number(obj.num * obj.price) * 100 + Number(obj
|
|
.totalAddedValueTax) * 100) / 100 + Number(obj.svipTaxReduction)).toFixed(2);
|
|
.totalAddedValueTax) * 100) / 100 + Number(obj.svipTaxReduction)).toFixed(2);
|
|
@@ -2144,7 +2167,6 @@ function setProductTotalFee() {
|
|
|
|
|
|
trs.each(function (index, element) {
|
|
trs.each(function (index, element) {
|
|
var obj = JSON.parse($(this).attr("data-value"));
|
|
var obj = JSON.parse($(this).attr("data-value"));
|
|
-
|
|
|
|
var _taxRate = Number(obj.taxRate); //税率
|
|
var _taxRate = Number(obj.taxRate); //税率
|
|
var _totalFee = Number(obj.totalFee); //总价
|
|
var _totalFee = Number(obj.totalFee); //总价
|
|
var _shopFee1 = isNaN(Number(obj.shopFee1)) ? Number(obj.singleShopFee) : Number(obj.shopFee1);
|
|
var _shopFee1 = isNaN(Number(obj.shopFee1)) ? Number(obj.singleShopFee) : Number(obj.shopFee1);
|