Commit 9b4e3bd4 authored by 吴春's avatar 吴春

提交代码

parent cbcafbef
...@@ -5,6 +5,7 @@ using System.Text; ...@@ -5,6 +5,7 @@ using System.Text;
using Mall.Model.Entity.Product; using Mall.Model.Entity.Product;
using Mall.Model.Entity.BaseSetUp; using Mall.Model.Entity.BaseSetUp;
using Mall.Model.Extend.BaseSetUp; using Mall.Model.Extend.BaseSetUp;
using Mall.Common.Enum.GuideCar;
namespace Mall.Model.Extend.Product namespace Mall.Model.Extend.Product
{ {
...@@ -33,6 +34,22 @@ namespace Mall.Model.Extend.Product ...@@ -33,6 +34,22 @@ namespace Mall.Model.Extend.Product
/// 导游名称 /// 导游名称
/// </summary> /// </summary>
public string GuideName { get; set; } public string GuideName { get; set; }
/// <summary>
/// 从业年限
/// </summary>
public decimal GuideWorkYears { get; set; }
/// <summary>
/// 用户评分
/// </summary>
public decimal GuideScore { get; set; }
/// <summary>
/// 联系电话
/// </summary>
public string GuideTelephone { get; set; }
/// <summary> /// <summary>
/// 车辆名称 /// 车辆名称
/// </summary> /// </summary>
...@@ -50,6 +67,13 @@ namespace Mall.Model.Extend.Product ...@@ -50,6 +67,13 @@ namespace Mall.Model.Extend.Product
public string RegionIds { get; set; } public string RegionIds { get; set; }
/// <summary>
/// 车辆品牌
/// </summary>
public int? CarBrandId { get; set; }
#endregion #endregion
/// <summary> /// <summary>
......
...@@ -184,9 +184,6 @@ namespace Mall.Module.Product ...@@ -184,9 +184,6 @@ namespace Mall.Module.Product
private readonly RB_DiscountCoupon_ProductRepository discountCoupon_ProductRepository = new RB_DiscountCoupon_ProductRepository(); private readonly RB_DiscountCoupon_ProductRepository discountCoupon_ProductRepository = new RB_DiscountCoupon_ProductRepository();
/// <summary> /// <summary>
/// 车辆搜索模块 /// 车辆搜索模块
/// </summary> /// </summary>
...@@ -679,17 +676,21 @@ namespace Mall.Module.Product ...@@ -679,17 +676,21 @@ namespace Mall.Module.Product
/// <param name="goodsIs"></param> /// <param name="goodsIs"></param>
/// <param name="tdlist"></param> /// <param name="tdlist"></param>
/// <returns></returns> /// <returns></returns>
public string ValidateGoodsTargetDate(int goodsId, List<RB_Goods_TargetDate_Extend> tdlist) { public string ValidateGoodsTargetDate(int goodsId, List<RB_Goods_TargetDate_Extend> tdlist)
{
var oldtdlist = goods_TargetDateRepository.GetList(new RB_Goods_TargetDate_Extend() { GoodsId = goodsId }); var oldtdlist = goods_TargetDateRepository.GetList(new RB_Goods_TargetDate_Extend() { GoodsId = goodsId });
var tddeleteList = oldtdlist.Where(x => !tdlist.Select(y => y.Date).Contains(x.Date)).ToList(); var tddeleteList = oldtdlist.Where(x => !tdlist.Select(y => y.Date).Contains(x.Date)).ToList();
string msg = ""; string msg = "";
foreach (var item in tddeleteList) { foreach (var item in tddeleteList)
{
//看是否有不可预约的 / 有预定人数的 //看是否有不可预约的 / 有预定人数的
if (item.IsReserve == 2 || item.ReserveNum > 0) { if (item.IsReserve == 2 || item.ReserveNum > 0)
{
msg += item.Date.Value.ToString("yyyy-MM-dd") + ","; msg += item.Date.Value.ToString("yyyy-MM-dd") + ",";
} }
} }
if (msg != "") { if (msg != "")
{
msg = msg[..1]; msg = msg[..1];
msg += " 已有订单预定,无法修改当前日期"; msg += " 已有订单预定,无法修改当前日期";
} }
...@@ -1147,6 +1148,16 @@ namespace Mall.Module.Product ...@@ -1147,6 +1148,16 @@ namespace Mall.Module.Product
#region 小程序商品 #region 小程序商品
/// <summary>
/// 获取用户信息
/// </summary>
/// <param name="userId"></param>
/// <returns></returns>
public RB_Member_User_Extend GetMemberUserInfo(int userId)
{
return member_UserRepository.GetEntity(userId).RefMapperTo<RB_Member_User_Extend>();
}
/// <summary> /// <summary>
/// 获取小程序商品详情 /// 获取小程序商品详情
/// </summary> /// </summary>
...@@ -1628,7 +1639,7 @@ namespace Mall.Module.Product ...@@ -1628,7 +1639,7 @@ namespace Mall.Module.Product
var carModel = GuideCarRepository.GetGuideCarCarList(new RB_GuideCar_Car_Extend() { ID = model.GuideId ?? 0 }).FirstOrDefault(); var carModel = GuideCarRepository.GetGuideCarCarList(new RB_GuideCar_Car_Extend() { ID = model.GuideId ?? 0 }).FirstOrDefault();
string CarName = carModel?.Name ?? ""; string CarName = carModel?.Name ?? "";
string CarColorName = CarColorRepository.GetCarColorList(new RB_GuideCar_CarColor_Extend() { ID = model.CarColorId ?? 0 }).FirstOrDefault()?.ColorName ?? ""; string CarColorName = CarColorRepository.GetCarColorList(new RB_GuideCar_CarColor_Extend() { ID = model.CarColorId ?? 0 }).FirstOrDefault()?.ColorName ?? "";
decimal GuideScore = guideModel?.Score ?? 5; decimal GuideScore = guideModel?.Score ?? 5;
decimal CarScore = carModel?.Score ?? 5; decimal CarScore = carModel?.Score ?? 5;
model.LineDescriptionList = new List<string>(); model.LineDescriptionList = new List<string>();
if (!string.IsNullOrEmpty(model.LineDescription) && model.LineDescription != "[]") if (!string.IsNullOrEmpty(model.LineDescription) && model.LineDescription != "[]")
...@@ -1898,7 +1909,7 @@ namespace Mall.Module.Product ...@@ -1898,7 +1909,7 @@ namespace Mall.Module.Product
foreach (var item in demodel.DetailList) foreach (var item in demodel.DetailList)
{ {
var gmodel = gList.Where(x => x.Id == item.GoodsId).FirstOrDefault(); var gmodel = gList.Where(x => x.Id == item.GoodsId).FirstOrDefault();
if (gmodel == null || gmodel.GoodsStatus != 1 || gmodel.GoodsClassify !=1) if (gmodel == null || gmodel.GoodsStatus != 1 || gmodel.GoodsClassify != 1)
{ {
continue; continue;
} }
...@@ -2239,12 +2250,12 @@ namespace Mall.Module.Product ...@@ -2239,12 +2250,12 @@ namespace Mall.Module.Product
} }
} }
} }
//赋值 //赋值
foreach (var item in demodel.DetailList) foreach (var item in demodel.DetailList)
{ {
var gmodel = gList.Where(x => x.Id == item.GoodsId).FirstOrDefault(); var gmodel = gList.Where(x => x.Id == item.GoodsId).FirstOrDefault();
if (gmodel == null || gmodel.GoodsStatus != 1 || gmodel.GoodsClassify !=1) if (gmodel == null || gmodel.GoodsStatus != 1 || gmodel.GoodsClassify != 1)
{ {
continue; continue;
} }
...@@ -2259,7 +2270,7 @@ namespace Mall.Module.Product ...@@ -2259,7 +2270,7 @@ namespace Mall.Module.Product
var areaGoods = AreaList.Where(x => x.GoodsId == item.GoodsId).ToList(); var areaGoods = AreaList.Where(x => x.GoodsId == item.GoodsId).ToList();
bool address_disabled = false; bool address_disabled = false;
if (gmodel.IsAreaBuy == 1 && areaGoods.Any()) if (gmodel.IsAreaBuy == 1 && areaGoods.Any())
{ {
if (!areaGoods.Where(x => disList.Contains(x.AreaId ?? 0)).Any()) if (!areaGoods.Where(x => disList.Contains(x.AreaId ?? 0)).Any())
...@@ -2294,7 +2305,8 @@ namespace Mall.Module.Product ...@@ -2294,7 +2305,8 @@ namespace Mall.Module.Product
DateTime Mindate = Convert.ToDateTime(DateTime.Now.AddDays(gmodel.AdvanceDay ?? 0).ToString("yyyy-MM-dd")); DateTime Mindate = Convert.ToDateTime(DateTime.Now.AddDays(gmodel.AdvanceDay ?? 0).ToString("yyyy-MM-dd"));
targetList = targetList.Where(x => x.Date >= Mindate).ToList(); targetList = targetList.Where(x => x.Date >= Mindate).ToList();
} }
if (!targetList.Any()) { if (!targetList.Any())
{
date_enable = false; date_enable = false;
} }
...@@ -2369,7 +2381,7 @@ namespace Mall.Module.Product ...@@ -2369,7 +2381,7 @@ namespace Mall.Module.Product
cover_pic = gmodel.CoverImage, cover_pic = gmodel.CoverImage,
is_level_alone = gmodel.SeparateSetMember,//是否单独设置会员价 is_level_alone = gmodel.SeparateSetMember,//是否单独设置会员价
is_level = gmodel.EnjoyMember,//是否销售会员价格 is_level = gmodel.EnjoyMember,//是否销售会员价格
sign = "", sign = "",
marketingLogo = gmodel.MarketingLogo marketingLogo = gmodel.MarketingLogo
}); });
} }
...@@ -2455,7 +2467,7 @@ namespace Mall.Module.Product ...@@ -2455,7 +2467,7 @@ namespace Mall.Module.Product
demodel.ShoppingAddress demodel.ShoppingAddress
}, },
address_enable, address_enable,
template_message_list template_message_list
}; };
#endregion #endregion
return ApiResult.Success("", Robj); return ApiResult.Success("", Robj);
...@@ -2488,6 +2500,130 @@ namespace Mall.Module.Product ...@@ -2488,6 +2500,130 @@ namespace Mall.Module.Product
}); });
} }
public List<RB_Goods_Extend> GetAppletGuidCarPageListForCar(int pageIndex, int pageSize, out long rowCount, RB_Goods_Extend demodel)
{
var list = goodsRepository.GetAppletPageListForCar(pageIndex, pageSize, out rowCount, demodel);
if (list.Any())
{
//会员价格
var MemberPriceList = new List<RB_Goods_MemberPrice_Extend>();
if (list.Where(x => x.EnjoyMember == 1 && x.SeparateSetMember == 1).Any())
{
string goodsIds = string.Join(",", list.Where(x => x.EnjoyMember == 1 && x.SeparateSetMember == 1).Select(x => x.Id));
MemberPriceList = goods_MemberPriceRepository.GetList(new RB_Goods_MemberPrice_Extend() { GoodsIds = goodsIds, TenantId = demodel.TenantId, MallBaseId = demodel.MallBaseId });
}
string goodsIds2 = string.Join(",", list.Select(x => x.Id));
List<RB_Goods_Order_Extend> orderlist = goods_OrderRepository.GetGoodsOrderNum(goodsIds: goodsIds2);
#region 微店价格
RB_SmallShops_Info smallModel = new RB_SmallShops_Info();
List<RB_SmallShops_Price_Extend> smallPList = new List<RB_SmallShops_Price_Extend>();
if (demodel.SmallShopsId > 0)
{
smallModel = smallShops_InfoRepository.GetEntity(demodel.SmallShopsId);
smallPList = smallShops_PriceRepository.GetList(new RB_SmallShops_Price_Extend() { SmallShopsId = demodel.SmallShopsId, GoodsIds = goodsIds2 });
}
#endregion
foreach (var item in list)
{
item.CoverImage = "";
if (!string.IsNullOrEmpty(item.CarouselImage) && item.CarouselImage != "[]")
{
List<string> CarouselIdList = JsonConvert.DeserializeObject<List<string>>(item.CarouselImage);
//封面图
item.CoverImage = CarouselIdList[0];
}
item.SpecificationList = new List<RB_Goods_Specification_Extend>();
item.SpecificationPriceList = new List<RB_Goods_SpecificationPrice_Extend>();
if (demodel.SmallShopsId > 0)
{
if ((smallModel.UpPrice ?? 0) > 0 || smallPList.Where(x => x.GoodsId == item.Id && x.UpPrice > 0).Any())
{
var sspModel = smallPList.Where(x => x.GoodsId == item.Id && x.SpecificationKey == "").FirstOrDefault();
if (sspModel != null)
{
//单商品设置的
if (sspModel.PriceType == 1)
{
item.SellingPrice = (item.SellingPrice ?? 0) + Math.Ceiling((item.SellingPrice ?? 0) * (sspModel.UpPrice ?? 0) / 100);
}
else if (sspModel.PriceType == 2)
{
item.SellingPrice = (item.SellingPrice ?? 0) + (sspModel.UpPrice ?? 0);
}
}
else
{
if ((smallModel.UpPrice ?? 0) > 0)
{
if (smallModel.PriceType == 1)
{
item.SellingPrice = (item.SellingPrice ?? 0) + Math.Ceiling((item.SellingPrice ?? 0) * (smallModel.UpPrice ?? 0) / 100);
}
else if (smallModel.PriceType == 2)
{
item.SellingPrice = (item.SellingPrice ?? 0) + (smallModel.UpPrice ?? 0);
}
}
}
}
}
if (item.EnjoyMember == 1 && item.SeparateSetMember == 1)
{
item.MemberPriceList = MemberPriceList.Where(x => x.GoodsId == item.Id).ToList();
#region 微店处理会员价格
if (item.MemberPriceList.Any() && demodel.SmallShopsId > 0)
{
if ((smallModel.UpPrice ?? 0) > 0 || smallPList.Where(x => x.GoodsId == item.Id && x.UpPrice > 0).Any())
{
foreach (var mqitem in item.MemberPriceList)
{
var sspModel = smallPList.Where(x => x.SpecificationKey == mqitem.SpecificationSort).FirstOrDefault();
if (sspModel != null)
{
//单商品设置的
if (sspModel.PriceType == 1)
{
mqitem.MemberPrice = (mqitem.MemberPrice ?? 0) + Math.Ceiling((mqitem.MemberPrice ?? 0) * (sspModel.UpPrice ?? 0) / 100);
}
else if (sspModel.PriceType == 2)
{
mqitem.MemberPrice = (mqitem.MemberPrice ?? 0) + (sspModel.UpPrice ?? 0);
}
}
else
{
if ((smallModel.UpPrice ?? 0) > 0)
{
if (smallModel.PriceType == 1)
{
mqitem.MemberPrice = (mqitem.MemberPrice ?? 0) + Math.Ceiling((mqitem.MemberPrice ?? 0) * (smallModel.UpPrice ?? 0) / 100);
}
else if (smallModel.PriceType == 2)
{
mqitem.MemberPrice = (mqitem.MemberPrice ?? 0) + (smallModel.UpPrice ?? 0);
}
}
}
}
}
}
#endregion
}
item.SalesNum += (orderlist.Where(x => x.GoodsId == item.Id).FirstOrDefault()?.OrderNum ?? 0);
}
}
return list;
}
#endregion #endregion
#region 站点配置 #region 站点配置
...@@ -3190,7 +3326,7 @@ namespace Mall.Module.Product ...@@ -3190,7 +3326,7 @@ namespace Mall.Module.Product
{ {
new WhereHelper (){ FiledName=nameof(RB_GuideCar_CarBrand.ID),FiledValue=model.ID,OperatorEnum=OperatorEnum.Equal} new WhereHelper (){ FiledName=nameof(RB_GuideCar_CarBrand.ID),FiledValue=model.ID,OperatorEnum=OperatorEnum.Equal}
}; };
flag= carBrandRepository.Update(filedsRegion, whereHelpersRegion); flag = carBrandRepository.Update(filedsRegion, whereHelpersRegion);
} }
} }
catch (Exception ex) catch (Exception ex)
...@@ -3209,7 +3345,7 @@ namespace Mall.Module.Product ...@@ -3209,7 +3345,7 @@ namespace Mall.Module.Product
/// <param name="gradeId"></param> /// <param name="gradeId"></param>
/// <param name="uid"></param> /// <param name="uid"></param>
/// <returns></returns> /// <returns></returns>
public bool DelGuideCarBrandInfo(List<string> ids, int uid, int mallBaseId) public bool DelGuideCarBrandInfo(List<string> ids, int uid, int mallBaseId)
{ {
var trans = carBrandRepository.DbTransaction; var trans = carBrandRepository.DbTransaction;
bool flag = false; bool flag = false;
......
...@@ -119,6 +119,10 @@ namespace Mall.Repository.GuideCar ...@@ -119,6 +119,10 @@ namespace Mall.Repository.GuideCar
{ {
builder.Append($" AND a.{nameof(RB_GuideCar_Guide_Extend.ID)}={query.ID}"); builder.Append($" AND a.{nameof(RB_GuideCar_Guide_Extend.ID)}={query.ID}");
} }
if (query.SiteId > 0)
{
builder.Append($" AND a.{nameof(RB_GuideCar_Guide_Extend.SiteId)}={query.SiteId}");
}
if (!string.IsNullOrEmpty(query.GuideIds)) if (!string.IsNullOrEmpty(query.GuideIds))
{ {
builder.Append($" AND a.{nameof(RB_GuideCar_Guide_Extend.ID)} in({query.GuideIds})"); builder.Append($" AND a.{nameof(RB_GuideCar_Guide_Extend.ID)} in({query.GuideIds})");
......
...@@ -829,7 +829,7 @@ WHERE {where} group by g.Id order by g.CreateDate desc"; ...@@ -829,7 +829,7 @@ WHERE {where} group by g.Id order by g.CreateDate desc";
/// <returns></returns> /// <returns></returns>
public List<RB_Goods_Extend> GetAppletPageListForCar(int pageIndex, int pageSize, out long rowCount, RB_Goods_Extend dmodel) public List<RB_Goods_Extend> GetAppletPageListForCar(int pageIndex, int pageSize, out long rowCount, RB_Goods_Extend dmodel)
{ {
string where = $" 1=1 and g.{nameof(RB_Goods_Extend.Status)}=0 and g.GoodsClassify=1 and g.{nameof(RB_Goods_Extend.GoodsStatus)}=1"; string where = $" 1=1 and g.{nameof(RB_Goods_Extend.Status)}=0 and gcg.Status=0 and c.Status=0 and d.Status=0 and f.Status=0 and b.IsReserve=1 and a.AdvanceDay<=datediff(b.Date,NOW()) and g.GoodsClassify=1 and g.{nameof(RB_Goods_Extend.GoodsStatus)}=1";
if (dmodel.TenantId > 0) if (dmodel.TenantId > 0)
{ {
where += $@" and g.{nameof(RB_Goods_Extend.TenantId)}={dmodel.TenantId}"; where += $@" and g.{nameof(RB_Goods_Extend.TenantId)}={dmodel.TenantId}";
...@@ -849,11 +849,17 @@ WHERE {where} group by g.Id order by g.CreateDate desc"; ...@@ -849,11 +849,17 @@ WHERE {where} group by g.Id order by g.CreateDate desc";
if (dmodel.CarType.HasValue&& (int)dmodel.CarType > 0) if (dmodel.CarType.HasValue&& (int)dmodel.CarType > 0)
{ {
where += $@" and g.{nameof(RB_Goods_Extend.CarType)}={(int)dmodel.CarType}"; where += $@" and g.{nameof(RB_Goods_Extend.CarType)}={(int)dmodel.CarType}";
if (dmodel.CarType==Common.Enum.Goods.GuideCarGoodsTypeEnum.Line)
{
if (dmodel.IsSpell > 0)
{
where += $@" and g.{nameof(RB_Goods_Extend.IsSpell)}={dmodel.IsSpell}";
}
}
} }
if (!string.IsNullOrEmpty(dmodel.RegionIds)) if (!string.IsNullOrEmpty(dmodel.RegionIds))
{ {
where += $@" and e.RegionId in({dmodel.RegionIds}) "; where += $@" and d.RegionId in({dmodel.RegionIds}) ";
} }
if (!string.IsNullOrEmpty(dmodel.LineName)) if (!string.IsNullOrEmpty(dmodel.LineName))
{ {
...@@ -867,23 +873,18 @@ WHERE {where} group by g.Id order by g.CreateDate desc"; ...@@ -867,23 +873,18 @@ WHERE {where} group by g.Id order by g.CreateDate desc";
{ {
where += $@" and g.{nameof(RB_Goods_Extend.UseDay)}={dmodel.UseDay}"; where += $@" and g.{nameof(RB_Goods_Extend.UseDay)}={dmodel.UseDay}";
} }
if (dmodel.IsSpell > 0)
{
where += $@" and g.{nameof(RB_Goods_Extend.IsSpell)}={dmodel.IsSpell}";
}
if (dmodel.RideNum > 0) if (dmodel.RideNum > 0)
{ {
where += $@" and (g.{nameof(RB_Goods_Extend.RideNum)}-b.ReserveNum)>={dmodel.RideNum}"; where += $@" and (g.{nameof(RB_Goods_Extend.RideNum)}-b.ReserveNum)>={dmodel.RideNum}";
} }
if (dmodel.CarClass.HasValue&& dmodel.CarClass > 0) if (dmodel.CarClass.HasValue&& dmodel.CarClass > 0)
{ {
where += $@" and e.CarClass={dmodel.CarClass}"; where += $@" and e.CarClass={dmodel.CarClass}";
} }
if (dmodel.CarBrandId.HasValue && dmodel.CarBrandId > 0)
{
where += $@" and e.CarBrandId={dmodel.CarBrandId}";
}
if (!string.IsNullOrEmpty(dmodel.GoodsIds)) if (!string.IsNullOrEmpty(dmodel.GoodsIds))
{ {
where += $@" and g.{nameof(RB_Goods_Extend.Id)} in({dmodel.GoodsIds})"; where += $@" and g.{nameof(RB_Goods_Extend.Id)} in({dmodel.GoodsIds})";
...@@ -902,12 +903,12 @@ WHERE {where} group by g.Id order by g.CreateDate desc"; ...@@ -902,12 +903,12 @@ WHERE {where} group by g.Id order by g.CreateDate desc";
} }
if (!string.IsNullOrEmpty(dmodel.StartTime)) if (!string.IsNullOrEmpty(dmodel.StartTime))
{ {
where += $@" and g.{nameof(RB_Goods_Extend.CreateDate)} >='{dmodel.StartTime}'"; where += $@" and b.Date >='{dmodel.StartTime}'";
}
if (!string.IsNullOrEmpty(dmodel.EndTime))
{
where += $@" and g.{nameof(RB_Goods_Extend.CreateDate)} <='{dmodel.EndTime + " 23:59:59"}'";
} }
//if (!string.IsNullOrEmpty(dmodel.EndTime))
//{
// where += $@" and b.Date <='{dmodel.EndTime + " 23:59:59"}'";
//}
if (dmodel.IsProcurement > 0) if (dmodel.IsProcurement > 0)
{ {
where += $@" and g.{nameof(RB_Goods_Extend.IsProcurement)}={dmodel.IsProcurement}"; where += $@" and g.{nameof(RB_Goods_Extend.IsProcurement)}={dmodel.IsProcurement}";
...@@ -920,7 +921,6 @@ WHERE {where} group by g.Id order by g.CreateDate desc"; ...@@ -920,7 +921,6 @@ WHERE {where} group by g.Id order by g.CreateDate desc";
{ {
where += $@" and g.{nameof(RB_Goods_Extend.SupplierId)}={dmodel.SupplierId}"; where += $@" and g.{nameof(RB_Goods_Extend.SupplierId)}={dmodel.SupplierId}";
} }
string orderBy = " g.Sort desc"; string orderBy = " g.Sort desc";
if (dmodel.OrderBy == 1) if (dmodel.OrderBy == 1)
{ {
...@@ -962,17 +962,13 @@ WHERE {where} group by g.Id order by g.CreateDate desc"; ...@@ -962,17 +962,13 @@ WHERE {where} group by g.Id order by g.CreateDate desc";
//最新降序 //最新降序
orderBy = " g.CreateDate desc"; orderBy = " g.CreateDate desc";
} }
string sql = $@"SELECT g.*,c.SiteName,e.`Name` as CarName,e.CarType as GuideCarType,f.ColorName as CarColorName,gcg.Name as GuideName,gcg.WorkYears as GuideWorkYears,gcg.Score as GuideScore,gcg.Telephone as GuideTelephone from rb_goods as g
// e.CarClass = 1
//and g.CarType = 1 and g.LineName like'%川藏%' and g.LineDescription like'%成都%'
//and g.UseDay = 2 and g.IsSpell = 1 and(g.RideNum - b.ReserveNum) >= 4 and d.RegionId in(4)
string sql = $@"SELECT g.*,c.SiteName,e.`Name` as CarName from rb_goods as g
LEFT JOIN rb_goods_targetdate as b on g.Id=b.GoodsId LEFT JOIN rb_goods_targetdate as b on g.Id=b.GoodsId
LEFT JOIN rb_guidecar_site as c on g.SiteId=c.ID LEFT JOIN rb_guidecar_site as c on g.SiteId=c.ID
LEFT JOIN rb_guidecar_car as e on e.ID=g.CarId LEFT JOIN rb_guidecar_car as e on e.ID=g.CarId
LEFT JOIN rb_guidecar_siteregion d on d.SiteId=g.SiteId LEFT JOIN rb_guidecar_siteregion as d on d.SiteId=g.SiteId
LEFT JOIN rb_guidecar_carcolor as f on f.ID=g.CarColorId
LEFT JOIN rb_guidecar_guide as gcg on gcg.ID=g.GuideId
where {where} GROUP BY g.Id order by {orderBy}"; where {where} GROUP BY g.Id order by {orderBy}";
return GetPage<RB_Goods_Extend>(pageIndex, pageSize, out rowCount, sql).ToList(); return GetPage<RB_Goods_Extend>(pageIndex, pageSize, out rowCount, sql).ToList();
} }
......
...@@ -5,6 +5,8 @@ using System.Threading.Tasks; ...@@ -5,6 +5,8 @@ using System.Threading.Tasks;
using Mall.Common.API; using Mall.Common.API;
using Mall.Common.Plugin; using Mall.Common.Plugin;
using Mall.Model.Extend.GuideCar; using Mall.Model.Extend.GuideCar;
using Mall.Model.Extend.Product;
using Mall.Model.Extend.User;
using Mall.Module.Product; using Mall.Module.Product;
using Mall.WebApi.Filter; using Mall.WebApi.Filter;
using Microsoft.AspNetCore.Cors; using Microsoft.AspNetCore.Cors;
...@@ -26,6 +28,211 @@ namespace Mall.WebApi.Controllers.Product ...@@ -26,6 +28,211 @@ namespace Mall.WebApi.Controllers.Product
#region 商品详情 #region 商品详情
/// <summary>
/// 小程序分页列表(赞羊)
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetAppletGoodsPageListForZY(object requestMsg)
{
var parms = JsonConvert.DeserializeObject<RequestParm>(requestMsg.ToString());
if (parms.MallBaseId <= 0)
{
return ApiResult.ParamIsNull();
}
ResultPageModel pagelist = JsonConvert.DeserializeObject<ResultPageModel>(parms.msg.ToString());
RB_Goods_Extend demodel = JsonConvert.DeserializeObject<RB_Goods_Extend>(parms.msg.ToString());
demodel.TenantId = parms.TenantId;
demodel.MallBaseId = parms.MallBaseId;
demodel.GoodsStatus = 1;//只查询销售中的
demodel.SmallShopsId = parms.SmallShopsId;
int UserId = parms.UserId;
RB_Member_User_Extend userModel = new RB_Member_User_Extend();
RB_Member_Grade_Extend memberGrade = new RB_Member_Grade_Extend();
if (UserId > 0)
{
userModel = guideCarModule.GetMemberUserInfo(UserId);
if (userModel.MemberGrade > 0)
{
memberGrade = guideCarModule.GetMemberGradeList(new RB_Member_Grade_Extend() { Id = userModel.MemberGrade ?? 0, Enabled = 1, TenantId = demodel.TenantId, MallBaseId = demodel.MallBaseId }).FirstOrDefault();
}
if (demodel.SmallShopsId == 0)
{
demodel.SmallShopsId = userModel.SmallShopId;
}
}
var list = guideCarModule.GetAppletGuidCarPageListForCar(pagelist.pageIndex, pagelist.pageSize, out long count, demodel);
List<object> RList = new List<object>();
if (list.Any())
{
foreach (var model in list)
{
#region 组装价格
List<object> priceList = new List<object>();
if (model.IsCustomSpecification == 1)
{
if (model.SpecificationPriceList.Any() && model.SpecificationList.Any())
{
foreach (var item in model.SpecificationPriceList)
{
var ssarr = item.SpecificationSort.Split(':');
int Sort = Convert.ToInt32(ssarr[0]);
string pic_url = model.SpecificationList[0].SpecificationValueList.Where(x => x.Sort == Sort).FirstOrDefault()?.ImagePath;
List<object> attr_list = new List<object>();
for (int i = 0; i < ssarr.Length; i++)
{
var smodel = model.SpecificationList[i];
var svmodel = smodel.SpecificationValueList.Where(x => x.Sort == Convert.ToInt32(ssarr[i])).FirstOrDefault();
attr_list.Add(new
{
attr_group_name = smodel.Name,
attr_group_id = smodel.Sort,
attr_id = svmodel.Id,
attr_name = svmodel.Name
});
}
decimal price_member = item.SellingPrice ?? 0;//未设会员价格的话 就为销售价格
if (model.EnjoyMember == 1 && model.SeparateSetMember == 1)
{
if (model.MemberPriceList.Any())
{
var mlist = model.MemberPriceList.Where(x => x.SpecificationSort == item.SpecificationSort).ToList();
if (UserId > 0 && userModel.MemberGrade > 0)
{
var gmodel = mlist.Where(x => x.MemberGrade == userModel.MemberGrade).FirstOrDefault();
price_member = gmodel.MemberPrice ?? 0;
}
}
}
else
{
if (UserId > 0 && userModel.MemberGrade > 0)
{
price_member = Math.Round((model.SellingPrice ?? 0) * (memberGrade?.Discount ?? 10) / 10, 2, MidpointRounding.AwayFromZero);
}
}
priceList.Add(new
{
id = item.Id,
goods_id = model.Id,
sign_id = item.SpecificationSort,
stock = item.InventoryNum,
price = item.SellingPrice,
no = item.GoodsNumbers,
weight = item.GoodsWeight,
pic_url,
is_delete = item.Status,
attr_list,
price_member
});
}
}
}
else
{
decimal price_member = model.SellingPrice ?? 0;//未设会员价格的话 就为销售价格
if (model.EnjoyMember == 1 && model.SeparateSetMember == 1)
{
if (model.MemberPriceList.Any())
{
var mlist = model.MemberPriceList;
if (UserId > 0 && userModel.MemberGrade > 0)
{
var gmodel = mlist.Where(x => x.MemberGrade == userModel.MemberGrade).FirstOrDefault();
price_member = gmodel.MemberPrice ?? 0;
}
}
}
else
{
if (UserId > 0 && userModel.MemberGrade > 0)
{
price_member = Math.Round((model.SellingPrice ?? 0) * (memberGrade?.Discount ?? 10) / 10, 2, MidpointRounding.AwayFromZero);
}
}
priceList.Add(new
{
id = 0,
goods_id = model.Id,
sign_id = "",
stock = model.InventoryNum,
price = model.SellingPrice ?? 0,
no = model.GoodsNumbers,
weight = model.GoodsWeight,
pic_url = "",
is_delete = 0,
attr_list = new
{
attr_group_name = "规格",
attr_group_id = 0,
attr_id = 0,
attr_name = model.DefaultSpecificationName
},
price_member
});
}
#endregion
#region 会员价格
decimal memberprice = model.SellingPrice ?? 0;
if (UserId > 0 && userModel.MemberGrade > 0 && model.EnjoyMember == 1 && model.SeparateSetMember == 1 && model.MemberPriceList.Any())
{
memberprice = model.MemberPriceList.Where(x => x.MemberGrade == userModel.MemberGrade).Min(x => x.MemberPrice ?? 0);
}
else if (UserId > 0 && userModel.MemberGrade > 0)
{
memberprice = memberprice * (memberGrade?.Discount ?? 10) / 10;
}
#endregion
RList.Add(new
{
id = model.Id,
sign = "",
name = model.Name,
cover_pic = model.CoverImage,
video_url = model.VideoAddress,
original_price = model.OriginalPrice,
unit = model.Unit,
page_url = "/pages/goods/goods?id=" + model.Id,
is_negotiable = model.IsGoodsNegotiable,
is_level = model.EnjoyMember,
level_price = memberprice,
price = (model.SellingPrice ?? 0).ToString("#0.00"),
price_content = "¥" + (model.SellingPrice ?? 0).ToString("#0.00"),
is_sales = model.GoodsStatus,
sales = "已售" + model.SalesNum + "件",
freeShippingName = model.FreeShippingModel.Name,
freeShippingFullMoneyPinkage = model.FreeShippingModel.FullMoneyPinkage ?? 0,
freeShippingFullNumPinkage = model.FreeShippingModel.FullNumPinkage ?? 0,
attr_groups = model.SpecificationList.Select(x => new
{
attr_group_id = x.Sort,
attr_group_name = x.Name,
attr_list = x.SpecificationValueList.Select(z => new
{
attr_id = z.Sort,
attr_name = z.Name,
pic_url = z.ImagePath
})
}),
attr = priceList,
goods_stock = model.InventoryNum,
goods_num = model.InventoryNum,
marketingLogo = model.MarketingLogo
});
}
}
pagelist.count = Convert.ToInt32(count);
pagelist.pageData = RList;
return ApiResult.Success("", pagelist);
}
/// <summary> /// <summary>
/// 获取小程序商品详情 /// 获取小程序商品详情
/// </summary> /// </summary>
......
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