Commit 522133f4 authored by liudong1993's avatar liudong1993

微店首页价格

parent 48388c5b
...@@ -214,9 +214,9 @@ namespace Mall.WebApi.Controllers ...@@ -214,9 +214,9 @@ namespace Mall.WebApi.Controllers
var spList = spriceList.Where(x => x.GoodsId == item.Id).ToList(); var spList = spriceList.Where(x => x.GoodsId == item.Id).ToList();
if (spList.Any()) if (spList.Any())
{ {
foreach (var qitem in spriceList) foreach (var qitem in spList)
{ {
var sspModel = smallPList.Where(x => x.SpecificationKey == qitem.SpecificationSort).FirstOrDefault(); var sspModel = smallPList.Where(x => x.GoodsId == item.Id && x.SpecificationKey == qitem.SpecificationSort).FirstOrDefault();
if (sspModel != null) if (sspModel != null)
{ {
//单商品设置的 //单商品设置的
...@@ -244,8 +244,8 @@ namespace Mall.WebApi.Controllers ...@@ -244,8 +244,8 @@ namespace Mall.WebApi.Controllers
} }
} }
} }
item.SellingPrice = spriceList.Min(x => x.SellingPrice ?? 0); item.SellingPrice = spList.Min(x => x.SellingPrice ?? 0);
decimal MaxPrice = spriceList.Max(x => x.SellingPrice ?? 0); decimal MaxPrice = spList.Max(x => x.SellingPrice ?? 0);
MaxPrice += Math.Ceiling(MaxPrice / 10); MaxPrice += Math.Ceiling(MaxPrice / 10);
if (MaxPrice > item.OriginalPrice) { if (MaxPrice > item.OriginalPrice) {
item.OriginalPrice = MaxPrice; item.OriginalPrice = MaxPrice;
...@@ -334,9 +334,9 @@ namespace Mall.WebApi.Controllers ...@@ -334,9 +334,9 @@ namespace Mall.WebApi.Controllers
var spList = spriceList.Where(x => x.GoodsId == item.Id).ToList(); var spList = spriceList.Where(x => x.GoodsId == item.Id).ToList();
if (spList.Any()) if (spList.Any())
{ {
foreach (var qitem in spriceList) foreach (var qitem in spList)
{ {
var sspModel = smallPList.Where(x => x.SpecificationKey == qitem.SpecificationSort).FirstOrDefault(); var sspModel = smallPList.Where(x => x.GoodsId == item.Id && x.SpecificationKey == qitem.SpecificationSort).FirstOrDefault();
if (sspModel != null) if (sspModel != null)
{ {
//单商品设置的 //单商品设置的
...@@ -364,8 +364,8 @@ namespace Mall.WebApi.Controllers ...@@ -364,8 +364,8 @@ namespace Mall.WebApi.Controllers
} }
} }
} }
item.SellingPrice = spriceList.Min(x => x.SellingPrice ?? 0); item.SellingPrice = spList.Min(x => x.SellingPrice ?? 0);
decimal MaxPrice = spriceList.Max(x => x.SellingPrice ?? 0); decimal MaxPrice = spList.Max(x => x.SellingPrice ?? 0);
MaxPrice += Math.Ceiling(MaxPrice / 10); MaxPrice += Math.Ceiling(MaxPrice / 10);
if (MaxPrice > item.OriginalPrice) if (MaxPrice > item.OriginalPrice)
{ {
...@@ -457,9 +457,9 @@ namespace Mall.WebApi.Controllers ...@@ -457,9 +457,9 @@ namespace Mall.WebApi.Controllers
var spList = spriceList.Where(x => x.GoodsId == item.Id).ToList(); var spList = spriceList.Where(x => x.GoodsId == item.Id).ToList();
if (spList.Any()) if (spList.Any())
{ {
foreach (var qitem in spriceList) foreach (var qitem in spList)
{ {
var sspModel = smallPList.Where(x => x.SpecificationKey == qitem.SpecificationSort).FirstOrDefault(); var sspModel = smallPList.Where(x => x.GoodsId == item.Id && x.SpecificationKey == qitem.SpecificationSort).FirstOrDefault();
if (sspModel != null) if (sspModel != null)
{ {
//单商品设置的 //单商品设置的
...@@ -487,8 +487,8 @@ namespace Mall.WebApi.Controllers ...@@ -487,8 +487,8 @@ namespace Mall.WebApi.Controllers
} }
} }
} }
item.SellingPrice = spriceList.Min(x => x.SellingPrice ?? 0); item.SellingPrice = spList.Min(x => x.SellingPrice ?? 0);
decimal MaxPrice = spriceList.Max(x => x.SellingPrice ?? 0); decimal MaxPrice = spList.Max(x => x.SellingPrice ?? 0);
MaxPrice += Math.Ceiling(MaxPrice / 10); MaxPrice += Math.Ceiling(MaxPrice / 10);
if (MaxPrice > item.OriginalPrice) if (MaxPrice > item.OriginalPrice)
{ {
...@@ -577,9 +577,9 @@ namespace Mall.WebApi.Controllers ...@@ -577,9 +577,9 @@ namespace Mall.WebApi.Controllers
var spList = spriceList.Where(x => x.GoodsId == item.Id).ToList(); var spList = spriceList.Where(x => x.GoodsId == item.Id).ToList();
if (spList.Any()) if (spList.Any())
{ {
foreach (var qitem in spriceList) foreach (var qitem in spList)
{ {
var sspModel = smallPList.Where(x => x.SpecificationKey == qitem.SpecificationSort).FirstOrDefault(); var sspModel = smallPList.Where(x => x.GoodsId == item.Id && x.SpecificationKey == qitem.SpecificationSort).FirstOrDefault();
if (sspModel != null) if (sspModel != null)
{ {
//单商品设置的 //单商品设置的
...@@ -607,8 +607,8 @@ namespace Mall.WebApi.Controllers ...@@ -607,8 +607,8 @@ namespace Mall.WebApi.Controllers
} }
} }
} }
item.SellingPrice = spriceList.Min(x => x.SellingPrice ?? 0); item.SellingPrice = spList.Min(x => x.SellingPrice ?? 0);
decimal MaxPrice = spriceList.Max(x => x.SellingPrice ?? 0); decimal MaxPrice = spList.Max(x => x.SellingPrice ?? 0);
MaxPrice += Math.Ceiling(MaxPrice / 10); MaxPrice += Math.Ceiling(MaxPrice / 10);
if (MaxPrice > item.OriginalPrice) if (MaxPrice > item.OriginalPrice)
{ {
......
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