Commit cabad9cb authored by liudong1993's avatar liudong1993
parents cec841bf 21da0253
......@@ -333,14 +333,23 @@ namespace Mall.Module.Product
{
var nowcategory = categoryList.Where(x => x.GoodsId == item.GoodsId).Select(x => x.CategoryId);
var fullNumPinkageModel = freeShippingList.Where(x => nowcategory.Contains(x.CategoryId) && x.IsFreeShipping == 1 && x.IsEnable == 1 && x.FullNumPinkage > 0).OrderBy(x => x.FullNumPinkage).FirstOrDefault();
var fullNumPinkageModel = freeShippingList.Where(x => nowcategory.Contains(x.CategoryId) && x.IsFreeShipping == 1 && x.IsEnable == 1 && x.FullNumPinkage > 0 && x.CategoryId > 0).OrderBy(x => x.FullNumPinkage).FirstOrDefault();
if (fullNumPinkageModel == null || fullNumPinkageModel.ID <= 0)
{
fullNumPinkageModel = freeShippingList.Where(x => x.IsFreeShipping == 1 && x.IsEnable == 1 && x.FullMoneyPinkage > 0).OrderBy(x => x.FullMoneyPinkage).FirstOrDefault();
fullNumPinkageModel = freeShippingList.Where(x => nowcategory.Contains(x.CategoryId) && x.IsFreeShipping == 1 && x.IsEnable == 1 && x.FullMoneyPinkage > 0 && x.CategoryId > 0).OrderBy(x => x.FullMoneyPinkage).FirstOrDefault();
}
if (fullNumPinkageModel == null || fullNumPinkageModel.ID <= 0)
{
fullNumPinkageModel = freeShippingList.Where(x => nowcategory.Contains(x.CategoryId) && x.IsFreeShipping == 1 && x.IsEnable == 1 && x.FullNumPinkage > 0 && x.CategoryId == 0).OrderBy(x => x.FullNumPinkage).FirstOrDefault();
}
if (fullNumPinkageModel == null || fullNumPinkageModel.ID <= 0)
{
fullNumPinkageModel = freeShippingList.Where(x => nowcategory.Contains(x.CategoryId) && x.IsFreeShipping == 1 && x.IsEnable == 1 && x.FullMoneyPinkage > 0 && x.CategoryId == 0).OrderBy(x => x.FullMoneyPinkage).FirstOrDefault();
}
item.FreeShippingModel = (fullNumPinkageModel == null || fullNumPinkageModel.ID <= 0) ? new RB_FreeShipping_Extend() : fullNumPinkageModel;
}
else {
else
{
item.FreeShippingModel = new RB_FreeShipping_Extend();
}
......@@ -4157,7 +4166,7 @@ namespace Mall.Module.Product
{
var supplierModel = supplist.Where(x => x.ID == item.SupplierId).FirstOrDefault();
var qscList = scList.Where(x => x.SupplierId == item.SupplierId).ToList();
if (item.CostMoney > 0 && ((item.Final_Price ?? 0) - (item.CostMoney ?? 0) * (item.Number ?? 0) - item.TCommissionMoney)>0 && qscList.Any())
if (item.CostMoney > 0 && ((item.Final_Price ?? 0) - (item.CostMoney ?? 0) * (item.Number ?? 0) - item.TCommissionMoney) > 0 && qscList.Any())
{
decimal Profit = (item.Final_Price ?? 0) - (item.CostMoney ?? 0) * (item.Number ?? 0) - item.TCommissionMoney;
decimal GrossMargin = Math.Round(Profit / (item.Final_Price ?? 0), 2, MidpointRounding.AwayFromZero);
......
......@@ -1059,10 +1059,18 @@ namespace Mall.Module.Product
var freeShippingList = freeShippingRepository.GetFreeShippingListByCategoryIds(new RB_FreeShipping_Extend { MallBaseId = model.MallBaseId, TenantId = model.TenantId, CategoryIds = categoryIds });
if (freeShippingList != null && freeShippingList.Any())
{
var fullNumPinkageModel = freeShippingList.Where(x => x.IsFreeShipping == 1 && x.IsEnable == 1 && x.FullNumPinkage > 0).OrderBy(x => x.FullNumPinkage).FirstOrDefault();
var fullNumPinkageModel = freeShippingList.Where(x => x.IsFreeShipping == 1 && x.IsEnable == 1 && x.FullNumPinkage > 0 && x.CategoryId > 0).OrderBy(x => x.FullNumPinkage).FirstOrDefault();
if (fullNumPinkageModel == null || fullNumPinkageModel.ID <= 0)
{
fullNumPinkageModel = freeShippingList.Where(x => x.IsFreeShipping == 1 && x.IsEnable == 1 && x.FullMoneyPinkage > 0).OrderBy(x => x.FullMoneyPinkage).FirstOrDefault();
fullNumPinkageModel = freeShippingList.Where(x => x.IsFreeShipping == 1 && x.IsEnable == 1 && x.FullMoneyPinkage > 0 && x.CategoryId > 0).OrderBy(x => x.FullMoneyPinkage).FirstOrDefault();
}
if (fullNumPinkageModel == null || fullNumPinkageModel.ID <= 0)
{
fullNumPinkageModel = freeShippingList.Where(x => x.IsFreeShipping == 1 && x.IsEnable == 1 && x.FullNumPinkage > 0 && x.CategoryId == 0).OrderBy(x => x.FullNumPinkage).FirstOrDefault();
}
if (fullNumPinkageModel == null || fullNumPinkageModel.ID <= 0)
{
fullNumPinkageModel = freeShippingList.Where(x => x.IsFreeShipping == 1 && x.IsEnable == 1 && x.FullMoneyPinkage > 0 && x.CategoryId == 0).OrderBy(x => x.FullMoneyPinkage).FirstOrDefault();
}
model.FreeShippingModel = (fullNumPinkageModel == null || fullNumPinkageModel.ID <= 0) ? new RB_FreeShipping_Extend() : fullNumPinkageModel;
}
......
......@@ -90,7 +90,7 @@ namespace Mall.Repository.BaseSetUp
INNER JOIN rb_mallbase as c on a.MallBaseId = c.ID and a.TenantId = c.TenantId WHERE a.{nameof(RB_FreeShipping_Extend.Status)}=0 ");
if (query != null)
{
if (query.TenantId > 0)
{
builder.Append($" AND a.{nameof(RB_FreeShipping_Extend.TenantId)}={query.TenantId}");
......@@ -101,6 +101,7 @@ INNER JOIN rb_mallbase as c on a.MallBaseId = c.ID and a.TenantId = c.TenantId W
}
if (!string.IsNullOrWhiteSpace(query.CategoryIds))
{
query.CategoryIds += query.CategoryIds + ",0";
builder.Append($" AND b.{nameof(RB_FreeShippingCategory_Extend.CategoryId)} in({query.CategoryIds})");
}
}
......
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