Commit ae8f0151 authored by liudong1993's avatar liudong1993

课程和购物车调整

parent 55468ea3
...@@ -24,6 +24,11 @@ namespace Mall.Model.Extend.Product ...@@ -24,6 +24,11 @@ namespace Mall.Model.Extend.Product
/// </summary> /// </summary>
public decimal? CourseScore { get; set; } public decimal? CourseScore { get; set; }
/// <summary>
/// 商品类型 2网课商品
/// </summary>
public int GoodsClassify { get; set; }
/// <summary> /// <summary>
/// 商品状态 1销售中 2下架中 3 失效 /// 商品状态 1销售中 2下架中 3 失效
/// </summary> /// </summary>
......
...@@ -360,6 +360,13 @@ namespace Mall.Module.Product ...@@ -360,6 +360,13 @@ namespace Mall.Module.Product
smallPList = smallShops_PriceRepository.GetList(new RB_SmallShops_Price_Extend() { SmallShopsId = demodel.SmallShopsId, GoodsIds = goodsIds }); smallPList = smallShops_PriceRepository.GetList(new RB_SmallShops_Price_Extend() { SmallShopsId = demodel.SmallShopsId, GoodsIds = goodsIds });
} }
#endregion #endregion
#region 课程购买
List<RB_Goods_Order_Extend> CourseOrderList = new List<RB_Goods_Order_Extend>();
if (demodel.GoodsClassify == 2)
{
CourseOrderList = goods_OrderRepository.GetCourseOrderIsPay(GoodsIds: goodsIds, UserId: demodel.UserId ?? 0);
}
#endregion
foreach (var item in list) foreach (var item in list)
{ {
item.CoverImage = ""; item.CoverImage = "";
...@@ -388,6 +395,15 @@ namespace Mall.Module.Product ...@@ -388,6 +395,15 @@ namespace Mall.Module.Product
item.GoodsStatus = 3; item.GoodsStatus = 3;
} }
} }
//验证课程是否已下单
if (demodel.GoodsClassify == 2)
{
var coModel = CourseOrderList.Where(x => x.GoodsId == item.GoodsId).FirstOrDefault();
if (coModel != null)
{
item.GoodsStatus = 3;
}
}
//规格赋值 //规格赋值
item.SpecificationList = new List<string>(); item.SpecificationList = new List<string>();
if (item.GoodsStatus != 3) if (item.GoodsStatus != 3)
...@@ -550,8 +566,6 @@ namespace Mall.Module.Product ...@@ -550,8 +566,6 @@ namespace Mall.Module.Product
{ {
item.FreeShippingModel = new RB_FreeShipping_Extend(); item.FreeShippingModel = new RB_FreeShipping_Extend();
} }
} }
} }
return list; return list;
......
...@@ -49,7 +49,7 @@ namespace Mall.Repository.Product ...@@ -49,7 +49,7 @@ namespace Mall.Repository.Product
} }
string sql = $@"select sc.*,g.Name as GoodsName,g.GoodsStatus,g.CarouselImage,g.SellingPrice as Price,g.IsCustomSpecification,g.DefaultSpecificationName, string sql = $@"select sc.*,g.Name as GoodsName,g.GoodsStatus,g.CarouselImage,g.SellingPrice as Price,g.IsCustomSpecification,g.DefaultSpecificationName,
g.EnjoyMember,g.SeparateSetMember,g.InventoryNum,g.FullNumPinkage,g.FullMoneyPinkage,g.MarketingLogo,g.CourseScore from RB_Goods_ShoppingCart sc g.EnjoyMember,g.SeparateSetMember,g.InventoryNum,g.FullNumPinkage,g.FullMoneyPinkage,g.MarketingLogo,g.CourseScore,g.GoodsClassify from RB_Goods_ShoppingCart sc
inner join RB_Goods g on sc.GoodsId=g.Id inner join RB_Goods g on sc.GoodsId=g.Id
where {where} order by g.GoodsStatus asc,sc.CreateDate desc"; where {where} order by g.GoodsStatus asc,sc.CreateDate desc";
return GetPage<RB_Goods_ShoppingCart_Extend>(pageIndex, pageSize, out rowCount, sql).ToList(); return GetPage<RB_Goods_ShoppingCart_Extend>(pageIndex, pageSize, out rowCount, sql).ToList();
......
...@@ -347,7 +347,7 @@ namespace Mall.WebApi.Controllers.Education ...@@ -347,7 +347,7 @@ namespace Mall.WebApi.Controllers.Education
{ {
return ApiResult.ParamIsNull("请输入售价"); return ApiResult.ParamIsNull("请输入售价");
} }
if ((demodel.OriginalPrice ?? 0) <= 0) if ((demodel.OriginalPrice ?? 0) < 0)
{ {
return ApiResult.ParamIsNull("请输入原价"); return ApiResult.ParamIsNull("请输入原价");
} }
......
...@@ -71,10 +71,10 @@ namespace Mall.WebApi.Controllers.MallBase ...@@ -71,10 +71,10 @@ namespace Mall.WebApi.Controllers.MallBase
x.GoodsName, x.GoodsName,
x.CoverImage, x.CoverImage,
x.Price, x.Price,
x.InventoryNum, InventoryNum = x.GoodsClassify == 2 ? 1 : x.InventoryNum,
x.SpecificationList, x.SpecificationList,
x.SpecificationSort, x.SpecificationSort,
x.Number, Number = x.GoodsClassify == 2 ? 1 : x.Number,
x.GoodsStatus, x.GoodsStatus,
x.TenantId, x.TenantId,
x.MallBaseId, x.MallBaseId,
......
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