Commit a36ffcac authored by liudong1993's avatar liudong1993

修改佣金

parent 36625a0a
......@@ -31,7 +31,7 @@ namespace Mall.Model.Entity.Product
set;
}
/// <summary>
/// 来源类型 1订单 2商品
/// 来源类型 1订单 2商品 3推荐返佣
/// </summary>
public int? Type
{
......
......@@ -9273,6 +9273,52 @@ namespace Mall.Module.Product
return RList;
}
/// <summary>
/// 设置推荐供应商返佣
/// </summary>
/// <param name="orderDetailId"></param>
/// <param name="commission"></param>
/// <param name="tenantId"></param>
/// <param name="mallBaseId"></param>
/// <returns></returns>
public bool SetRecommendOrdersCommission(int orderDetailId, decimal commission, int tenantId, int mallBaseId, int empId)
{
var introductionModel = goods_OrderIntroductionRepository.GetList(new RB_Goods_OrderIntroduction_Extend() { OrderDetailId = orderDetailId, TenantId = tenantId, MallBaseId = mallBaseId }).FirstOrDefault();
if (introductionModel == null) { return false; }
if (introductionModel.CommissionState != 1) { return false; }
Dictionary<string, object> keyValues = new Dictionary<string, object>() {
{ nameof(RB_Goods_OrderIntroduction.Commission),commission},
{ nameof(RB_Goods_OrderIntroduction.Remark),(introductionModel.Remark??"")+" "+"修改返佣:由" + (introductionModel.Commission ?? 0) + "=>" + commission}
};
List<WhereHelper> wheres = new List<WhereHelper>() {
new WhereHelper(){
FiledName=nameof(RB_Goods_OrderIntroduction.Id),
FiledValue=introductionModel.Id,
OperatorEnum=OperatorEnum.Equal
}
};
bool flag = goods_OrderIntroductionRepository.Update(keyValues, wheres);
if (flag)
{
//记录日志
goods_LogRepository.Insert(new RB_Goods_Log()
{
Content = empId + " 修改推荐供应商返佣:由" + (introductionModel.Commission ?? 0) + "=>" + commission,
CreateDate = DateTime.Now,
Id = 0,
MallBaseId = mallBaseId,
SourceId = introductionModel.Id,
TenantId = tenantId,
Type = 3
});
return true;
}
else {
return false;
}
}
#endregion
#region 供应商订单商品信息
......
......@@ -43,6 +43,10 @@ namespace Mall.Repository.Product
{
where += $@" and oc.{nameof(RB_Goods_OrderIntroduction.OrderId)} in({dmodel.OrderIds})";
}
if (dmodel.OrderDetailId > 0)
{
where += $@" and oc.{nameof(RB_Goods_OrderIntroduction.OrderDetailId)}={dmodel.OrderDetailId}";
}
if (!string.IsNullOrEmpty(dmodel.IntroductionIds))
{
where += $@" and oc.{nameof(RB_Goods_OrderIntroduction.Id)} in({dmodel.IntroductionIds})";
......
......@@ -1768,6 +1768,30 @@ namespace Mall.WebApi.Controllers.MallBase
}
/// <summary>
/// 设置推荐分销
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult SetRecommendOrdersCommission() {
var req = RequestParm;
JObject parms = JObject.Parse(req.msg.ToString());
int OrderDetailId = parms.GetInt("OrderDetailId", 0);
decimal Commission = parms.GetDecimal("Commission");
if (OrderDetailId <= 0) {
return ApiResult.ParamIsNull("请传递订单明细id");
}
bool flag = orderModule.SetRecommendOrdersCommission(OrderDetailId, Commission, req.TenantId, req.MallBaseId);
if (flag)
{
return ApiResult.Success();
}
else {
return ApiResult.Failed();
}
}
#endregion
#region 推荐供应商
......
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