Commit 87f6ad82 authored by liudong1993's avatar liudong1993

1

parent 7be93414
......@@ -1467,7 +1467,15 @@ namespace Mall.Module.Product
{
if (model.SpecificationPriceList.Any() && model.SpecificationList.Any())
{
foreach (var item in model.SpecificationPriceList)
List<RB_Goods_Specification_Extend> SpecificationListToPrice = new List<RB_Goods_Specification_Extend>();
List<RB_Goods_SpecificationValue_Extend> SpecificationValueListToPrice = new List<RB_Goods_SpecificationValue_Extend>();
bool IsHaveSellingPriceZero = false;
if (model.SpecificationPriceList.Where(x => x.SellingPrice > 0).Count() != model.SpecificationPriceList.Count())
{
//有数量为0的
IsHaveSellingPriceZero = true;
}
foreach (var item in model.SpecificationPriceList.Where(x => x.SellingPrice > 0))
{
var ssarr = item.SpecificationSort.Split(':');
int Sort = Convert.ToInt32(ssarr[0]);
......@@ -1476,7 +1484,15 @@ namespace Mall.Module.Product
for (int i = 0; i < ssarr.Length; i++)
{
var smodel = model.SpecificationList[i];
if (IsHaveSellingPriceZero && !SpecificationListToPrice.Where(x => x.Id == smodel.Id).Any())
{
SpecificationListToPrice.Add(smodel);
}
var svmodel = smodel.SpecificationValueList.Where(x => x.Sort == Convert.ToInt32(ssarr[i])).FirstOrDefault();
if (IsHaveSellingPriceZero && !SpecificationValueListToPrice.Where(x => x.Id == svmodel.Id).Any())
{
SpecificationValueListToPrice.Add(svmodel);
}
attr_list.Add(new
{
attr_group_name = smodel.Name,
......@@ -1549,6 +1565,17 @@ namespace Mall.Module.Product
member_price_list
});
}
//当只有一组规格项目时
if (IsHaveSellingPriceZero && SpecificationListToPrice.Any() && model.SpecificationList.Count() == 1)
{
foreach (var item in SpecificationListToPrice)
{
item.SpecificationValueList = SpecificationValueListToPrice.Where(x => x.SpecificationId == item.Id).OrderBy(x => x.Sort).ToList();
}
SpecificationListToPrice = SpecificationListToPrice.Where(x => x.SpecificationValueList.Any()).ToList();
//有价格小于等于0的 在前端展示时 需屏蔽掉
model.SpecificationList = SpecificationListToPrice;
}
}
}
else
......@@ -1672,8 +1699,8 @@ namespace Mall.Module.Product
if (model.IsCustomSpecification == 1)
{
price_member_min = price_min = model.SpecificationPriceList.Min(x => x.SellingPrice ?? 0);
price_member_max = price_max = model.SpecificationPriceList.Max(x => x.SellingPrice ?? 0);
price_member_min = price_min = model.SpecificationPriceList.Where(x => x.SellingPrice > 0).Min(x => x.SellingPrice ?? 0);
price_member_max = price_max = model.SpecificationPriceList.Where(x => x.SellingPrice > 0).Max(x => x.SellingPrice ?? 0);
}
else
{
......
......@@ -1665,7 +1665,7 @@ namespace Mall.WebApi.Controllers.MallBase
demodel.InventoryNum += (pricemodel.InventoryNum ?? 0);
}
//主表价格 如果有自定义规格,直接取最小值
demodel.SellingPrice = demodel.SpecificationPriceList.Min(x => x.SellingPrice ?? 0);
demodel.SellingPrice = demodel.SpecificationPriceList.Where(x => x.SellingPrice > 0)?.Min(x => x.SellingPrice ?? 0) ?? 0;
//分销佣金
if (demodel.SeparateDistribution == 1)
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment