mirror of
http://git.coreshop.cn/jianweie/coreshoppro.git
synced 2025-12-06 18:43:26 +08:00
【优化】优化团购秒杀数据返回内容,调整前端显示价格数据及增加团购秒杀策略提示。
This commit is contained in:
@@ -574,9 +574,67 @@ namespace CoreCms.Net.Services
|
||||
TimeSpan ts = promotion.endTime.Subtract(dt);
|
||||
goods.groupTimestamp = (int)ts.TotalSeconds;
|
||||
|
||||
//获取规则结果集
|
||||
decimal promotionAmount = 0;
|
||||
var result = await _promotionResultServices.QueryByClauseAsync(p => p.promotionId == promotion.id);
|
||||
if (result != null)
|
||||
{
|
||||
JObject resultParameters = (JObject)JsonConvert.DeserializeObject(result.parameters);
|
||||
var cartProducts = new CartProducts()
|
||||
{
|
||||
nums = 1,
|
||||
products = new CoreCmsProducts()
|
||||
{
|
||||
price = goods.product.price,
|
||||
amount = goods.product.price,
|
||||
}
|
||||
};
|
||||
switch (result.code)
|
||||
{
|
||||
//指定商品减固定金额
|
||||
case "GOODS_REDUCE":
|
||||
promotionAmount = _promotionResultServices.result_GOODS_REDUCE(resultParameters, cartProducts, promotion);
|
||||
goods.groupPromotionResult = "指定商品减少固定金额:减" + resultParameters["money"].ObjectToString() + "元 ";
|
||||
break;
|
||||
//指定商品打X折
|
||||
case "GOODS_DISCOUNT":
|
||||
promotionAmount = _promotionResultServices.result_GOODS_DISCOUNT(resultParameters, cartProducts, promotion);
|
||||
goods.groupPromotionResult = "指定商品打折:打" + resultParameters["discount"].ObjectToString() + "折 ";
|
||||
break;
|
||||
//指定商品一口价
|
||||
case "GOODS_ONE_PRICE":
|
||||
promotionAmount = _promotionResultServices.result_GOODS_ONE_PRICE(resultParameters, cartProducts, promotion);
|
||||
goods.groupPromotionResult = "指定商品一口价:" + resultParameters["money"].ObjectToString() + "元 ";
|
||||
break;
|
||||
//指定商品每第几件减指定金额
|
||||
case "GOODS_HALF_PRICE":
|
||||
//这个条件不在列表做处理
|
||||
promotionAmount = 0;
|
||||
goods.groupPromotionResult = "指定商品每第" + resultParameters["num"].ObjectToString() + "件减少" + resultParameters["money"].ObjectToString() + "元";
|
||||
break;
|
||||
case "ORDER_REDUCE":
|
||||
goods.groupPromotionResult = "订单减" + resultParameters["money"].ObjectToString() + "元 ";
|
||||
break;
|
||||
case "ORDER_DISCOUNT":
|
||||
goods.groupPromotionResult = "订单打" + resultParameters["discount"].ObjectToString() + "折 ";
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
if (promotionAmount > 0)
|
||||
{
|
||||
goods.product.price = Math.Round(goods.product.price - promotionAmount, 2);
|
||||
}
|
||||
|
||||
foreach (var item in goods.skuList.sku_list)
|
||||
{
|
||||
item.price = Math.Round(item.price - promotionAmount, 2);
|
||||
}
|
||||
|
||||
|
||||
//进行促销后要更换原销售价替换原市场价
|
||||
var originPrice = Math.Round(goods.product.price + goods.product.promotionAmount, 2);
|
||||
goods.product.mktprice = originPrice;
|
||||
//var originPrice = Math.Round(goods.product.price + goods.product.promotionAmount, 2);
|
||||
//goods.product.mktprice = originPrice;
|
||||
jm.status = true;
|
||||
jm.msg = "数据获取成功";
|
||||
jm.data = goods;
|
||||
|
||||
Reference in New Issue
Block a user