Commit c078d1e6 authored by liudong1993's avatar liudong1993

和平返佣

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