Commit 3b83c283 authored by 吴春's avatar 吴春

提交

parent c67adeb7
......@@ -250,9 +250,16 @@ namespace Mall.Model.Query
/// <summary>
/// 主播佣金
/// 主播应付佣金
/// </summary>
public decimal LiveCommission { get; set; }
/// <summary>
/// 主播已付佣金
/// </summary>
public decimal PaidLiveCommission { get; set; }
/// <summary>
/// 主播佣金生成的财务单据 逗号分隔
/// </summary>
......
......@@ -289,7 +289,8 @@ namespace Mall.Module.Product
count = 0;
return new List<RB_Goods_ShoppingCart_Extend>();
}
if (demodel.SmallShopsId == 0) {
if (demodel.SmallShopsId == 0)
{
demodel.SmallShopsId = umodel.SmallShopId;
}
var list = goods_ShoppingCartRepository.GetPageList(pageIndex, pageSize, out count, demodel);
......@@ -1255,7 +1256,8 @@ namespace Mall.Module.Product
{
return ApiResult.Failed("用户不存在");
}
if (demodel.SmallShopsId == 0) {
if (demodel.SmallShopsId == 0)
{
demodel.SmallShopsId = umodel.SmallShopId;
}
//积分
......@@ -1549,7 +1551,7 @@ namespace Mall.Module.Product
{
if (smallModel.PriceType == 1)
{
gmodel.SellingPrice += Math.Ceiling((gmodel.SellingPrice??0) * (smallModel.UpPrice ?? 0) / 100);
gmodel.SellingPrice += Math.Ceiling((gmodel.SellingPrice ?? 0) * (smallModel.UpPrice ?? 0) / 100);
}
else if (smallModel.PriceType == 2)
{
......@@ -2634,7 +2636,8 @@ namespace Mall.Module.Product
{
return ApiResult.Failed("用户不存在");
}
if (demodel.SmallShopsId == 0) {
if (demodel.SmallShopsId == 0)
{
demodel.SmallShopsId = umodel.SmallShopId;
}
if (umodel.Blacklist == 1)
......@@ -3269,7 +3272,8 @@ namespace Mall.Module.Product
item.CouponMoney = couponModel.CouponMoney;
TotalMoney -= (item.CouponMoney ?? 0);//总价格需减去优惠券金额
item.Final_Price -= (item.CouponMoney ?? 0);
if (IsCommissionCoupons) {
if (IsCommissionCoupons)
{
//通用优惠券
item.SmallShopsCostPrice -= (item.CouponMoney ?? 0);
}
......@@ -3624,7 +3628,8 @@ namespace Mall.Module.Product
}
//任务执行返佣 失败查看日志,手动返佣(空闲可增加手动返佣接口)
if (demodel.User_Coupon_Id > 0 && demodel.CouponMoney > 0) {
if (demodel.User_Coupon_Id > 0 && demodel.CouponMoney > 0)
{
demodel.CouponDestription = "使用" + (IsCommissionCoupons ? "通用" : "店铺") + "优惠券抵扣";
}
Task.Run(() => InsertOrderCommission(demodel, umodel, GoodsIds, OrderId));
......@@ -8824,6 +8829,87 @@ namespace Mall.Module.Product
}
/// <summary>
/// 更新订单直播人数和提成
/// </summary>
/// <param name="type">//1-更新人数和金额,2-更新人数,3-更新金额</param>
/// <param name="LivePeopleNum"></param>
/// <param name="LiveCommission"></param>
/// <param name="orderList"></param>
/// <param name="tenantId"></param>
/// <param name="mallBaseId"></param>
/// <returns></returns>
public bool SetOrderSupplierId(int type, int LivePeopleNum, decimal LiveCommission, List<RB_Goods_OrderDetail_Extend> orderList, int tenantId, int mallBaseId)
{
Dictionary<string, object> keyValues;
if (type == 1)
{
keyValues = new Dictionary<string, object>() {
{ nameof(RB_Goods_OrderDetail.LiveCommission),LiveCommission},
{ nameof(RB_Goods_OrderDetail.LivePeopleNum),LivePeopleNum}
};
}
else if (type == 2)
{
keyValues = new Dictionary<string, object>() {
{ nameof(RB_Goods_OrderDetail.LivePeopleNum),LivePeopleNum}
};
}
else if (type == 3)
{
keyValues = new Dictionary<string, object>() {
{ nameof(RB_Goods_OrderDetail.LiveCommission),LiveCommission},
};
}
else
{
return false;
}
bool flag = false;
foreach (var item in orderList)
{
List<WhereHelper> wheres1 = new List<WhereHelper>() {
new WhereHelper(){
FiledName=nameof(RB_Goods_OrderDetail.Id),
FiledValue=item.Id,
OperatorEnum=OperatorEnum.Equal
},
new WhereHelper(){
FiledName=nameof(RB_Goods_OrderDetail.TenantId),
FiledValue=tenantId,
OperatorEnum=OperatorEnum.Equal
},
new WhereHelper(){
FiledName=nameof(RB_Goods_OrderDetail.MallBaseId),
FiledValue=mallBaseId,
OperatorEnum=OperatorEnum.Equal
}
};
flag = goods_OrderDetailRepository.Update(keyValues, wheres1);
if (flag)
{
//记录日志
Task.Run(() => goods_LogRepository.Insert(new RB_Goods_Log()
{
//Content = "修改订单商品:" + item.GoodsName + "供应商ID:" + SupplierId + ";供应商历史ID:" + orderModel.SupplierId.ToString(),
CreateDate = DateTime.Now,
Id = 0,
MallBaseId = mallBaseId,
SourceId = item.OrderId,
TenantId = tenantId,
Type = 1
}));
}
}
return flag;
}
/// <summary>
/// 根据订单好获取物流id
/// </summary>
......@@ -9022,9 +9108,11 @@ namespace Mall.Module.Product
#region 推荐返佣
List<RB_Goods_OrderIntroduction_Extend> OrderIntroduction = new List<RB_Goods_OrderIntroduction_Extend>();
var introductList = goods_OrderIntroductionRepository.GetList(new RB_Goods_OrderIntroduction_Extend() { TenantId = tenantId, MallBaseId = mallBaseId, OrderId = orderId });
if (introductList.Any()) {
if (introductList.Any())
{
var ulist = member_UserRepository.GetList(new RB_Member_User_Extend() { TenantId = tenantId, MallBaseId = mallBaseId, UserIds = string.Join(",", introductList.Select(x => x.UserId).Distinct()) });
foreach (var item in ulist) {
foreach (var item in ulist)
{
decimal Commission = introductList.Where(x => x.UserId == item.Id).Sum(x => x.Commission ?? 0);
OrderIntroduction.Add(new RB_Goods_OrderIntroduction_Extend()
{
......@@ -9039,10 +9127,12 @@ namespace Mall.Module.Product
#region 微店返佣
List<RB_SmallShops_Commission_Extend> SmallShopsCommission = new List<RB_SmallShops_Commission_Extend>();
var ssList = smallShops_CommissionRepository.GetList(new RB_SmallShops_Commission_Extend() { TenantId = tenantId, MallBaseId = mallBaseId, OrderId = orderId });
if (ssList.Any()) {
if (ssList.Any())
{
var ulist = member_UserRepository.GetList(new RB_Member_User_Extend() { TenantId = tenantId, MallBaseId = mallBaseId, UserIds = string.Join(",", introductList.Select(x => x.UserId).Distinct()) });
var slist = smallShops_InfoRepository.GetListForSingle(new RB_SmallShops_Info_Extend() { TenantId = tenantId, MallBaseId = mallBaseId, UserIds = string.Join(",", introductList.Select(x => x.UserId).Distinct()) });
foreach (var item in ulist) {
foreach (var item in ulist)
{
decimal Commission = ssList.Where(x => x.UserId == item.Id).Sum(x => x.Commission ?? 0);
var smodel = slist.Where(x => x.UserId == item.Id).FirstOrDefault();
SmallShopsCommission.Add(new RB_SmallShops_Commission_Extend()
......@@ -9127,13 +9217,13 @@ namespace Mall.Module.Product
x.UserName,
x.Commission
}),
OrderIntroductionInfo = OrderIntroduction.Select(x=>new
OrderIntroductionInfo = OrderIntroduction.Select(x => new
{
x.UserId,
x.UserName,
x.Commission
}),
SmallShopsCommissionInfo = SmallShopsCommission.Select(x=>new
SmallShopsCommissionInfo = SmallShopsCommission.Select(x => new
{
x.UserId,
x.UserName,
......
......@@ -1123,7 +1123,7 @@ as t GROUP BY t.CreateDate desc";
string sql = $@" SELECT MAX( a.OrderNo) as OrderNo,MAX(b.GoodsName) as GoodsName,b.Specification,MAX(b.Unit_Price) as Unit_Price,SUM(b.Number) as Number,f.`Name` as SupplierName,
SUM(b.Final_Price) as Final_Price,SUM(b.FreightMoney) as FreightMoney,SUM(b.Final_Price+b.FreightMoney) as AllPrice ,
SUM(IFNULL(b.CostMoney,0)*b.Number) as CostMoney,0 as PackingMoney, 0 as CostFreight,0 as GoodsFreight,
c.OneCommission,c.OneUserId,c.OneUserName,d.TwoCommission,d.TwoUserId,d.TwoUserName,0 as OtherPrice,e.FXCommission,0 as Paid
c.OneCommission,c.OneUserId,c.OneUserName,d.TwoCommission,d.TwoUserId,d.TwoUserName,0 as OtherPrice,e.FXCommission,b.LiveCommission,b.LiveFinanceIds,0 as Paid
from rb_goods_orderdetail as b
LEFT JOIN rb_goods_order as A on a.OrderId=b.OrderId
LEFT JOIN rb_supplier as f on f.ID=b.SupplierId
......@@ -1302,7 +1302,7 @@ GROUP BY od.GoodsId,o.OrderId
string sql = $@" SELECT B.Id,SUM(b.PaidCostMoney) as PaidCostMoney,MAX(b.OrderId) as OrderId,MAX( a.OrderNo) as OrderNo,MAX(b.GoodsName) as GoodsName,b.Specification,MAX(b.Unit_Price) as Unit_Price,SUM(b.Number) as Number,f.`Name` as SupplierName,
SUM(b.Final_Price) as Final_Price,SUM(b.FreightMoney) as FreightMoney,SUM(b.Final_Price+b.FreightMoney) as AllPrice ,
SUM(IFNULL(b.CostMoney,0)*b.Number) as CostMoney,0 as PackingMoney, 0 as CostFreight,0 as GoodsFreight,
0 as OtherPrice,e.FXCommission,f.RemitFXCommission,0 as Paid
0 as OtherPrice,e.FXCommission,f.RemitFXCommission,b.LiveCommission,b.LiveFinanceIds,0 as Paid
from rb_goods_orderdetail as b
LEFT JOIN rb_goods_order as A on a.OrderId=b.OrderId
LEFT JOIN rb_supplier as f on f.ID=b.SupplierId
......
......@@ -147,10 +147,10 @@ namespace Mall.WebApi.Controllers.AppletWeChat
foreach (var item in list)
{
// item.ALLCommission = item.CostFreight + item.CostMoney + item.PackingMoney + item.GoodsFreight + item.OneCommission + item.TwoCommission + item.OtherPrice;
item.ALLCommission = item.CostFreight + item.CostMoney + item.PackingMoney + item.GoodsFreight + item.FXCommission + item.OtherPrice;
item.ALLCommission = item.CostFreight + item.CostMoney + item.PackingMoney + item.GoodsFreight + item.FXCommission + item.LiveCommission + item.OtherPrice;
// item.NoPaid = item.ALLCommission - item.Paid;
item.NoPaid = item.ALLCommission;
item.Paid = item.PaidCostMoney + item.RemitFXCommission;
item.Paid = item.PaidCostMoney + item.RemitFXCommission + (!string.IsNullOrWhiteSpace(item.LiveFinanceIds) ? item.LiveCommission : 0);
item.GrossProfit = item.AllPrice - item.ALLCommission;
item.GrossProfitRate = item.AllPrice == 0 ? 0 : Math.Round((item.GrossProfit / item.AllPrice), 2, MidpointRounding.AwayFromZero);
}
......@@ -345,9 +345,9 @@ namespace Mall.WebApi.Controllers.AppletWeChat
foreach (var item in list)
{
// item.ALLCommission = item.CostFreight + item.CostMoney + item.PackingMoney + item.GoodsFreight + item.OneCommission + item.TwoCommission + item.OtherPrice;
item.ALLCommission = item.CostFreight + item.CostMoney + item.PackingMoney + item.GoodsFreight + item.FXCommission + item.OtherPrice;
item.ALLCommission = item.CostFreight + item.CostMoney + item.PackingMoney + item.GoodsFreight + item.FXCommission + item.LiveCommission + item.OtherPrice;
item.NoPaid = item.ALLCommission;
item.Paid = item.PaidCostMoney + item.RemitFXCommission;
item.Paid = item.PaidCostMoney + item.RemitFXCommission + (!string.IsNullOrWhiteSpace(item.LiveFinanceIds) ? item.LiveCommission : 0);
item.GrossProfit = item.AllPrice - item.ALLCommission;
item.GrossProfitRate = item.AllPrice == 0 ? 0 : Math.Round((item.GrossProfit / item.AllPrice), 2, MidpointRounding.AwayFromZero);
}
......@@ -393,11 +393,16 @@ namespace Mall.WebApi.Controllers.AppletWeChat
commissionInfo += ("[" + itemCommi.GradeDescription + ":" + itemCommi.Commission + itemCommi.UserName + "]");
}
}
if (item.LiveCommission > 0)
{
commissionInfo += (",[主播佣金:" + item.LiveCommission + "]");
}
// commissionInfo = string.Join(",", item.OrderCommissionList.Select(x=>"["+ x.GradeDescription+x.UserName+x.Commission+x.CommissionState==1?"待返":"已返"));
}
datarow.ExcelRows.Add(new ExcelColumn(value: commissionInfo) { });//返佣信息
datarow.ExcelRows.Add(new ExcelColumn(value: item.OtherPrice.ToString("#0.00")) { });
// datarow.ExcelRows.Add(new ExcelColumn(value: item.ALLCommission.ToString("#0.00")) { });
// datarow.ExcelRows.Add(new ExcelColumn(value: item.ALLCommission.ToString("#0.00")) { });
datarow.ExcelRows.Add(new ExcelColumn(value: item.Paid.ToString("#0.00")) { });
datarow.ExcelRows.Add(new ExcelColumn(value: item.NoPaid.ToString("#0.00")) { });
datarow.ExcelRows.Add(new ExcelColumn(value: item.GrossProfit.ToString("#0.00")) { });
......
......@@ -172,7 +172,7 @@ namespace Mall.WebApi.Controllers.MallBase
{
demodel.TenantId = Convert.ToInt32(parms.uid);
demodel.MallBaseId = parms.MallBaseId;
if (!(demodel.OrderStatus > 0))
if (!(demodel.OrderStatus > 0))
{
demodel.IsNotSelectCancel = 1;
}
......@@ -895,7 +895,7 @@ namespace Mall.WebApi.Controllers.MallBase
}
else
{
bool flag = orderModule.SetOrderApplyForCancelAudit(omodel, Type, Remark, "", req.TenantId, req.MallBaseId, Common.Enum.Goods.OrderPayTypeEnum.WeChatPay, "","","","");
bool flag = orderModule.SetOrderApplyForCancelAudit(omodel, Type, Remark, "", req.TenantId, req.MallBaseId, Common.Enum.Goods.OrderPayTypeEnum.WeChatPay, "", "", "", "");
if (flag)
{
return ApiResult.Success();
......@@ -1037,6 +1037,68 @@ namespace Mall.WebApi.Controllers.MallBase
return ApiResult.Failed();
}
}
/// <summary>
/// 修改订单商品的主播信息
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult UpdateOrderDetailLive()
{
var req = RequestParm;
JObject parms = JObject.Parse(req.msg.ToString());
string OrderIds = parms.GetStringValue("Ids");
int Type = parms.GetInt("Type", 0);//1-更新人数和金额,2-更新人数,3-更新金额
int LivePeopleNum = parms.GetInt("LivePeopleNum", 0);
decimal LiveCommission = parms.GetDecimal("LiveCommission");
if (string.IsNullOrWhiteSpace(OrderIds))
{
return ApiResult.ParamIsNull("请传递订单明细id");
}
if (Type < 0)
{
return ApiResult.ParamIsNull("请传递需要操作的类型");
}
if (Type == 1 || Type == 2)
{
if (LivePeopleNum <= 0)
{
return ApiResult.ParamIsNull("人数不能为0");
}
}
if (Type == 1 || Type == 3)
{
if (LiveCommission < 0)
{
return ApiResult.ParamIsNull("佣金不能小于0");
}
}
//根据订单ids判断是否已经制单
var orderDetailsList = orderModule.GetOrderDetailList(new RB_Goods_OrderDetail_Extend { OrderDetailIds = OrderIds, MallBaseId = req.MallBaseId, TenantId = req.TenantId });
if (orderDetailsList != null && orderDetailsList.Any(x => !string.IsNullOrWhiteSpace(x.LiveFinanceIds)))
{
return ApiResult.ParamIsNull("选中的订单部分已制单,不能修改");
}
bool flag = orderModule.SetOrderSupplierId(Type, LivePeopleNum, LiveCommission, orderDetailsList, req.TenantId, req.MallBaseId);
if (flag)
{
return ApiResult.Success();
}
else
{
return ApiResult.Failed();
}
}
#endregion
#endregion
......@@ -1567,7 +1629,8 @@ namespace Mall.WebApi.Controllers.MallBase
},
ColumnHight = 30
};
for (var i = 0; i < QNum; i++) {
for (var i = 0; i < QNum; i++)
{
datarow.ExcelRows.Add(new ExcelColumn(value: "") { });
}
}
......@@ -1580,7 +1643,8 @@ namespace Mall.WebApi.Controllers.MallBase
IsOCFirst = false;
}
}
else {
else
{
datarow.ExcelRows.Add(new ExcelColumn(value: "") { });
datarow.ExcelRows.Add(new ExcelColumn(value: "") { });
datarow.ExcelRows.Add(new ExcelColumn(value: "") { });
......@@ -1655,7 +1719,7 @@ namespace Mall.WebApi.Controllers.MallBase
Name = y.OrderIntroduction?.Name ?? "",
Commission = y.OrderIntroduction?.Commission ?? 0,
CommissionState = y.OrderIntroduction?.CommissionState ?? 1,
Remark = y.OrderIntroduction?.Remark ,
Remark = y.OrderIntroduction?.Remark,
}
}),
x.Consignee,
......@@ -1820,12 +1884,14 @@ namespace Mall.WebApi.Controllers.MallBase
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult SetRecommendOrdersCommission() {
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) {
if (OrderDetailId <= 0)
{
return ApiResult.ParamIsNull("请传递订单明细id");
}
......@@ -1834,7 +1900,8 @@ namespace Mall.WebApi.Controllers.MallBase
{
return ApiResult.Success();
}
else {
else
{
return ApiResult.Failed();
}
}
......@@ -2024,7 +2091,7 @@ namespace Mall.WebApi.Controllers.MallBase
if (item2.SmallShopsCommission != null)
{
datarow.ExcelRows.Add(new ExcelColumn(value: item2.SmallShopsCommission.Name) { });
datarow.ExcelRows.Add(new ExcelColumn(value: item2.SmallShopsCommission.UserName) { });
datarow.ExcelRows.Add(new ExcelColumn(value: item2.SmallShopsCommission.UserName) { });
datarow.ExcelRows.Add(new ExcelColumn(value: (item2.SmallShopsCommission.Commission ?? 0).ToString()) { });
slist.Add(datarow);
}
......@@ -2096,7 +2163,8 @@ namespace Mall.WebApi.Controllers.MallBase
demodel.TenantId = parms.TenantId;
demodel.MallBaseId = parms.MallBaseId;
if ((demodel.UserId ?? 0) <= 0) {
if ((demodel.UserId ?? 0) <= 0)
{
return ApiResult.Failed("请选择用户id");
}
var list = orderModule.GetRecommendOrdersCommissionPageList(pagelist.pageIndex, pagelist.pageSize, out long count, demodel);
......@@ -2104,7 +2172,7 @@ namespace Mall.WebApi.Controllers.MallBase
pagelist.pageData = list.Select(y => new
{
y.OrderId,
y.OrderNo,
y.OrderNo,
y.Id,
y.CoverImage,
y.GoodsName,
......
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