mirror of
http://git.coreshop.cn/jianweie/coreshoppro.git
synced 2025-12-06 18:33:27 +08:00
【优化】优化团购秒杀数据返回内容,调整前端显示价格数据及增加团购秒杀策略提示。
This commit is contained in:
@@ -3211,6 +3211,41 @@
|
||||
所属团购秒杀
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:CoreCms.Net.Model.Entities.CoreCmsGoods.groupType">
|
||||
<summary>
|
||||
团购秒杀类型
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:CoreCms.Net.Model.Entities.CoreCmsGoods.groupStatus">
|
||||
<summary>
|
||||
团购秒杀状态
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:CoreCms.Net.Model.Entities.CoreCmsGoods.groupTime">
|
||||
<summary>
|
||||
团购秒杀时效
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:CoreCms.Net.Model.Entities.CoreCmsGoods.groupStartTime">
|
||||
<summary>
|
||||
团购秒杀开始时间
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:CoreCms.Net.Model.Entities.CoreCmsGoods.groupEndTime">
|
||||
<summary>
|
||||
团购秒杀结束时间
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:CoreCms.Net.Model.Entities.CoreCmsGoods.groupTimestamp">
|
||||
<summary>
|
||||
团购秒杀时间戳
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:CoreCms.Net.Model.Entities.CoreCmsGoods.groupPromotionResult">
|
||||
<summary>
|
||||
团购秒杀促销结果
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:CoreCms.Net.Model.Entities.CoreCmsGoods.minPrice">
|
||||
<summary>
|
||||
sku最小价格
|
||||
|
||||
@@ -177,17 +177,47 @@ namespace CoreCms.Net.Model.Entities
|
||||
[SugarColumn(IsIgnore = true)]
|
||||
public int groupId { get; set; }
|
||||
|
||||
[SugarColumn(IsIgnore = true)] public int groupType { get; set; }
|
||||
/// <summary>
|
||||
/// 团购秒杀类型
|
||||
/// </summary>
|
||||
[SugarColumn(IsIgnore = true)]
|
||||
public int groupType { get; set; }
|
||||
|
||||
[SugarColumn(IsIgnore = true)] public bool groupStatus { get; set; }
|
||||
/// <summary>
|
||||
/// 团购秒杀状态
|
||||
/// </summary>
|
||||
[SugarColumn(IsIgnore = true)]
|
||||
public bool groupStatus { get; set; }
|
||||
|
||||
[SugarColumn(IsIgnore = true)] public DateTime groupTime { get; set; }
|
||||
/// <summary>
|
||||
/// 团购秒杀时效
|
||||
/// </summary>
|
||||
[SugarColumn(IsIgnore = true)]
|
||||
public DateTime groupTime { get; set; }
|
||||
|
||||
[SugarColumn(IsIgnore = true)] public DateTime groupStartTime { get; set; }
|
||||
/// <summary>
|
||||
/// 团购秒杀开始时间
|
||||
/// </summary>
|
||||
[SugarColumn(IsIgnore = true)]
|
||||
public DateTime groupStartTime { get; set; }
|
||||
|
||||
[SugarColumn(IsIgnore = true)] public DateTime groupEndTime { get; set; }
|
||||
/// <summary>
|
||||
/// 团购秒杀结束时间
|
||||
/// </summary>
|
||||
[SugarColumn(IsIgnore = true)]
|
||||
public DateTime groupEndTime { get; set; }
|
||||
|
||||
[SugarColumn(IsIgnore = true)] public int groupTimestamp { get; set; }
|
||||
/// <summary>
|
||||
/// 团购秒杀时间戳
|
||||
/// </summary>
|
||||
[SugarColumn(IsIgnore = true)]
|
||||
public int groupTimestamp { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 团购秒杀促销结果
|
||||
/// </summary>
|
||||
[SugarColumn(IsIgnore = true)]
|
||||
public string groupPromotionResult { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -16,11 +16,16 @@
|
||||
<u-swiper height="calc(750rpx * 6 / 6)" radius="0" :list="goodsInfo.album" :autoplay="autoplay" indicator indicatorMode="line" circular @click="clickImg"></u-swiper>
|
||||
</view>
|
||||
|
||||
<view class="coreshop-margin-left-8 coreshop-margin-right-8 coreshop-margin-top-12 coreshop-border-radius-9" v-if="goodsInfo.groupPromotionResult">
|
||||
<u-alert title="当前团购活动规则:" type="warning" effect="dark" closable="true" :description="goodsInfo.groupPromotionResult"></u-alert>
|
||||
</view>
|
||||
|
||||
<view class="coreshop-margin-left-8 coreshop-margin-right-8 coreshop-margin-top-12 coreshop-padding-8 coreshop-border-radius-9 coreshop-bg-white">
|
||||
<view class="coreshop-flex coreshop-justify-between coreshop-align-center">
|
||||
<view class="coreshop-text-red coreshop-font-weight-bold">
|
||||
<text class="coreshop-font-16">¥</text>
|
||||
<text class="coreshop-font-24">{{ product.price || '0.00' }}</text>
|
||||
<text class="coreshop-font-12 coreshop-text-gray coreshop-text-through coreshop-margin-left-8">¥{{ product.mktprice }}</text>
|
||||
</view>
|
||||
<view class="coreshop-flex coreshop-text-left coreshop-justify-center coreshop-align-center">
|
||||
<view class="coreshop-text-right coreshop-time-right">
|
||||
|
||||
@@ -16,11 +16,16 @@
|
||||
<u-swiper height="calc(750rpx * 6 / 6)" radius="0" :list="goodsInfo.album" :autoplay="autoplay" indicator indicatorMode="line" circular @click="clickImg"></u-swiper>
|
||||
</view>
|
||||
|
||||
<view class="coreshop-margin-left-8 coreshop-margin-right-8 coreshop-margin-top-12 coreshop-border-radius-9" v-if="goodsInfo.groupPromotionResult">
|
||||
<u-alert title="当前秒杀活动规则:" type="error" effect="dark" closable="true" :description="goodsInfo.groupPromotionResult"></u-alert>
|
||||
</view>
|
||||
|
||||
<view class="coreshop-margin-left-8 coreshop-margin-right-8 coreshop-margin-top-12 coreshop-padding-8 coreshop-border-radius-9 coreshop-bg-white">
|
||||
<view class="coreshop-flex coreshop-justify-between coreshop-align-center">
|
||||
<view class="coreshop-text-red coreshop-font-weight-bold">
|
||||
<text class="coreshop-font-16">¥</text>
|
||||
<text class="coreshop-font-24">{{ product.price || '0.00' }}</text>
|
||||
<text class="coreshop-font-12 coreshop-text-gray coreshop-text-through coreshop-margin-left-8">¥{{ product.mktprice }}</text>
|
||||
</view>
|
||||
<view class="coreshop-flex coreshop-text-left coreshop-justify-center coreshop-align-center">
|
||||
<view class="coreshop-text-right coreshop-time-right">
|
||||
|
||||
Reference in New Issue
Block a user