# 2022-02-24

### 1.3.7 开源社区版:
无
### 0.2.4 会员专业版:
【新增】数据库sku表【CoreCmsProducts】增加"积分可抵扣金额"【pointsDeduction】字段
【新增】商品sku新增最高抵扣金额功能,可通过积分进行价格抵扣,实现单品使用【积分+价格】的购买模式。与订单积分折扣并存。
【新增】积分新增积分模式功能,分为全局计算和单品计算,【全局计算】是指直接对订单按照使用比例进行计算,【单品计算】是指根据单个商品下sku独立设置的最高可抵扣金额进行计算。
【新增】积分新增显示积分组合兑换价功能,勾选显示,将在商品详情,购物车等界面显示积分加价格的效果。
【新增】积分新增显示名称功能,前端可改名积分显示名称为自定义,如:金豆,衡豆等。
【新增】商品列表页面、购物车界面、下单界面、商品详情界面新增积分新增是否显示组合价功能,如果勾选,将显示【1000积分+25元换购】的内容。
【优化】当添加视频后,默认采用商品封面图作为视频底图,防止视频大小差异出现黑边或预加载中黑屏的问题。
【优化】商品列表展示列表去除padding留白效果。
【优化】优化form表单redio和checkBox选项分行显示的问题。
【修复】修复拼团分享页面倒计时识别失败的问题,修复拼团分享页面分享按钮点击失败的问题。#I4QWDH #I4QWFC
This commit is contained in:
JianWeie
2022-02-24 02:16:41 +08:00
parent 289c3fc5a1
commit 53b16cfeab
31 changed files with 605 additions and 207 deletions

View File

@@ -241,6 +241,21 @@ namespace CoreCms.Net.Configuration
/// </summary>
public const string PointSwitch = "pointSwitch";
/// <summary>
/// 积分模式
/// </summary>
public const string PointExchangeModel = "pointExchangeModel";
/// <summary>
/// 积分昵称
/// </summary>
public const string PointShowName = "pointShowName";
/// <summary>
/// 显示积分组合兑换价
/// </summary>
public const string PointShowExchangePrice = "pointShowExchangePrice";
/// <summary>
/// 订单积分折现比例
/// </summary>

View File

@@ -117,6 +117,9 @@ namespace CoreCms.Net.Configuration
di.Add(SystemSettingConstVars.ContinuitySignAdditional, new DictionaryKeyValues() { sKey = "连续签到追加", sValue = "1" });
di.Add(SystemSettingConstVars.SignMostPoint, new DictionaryKeyValues() { sKey = "单日最大奖励", sValue = "10" });
di.Add(SystemSettingConstVars.PointSwitch, new DictionaryKeyValues() { sKey = "开启积分功能", sValue = "1" });
di.Add(SystemSettingConstVars.PointExchangeModel, new DictionaryKeyValues() { sKey = "积分模式", sValue = "1" });
di.Add(SystemSettingConstVars.PointShowName, new DictionaryKeyValues() { sKey = "积分昵称", sValue = "积分" });
di.Add(SystemSettingConstVars.PointShowExchangePrice, new DictionaryKeyValues() { sKey = "显示积分组合兑换价", sValue = "1" });
di.Add(SystemSettingConstVars.PointDiscountedProportion, new DictionaryKeyValues() { sKey = "订单积分折现比例", sValue = "100" });
di.Add(SystemSettingConstVars.OrdersPointProportion, new DictionaryKeyValues() { sKey = "订单积分使用比例", sValue = "10" });
di.Add(SystemSettingConstVars.OrdersRewardProportion, new DictionaryKeyValues() { sKey = "订单积分奖励比例", sValue = "1" });

View File

@@ -16,8 +16,8 @@ using CoreCms.Net.Configuration;
using CoreCms.Net.Model.Entities;
using CoreCms.Net.Model.FromBody;
using CoreCms.Net.Model.ViewModels.Basics;
using CoreCms.Net.Model.ViewModels.UI;
using CoreCms.Net.Model.ViewModels.DTO;
using CoreCms.Net.Model.ViewModels.UI;
using SqlSugar;
namespace CoreCms.Net.IServices
@@ -48,8 +48,10 @@ namespace CoreCms.Net.IServices
/// </summary>
/// <param name="userId">用户序列</param>
/// <param name="orderMoney">订单金额</param>
/// <param name="ids">货品序列</param>
/// <param name="cartType">购物车类型</param>
/// <returns></returns>
Task<GetUserPointResult> GetUserPoint(int userId, decimal orderMoney);
Task<GetUserPointResult> GetUserPoint(int userId, decimal orderMoney, int[] ids, int cartType);
/// <summary>
@@ -102,7 +104,7 @@ namespace CoreCms.Net.IServices
/// <param name="platform"></param>
/// <returns></returns>
Task<WebApiCallBack> SmsLogin(FMWxAccountCreate entity,
int loginType = (int) GlobalEnumVars.LoginType.WeChatPhoneNumber, int platform = 1);
int loginType = (int)GlobalEnumVars.LoginType.WeChatPhoneNumber, int platform = 1);
/// <summary>

View File

@@ -70,6 +70,12 @@ namespace CoreCms.Net.Model.Entities
[SugarColumn(IsIgnore = true)]
public decimal weight { get; set; } = 0;
/// <summary>
/// 积分抵扣金额
/// </summary>
[Display(Name = "积分抵扣金额")]
[SugarColumn(IsIgnore = true)]
public decimal pointsDeduction { get; set; } = 0;
/// <summary>
/// 图集
@@ -95,6 +101,7 @@ namespace CoreCms.Net.Model.Entities
[SugarColumn(IsIgnore = true)]
public List<CoreCmsProducts> sku { get; set; } = new();
/// <summary>
/// 是否收藏
/// </summary>

View File

