Commit c078d1e6 authored by liudong1993's avatar liudong1993

和平返佣

parent bc33739d
......@@ -75,6 +75,10 @@ namespace Mall.Model.Entity.Product
set;
}
/// <summary>
/// 类型 1标准返佣 2和平返佣
/// </summary>
public int? Type { get; set; }
/// <summary>
/// Remark
/// </summary>
public string Remark
......
This diff is collapsed.
......@@ -790,16 +790,16 @@ namespace Mall.Module.Product
var gList = distributor_HPGradeRatioRepository.GetList(new RB_Distributor_HPGradeRatio_Extend() { CommissionId = hpcModel.Id, TenantId = TenantId, MallBaseId = MallBaseId });
var ratioModel = gList.Where(x => x.GradeId == disModel.HPGradeId).FirstOrDefault();
decimal MPrice = (model.CostPrice ?? 0) / (1 - ((ratioModel.CommissionRatio ?? 0) / 100));
decimal MPrice = (model.CostPrice ?? 0) / (1 - ((ratioModel.CommissionRatio ?? 0) / 100));
model.MaxShare = MaxSellMoney - MPrice > 0 ? MaxSellMoney - MPrice : 0;
if (hpcModel.DecimalType == 1)
{
MPrice = Math.Ceiling(MPrice);
model.MaxShare = Math.Ceiling(model.MaxShare);
}
else if (hpcModel.DecimalType == 2)
{
MPrice = Math.Ceiling(MPrice * 100) / 100;
model.MaxShare = Math.Ceiling(model.MaxShare * 100) / 100;
}
model.MaxShare = MaxSellMoney - MPrice > 0 ? MaxSellMoney - MPrice : 0;
}
}
}
......@@ -1155,16 +1155,16 @@ namespace Mall.Module.Product
var gList = distributor_HPGradeRatioRepository.GetList(new RB_Distributor_HPGradeRatio_Extend() { CommissionId = hpcModel.Id, TenantId = TenantId, MallBaseId = MallBaseId });
var ratioModel = gList.Where(x => x.GradeId == disModel.HPGradeId).FirstOrDefault();
decimal MPrice = (model.CostPrice ?? 0) / (1 - ((ratioModel.CommissionRatio ?? 0) / 100));
decimal MPrice = (model.CostPrice ?? 0) / (1 - ((ratioModel.CommissionRatio ?? 0) / 100));
model.MaxShare = MaxSellMoney - MPrice > 0 ? MaxSellMoney - MPrice : 0;
if (hpcModel.DecimalType == 1)
{
MPrice = Math.Ceiling(MPrice);
model.MaxShare = Math.Ceiling(model.MaxShare);
}
else if (hpcModel.DecimalType == 2)
{
MPrice = Math.Ceiling(MPrice * 100) / 100;
model.MaxShare = Math.Ceiling(model.MaxShare * 100) / 100;
}
model.MaxShare = MaxSellMoney - MPrice > 0 ? MaxSellMoney - MPrice : 0;
}
}
}
......
......@@ -1140,9 +1140,9 @@ namespace Mall.Module.User
//查询和平分销等级
string hpgradeIds = string.Join(",", list.Where(x => x.HPGradeId > 0).Select(x => x.HPGradeId ?? 0).Distinct());
List<RB_Distributor_HPGradeInfo_Extend> HPGradeList = new List<RB_Distributor_HPGradeInfo_Extend>();
if (!string.IsNullOrEmpty(gradeIds))
if (!string.IsNullOrEmpty(hpgradeIds))
{
HPGradeList = distributor_HPGradeInfoRepository.GetList(new RB_Distributor_HPGradeInfo_Extend() { GradeIds = gradeIds, TenantId = demodel.TenantId, MallBaseId = demodel.MallBaseId });
HPGradeList = distributor_HPGradeInfoRepository.GetList(new RB_Distributor_HPGradeInfo_Extend() { GradeIds = hpgradeIds, TenantId = demodel.TenantId, MallBaseId = demodel.MallBaseId });
}
//查询推荐人列表
string tjrIds = string.Join(",", list.Where(x => x.SuperiorId > 0).Select(x => x.SuperiorId ?? 0).Distinct());
......@@ -1169,11 +1169,12 @@ namespace Mall.Module.User
{
item.GradeName = GradeList.Where(x => x.Id == item.GradeId).FirstOrDefault()?.Name ?? "";
}
if (item.HPGradeId == 0)
if ((item.HPGradeId ?? 0) == 0)
{
item.HPGradeName = "默认等级";
}
else if (item.HPGradeId > 0) {
else if (item.HPGradeId > 0)
{
item.HPGradeName = HPGradeList.Where(x => x.Id == item.HPGradeId).FirstOrDefault()?.GradeName ?? "";
}
......@@ -3118,8 +3119,9 @@ namespace Mall.Module.User
var rInsertList = demodel.RatioList.Where(x => !rlist.Select(z => z.GradeId).Contains(x.GradeId)).ToList();
foreach (var item in rUpdateList) {
var rmodel = demodel.RatioList.Where(x => x.GradeId == item.GradeId).FirstOrDefault();
Dictionary<string, object> keyValues1 = new Dictionary<string, object>() {
{ nameof(RB_Distributor_HPGradeRatio.CommissionRatio),item.CommissionRatio}
{ nameof(RB_Distributor_HPGradeRatio.CommissionRatio),rmodel?.CommissionRatio??0}
};
List<WhereHelper> wheres1 = new List<WhereHelper>() {
new WhereHelper(){
......@@ -3324,6 +3326,7 @@ namespace Mall.Module.User
/// <returns></returns>
public object GetHpUserDistributorInfo(int userId, int tenantId, int mallBaseId)
{
var umodel = member_UserRepository.GetEntity(userId);
var model = distributor_InfoRepository.GetList(new RB_Distributor_Info_Extend() { UserId = userId, TenantId = tenantId, MallBaseId = mallBaseId }).FirstOrDefault();
if (model == null) {
return new
......@@ -3347,7 +3350,6 @@ namespace Mall.Module.User
};
}
var gmodel = distributor_HPGradeInfoRepository.GetEntity(model.HPGradeId);
var umodel = member_UserRepository.GetEntity(userId);
return new
{
Status = 1,
......
......@@ -77,7 +77,7 @@ namespace Mall.Repository.User
where += $@" and {nameof(RB_Distributor_HPGradeInfo.GradeName)} like '%{dmodel.GradeName}%'";
}
string sql = $@"select * from RB_Distributor_HPGradeInfo where {where} order by Id desc";
string sql = $@"select * from RB_Distributor_HPGradeInfo where {where} order by Grade asc";
return Get<RB_Distributor_HPGradeInfo_Extend>(sql).ToList();
}
}
......
......@@ -55,7 +55,7 @@ namespace Mall.Repository.User
where += $@" and di.{nameof(RB_Distributor_Info.Mobile)} like '%{dmodel.Mobile}%'";
}
string sql = $@"select di.*,u.Name as NickName,u.Photo,u.Source from RB_Distributor_Info di
string sql = $@"select di.*,u.Name as NickName,u.SuperiorId,u.Photo,u.Source from RB_Distributor_Info di
inner join rb_member_user u on di.UserId=u.Id
where {where} order by di.CreateDate desc";
return GetPage<RB_Distributor_Info_Extend>(pageIndex, pageSize, out rowCount, sql).ToList();
......
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