Commit 96142968 authored by 吴春's avatar 吴春

提交插件

parent 39037f3f
......@@ -2301,7 +2301,7 @@ namespace Mall.Model.Extend.MarketingCenter
/// </summary>
public int listStyle { get; set; }
/// <summary>
/// 背景颜色
......@@ -2422,7 +2422,7 @@ namespace Mall.Model.Extend.MarketingCenter
/// </summary>
public int listStyle { get; set; }
/// <summary>
/// 背景颜色
/// </summary>
......@@ -2466,4 +2466,286 @@ namespace Mall.Model.Extend.MarketingCenter
#endregion
#region 门店
/// <summary>
/// 门店
/// </summary>
public class StoreGoodsItem
{
/// <summary>
/// 显示分类
/// </summary>
public bool showCat { get; set; }
/// <summary>
/// 分类栏位置
/// </summary>
public string catPosition { get; set; }
/// <summary>
/// 分类样式
/// </summary>
public int catStyle { get; set; }
/// <summary>
/// 商品添加方式【0-自动添加,1-手动添加】
/// </summary>
public int addGoodsType { get; set; }
/// <summary>
/// 商品数量
/// </summary>
public int goodsLength { get; set; }
/// <summary>
/// 列表样式[-1-列表模式,0-左右滑动,1-一行一个,2-一行两个3-一行三个 4-教育模式]
/// </summary>
public int listStyle { get; set; }
/// <summary>
/// 商品封面图宽高比例[1-1]
/// </summary>
public string goodsCoverProportion { get; set; }
/// <summary>
/// 商品封面图填充
/// </summary>
public int fill { get; set; }
/// <summary>
/// 商品样式
/// </summary>
public int goodsStyle { get; set; }
/// <summary>
/// 文本样式
/// </summary>
public int textStyle { get; set; }
/// <summary>
/// 显示商品名称
/// </summary>
public bool showGoodsName { get; set; }
/// <summary>
/// 显示商品价格
/// </summary>
public bool showGoodsPrice { get; set; }
/// <summary>
/// 显示购买按钮
/// </summary>
public bool showBuyBtn { get; set; }
/// <summary>
/// 购买按钮样式[cart]
/// </summary>
public string buyBtn { get; set; }
/// <summary>
/// 购买按钮文字样式
/// </summary>
public int buyBtnStyle { get; set; }
/// <summary>
/// 购买按钮文字
/// </summary>
public string buyBtnText { get; set; }
/// <summary>
/// 购买按钮颜色
/// </summary>
public string buttonColor { get; set; }
/// <summary>
/// 显示评分 ld 2020-10-13
/// </summary>
public bool showScore { get; set; }
/// <summary>
/// 评分颜色
/// </summary>
public string scoreColor { get; set; }
/// <summary>
/// 显示商品角标
/// </summary>
public bool showGoodsTag { get; set; }
/// <summary>
/// 商品角标自定义
/// </summary>
public bool customizeGoodsTag { get; set; }
/// <summary>
/// 商品角标链接
/// </summary>
public string goodsTagPicUrl { get; set; }
/// <summary>
/// 是否显示图片背景
/// </summary>
public bool showImg { get; set; }
/// <summary>
/// 背景颜色
/// </summary>
public string backgroundColor { get; set; }
/// <summary>
/// 背景链接
/// </summary>
public string backgroundPicUrl { get; set; }
/// <summary>
///
/// </summary>
public int position { get; set; }
/// <summary>
/// 图片位置
/// </summary>
public int mode { get; set; }
/// <summary>
/// 背景高
/// </summary>
public int backgroundHeight { get; set; }
/// <summary>
/// 背景宽
/// </summary>
public int backgroundWidth { get; set; }
/// <summary>
/// 分类列表
/// </summary>
public List<StoreCatItem> catList { get; set; }
/// <summary>
/// 商品列表
/// </summary>
public List<StoreGoodsDetailsItem2> list { get; set; }
}
/// <summary>
/// 门店商品分类
/// </summary>
public class StoreCatItem
{
/// <summary>
/// 分类编号
/// </summary>
public int id { get; set; }
/// <summary>
/// 商品分类
/// </summary>
public string name { get; set; }
/// <summary>
/// 菜单名称
/// </summary>
public string menuName { get; set; }
/// <summary>
/// 商品数量
/// </summary>
public int goodsNum { get; set; }
/// <summary>
/// 是否显示自定义商品
/// </summary>
public bool staticGoods { get; set; }
/// <summary>
/// 商品列表
/// </summary>
public List<GoodsDetailsItem2> goodsList { get; set; }
}
/// <summary>
/// 门店商品详情项
/// </summary>
public class StoreGoodsDetailsItem2
{
/// <summary>
/// 商品编号
/// </summary>
public int id { get; set; }
/// <summary>
/// 商品名称
/// </summary>
public string name { get; set; }
/// <summary>
/// 商品图片
/// </summary>
public string picUrl { get; set; }
/// <summary>
/// 售价
/// </summary>
public decimal price { get; set; }
/// <summary>
/// 【原价】前端使用
/// </summary>
public decimal OriginalPrice { get; set; }
/// <summary>
/// 课程评分 2020-10-13 ld
/// </summary>
public decimal courseScore { get; set; }
}
/// <summary>
/// 门店
/// </summary>
public class ReserveStoreItem
{
/// <summary>
/// 上边距
/// </summary>
public string PaddingTop { get; set; }
/// <summary>
/// 下边距
/// </summary>
public string PaddingBottom { get; set; }
/// <summary>
/// 左边距
/// </summary>
public string PaddingLeft { get; set; }
/// <summary>
/// 右边距
/// </summary>
public string PaddingRight { get; set; }
/// <summary>
/// 搜索圆角像素
/// </summary>
public int SearchFilletPX
{
get;
set;
}
/// <summary>
/// 是否显示封面图
/// </summary>
public bool IsShowStoreImg { get; set; }
}
#endregion
}
\ No newline at end of file
......@@ -161,11 +161,11 @@ namespace Mall.Module.MarketingCenter
h = h_root,
hotspot = new List<hotspotItem>(),
list = new List<rubikDetailItem>(),
left=jObj.ContainsKey("left")? jObj["left"].ToString():"0",
right = jObj.ContainsKey("right") ? jObj["right"].ToString():"0",
top = jObj.ContainsKey("top") ? jObj["top"].ToString():"0",
bottom = jObj.ContainsKey("bottom") ? jObj["bottom"].ToString():"0",
background= jObj.ContainsKey("background") ? jObj["background"].ToString():"",
left = jObj.ContainsKey("left") ? jObj["left"].ToString() : "0",
right = jObj.ContainsKey("right") ? jObj["right"].ToString() : "0",
top = jObj.ContainsKey("top") ? jObj["top"].ToString() : "0",
bottom = jObj.ContainsKey("bottom") ? jObj["bottom"].ToString() : "0",
background = jObj.ContainsKey("background") ? jObj["background"].ToString() : "",
};
if (!string.IsNullOrWhiteSpace(jObj["hotspot"].ToString()))
......@@ -186,7 +186,7 @@ namespace Mall.Module.MarketingCenter
int zIndex = 0;
if (subItem["zIndex"] != null && !string.IsNullOrWhiteSpace(subItem["zIndex"].ToString()))
{
Int32.TryParse(subItem["zIndex"].ToString(), out zIndex);
Int32.TryParse(subItem["zIndex"].ToString(), out zIndex);
}
var links = new List<rubikLinkItem>();
if (subItem["link"] != null && !string.IsNullOrWhiteSpace(subItem["link"].ToString()))
......@@ -253,7 +253,7 @@ namespace Mall.Module.MarketingCenter
}
catch
{
}
}
try
......@@ -397,12 +397,12 @@ namespace Mall.Module.MarketingCenter
}
}
catch
{
{
}
item.data = shopModel;
break;
//司导插件
//司导插件
case "drive-guide":
driveGuideItem driveModel = new driveGuideItem();
try
......@@ -513,6 +513,29 @@ namespace Mall.Module.MarketingCenter
}
item.data = educationArticleModel;
break;
//商品插件
case "storeGoods": item.data = JsonHelper.DeserializeObject<StoreGoodsItem>(item.data.ToString()); break;
case "reservestore":
ReserveStoreItem storeModel = new ReserveStoreItem();
try
{
var driveData = JsonHelper.DeserializeObject<ReserveStoreItem>(item.data.ToString());
if (driveData != null)
{
storeModel.PaddingTop = driveData?.PaddingTop ?? "0";
storeModel.PaddingBottom = driveData?.PaddingBottom ?? "0";
storeModel.PaddingLeft = driveData?.PaddingLeft ?? "0";
storeModel.PaddingRight = driveData?.PaddingRight ?? "0";
storeModel.SearchFilletPX = driveData?.SearchFilletPX ?? 0;
storeModel.IsShowStoreImg = driveData?.IsShowStoreImg ?? false;
}
}
catch
{
}
item.data = storeModel;
break;
}
}
......
......@@ -830,8 +830,350 @@ namespace Mall.WebApi.Controllers
};
break;
//商品插件
case "storeGoods":
var storeGoodsData = subItem.data as StoreGoodsItem;
if (storeGoodsData != null)
{
//显示商品分类
if (storeGoodsData.showCat)
{
if (storeGoodsData.catList != null && storeGoodsData.catList.Count > 0)
{
foreach (var childItem in storeGoodsData.catList)
{
//自定义商品
if (childItem.staticGoods)
{
if (childItem.goodsList != null && childItem.goodsList.Count > 0)
{
var Ids = "0," + string.Join(",", childItem.goodsList.Select(qitem => qitem.id));
var tempGoodsList = productModule.GetProductGoodsList(new Model.Extend.Product.RB_Goods_Extend()
{
TenantId = TenantId,
MallBaseId = MallBaseId,
GoodsIds = Ids,
GoodsStatus = 1,
GoodsClassify = 3,//查询非司导
GoodsPageType = IsOpenSchool == 1 ? Common.Enum.Goods.GoodsPageTypeEnum.School : Common.Enum.Goods.GoodsPageTypeEnum.Mall
}, SmallShopsId: SmallShopsId);
List<GoodsDetailsItem2> newGoodsList = new List<GoodsDetailsItem2>();
foreach (var goodItem in childItem.goodsList)
{
var lastItem = new GoodsDetailsItem2();
var tempGood = tempGoodsList?.Where(qitem => qitem.Id == goodItem.id)?.FirstOrDefault();
if (tempGood != null && tempGood.Id > 0)
{
lastItem.id = tempGood.Id;
lastItem.name = tempGood.Name;
lastItem.price = Math.Round((tempGood?.SellingPrice ?? 0), 2);
lastItem.picUrl = tempGood?.CoverImage != null ? Common.Config.GetFileUrl(tempGood.CoverImage) : "";
lastItem.OriginalPrice = Math.Round((tempGood?.OriginalPrice ?? 0), 2);
lastItem.courseScore = (tempGood.CourseScore ?? 0);
newGoodsList.Add(lastItem);
}
}
childItem.goodsList = newGoodsList;
}
}
//自动添加商品
else
{
childItem.goodsList = new List<GoodsDetailsItem2>();
var catGoodsList = productModule.GetProductGoodsPageList_V2(1, childItem.goodsNum, out long rowsCount, new Model.Extend.Product.RB_Goods_Extend()
{
TenantId = TenantId,
MallBaseId = MallBaseId,
CategoryIds = childItem.id.ToString(),
GoodsStatus = 1,
GoodsClassify = 3,//查询非司导
GoodsPageType = IsOpenSchool == 1 ? Common.Enum.Goods.GoodsPageTypeEnum.School : Common.Enum.Goods.GoodsPageTypeEnum.Mall
}, SmallShopsId: SmallShopsId);
if (catGoodsList != null && catGoodsList.Count > 0)
{
foreach (var gItem in catGoodsList)
{
childItem.goodsList.Add(new GoodsDetailsItem2()
{
id = gItem.Id,
price = Math.Round((gItem?.SellingPrice ?? 0), 2),
name = gItem.Name,
picUrl = Common.Config.GetFileUrl(gItem.CoverImage),
OriginalPrice = Math.Round((gItem?.OriginalPrice ?? 0), 2),
courseScore = gItem.CourseScore ?? 0
});
}
}
}
}
}
}
//不显示商品分类
else
{
//自动添加商品
if (storeGoodsData.addGoodsType == 0)
{
storeGoodsData.list = new List<StoreGoodsDetailsItem2>();
var goodsList = productModule.GetProductGoodsPageList_V2(1, storeGoodsData.goodsLength, out long rowsCount, new Model.Extend.Product.RB_Goods_Extend()
{
TenantId = TenantId,
MallBaseId = MallBaseId,
GoodsStatus = 1,
GoodsClassify =3,//查询非司导
GoodsPageType = IsOpenSchool == 1 ? Common.Enum.Goods.GoodsPageTypeEnum.School : Common.Enum.Goods.GoodsPageTypeEnum.Mall
});
#region 微店价格
RB_SmallShops_Info_Extend smallModel = new RB_SmallShops_Info_Extend();
List<RB_SmallShops_Price_Extend> smallPList = new List<RB_SmallShops_Price_Extend>();
if (SmallShopsId > 0 && goodsList.Any())
{
string goodsId = string.Join(",", goodsList.Select(x => x.Id));
smallModel = smallShops_InfoRepository.GetEntity<RB_SmallShops_Info_Extend>(SmallShopsId);
smallPList = smallShops_PriceRepository.GetList(new RB_SmallShops_Price_Extend() { SmallShopsId = SmallShopsId, GoodsIds = goodsId });
var spriceList = goods_SpecificationPriceRepository.GetList(new RB_Goods_SpecificationPrice_Extend() { GoodsIds = goodsId });
foreach (var item in goodsList)
{
if ((smallModel.UpPrice ?? 0) > 0 || smallPList.Where(x => x.GoodsId == item.Id && x.UpPrice > 0).Any())
{
var spList = spriceList.Where(x => x.GoodsId == item.Id).ToList();
if (spList.Any())
{
foreach (var qitem in spList)
{
var sspModel = smallPList.Where(x => x.GoodsId == item.Id && x.SpecificationKey == qitem.SpecificationSort).FirstOrDefault();
if (sspModel != null)
{
//单商品设置的
if (sspModel.PriceType == 1)
{
qitem.SellingPrice = (qitem.SellingPrice ?? 0) + Math.Ceiling((qitem.SellingPrice ?? 0) * (sspModel.UpPrice ?? 0) / 100);
}
else if (sspModel.PriceType == 2)
{
qitem.SellingPrice = (qitem.SellingPrice ?? 0) + (sspModel.UpPrice ?? 0);
}
}
else
{
if ((smallModel.UpPrice ?? 0) > 0)
{
if (smallModel.PriceType == 1)
{
qitem.SellingPrice = (qitem.SellingPrice ?? 0) + Math.Ceiling((qitem.SellingPrice ?? 0) * (smallModel.UpPrice ?? 0) / 100);
}
else if (smallModel.PriceType == 2)
{
qitem.SellingPrice = (qitem.SellingPrice ?? 0) + (smallModel.UpPrice ?? 0);
}
}
}
}
item.SellingPrice = spList.Min(x => x.SellingPrice ?? 0);
decimal MaxPrice = spList.Max(x => x.SellingPrice ?? 0);
MaxPrice += Math.Ceiling(MaxPrice / 10);
if (MaxPrice > item.OriginalPrice)
{
item.OriginalPrice = MaxPrice;
}
}
else
{
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);
item.OriginalPrice = (item.OriginalPrice ?? 0) + Math.Ceiling((item.OriginalPrice ?? 0) * (sspModel.UpPrice ?? 0) / 100);
}
else if (sspModel.PriceType == 2)
{
item.SellingPrice = (item.SellingPrice ?? 0) + (sspModel.UpPrice ?? 0);
item.OriginalPrice = (item.OriginalPrice ?? 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);
item.OriginalPrice = (item.OriginalPrice ?? 0) + Math.Ceiling((item.OriginalPrice ?? 0) * (smallModel.UpPrice ?? 0) / 100);
}
else if (smallModel.PriceType == 2)
{
item.SellingPrice = (item.SellingPrice ?? 0) + (smallModel.UpPrice ?? 0);
item.OriginalPrice = (item.OriginalPrice ?? 0) + (smallModel.UpPrice ?? 0);
}
}
}
}
}
}
}
#endregion
if (goodsList != null && goodsList.Count > 0)
{
foreach (var gItem in goodsList)
{
storeGoodsData.list.Add(new StoreGoodsDetailsItem2()
{
id = gItem.Id,
price = Math.Round((gItem?.SellingPrice ?? 0), 2),
name = gItem.Name,
picUrl = Common.Config.GetFileUrl(gItem.CoverImage),
OriginalPrice = Math.Round((gItem?.OriginalPrice ?? 0), 2),
courseScore = gItem.CourseScore ?? 0
});
}
}
}
//手动添加商品
else
{
if (storeGoodsData.list != null && storeGoodsData.list.Count > 0)
{
var Ids = "0," + string.Join(",", storeGoodsData.list.Select(qitem => qitem.id));
var tempGoodsList = productModule.GetProductGoodsList(new Model.Extend.Product.RB_Goods_Extend()
{
TenantId = TenantId,
MallBaseId = MallBaseId,
GoodsIds = Ids,
GoodsStatus = 1,
GoodsClassify = 3,//查询非司导
GoodsPageType = IsOpenSchool == 1 ? Common.Enum.Goods.GoodsPageTypeEnum.School : Common.Enum.Goods.GoodsPageTypeEnum.Mall
});
#region 微店价格
RB_SmallShops_Info_Extend smallModel = new RB_SmallShops_Info_Extend();
List<RB_SmallShops_Price_Extend> smallPList = new List<RB_SmallShops_Price_Extend>();
if (SmallShopsId > 0 && tempGoodsList.Any())
{
string goodsId = string.Join(",", tempGoodsList.Select(x => x.Id));
smallModel = smallShops_InfoRepository.GetEntity<RB_SmallShops_Info_Extend>(SmallShopsId);
smallPList = smallShops_PriceRepository.GetList(new RB_SmallShops_Price_Extend() { SmallShopsId = SmallShopsId, GoodsIds = goodsId });
var spriceList = goods_SpecificationPriceRepository.GetList(new RB_Goods_SpecificationPrice_Extend() { GoodsIds = goodsId });
foreach (var item in tempGoodsList)
{
if ((smallModel.UpPrice ?? 0) > 0 || smallPList.Where(x => x.GoodsId == item.Id && x.UpPrice > 0).Any())
{
var spList = spriceList.Where(x => x.GoodsId == item.Id).ToList();
if (spList.Any())
{
foreach (var qitem in spList)
{
var sspModel = smallPList.Where(x => x.GoodsId == item.Id && x.SpecificationKey == qitem.SpecificationSort).FirstOrDefault();
if (sspModel != null)
{
//单商品设置的
if (sspModel.PriceType == 1)
{
qitem.SellingPrice = (qitem.SellingPrice ?? 0) + Math.Ceiling((qitem.SellingPrice ?? 0) * (sspModel.UpPrice ?? 0) / 100);
}
else if (sspModel.PriceType == 2)
{
qitem.SellingPrice = (qitem.SellingPrice ?? 0) + (sspModel.UpPrice ?? 0);
}
}
else
{
if ((smallModel.UpPrice ?? 0) > 0)
{
if (smallModel.PriceType == 1)
{
qitem.SellingPrice = (qitem.SellingPrice ?? 0) + Math.Ceiling((qitem.SellingPrice ?? 0) * (smallModel.UpPrice ?? 0) / 100);
}
else if (smallModel.PriceType == 2)
{
qitem.SellingPrice = (qitem.SellingPrice ?? 0) + (smallModel.UpPrice ?? 0);
}
}
}
}
item.SellingPrice = spList.Min(x => x.SellingPrice ?? 0);
decimal MaxPrice = spList.Max(x => x.SellingPrice ?? 0);
MaxPrice += Math.Ceiling(MaxPrice / 10);
if (MaxPrice > item.OriginalPrice)
{
item.OriginalPrice = MaxPrice;
}
}
else
{
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);
item.OriginalPrice = (item.OriginalPrice ?? 0) + Math.Ceiling((item.OriginalPrice ?? 0) * (sspModel.UpPrice ?? 0) / 100);
}
else if (sspModel.PriceType == 2)
{
item.SellingPrice = (item.SellingPrice ?? 0) + (sspModel.UpPrice ?? 0);
item.OriginalPrice = (item.OriginalPrice ?? 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);
item.OriginalPrice = (item.OriginalPrice ?? 0) + Math.Ceiling((item.OriginalPrice ?? 0) * (smallModel.UpPrice ?? 0) / 100);
}
else if (smallModel.PriceType == 2)
{
item.SellingPrice = (item.SellingPrice ?? 0) + (smallModel.UpPrice ?? 0);
item.OriginalPrice = (item.OriginalPrice ?? 0) + (smallModel.UpPrice ?? 0);
}
}
}
}
}
}
}
#endregion
List<StoreGoodsDetailsItem2> newGoodsList = new List<StoreGoodsDetailsItem2>();
foreach (var goodItem in storeGoodsData.list)
{
var childItem = new StoreGoodsDetailsItem2();
var tempGood = tempGoodsList?.Where(qitem => qitem.Id == goodItem.id)?.FirstOrDefault();
if (tempGood != null && tempGood.Id > 0)
{
childItem.id = tempGood.Id;
childItem.name = tempGood?.Name ?? "";
childItem.price = Math.Round((tempGood?.SellingPrice ?? 0), 2);
childItem.picUrl = tempGood?.CoverImage != null ? Common.Config.GetFileUrl(tempGood.CoverImage) : "";
childItem.OriginalPrice = Math.Round((tempGood?.OriginalPrice ?? 0), 2);
childItem.courseScore = (tempGood.CourseScore ?? 0);
newGoodsList.Add(childItem);
}
}
storeGoodsData.list = newGoodsList;
}
}
}
}
obj = new
{
id = subItem.Id,
data = storeGoodsData
};
break;
case "reservestore":
var reserveStoreInfo = subItem.data as ReserveStoreItem;
obj = new
{
id = subItem.Id,
data = reserveStoreInfo
};
break;
}
return obj;
}
......@@ -1860,6 +2202,7 @@ namespace Mall.WebApi.Controllers
});
}
break;
}
}
var tempObj = new
......
......@@ -531,6 +531,17 @@ namespace Mall.WebApi.Controllers.MarketingCenter
}
item.data = noticeData;
break;
//商品插件
case "storeGoods":
var storeGoodData = Common.Plugin.JsonHelper.DeserializeObject<StoreGoodsItem>(item.data.ToString());
if (!string.IsNullOrWhiteSpace(storeGoodData.goodsTagPicUrl))
{
Common.Plugin.FileHelper.CreateImage(storeGoodData.goodsTagPicUrl);
storeGoodData.goodsTagPicUrl = Common.Plugin.FileHelper.GetFileUrl(storeGoodData.goodsTagPicUrl);
storeGoodData.goodsTagPicUrl = Common.Config.GetFileUrl(storeGoodData.goodsTagPicUrl);
}
item.data = storeGoodData;
break;
}
}
}
......
......@@ -307,8 +307,6 @@ namespace Mall.WebApi.Controllers.Reserve
#endregion
#region 套餐卡
[HttpPost]
......
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