@@ -3,11 +3,13 @@
* ProjectName: 核心内容管理系统
* Web: https://www.corecms.net
* Author: 大灰灰
* Email: jianweie@163.com
* CreateTime: 2021-06-08 22:14:58
* Email: jianweie@163.com
* CreateTime: 2022/2/22 0:43:08
* Description: 暂无
***********************************************************************/
***********************************************************************/
using SqlSugar;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
namespace CoreCms.Net.Model.Entities
@@ -15,118 +17,208 @@ namespace CoreCms.Net.Model.Entities
/// <summary>
/// 货品表
/// </summary>
[SugarTable("CoreCmsProducts",TableDescription = "货品表")]
public partial class CoreCmsProducts
{
/// <summary>
/// 货品表
/// 构造函数
/// </summary>
public CoreCmsProducts()
{
}
/// <summary>
/// 货品序列
/// </summary>
[Display(Name = "货品序列")]
[SugarColumn(ColumnDescription = "货品序列", IsPrimaryKey = true, IsIdentity = true)]
[SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
[Required(ErrorMessage = "请输入{0}")]
public System.Int32 id { get; set; }
public System.Int32 id { get; set; }
/// <summary>
/// 商品序列
/// </summary>
[Display(Name = "商品序列")]
[SugarColumn(ColumnDescription = "商品序列")]
[Required(ErrorMessage = "请输入{0}")]
public System.Int32 goodsId { get; set; }
public System.Int32 goodsId { get; set; }
/// <summary>
/// 商品条码
/// </summary>
[Display(Name = "商品条码")]
[SugarColumn(ColumnDescription = "商品条码", IsNullable = true)]
[StringLength(128, ErrorMessage = "【{0}】不能超过{1}字符长度")]
public System.String barcode { get; set; }
[StringLength(maximumLength:128,ErrorMessage = "{0}不能超过{1}字")]
public System.String barcode { get; set; }
/// <summary>
/// 货品编码
/// </summary>
[Display(Name = "货品编码")]
[SugarColumn(ColumnDescription = "货品编码", IsNullable = true)]
[StringLength(30, ErrorMessage = "【{0}】不能超过{1}字符长度")]
public System.String sn { get; set; }
[StringLength(maximumLength:30,ErrorMessage = "{0}不能超过{1}字")]
public System.String sn { get; set; }
/// <summary>
/// 货品价格
/// </summary>
[Display(Name = "货品价格")]
[SugarColumn(ColumnDescription = "货品价格")]
[Required(ErrorMessage = "请输入{0}")]
public System.Decimal price { get; set; }
public System.Decimal price { get; set; }
/// <summary>
/// 货品成本价
/// </summary>
[Display(Name = "货品成本价")]
[SugarColumn(ColumnDescription = "货品成本价")]
[Required(ErrorMessage = "请输入{0}")]
public System.Decimal costprice { get; set; }
public System.Decimal costprice { get; set; }
/// <summary>
/// 货品市场价
/// </summary>
[Display(Name = "货品市场价")]
[SugarColumn(ColumnDescription = "货品市场价")]
[Required(ErrorMessage = "请输入{0}")]
public System.Decimal mktprice { get; set; }
public System.Decimal mktprice { get; set; }
/// <summary>
/// 是否上架
/// </summary>
[Display(Name = "是否上架")]
[SugarColumn(ColumnDescription = "是否上架")]
[Required(ErrorMessage = "请输入{0}")]
public System.Boolean marketable { get; set; }
public System.Boolean marketable { get; set; }
/// <summary>
/// 积分可抵扣金额
/// </summary>
[Display(Name = "积分可抵扣金额")]
[Required(ErrorMessage = "请输入{0}")]
public System.Decimal pointsDeduction { get; set; }
/// <summary>
/// 重量(千克)
/// </summary>
[Display(Name = "重量(千克)")]
[SugarColumn(ColumnDescription = "重量(千克)")]
[Required(ErrorMessage = "请输入{0}")]
public System.Decimal weight { get; set; }
public System.Decimal weight { get; set; }
/// <summary>
/// 库存
/// </summary>
[Display(Name = "库存")]
[SugarColumn(ColumnDescription = "库存")]
[Required(ErrorMessage = "请输入{0}")]
public System.Int32 stock { get; set; }
public System.Int32 stock { get; set; }
/// <summary>
/// 冻结库存
/// </summary>
[Display(Name = "冻结库存")]
[SugarColumn(ColumnDescription = "冻结库存")]
[Required(ErrorMessage = "请输入{0}")]
public System.Int32 freezeStock { get; set; }
public System.Int32 freezeStock { get; set; }
/// <summary>
/// 规格值
/// </summary>
[Display(Name = "规格值")]
[SugarColumn(ColumnDescription = "规格值", IsNullable = true)]
public System.String spesDesc { get; set; }
public System.String spesDesc { get; set; }
/// <summary>
/// 是否默认货品
/// </summary>
[Display(Name = "是否默认货品")]
[SugarColumn(ColumnDescription = "是否默认货品")]
[Required(ErrorMessage = "请输入{0}")]
public System.Boolean isDefalut { get; set; }
public System.Boolean isDefalut { get; set; }
/// <summary>
/// 规格图片
/// </summary>
[Display(Name = "规格图片")]
[SugarColumn(ColumnDescription = "规格图片", IsNullable = true)]
public System.String images { get; set; }
public System.String images { get; set; }
/// <summary>
/// 是否删除
/// </summary>
[Display(Name = "是否删除")]
[SugarColumn(ColumnDescription = "是否删除")]
[Required(ErrorMessage = "请输入{0}")]
public System.Boolean isDel { get; set; }
public System.Boolean isDel { get; set; }
}
}
}

View File

@@ -36,6 +36,16 @@ namespace CoreCms.Net.Model.ViewModels.DTO
/// 订单金额
/// </summary>
public decimal orderMoney { get; set; }
/// <summary>
/// 购物车货品序列号
/// </summary>
public string ids { get; set; }
/// <summary>
/// 购物车类型
/// </summary>
public int cartType { get; set; }
}
/// <summary>

View File

@@ -186,6 +186,7 @@ namespace CoreCms.Net.Repository
obj.weight = p.weight;
obj.freezeStock = 0;
obj.spesDesc = p.spesDesc;
obj.pointsDeduction = p.pointsDeduction;
obj.isDefalut = p.isDefalut;
obj.isDel = false;
products.Add(obj);
@@ -233,6 +234,7 @@ namespace CoreCms.Net.Repository
obj.weight = oldObj.weight;
obj.freezeStock = 0;
obj.spesDesc = oldObj.spesDesc;
obj.pointsDeduction = oldObj.pointsDeduction;
obj.isDefalut = true;
obj.isDel = false;
if (string.IsNullOrEmpty(obj.images) || !obj.images.Contains(".jpg"))
@@ -514,11 +516,13 @@ namespace CoreCms.Net.Repository
p.mktprice = child.mktprice;
p.price = child.price;
p.spesDesc = child.spesDesc;
p.pointsDeduction = child.pointsDeduction;
p.stock = child.stock;
p.weight = child.weight;
}
});
oldDistributions.ForEach(o =>
{
var oldPost = oldPostProducts.Find(p => p.id == o.productsId);
@@ -578,7 +582,6 @@ namespace CoreCms.Net.Repository
}
}
}
}
else
@@ -607,6 +610,7 @@ namespace CoreCms.Net.Repository
obj.weight = p.weight;
obj.freezeStock = 0;
obj.spesDesc = p.spesDesc;
obj.pointsDeduction = p.pointsDeduction;
obj.isDefalut = p.isDefalut;
obj.images = p.images;
if (string.IsNullOrEmpty(p.images) || !p.images.Contains(".jpg"))
@@ -661,6 +665,7 @@ namespace CoreCms.Net.Repository
obj.marketable = true;
obj.stock = newObj.stock;
obj.weight = newObj.weight;
obj.pointsDeduction = newObj.pointsDeduction;
obj.images = newObj.images;
obj.isDefalut = true;
obj.isDel = false;
@@ -690,6 +695,7 @@ namespace CoreCms.Net.Repository
obj.marketable = true;
obj.stock = newObj.stock;
obj.weight = newObj.weight;
obj.pointsDeduction = newObj.pointsDeduction;
obj.freezeStock = 0;
obj.spesDesc = "";
obj.isDefalut = true;
@@ -911,6 +917,7 @@ namespace CoreCms.Net.Repository
mktprice = pd.mktprice,
stock = pd.stock,
freezeStock = pd.freezeStock,
pointsDeduction = pd.pointsDeduction,
weight = pd.weight
})
.MergeTable()
@@ -973,6 +980,7 @@ namespace CoreCms.Net.Repository
mktprice = pd.mktprice,
stock = pd.stock,
freezeStock = pd.freezeStock,
pointsDeduction = pd.pointsDeduction,
weight = pd.weight
})
.MergeTable()
@@ -1045,6 +1053,7 @@ namespace CoreCms.Net.Repository
price = pd.price,
costprice = pd.costprice,
mktprice = pd.mktprice,
pointsDeduction = pd.pointsDeduction,
stock = pd.stock,
freezeStock = pd.freezeStock,
weight = pd.weight
@@ -1095,6 +1104,7 @@ namespace CoreCms.Net.Repository
price = pd.price,
costprice = pd.costprice,
mktprice = pd.mktprice,
pointsDeduction = pd.pointsDeduction,
stock = pd.stock,
freezeStock = pd.freezeStock,
weight = pd.weight
@@ -1169,6 +1179,7 @@ namespace CoreCms.Net.Repository
mktprice = pd.mktprice,
stock = pd.stock,
freezeStock = pd.freezeStock,
pointsDeduction = pd.pointsDeduction,
weight = pd.weight
})
.With(SqlWith.NoLock)
@@ -1221,6 +1232,7 @@ namespace CoreCms.Net.Repository
mktprice = pd.mktprice,
stock = pd.stock,
freezeStock = pd.freezeStock,
pointsDeduction = pd.pointsDeduction,
weight = pd.weight
})
.MergeTable()
@@ -1246,12 +1258,6 @@ namespace CoreCms.Net.Repository
public new async Task<List<CoreCmsGoods>> QueryListByClauseAsync(Expression<Func<CoreCmsGoods, bool>> predicate, int take,
Expression<Func<CoreCmsGoods, object>> orderByPredicate, OrderByType orderByType, bool blUseNoLock = false)
{
//return blUseNoLock
// ? await DbBaseClient.Queryable<T>().OrderByIF(orderByPredicate != null, orderByPredicate, orderByType)
// .WhereIF(predicate != null, predicate).Take(take).With(SqlWith.NoLock).ToListAsync()
// : await DbBaseClient.Queryable<T>().OrderByIF(orderByPredicate != null, orderByPredicate, orderByType)
// .WhereIF(predicate != null, predicate).Take(take).ToListAsync();
List<CoreCmsGoods> page;
if (blUseNoLock)
{
@@ -1297,6 +1303,7 @@ namespace CoreCms.Net.Repository
mktprice = pd.mktprice,
stock = pd.stock,
freezeStock = pd.freezeStock,
pointsDeduction = pd.pointsDeduction,
weight = pd.weight
})
.With(SqlWith.NoLock)
@@ -1349,6 +1356,7 @@ namespace CoreCms.Net.Repository
mktprice = pd.mktprice,
stock = pd.stock,
freezeStock = pd.freezeStock,
pointsDeduction = pd.pointsDeduction,
weight = pd.weight
})
.MergeTable()
@@ -1417,6 +1425,7 @@ namespace CoreCms.Net.Repository
mktprice = pd.mktprice,
stock = pd.stock,
freezeStock = pd.freezeStock,
pointsDeduction = pd.pointsDeduction,
weight = pd.weight
})
.With(SqlWith.NoLock)
@@ -1469,6 +1478,7 @@ namespace CoreCms.Net.Repository
mktprice = pd.mktprice,
stock = pd.stock,
freezeStock = pd.freezeStock,
pointsDeduction = pd.pointsDeduction,
weight = pd.weight
})
.MergeTable()
@@ -1481,9 +1491,9 @@ namespace CoreCms.Net.Repository
}
#endregion
#region
#region
/// <summary>
/// 根据条件查询分页数据
/// 重写根据条件及自定义排序查询分页数据
/// </summary>
/// <param name="predicate"></param>
/// <param name="orderBy"></param>
@@ -1540,6 +1550,7 @@ namespace CoreCms.Net.Repository
mktprice = pd.mktprice,
stock = pd.stock,
freezeStock = pd.freezeStock,
pointsDeduction = pd.pointsDeduction,
weight = pd.weight
})
.With(SqlWith.NoLock)
@@ -1592,6 +1603,7 @@ namespace CoreCms.Net.Repository
mktprice = pd.mktprice,
stock = pd.stock,
freezeStock = pd.freezeStock,
pointsDeduction = pd.pointsDeduction,
weight = pd.weight
})
.MergeTable()
@@ -1608,7 +1620,6 @@ namespace CoreCms.Net.Repository
#endregion
#region
/// <summary>
/// 根据条件查询代理池商品分页数据
@@ -1668,6 +1679,7 @@ namespace CoreCms.Net.Repository
mktprice = pd.mktprice,
stock = pd.stock,
freezeStock = pd.freezeStock,
pointsDeduction = pd.pointsDeduction,
weight = pd.weight
})
.With(SqlWith.NoLock)
@@ -1720,6 +1732,7 @@ namespace CoreCms.Net.Repository
mktprice = pd.mktprice,
stock = pd.stock,
freezeStock = pd.freezeStock,
pointsDeduction = pd.pointsDeduction,
weight = pd.weight
})
.MergeTable()

View File

@@ -20,6 +20,7 @@ using CoreCms.Net.Model.Entities;
using CoreCms.Net.Model.ViewModels.Basics;
using CoreCms.Net.Model.ViewModels.UI;
using CoreCms.Net.Utility.Extensions;
using SqlSugar;
namespace CoreCms.Net.Repository
@@ -111,25 +112,26 @@ namespace CoreCms.Net.Repository
List<CoreCmsProducts> page;
if (blUseNoLock)
{
page = await DbClient.Queryable<CoreCmsProducts, CoreCmsGoods>((p, good) => new JoinQueryInfos(
JoinType.Left, p.goodsId == good.id))
.Select((p, good) => new CoreCmsProducts
page = await DbClient.Queryable<CoreCmsGoods, CoreCmsProducts>((good, product) => new JoinQueryInfos(
JoinType.Inner, good.id == product.goodsId))
.Select((good, product) => new CoreCmsProducts
{
id = p.id,
goodsId = p.goodsId,
barcode = p.barcode,
sn = p.sn,
price = p.price,
costprice = p.costprice,
mktprice = p.mktprice,
marketable = p.marketable,
weight = p.weight,
stock = p.stock,
freezeStock = p.freezeStock,
spesDesc = p.spesDesc,
isDefalut = p.isDefalut,
images = p.images,
isDel = p.isDel,
id = product.id,
goodsId = product.goodsId,
barcode = product.barcode,
sn = product.sn,
price = product.price,
costprice = product.costprice,
mktprice = product.mktprice,
marketable = product.marketable,
weight = product.weight,
stock = product.stock,
freezeStock = product.freezeStock,
pointsDeduction = product.pointsDeduction,
spesDesc = product.spesDesc,
isDefalut = product.isDefalut,
images = product.images,
isDel = good.isDel,
name = good.name,
bn = good.bn,
isMarketable = good.isMarketable,
@@ -142,25 +144,26 @@ namespace CoreCms.Net.Repository
}
else
{
page = await DbClient.Queryable<CoreCmsProducts, CoreCmsGoods>((p, good) => new JoinQueryInfos(
JoinType.Left, p.goodsId == good.id))
.Select((p, good) => new CoreCmsProducts
page = await DbClient.Queryable<CoreCmsGoods, CoreCmsProducts>((good, product) => new JoinQueryInfos(
JoinType.Inner, good.id == product.goodsId))
.Select((good, product) => new CoreCmsProducts
{
id = p.id,
goodsId = p.goodsId,
barcode = p.barcode,
sn = p.sn,
price = p.price,
costprice = p.costprice,
mktprice = p.mktprice,
marketable = p.marketable,
weight = p.weight,
stock = p.stock,
freezeStock = p.freezeStock,
spesDesc = p.spesDesc,
isDefalut = p.isDefalut,
images = p.images,
isDel = p.isDel,
id = product.id,
goodsId = product.goodsId,
barcode = product.barcode,
sn = product.sn,
price = product.price,
costprice = product.costprice,
mktprice = product.mktprice,
marketable = product.marketable,
weight = product.weight,
stock = product.stock,
freezeStock = product.freezeStock,
pointsDeduction = product.pointsDeduction,
spesDesc = product.spesDesc,
isDefalut = product.isDefalut,
images = product.images,
isDel = good.isDel,
name = good.name,
bn = good.bn,
isMarketable = good.isMarketable,
@@ -204,6 +207,7 @@ namespace CoreCms.Net.Repository
weight = p.weight,
stock = p.stock,
freezeStock = p.freezeStock,
pointsDeduction = p.pointsDeduction,
spesDesc = p.spesDesc,
isDefalut = p.isDefalut,
images = p.images,
@@ -309,6 +313,7 @@ namespace CoreCms.Net.Repository
weight = p.weight,
stock = p.stock,
freezeStock = p.freezeStock,
pointsDeduction = p.pointsDeduction,
spesDesc = p.spesDesc,
isDefalut = p.isDefalut,
images = p.images,

View File

@@ -780,8 +780,8 @@ namespace CoreCms.Net.Services
var jm = new WebApiCallBack() { status = true };
if (point != 0)
{
var getUserPointDto = await _userServices.GetUserPoint(userId, 0);
if (getUserPointDto.point < point)
var user = await _userServices.QueryByClauseAsync(p => p.id == userId);
if (user.point < point)
{
jm.status = false;
jm.msg = "积分不足,无法使用积分";
@@ -789,23 +789,45 @@ namespace CoreCms.Net.Services
}
//判断积分值多少钱
//计算可用积分
var allConfigs = await _settingServices.GetConfigDictionaries();
var ordersPointProportion = CommonHelper.GetConfigDictionary(allConfigs, SystemSettingConstVars.OrdersPointProportion).ObjectToInt(10);//订单积分使用比例
var maxPointDeductedMoney = Math.Round(cartDto.amount * ordersPointProportion / 100, 2); //最大积分抵扣的钱
var pointDiscountedProportion = CommonHelper.GetConfigDictionary(allConfigs, SystemSettingConstVars.PointDiscountedProportion).ObjectToInt(100); //积分兑换比例
var pointDeductedMoney = point / pointDiscountedProportion; //积分可以抵扣的钱
if (maxPointDeductedMoney < pointDeductedMoney)
var pointExchangeModel = CommonHelper.GetConfigDictionary(allConfigs, SystemSettingConstVars.PointExchangeModel).ObjectToInt(); //判断是全局模式还是单品模式
if (pointExchangeModel == 1)
{
jm.status = false;
jm.msg = "积分超过订单可使用的积分数量";
return jm;
var ordersPointProportion = CommonHelper.GetConfigDictionary(allConfigs, SystemSettingConstVars.OrdersPointProportion).ObjectToInt(10);//订单积分使用比例
var maxPointDeductedMoney = Math.Round(cartDto.amount * ordersPointProportion / 100, 2); //最大积分抵扣的钱
var pointDiscountedProportion = CommonHelper.GetConfigDictionary(allConfigs, SystemSettingConstVars.PointDiscountedProportion).ObjectToInt(100); //积分兑换比例
var pointDeductedMoney = point / pointDiscountedProportion; //积分可以抵扣的钱
if (maxPointDeductedMoney < pointDeductedMoney)
{
jm.status = false;
jm.msg = "积分超过订单可使用的积分数量";
return jm;
}
cartDto.point = point;
cartDto.pointExchangeMoney = pointDeductedMoney;
cartDto.amount -= pointDeductedMoney;
}
else
{
//可抵扣金额
decimal money = 0;
foreach (var item in cartDto.list)
{
money += item.nums * item.products.pointsDeduction;
}
//计算抵扣这么多金额需要多少积分。
//订单积分折现比例(多少积分可以折现1块钱)
var pointDiscountedProportion = CommonHelper.GetConfigDictionary(allConfigs, SystemSettingConstVars.PointDiscountedProportion).ObjectToInt(100);
//计算需要多少积分
var needsPoint = money * pointDiscountedProportion;
cartDto.point = point;
cartDto.pointExchangeMoney = Convert.ToInt32(money);
cartDto.amount -= Convert.ToInt32(money);
}
cartDto.point = point;
cartDto.pointExchangeMoney = pointDeductedMoney;
cartDto.amount -= pointDeductedMoney;
}
jm.data = cartDto;
return jm;

View File

@@ -11,6 +11,7 @@
using System;
using System.Collections.Generic;
using System.IdentityModel.Tokens.Jwt;
using System.Linq;
using System.Linq.Expressions;
using System.Security.Claims;
using System.Threading.Tasks;
@@ -22,12 +23,13 @@ using CoreCms.Net.IServices;
using CoreCms.Net.Model.Entities;
using CoreCms.Net.Model.FromBody;
using CoreCms.Net.Model.ViewModels.Basics;
using CoreCms.Net.Model.ViewModels.UI;
using CoreCms.Net.Model.ViewModels.DTO;
using CoreCms.Net.Model.ViewModels.UI;
using CoreCms.Net.Utility.Extensions;
using CoreCms.Net.Utility.Helper;
using Microsoft.AspNetCore.Authentication.JwtBearer;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.DependencyInjection;
using SqlSugar;
@@ -47,6 +49,8 @@ namespace CoreCms.Net.Services
private readonly ICoreCmsUserGradeServices _userGradeServices;
private readonly ICoreCmsUserLogServices _userLogServices;
private readonly IServiceProvider _serviceProvider;
private readonly IUnitOfWork _unitOfWork;
private readonly PermissionRequirement _permissionRequirement;
private readonly IHttpContextAccessor _httpContextAccessor;
@@ -56,7 +60,7 @@ namespace CoreCms.Net.Services
, ICoreCmsUserRepository dal
, ICoreCmsUserBalanceServices userBalanceServices
, ICoreCmsSettingServices settingServices
, ICoreCmsUserPointLogServices userPointLogServices, ICoreCmsSmsServices smsServices, ICoreCmsUserWeChatInfoServices userWeChatInfoServices, ICoreCmsUserGradeServices userGradeServices, PermissionRequirement permissionRequirement, IHttpContextAccessor httpContextAccessor, ICoreCmsUserLogServices userLogServices)
, ICoreCmsUserPointLogServices userPointLogServices, ICoreCmsSmsServices smsServices, ICoreCmsUserWeChatInfoServices userWeChatInfoServices, ICoreCmsUserGradeServices userGradeServices, PermissionRequirement permissionRequirement, IHttpContextAccessor httpContextAccessor, ICoreCmsUserLogServices userLogServices, IServiceProvider serviceProvider)
{
this._dal = dal;
base.BaseDal = dal;
@@ -70,6 +74,7 @@ namespace CoreCms.Net.Services
_permissionRequirement = permissionRequirement;
_httpContextAccessor = httpContextAccessor;
_userLogServices = userLogServices;
_serviceProvider = serviceProvider;
}
@@ -160,9 +165,13 @@ namespace CoreCms.Net.Services
/// </summary>
/// <param name="userId">用户序列</param>
/// <param name="orderMoney">订单金额</param>
/// <param name="ids">货品序列</param>
/// <param name="cartType">购物车类型</param>
/// <returns></returns>
public async Task<GetUserPointResult> GetUserPoint(int userId, decimal orderMoney)
public async Task<GetUserPointResult> GetUserPoint(int userId, decimal orderMoney, int[] ids, int cartType)
{
GetUserPointResult dto = new GetUserPointResult();
//1是2否
var allConfigs = await _settingServices.GetConfigDictionaries();
@@ -177,19 +186,67 @@ namespace CoreCms.Net.Services
if (user != null)
{
dto.point = user.point;
if (orderMoney != 0)
var pointExchangeModel = CommonHelper.GetConfigDictionary(allConfigs, SystemSettingConstVars.PointExchangeModel).ObjectToInt(); //判断是全局模式还是单品模式
if (pointExchangeModel == 1)
{
//计算可用积分
var ordersPointProportion = CommonHelper.GetConfigDictionary(allConfigs, SystemSettingConstVars.OrdersPointProportion).ObjectToInt(10);//订单积分使用比例
//最多可以抵扣的金额
var maxPointDeductedMoney = Math.Round((orderMoney * ordersPointProportion) / 100, 2);
//订单积分折现比例(多少积分可以折现1块钱)
var pointDiscountedProportion = CommonHelper.GetConfigDictionary(allConfigs, SystemSettingConstVars.PointDiscountedProportion).ObjectToInt(100);
//计算需要多少积分
var needsPoint = maxPointDeductedMoney * pointDiscountedProportion;
//确定是否有那么多积分去抵扣比例计算出的能抵扣的钱
dto.availablePoint = Convert.ToInt32(needsPoint > user.point ? user.point : needsPoint);
dto.pointExchangeMoney = dto.availablePoint / pointDiscountedProportion;
if (orderMoney != 0)
{
//计算可用积分//订单积分使用比例
var ordersPointProportion = CommonHelper.GetConfigDictionary(allConfigs, SystemSettingConstVars.OrdersPointProportion).ObjectToInt(10);
//最多可以抵扣的金额
var maxPointDeductedMoney = Math.Round((orderMoney * ordersPointProportion) / 100, 2);
//订单积分折现比例(多少积分可以折现1块钱)
var pointDiscountedProportion = CommonHelper.GetConfigDictionary(allConfigs, SystemSettingConstVars.PointDiscountedProportion).ObjectToInt(100);
//计算需要多少积分
var needsPoint = maxPointDeductedMoney * pointDiscountedProportion;
//确定是否有那么多积分去抵扣比例计算出的能抵扣的钱
dto.availablePoint = Convert.ToInt32(needsPoint > user.point ? user.point : needsPoint);
dto.pointExchangeMoney = dto.availablePoint / pointDiscountedProportion;
}
}
else if (pointExchangeModel == 2)
{
using var container = _serviceProvider.CreateScope();
var cartServices = container.ServiceProvider.GetService<ICoreCmsCartServices>();
var productsServices = container.ServiceProvider.GetService<ICoreCmsProductsServices>();
//获取购物车数据
var cartProducts = await cartServices.QueryListByClauseAsync(p => p.type == cartType && p.userId == userId && ids.Contains(p.id));
if (cartProducts.Any())
{
//获取购物车货品序列
var cartIds = cartProducts.Select(p => p.productId).ToList();
//根据货品序列去找货品
var products = await productsServices.QueryListByClauseAsync(p => cartIds.Contains(p.id));
if (products.Any())
{
//可抵扣金额
decimal money = 0;
//迭代货品,获取到最高可优惠金额,进行累加
foreach (var item in products)
{
var numObj = cartProducts.Find(p => p.productId == item.id);
if (numObj != null)
{
money += numObj.nums * item.pointsDeduction;
}
}
//计算抵扣这么多金额需要多少积分。
//订单积分折现比例(多少积分可以折现1块钱)
var pointDiscountedProportion = CommonHelper.GetConfigDictionary(allConfigs, SystemSettingConstVars.PointDiscountedProportion).ObjectToInt(100);
//计算需要多少积分
var needsPoint = money * pointDiscountedProportion;
//确定是否有那么多积分去抵扣比例计算出的能抵扣的钱
dto.availablePoint = Convert.ToInt32(needsPoint > user.point ? 0 : needsPoint);
dto.pointExchangeMoney = Convert.ToInt32(user.point > needsPoint ? money : 0);
}
}
}
}
return dto;
@@ -613,14 +670,13 @@ namespace CoreCms.Net.Services
var identity = new ClaimsIdentity(JwtBearerDefaults.AuthenticationScheme);
identity.AddClaims(claims);
jm.status = true;
jm.msg = "注册成功";
jm.msg = "成功";
jm.data = JwtToken.BuildJwtToken(claims.ToArray(), _permissionRequirement);
//录入登录日志
var log = new CoreCmsUserLog();
log.userId = userInfo.id;
log.state = isReg ? (int)GlobalEnumVars.UserLogTypes. : (int)GlobalEnumVars.UserLogTypes.;
log.ip = _httpContextAccessor.HttpContext?.Connection.RemoteIpAddress != null ?
_httpContextAccessor.HttpContext.Connection.RemoteIpAddress.MapToIPv4().ToString() : "127.0.0.1";
log.ip = _httpContextAccessor.HttpContext?.Connection.RemoteIpAddress != null ? _httpContextAccessor.HttpContext.Connection.RemoteIpAddress.MapToIPv4().ToString() : "127.0.0.1";
log.createTime = DateTime.Now;
log.parameters = isReg ? GlobalEnumVars.UserLogTypes..ToString() : GlobalEnumVars.UserLogTypes..ToString();
await _userLogServices.InsertAsync(log);

View File

@@ -569,8 +569,17 @@
} else {
let info = res.data;
let products = res.data.product;
_this.goodsInfo = info;
if (_this.goodsInfo.album && _this.goodsInfo.video) {
var videoObj = {
url: _this.goodsInfo.video,
poster: _this.goodsInfo.image
};
_this.goodsInfo.album.unshift(videoObj);
_this.autoplay = false;
}
_this.isfav = _this.goodsInfo.isfav;
_this.type = _this.goodsInfo.groupType;
_this.product = _this.spesClassHandle(products);

View File

@@ -709,6 +709,16 @@
let products = res.data.product;
_this.goodsInfo = info;
if (_this.goodsInfo.album && _this.goodsInfo.video) {
var videoObj = {
url: _this.goodsInfo.video,
poster: _this.goodsInfo.image
};
_this.goodsInfo.album.unshift(videoObj);
_this.autoplay = false;
}
_this.discountAmount = parseFloat(info.pinTuanRule.discountAmount).toFixed(2);
_this.product = _this.spesClassHandle(products);

View File

@@ -574,6 +574,16 @@
let products = res.data.product;
_this.goodsInfo = info;
if (_this.goodsInfo.album && _this.goodsInfo.video) {
var videoObj = {
url: _this.goodsInfo.video,
poster: _this.goodsInfo.image
};
_this.goodsInfo.album.unshift(videoObj);
_this.autoplay = false;
}
_this.isfav = _this.goodsInfo.isfav;
_this.type = _this.goodsInfo.groupType;
_this.product = _this.spesClassHandle(products);

View File

@@ -1,7 +1,7 @@
.topBox { position: sticky; z-index: 1; width: 100%; /* #ifdef APP-PLUS */ top: calc(var(--status-bar-height) + 35px); /* #endif */ /* #ifdef H5 */ top: calc(var(--status-bar-height) + 55px); /* #endif */ /* #ifdef MP */ top: calc(var(--status-bar-height) + 62.5px); /* #endif */ }
.good_box { border-radius: 8px; margin: 5px; background-color: #ffffff; padding: 5px; position: relative; width: calc(100% - 6px); }
.good_image { width: 100%; border-radius: 4px; }
.goodsBox { display: flex; flex-flow: row wrap; align-content: flex-start; margin-top: 10px; }
.good_box { border-radius: 8px; margin: 0 5px 8px 5px; background-color: #ffffff; position: relative; box-sizing: border-box; break-inside: avoid; overflow: auto; width: calc(50% - 10px); }
.good_image { width: 100%; border-top-left-radius: 4px; border-top-right-radius: 4px; }
.good_title { font-size: 13px; margin-top: 5px; color: $core-main-color; }
.good_title-xl { font-size: 14px; margin-top: 5px; color: $core-main-color; }
.good-tag-hot { display: flex; margin-top: 5px; position: absolute; top: 7.5px; left: 7.5px; background-color: $core-type-error; color: #FFFFFF; display: flex; align-items: center; padding: 2px 7px; border-radius: 25px; font-size: 10px; line-height: 1; }

View File

@@ -84,36 +84,44 @@
<!-- 商品列表 -->
<scroll-view scroll-y="true" :scroll-into-view="toView" class="scroll-Y" @scrolltolower="lower" enable-back-to-top="true" lower-threshold="45">
<!-- 表格图片 -->
<view v-if="current === 0">
<view v-if="goodsList.length > 0" class="goodsBox">
<u-grid :col="2" :border="false" align="left">
<u-grid-item bg-color="transparent" :custom-style="{padding: '1px'}" v-for="item in goodsList" :key="item.id" @click="goGoodsDetail(item.id)">
<view class="good_box">
<u--image :src="item.image" :index="item.id" width="100%" height="167px" mode="widthFix" radius="10"></u--image>
<view class="good_title u-line-2 coreshop-min-height-34">
{{item.name}}
<view class="good_box" v-for="item in goodsList" :key="item.id" @click="goGoodsDetail(item.id)">
<u--image :src="item.image" :index="item.id" width="100%" height="167px" mode="widthFix"></u--image>
<view class="coreshop-padding-5">
<view class="good_title u-line-2 coreshop-min-height-34">
{{item.name}}
</view>
<view class="good-price">
{{item.price}} <span class="coreshop-font-xs coreshop-text-through coreshop-margin-left-15 coreshop-text-gray">{{item.mktprice}}</span>
</view>
<view class="good-tag-recommend" v-if="item.isRecommend">
推荐
</view>
<view class="good-tag-hot" v-if="item.isHot">
热门
</view>
<view class="coreshop-flex coreshop-flex-direction-row coreshop-font-11 coreshop-margin-top-5" v-if="pointSwitch==1 && pointExchangeModel==2 && pointShowExchangePrice==1 && item.pointsDeduction > 0">
<view>
{{ pointShowName}}兑换价:
</view>
<view class="good-price">
{{item.price}} <span class="coreshop-font-xs coreshop-text-through coreshop-margin-left-15 coreshop-text-gray">{{item.mktprice}}</span>
</view>
<view class="good-tag-recommend" v-if="item.isRecommend">
推荐
</view>
<view class="good-tag-hot" v-if="item.isHot">
热门
<view class="coreshop-text-red">
{{pointDiscountedProportion * item.pointsDeduction }}{{ pointShowName}}+{{ item.price - item.pointsDeduction}}
</view>
</view>
</u-grid-item>
</u-grid>
<u-loadmore :status="loadStatus" :icon-type="loadIconType" :load-text="loadText" margin-top="20" margin-bottom="20" />
</view>
</view>
<view class="coreshop-btn-all">
<u-loadmore :status="loadStatus" :icon-type="loadIconType" :load-text="loadText" margin-top="20" margin-bottom="20" />
</view>
</view>
<!-- 无数据时默认显示 -->
<view class="coreshop-emptybox" v-else>
<u-empty :icon="$globalConstVars.apiFilesUrl+'/static/images/empty/data.png'" icon-size="150" text="当前列表为空" mode="list"></u-empty>
</view>
</view>
<!-- 列表图片 -->
@@ -134,7 +142,7 @@
</u-col>
<u-col span="8">
<view class="contentBody">
<view class="good_title-xl u-line-2 coreshop-padding-left-10 coreshop-padding-right-10">
<view class="good_title-xl u-line-2 coreshop-padding-left-10 coreshop-padding-right-10">
{{item.name}}
</view>
<view class="good-price coreshop-padding-10">
@@ -306,6 +314,13 @@
this.getGoods();
}
},
computed: {
pointSwitch() { return this.$store.state.config.pointSwitch },
pointShowExchangePrice() { return this.$store.state.config.pointShowExchangePrice },
pointDiscountedProportion() { return this.$store.state.config.pointDiscountedProportion },
pointExchangeModel() { return this.$store.state.config.pointExchangeModel },
pointShowName() { return this.$store.state.config.pointShowName },
},
methods: {
listGrid() {
if (this.current == 0) {

View File

@@ -18,8 +18,19 @@
<view class="coreshop-limited-seckill-box coreshop-bg-red">
<text class="coreshop-text-price coreshop-font-20">{{ product.price || '0.00' }}</text>
<view class="coreshop-font-xs coreshop-cost-price-num price-4">
<view class="coreshop-text-through">原价{{ product.mktprice || '0.00'}}</view>
<view>{{ goodsInfo.buyCount || '0' }} 人已购买</view>
<view v-if="pointSwitch==1 && pointExchangeModel==2 && pointShowExchangePrice==1 && product.pointsDeduction > 0">
<view class="coreshop-padding-bottom-5 coreshop-font-14">
兑换价{{pointDiscountedProportion * product.pointsDeduction }}{{ pointShowName}}+{{ product.price - product.pointsDeduction}}
</view>
<view class="coreshop-flex coreshop-flex-wrap coreshop-flex-direction-row">
<view class="coreshop-text-through coreshop-padding-bottom-5">原价{{ product.mktprice || '0.00'}}</view>
<view class="coreshop-margin-left-10">{{ goodsInfo.buyCount || '0' }} 人已购买</view>
</view>
</view>
<view v-else>
<view class="coreshop-text-through coreshop-padding-bottom-5">原价{{ product.mktprice || '0.00'}}</view>
<view>{{ goodsInfo.buyCount || '0' }} 人已购买</view>
</view>
</view>
<view class="coreshop-text-right coreshop-share-right">
<u-icon name="share" @click="goShare()" label="分享" size="20" labelSize="11" color="#fff" labelColor="#fff" labelPos="bottom"></u-icon>
@@ -436,7 +447,7 @@
delivery: [],
service: [],
},
autoplay: true
autoplay: true,
}
},
onLoad(options) {
@@ -504,6 +515,11 @@
this.$store.commit('userInfo', val);
}
},
pointSwitch() { return this.$store.state.config.pointSwitch },
pointShowExchangePrice() { return this.$store.state.config.pointShowExchangePrice },
pointDiscountedProportion() { return this.$store.state.config.pointDiscountedProportion },
pointExchangeModel() { return this.$store.state.config.pointExchangeModel },
pointShowName() { return this.$store.state.config.pointShowName },
shopName() {
return this.$store.state.config.shopName;
},
@@ -590,7 +606,11 @@
_this.goodsInfo = info;
if (_this.goodsInfo.album && _this.goodsInfo.video) {
_this.goodsInfo.album.unshift(_this.goodsInfo.video);
var videoObj = {
url: _this.goodsInfo.video,
poster: _this.goodsInfo.image
};
_this.goodsInfo.album.unshift(videoObj);
_this.autoplay = false;
}

View File

@@ -15,7 +15,7 @@
}
.cart-shoppingcard:last-child { margin-bottom: 75px }
.cart-shoppingcard-checkbtn { width: 100px; margin-left: 25px; flex-shrink: 0; }
.cart-shoppingcard-checkbtn { /*width: 100px;*/ margin-left: 15px; flex-shrink: 0; }
.cart-shoppingcard-checkout { width: 90px; height: 50px; line-height: 50px; font-size: 14px; text-align: center; flex-shrink: 0; }
.cart-bg-gray { background: #A5A7B2 !important; color: #FFFFFF !important; }
.cart-badge { border-radius: 19px; height: 19px; line-height: 19px; padding: 0 6.5px; font-size: 11px; }

View File

@@ -38,10 +38,25 @@
<text class="cart-shoppingcard-remove coreshop-text-green" v-if="item.stockNo">库存不足</text>
<text class="cart-shoppingcard-remove coreshop-text-green" v-else-if="item.stockTension">库存紧张</text>
<text class="cart-shoppingcard-remove " v-else=""></text>
<u-icon name="trash" size="14" @click="removeGoods" :index="index" label="删除" labelSize="12"></u-icon>
</view>
</view>
</view>
<view class="coreshop-flex coreshop-flex-direction-row coreshop-justify-between coreshop-margin-top-10">
<view class="coreshop-flex coreshop-flex-direction-row coreshop-font-13" v-if="pointSwitch==1 && pointExchangeModel==2 && pointShowExchangePrice==1 && item.products.pointsDeduction > 0">
<view>
{{ pointShowName}}兑换价:
</view>
<view class="coreshop-text-red">
{{pointDiscountedProportion * item.products.pointsDeduction }}{{ pointShowName}}+{{ item.products.price - item.products.pointsDeduction}}元
</view>
</view>
<view v-else></view>
<u-icon name="trash" size="14" @click="removeGoods" :index="index" label="删除" labelSize="12"></u-icon>
</view>
</view>
</u-checkbox-group>
@@ -61,7 +76,18 @@
<u-checkbox name="全选" label="全选" active-color="red"></u-checkbox>
</u-checkbox-group>
</view>
<view class="cart-shoppingcard-count coreshop-flex coreshop-flex-direction-row coreshop-justify-between coreshop-align-center">
<view class="cart-shoppingcard-count coreshop-flex coreshop-flex-direction-column coreshop-justify-between coreshop-align-left coreshop-margin-right-5" v-if="pointSwitch==1 && pointExchangeModel==2 && pointShowExchangePrice==1 && pointShowMoney>0">
<view>
<text class="cart-text">合计 :</text>
<text class="coreshop-font-18 coreshop-text-red">¥{{totalprice}}</text>
</view>
<view>
<text class="coreshop-font-12">{{ pointShowName}}兑换价:</text>
<text class="coreshop-font-12 coreshop-text-red">{{pointShowText}}</text>
</view>
</view>
<view class="cart-shoppingcard-count coreshop-flex coreshop-flex-direction-row coreshop-justify-between coreshop-align-center coreshop-margin-right-5" v-else>
<text class="cart-text">合计 :</text>
<text class="coreshop-font-18 coreshop-text-red">¥{{totalprice}}</text>
</view>
@@ -84,7 +110,9 @@
shoppingCard: {},
cartIds: [], //选中ids
goSettlement: false, //去结算按钮
selectAll: ['全选']
selectAll: ['全选'],
pointShowText: "",
pointShowMoney: 0,
}
},
//页面加载
@@ -103,14 +131,18 @@
},
GoodsStocksWarn() {
return this.$store.state.config.goodsStocksWarn;
}
},
pointSwitch() { return this.$store.state.config.pointSwitch },
pointShowExchangePrice() { return this.$store.state.config.pointShowExchangePrice },
pointDiscountedProportion() { return this.$store.state.config.pointDiscountedProportion },
pointExchangeModel() { return this.$store.state.config.pointExchangeModel },
pointShowName() { return this.$store.state.config.pointShowName },
},
methods: {
//数组转字符串
arrayToStr: function (array) {
return array.toString();
},
//获取购物车数据
getCartData: function () {
let _this = this;
@@ -127,7 +159,6 @@
}
});
},
//渲染前配置数据
showHandle: function (data, flag = true) {
let _this = this;
@@ -214,16 +245,22 @@
}
_this.countTotoal();
},
//计算总计函数
countTotoal: function () {
let _that = this;
var total = 0;
var pointsMoneySum = 0;
var pointsSum = 0;
for (let i in _that.shoppingCard.list) {
if (_that.shoppingCard.list[i].isSelect) {
total += Number(_that.shoppingCard.list[i].products.price) * Number(_that.shoppingCard.list[i].nums);
_that.pointShowMoney += Number(_that.shoppingCard.list[i].products.pointsDeduction) * Number(_that.shoppingCard.list[i].nums);
pointsSum += _that.pointDiscountedProportion * Number(_that.shoppingCard.list[i].products.pointsDeduction) * Number(_that.shoppingCard.list[i].nums);
pointsMoneySum += Number(_that.shoppingCard.list[i].products.price - _that.shoppingCard.list[i].products.pointsDeduction) * Number(_that.shoppingCard.list[i].nums);
}
}
_that.pointShowText = pointsSum + _that.pointShowName + '+' + _that.$common.formatMoney(pointsMoneySum, 2, '');
_that.totalprice = _that.$common.formatMoney(total, 2, '');
},
toNumberChange: function (e) {

View File

@@ -39,7 +39,7 @@
<!-- 弹出层 -->
<view class="coreshop-padding-10">
<u-popup mode="bottom" v-model="shareBox" ref="share">
<u-popup mode="bottom" :show="shareBox" ref="share">
<!-- #ifdef H5 -->
<coreshop-share-h5 :shareType='3' :goodsId="goodsInfo.goodsId" :teamId="teamInfo.teamId" :groupId="teamInfo.ruleId"
:shareImg="goodsInfo.image_url" :shareTitle="goodsInfo.name" :shareContent="goodsInfo.brief" :shareHref="shareHref"
@@ -121,33 +121,8 @@
} else {
this.$u.toast('参数错误');
}
let teamInfo, orderInfo, goodsInfo
let pages = getCurrentPages()
let pre = pages[pages.length - 2]
if (typeof pre != 'undefined') {
// #ifdef H5 || APP-PLUS || APP-PLUS-NVUE
teamInfo = pre.teamInfo
orderInfo = pre.orderInfo
// #endif
// #ifdef MP-WEIXIN
teamInfo = pre.$vm.teamInfo
orderInfo = pre.$vm.orderInfo
// #endif
// #ifdef MP-ALIPAY || MP-TOUTIAO
teamInfo = pre.data.teamInfo;
orderInfo = pre.data.orderInfo
// #endif
}
if (teamInfo && orderInfo) {
this.teamInfo = teamInfo;
this.orderInfo = orderInfo;
this.goodsInfo = orderInfo.items[0];
} else {
this.orderDetail();
this.getTeam();
}
this.orderDetail();
this.getTeam();
},
computed: {
shareHref() {
@@ -259,20 +234,20 @@
});
}
},
watch: {
goodsInfo: {
handler() {
this.getShareUrl();
},
deep: true
},
teamInfo: {
handler() {
this.getShareUrl();
},
deep: true
}
},
//watch: {
// goodsInfo: {
// handler() {
// this.getShareUrl();
// },
// deep: true
// },
// teamInfo: {
// handler() {
// this.getShareUrl();
// },
// deep: true
// }
//},
//分享
onShareAppMessage(res) {
return {

View File

@@ -107,10 +107,31 @@
<u-tag :text="v.name" mode="light" size="mini" v-for="(v, k) in item.products.promotionList" :key="k" />
</view>
<view class="goods-price-view">
<text class="coreshop-text-price coreshop-text-red coreshop-font-lg">{{ item.products.price || ''}}</text>
<view class="coreshop-flex coreshop-flex-direction-row">
<text class="coreshop-text-price coreshop-text-red coreshop-font-lg">{{ item.products.price || ''}}</text>
<view class="coreshop-flex coreshop-flex-direction-row coreshop-font-10 coreshop-align-center" v-if="pointSwitch==1 && pointExchangeModel==2 && pointShowExchangePrice==1 && item.products.pointsDeduction > 0">
<view>
{{ pointShowName}}兑换价:
</view>
<view class="coreshop-text-red">
{{pointDiscountedProportion * item.products.pointsDeduction }}{{ pointShowName}}+{{ item.products.price - item.products.pointsDeduction}}
</view>
</view>
</view>
<view class='coreshop-text-right goods-num'>× {{ item.nums || ''}}</view>
</view>
</view>
<view class="coreshop-flex coreshop-flex-direction-row coreshop-font-13 coreshop-margin-top-10" v-if="pointSwitch==1 && pointExchangeModel==2 && pointShowExchangePrice==1 && item.products.pointsDeduction > 0">
<view>
{{ pointShowName}}兑换价合计
</view>
<view class="coreshop-text-red">
{{pointDiscountedProportion * item.products.pointsDeduction * item.nums }}{{ pointShowName}}+{{(item.products.price - item.products.pointsDeduction)*item.nums }}
</view>
</view>
</view>
</view>
</view>
@@ -162,10 +183,10 @@
<view class="coreshop-list-item" v-if="isOpenPoint === 1 && userPointNums > 0">
<!--<view class="coreshop-list-item arrow">-->
<view class="content">
<text class="coreshop-text-black">积分抵扣</text>
<text class="coreshop-text-black">{{ pointShowName}}抵扣</text>
<view class="coreshop-text-gray coreshop-font-xs flex">
<text class="u-line-1">
可用{{ canUsePoint}}积分可抵扣{{ pointMoney}}共有{{ userPointNums}}积分
可用{{ canUsePoint}}{{ pointShowName}}可抵扣{{ pointMoney}}共有{{ userPointNums}}{{ pointShowName}}
</text>
</view>
</view>
@@ -468,6 +489,8 @@
// 判断是否开启积分抵扣 并且 没有勾选积分使用
if (this.isOpenPoint === 1 && !this.isUsePoint) {
let money = {
cartType: this.orderType,
ids: this.params.ids,
orderMoney: data.amount
}
this.$u.api.usablePoint(money).then(res => {
@@ -841,7 +864,11 @@
//console.log(this.cartData.coupon);
return this.cartData.coupon && this.cartData.coupon.length > 0;
},
pointSwitch() { return this.$store.state.config.pointSwitch },
pointShowExchangePrice() { return this.$store.state.config.pointShowExchangePrice },
pointDiscountedProportion() { return this.$store.state.config.pointDiscountedProportion },
pointExchangeModel() { return this.$store.state.config.pointExchangeModel },
pointShowName() { return this.$store.state.config.pointShowName },
},
watch: {
// 监听数据状态(切换收货地址, 是否使用优惠券, 是否使用积分) 重新请求订单数据

View File

@@ -297,6 +297,7 @@
<col width="80">
<col width="80">
<col width="80">
<col width="80">
</colgroup>
<thead>
<tr>
@@ -305,6 +306,7 @@
<th>货号</th>
<th>SKU</th>
<th>重量()</th>
<th>低分最大<br />可抵金额</th>
<th>库存</th>
<th><i class="required-color">*</i></th>
<th>成本价</th>
@@ -345,6 +347,9 @@
<td>
<input type="text" name="product[weight][]" value="{{item.weight}}" placeholder="重量" class="layui-input layui-inline-1">
</td>
<td>
<input type="text" name="product[pointsDeduction][]" value="{{item.pointsDeduction}}" placeholder="金额" class="layui-input layui-inline-1">
</td>
<td class="have-add-td">
<input type="text" name="product[stock][]" value="{{item.stock}}" placeholder="库存" class="layui-input layui-inline-1 goods-stock">
</td>
@@ -507,6 +512,7 @@
sn: layui.coreHelper.getSN('SN'),
spesDesc: "",
stock: 1000,
pointsDeduction: 0,
weight: 0,
price: 0,
costprice: 0,
@@ -781,7 +787,7 @@
}
, done: function (res) {
if (res.code > 0) {
return layer.msg('上传失败');
return layer.msg('上传失败');
} else {
layer.msg('上传成功');
imgs.push(res.data.fileUrl);
@@ -801,7 +807,7 @@
}
});
//SKU缩略图上传
$('.upSpecImage').click(function () {
var _that = this;
@@ -1428,6 +1434,7 @@
productModel.levelOne = field['product[levelOne][' + i + ']'];
productModel.levelTwo = field['product[levelTwo][' + i + ']'];
productModel.levelThree = field['product[levelThree][' + i + ']'];
productModel.pointsDeduction = field['product[pointsDeduction][' + i + ']'];
products.push(productModel);
}
//会员价格模型

View File

@@ -289,6 +289,7 @@
<col width="80">
<col width="80">
<col width="80">
<col width="80">
</colgroup>
<thead>
<tr>
@@ -298,6 +299,7 @@
<th>SKU</th>
<th>冻结库存</th>
<th>重量()</th>
<th>低分最大<br />可抵金额</th>
<th>库存</th>
<th><i class="required-color">*</i></th>
<th>成本价</th>
@@ -341,7 +343,9 @@
<td>
<input type="text" name="product[weight][]" value="{{item.weight}}" placeholder="重量" class="layui-input layui-inline-1">
</td>
<td>
<input type="text" name="product[pointsDeduction][]" value="{{item.pointsDeduction}}" placeholder="金额" class="layui-input layui-inline-1">
</td>
<td class="have-add-td">
<input type="text" name="product[stock][]" value="{{item.stock}}" placeholder="库存" class="layui-input layui-inline-1 goods-stock">
</td>
@@ -610,6 +614,7 @@
sn: layui.coreHelper.getSN('SN'),
spesDesc: "",
stock: 1000,
pointsDeduction: 0,
weight: 0,
price: 0,
costprice: 0,
@@ -1537,6 +1542,7 @@
productModel.levelOne = field['product[levelOne][' + i + ']'];
productModel.levelTwo = field['product[levelTwo][' + i + ']'];
productModel.levelThree = field['product[levelThree][' + i + ']'];
productModel.pointsDeduction = field['product[pointsDeduction][' + i + ']'];
products.push(productModel);
}
//会员价格模型

View File

@@ -445,6 +445,29 @@
<input type="radio" lay-filter="pointSwitch" name="pointSwitch" value="2" title="不开启" {{d.data.configs['pointSwitch']['sValue']==="2" ? 'checked':''}}>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">{{d.data.configs['pointExchangeModel']['sKey']}}</label>
<div class="layui-input-inline layui-inline-7">
<input type="radio" lay-filter="pointExchangeModel" name="pointExchangeModel" value="1" title="全局计算" {{d.data.configs['pointExchangeModel']['sValue']==="1" ? 'checked':''}}>
<input type="radio" lay-filter="pointExchangeModel" name="pointExchangeModel" value="2" title="单品计算" {{d.data.configs['pointExchangeModel']['sValue']==="2" ? 'checked':''}}>
</div>
<div class="layui-form-mid layui-word-aux">全局计算是指直接对订单按照使用比例进行计算单品计算是指根据单个商品下sku独立设置的最高可抵扣金额进行计算</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">{{d.data.configs['pointShowExchangePrice']['sKey']}}</label>
<div class="layui-input-inline layui-inline-7">
<input type="radio" lay-filter="pointShowExchangePrice" name="pointShowExchangePrice" value="1" title="显示" {{d.data.configs['pointShowExchangePrice']['sValue']==="1" ? 'checked':''}}>
<input type="radio" lay-filter="pointShowExchangePrice" name="pointShowExchangePrice" value="2" title="不显示" {{d.data.configs['pointShowExchangePrice']['sValue']==="2" ? 'checked':''}}>
</div>
<div class="layui-form-mid layui-word-aux">勾选显示将在商品详情购物车等界面显示积分加价格的效果</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">{{d.data.configs['pointShowName']['sKey']}}</label>
<div class="layui-input-inline layui-inline-2">
<input type="text" name="pointShowName" value="{{d.data.configs['pointShowName']['sValue']}}" lay-verify="title" autocomplete="off" placeholder="请输入" class="layui-input">
</div>
<div class="layui-form-mid layui-word-aux">前端积分可以展示别的名称如衡豆金豆等等</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">{{d.data.configs['pointDiscountedProportion']['sKey']}}</label>
<div class="layui-input-inline layui-inline-2">
@@ -457,7 +480,7 @@
<div class="layui-input-inline layui-inline-2">
<input type="number" name="ordersPointProportion" value="{{d.data.configs['ordersPointProportion']['sValue']}}" lay-verify="title|number" autocomplete="off" placeholder="请输入正整数" class="layui-input" max="100" min="0">
</div>
<div class="layui-form-mid layui-word-aux">%单个订单积分折现最大百分比</div>
<div class="layui-form-mid layui-word-aux">%单个订单积分折现最大百分比仅全局计算下有小单品计算模式直接根据单品的设置</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">{{d.data.configs['ordersRewardProportion']['sKey']}}</label>

View File

@@ -107,6 +107,10 @@ namespace CoreCms.Net.Web.WebApi.Controllers
var toCashMoneyLow = CommonHelper.GetConfigDictionary(allConfigs, SystemSettingConstVars.TocashMoneyLow); //最低提现
var toCashMoneyRate = CommonHelper.GetConfigDictionary(allConfigs, SystemSettingConstVars.TocashMoneyRate); //服务费
var pointSwitch = CommonHelper.GetConfigDictionary(allConfigs, SystemSettingConstVars.PointSwitch).ObjectToInt(); //是否开启积分功能
var pointExchangeModel = CommonHelper.GetConfigDictionary(allConfigs, SystemSettingConstVars.PointExchangeModel).ObjectToInt(); //积分模式
var pointDiscountedProportion = CommonHelper.GetConfigDictionary(allConfigs, SystemSettingConstVars.PointDiscountedProportion).ObjectToInt(); //积分折现比例
var pointShowName = CommonHelper.GetConfigDictionary(allConfigs, SystemSettingConstVars.PointShowName); //积分昵称
var pointShowExchangePrice = CommonHelper.GetConfigDictionary(allConfigs, SystemSettingConstVars.PointShowExchangePrice).ObjectToInt(); //积分昵称
var statistics = CommonHelper.GetConfigDictionary(allConfigs, SystemSettingConstVars.StatisticsCode); //获取统计代码
var recommendKeysStr = CommonHelper.GetConfigDictionary(allConfigs, SystemSettingConstVars.RecommendKeys);
var recommendKeys = !string.IsNullOrEmpty(recommendKeysStr) ? recommendKeysStr.Split("|") : new string[] { }; //搜索推荐关键字
@@ -173,6 +177,10 @@ namespace CoreCms.Net.Web.WebApi.Controllers
toCashMoneyLow,
toCashMoneyRate,
pointSwitch,
pointExchangeModel,
pointShowName,
pointShowExchangePrice,
pointDiscountedProportion,
statistics,
recommendKeys,
invoiceSwitch,

View File

@@ -919,7 +919,14 @@ namespace CoreCms.Net.Web.WebApi.Controllers
{
var jm = new WebApiCallBack();
var ship = await _userServices.GetUserPoint(_user.ID, entity.orderMoney);
var ids = CommonHelper.StringToIntArray(entity.ids);
if (!ids.Any())
{
jm.status = false;
jm.msg = "请提交货品信息";
return jm;
}
var ship = await _userServices.GetUserPoint(_user.ID, entity.orderMoney, ids, entity.cartType);
jm.status = true;
jm.data = ship;

View File

@@ -0,0 +1 @@
ALTER TABLE CoreCmsProducts ADD COLUMN pointsDeduction decimal(10,2) DEFAULT 0 NOT NULL COMMENT '积分可抵扣金额' AFTER isDel;

View File

@@ -1,3 +1,6 @@
2022-02-24
【新增】表【CoreCmsProducts】增加【积分可抵扣金额pointsDeduction】字段
2022-02-12
【新增】表【CoreCmsUserShip】增加【精度longitude】【纬度latitude】【街道street】三字段。

View File

@@ -0,0 +1,12 @@
ALTER TABLE [dbo].[CoreCmsProducts]
ADD [pointsDeduction] DECIMAL(10, 2)
DEFAULT 0 NOT NULL;
EXECUTE sp_addextendedproperty @name = N'MS_Description',
@value = N'<EFBFBD><EFBFBD><EFBFBD>ֿɵֿ۽<EFBFBD><EFBFBD><EFBFBD>',
@level0type = N'SCHEMA',
@level0name = N'dbo',
@level1type = N'TABLE',
@level1name = N'CoreCmsProducts',
@level2type = N'COLUMN',
@level2name = N'pointsDeduction';

View File

@@ -1,3 +1,6 @@
2022-02-24
【新增】表【CoreCmsProducts】增加【积分可抵扣金额pointsDeduction】字段
2022-02-12
【新增】表【CoreCmsUserShip】增加【精度longitude】【纬度latitude】【街道street】三字段。