Commit 77d012d1 authored by 黄奎's avatar 黄奎
parents 343b1a96 64ddbd57
...@@ -246,5 +246,9 @@ namespace Mall.Model.Entity.Product ...@@ -246,5 +246,9 @@ namespace Mall.Model.Entity.Product
/// 主播佣金生成的财务单据 逗号分隔 /// 主播佣金生成的财务单据 逗号分隔
/// </summary> /// </summary>
public string LiveFinanceIds { get; set; } public string LiveFinanceIds { get; set; }
/// <summary>
/// 主播数量
/// </summary>
public int? LivePeopleNum { get; set; }
} }
} }
...@@ -13,6 +13,14 @@ namespace Mall.Model.Extend.Product ...@@ -13,6 +13,14 @@ namespace Mall.Model.Extend.Product
[DB(ConnectionName = "DefaultConnection")] [DB(ConnectionName = "DefaultConnection")]
public class RB_Goods_OrderDetail_Extend : RB_Goods_OrderDetail public class RB_Goods_OrderDetail_Extend : RB_Goods_OrderDetail
{ {
/// <summary>
/// 是否直播订单
/// </summary>
public int? IsLiveOrder { get; set; }
/// <summary>
/// 单据状态 1已制单 2未制单
/// </summary>
public int? FinanceStatus { get; set; }
/// <summary> /// <summary>
/// 会员优惠 /// 会员优惠
/// </summary> /// </summary>
......
...@@ -250,9 +250,16 @@ namespace Mall.Model.Query ...@@ -250,9 +250,16 @@ namespace Mall.Model.Query
/// <summary> /// <summary>
/// 主播佣金 /// 主播应付佣金
/// </summary> /// </summary>
public decimal LiveCommission { get; set; } public decimal LiveCommission { get; set; }
/// <summary>
/// 主播已付佣金
/// </summary>
public decimal PaidLiveCommission { get; set; }
/// <summary> /// <summary>
/// 主播佣金生成的财务单据 逗号分隔 /// 主播佣金生成的财务单据 逗号分隔
/// </summary> /// </summary>
......
...@@ -289,7 +289,8 @@ namespace Mall.Module.Product ...@@ -289,7 +289,8 @@ namespace Mall.Module.Product
count = 0; count = 0;
return new List<RB_Goods_ShoppingCart_Extend>(); return new List<RB_Goods_ShoppingCart_Extend>();
} }
if (demodel.SmallShopsId == 0) { if (demodel.SmallShopsId == 0)
{
demodel.SmallShopsId = umodel.SmallShopId; demodel.SmallShopsId = umodel.SmallShopId;
} }
var list = goods_ShoppingCartRepository.GetPageList(pageIndex, pageSize, out count, demodel); var list = goods_ShoppingCartRepository.GetPageList(pageIndex, pageSize, out count, demodel);
...@@ -1255,7 +1256,8 @@ namespace Mall.Module.Product ...@@ -1255,7 +1256,8 @@ namespace Mall.Module.Product
{ {
return ApiResult.Failed("用户不存在"); return ApiResult.Failed("用户不存在");
} }
if (demodel.SmallShopsId == 0) { if (demodel.SmallShopsId == 0)
{
demodel.SmallShopsId = umodel.SmallShopId; demodel.SmallShopsId = umodel.SmallShopId;
} }
//积分 //积分
...@@ -1549,7 +1551,7 @@ namespace Mall.Module.Product ...@@ -1549,7 +1551,7 @@ namespace Mall.Module.Product
{ {
if (smallModel.PriceType == 1) 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) else if (smallModel.PriceType == 2)
{ {
...@@ -2634,7 +2636,8 @@ namespace Mall.Module.Product ...@@ -2634,7 +2636,8 @@ namespace Mall.Module.Product
{ {
return ApiResult.Failed("用户不存在"); return ApiResult.Failed("用户不存在");
} }
if (demodel.SmallShopsId == 0) { if (demodel.SmallShopsId == 0)
{
demodel.SmallShopsId = umodel.SmallShopId; demodel.SmallShopsId = umodel.SmallShopId;
} }
if (umodel.Blacklist == 1) if (umodel.Blacklist == 1)
...@@ -2847,7 +2850,8 @@ namespace Mall.Module.Product ...@@ -2847,7 +2850,8 @@ namespace Mall.Module.Product
item.ProductCode = gmodel.GoodsNumbers; item.ProductCode = gmodel.GoodsNumbers;
item.CategoryIdList = categoryList.Select(x => x.CategoryId ?? 0).ToList(); item.CategoryIdList = categoryList.Select(x => x.CategoryId ?? 0).ToList();
int GoodsWeight = gmodel.GoodsWeight ?? 0;//商品重量 int GoodsWeight = gmodel.GoodsWeight ?? 0;//商品重量
#region 规格 #region 规格
//验证规格是否已失效 //验证规格是否已失效
if (gmodel.IsCustomSpecification == 1) if (gmodel.IsCustomSpecification == 1)
...@@ -3024,6 +3028,15 @@ namespace Mall.Module.Product ...@@ -3024,6 +3028,15 @@ namespace Mall.Module.Product
} }
#endregion #endregion
#region 直播返佣
item.LiveCommission = 0;
item.LiveFinanceIds = "";
if (gmodel.IsLiveGoods == 1)
{
item.LiveCommission = (item.CommissionPrice / 4) * (item.Number ?? 0);
}
#endregion
item.SmallShopsCostPrice = (item.SmallShopsCostPrice ?? 0) * (item.Number ?? 0); item.SmallShopsCostPrice = (item.SmallShopsCostPrice ?? 0) * (item.Number ?? 0);
item.NorGoodsMoney = item.Final_Price ?? 0;//用于计算 运费的 202-08-05 ld item.NorGoodsMoney = item.Final_Price ?? 0;//用于计算 运费的 202-08-05 ld
item.GoodsWeight = GoodsWeight; item.GoodsWeight = GoodsWeight;
...@@ -3269,7 +3282,8 @@ namespace Mall.Module.Product ...@@ -3269,7 +3282,8 @@ namespace Mall.Module.Product
item.CouponMoney = couponModel.CouponMoney; item.CouponMoney = couponModel.CouponMoney;
TotalMoney -= (item.CouponMoney ?? 0);//总价格需减去优惠券金额 TotalMoney -= (item.CouponMoney ?? 0);//总价格需减去优惠券金额
item.Final_Price -= (item.CouponMoney ?? 0); item.Final_Price -= (item.CouponMoney ?? 0);
if (IsCommissionCoupons) { if (IsCommissionCoupons)
{
//通用优惠券 //通用优惠券
item.SmallShopsCostPrice -= (item.CouponMoney ?? 0); item.SmallShopsCostPrice -= (item.CouponMoney ?? 0);
} }
...@@ -3624,7 +3638,8 @@ namespace Mall.Module.Product ...@@ -3624,7 +3638,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 ? "通用" : "店铺") + "优惠券抵扣"; demodel.CouponDestription = "使用" + (IsCommissionCoupons ? "通用" : "店铺") + "优惠券抵扣";
} }
Task.Run(() => InsertOrderCommission(demodel, umodel, GoodsIds, OrderId)); Task.Run(() => InsertOrderCommission(demodel, umodel, GoodsIds, OrderId));
...@@ -5049,7 +5064,11 @@ namespace Mall.Module.Product ...@@ -5049,7 +5064,11 @@ namespace Mall.Module.Product
PresentFXGrade = item.PresentFXGrade, PresentFXGrade = item.PresentFXGrade,
PresentFXMonth = item.PresentFXMonth, PresentFXMonth = item.PresentFXMonth,
FreeShippingRemarks = item.FreeShippingRemarks, FreeShippingRemarks = item.FreeShippingRemarks,
SmallShopsCostPrice = item.SmallShopsCostPrice SmallShopsCostPrice = item.SmallShopsCostPrice,
PaidCostMoney = 0,
LiveCommission = item.LiveCommission,
LiveFinanceIds = "",
LivePeopleNum = 1
}, trans); }, trans);
item.Id = detailId; item.Id = detailId;
if (detailId > 0 && SatisfiedGoodsList.Any()) if (detailId > 0 && SatisfiedGoodsList.Any())
...@@ -5893,6 +5912,38 @@ namespace Mall.Module.Product ...@@ -5893,6 +5912,38 @@ namespace Mall.Module.Product
return list; return list;
} }
/// <summary>
/// 获取直播订单分页列表
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="count"></param>
/// <param name="demodel"></param>
/// <returns></returns>
public List<RB_Goods_OrderDetail_Extend> GetLiveGoodsOrderPageList(int pageIndex, int pageSize, out long count, RB_Goods_OrderDetail_Extend demodel)
{
//查询订单明细
var dlist = goods_OrderDetailRepository.GetSupplierOrderPageList(pageIndex, pageSize, out count, demodel);
return dlist;
}
/// <summary>
/// 直播订单创建财务单据
/// </summary>
/// <param name="isPublic"></param>
/// <param name="accountIdList"></param>
/// <param name="orderdetailIdList"></param>
/// <param name="tenantId"></param>
/// <param name="mallBaseId"></param>
/// <param name="eRPEmpId"></param>
/// <returns></returns>
public string SetLiveGoodsOrderFinance(int isPublic, List<int> accountIdList, List<int> orderdetailIdList, int tenantId, int mallBaseId, int eRPEmpId)
{
string orderdetailIds = string.Join(",", orderdetailIdList);
return "";
}
/// <summary> /// <summary>
/// 获取分销订单 /// 获取分销订单
/// </summary> /// </summary>
...@@ -8824,6 +8875,87 @@ namespace Mall.Module.Product ...@@ -8824,6 +8875,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> /// <summary>
/// 根据订单好获取物流id /// 根据订单好获取物流id
/// </summary> /// </summary>
...@@ -9022,9 +9154,11 @@ namespace Mall.Module.Product ...@@ -9022,9 +9154,11 @@ namespace Mall.Module.Product
#region 推荐返佣 #region 推荐返佣
List<RB_Goods_OrderIntroduction_Extend> OrderIntroduction = new List<RB_Goods_OrderIntroduction_Extend>(); 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 }); 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()) }); 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); decimal Commission = introductList.Where(x => x.UserId == item.Id).Sum(x => x.Commission ?? 0);
OrderIntroduction.Add(new RB_Goods_OrderIntroduction_Extend() OrderIntroduction.Add(new RB_Goods_OrderIntroduction_Extend()
{ {
...@@ -9039,10 +9173,12 @@ namespace Mall.Module.Product ...@@ -9039,10 +9173,12 @@ namespace Mall.Module.Product
#region 微店返佣 #region 微店返佣
List<RB_SmallShops_Commission_Extend> SmallShopsCommission = new List<RB_SmallShops_Commission_Extend>(); 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 }); 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 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()) }); 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); decimal Commission = ssList.Where(x => x.UserId == item.Id).Sum(x => x.Commission ?? 0);
var smodel = slist.Where(x => x.UserId == item.Id).FirstOrDefault(); var smodel = slist.Where(x => x.UserId == item.Id).FirstOrDefault();
SmallShopsCommission.Add(new RB_SmallShops_Commission_Extend() SmallShopsCommission.Add(new RB_SmallShops_Commission_Extend()
...@@ -9127,13 +9263,13 @@ namespace Mall.Module.Product ...@@ -9127,13 +9263,13 @@ namespace Mall.Module.Product
x.UserName, x.UserName,
x.Commission x.Commission
}), }),
OrderIntroductionInfo = OrderIntroduction.Select(x=>new OrderIntroductionInfo = OrderIntroduction.Select(x => new
{ {
x.UserId, x.UserId,
x.UserName, x.UserName,
x.Commission x.Commission
}), }),
SmallShopsCommissionInfo = SmallShopsCommission.Select(x=>new SmallShopsCommissionInfo = SmallShopsCommission.Select(x => new
{ {
x.UserId, x.UserId,
x.UserName, x.UserName,
......
...@@ -157,6 +157,19 @@ namespace Mall.Repository.Product ...@@ -157,6 +157,19 @@ namespace Mall.Repository.Product
where += $@" and od.{nameof(RB_Goods_OrderDetail.ProductCode)} like '%{dmodel.ProductCode}%'"; where += $@" and od.{nameof(RB_Goods_OrderDetail.ProductCode)} like '%{dmodel.ProductCode}%'";
} }
if (dmodel.IsLiveOrder == 1)
{
where += $@" and od.{nameof(RB_Goods_OrderDetail.LiveCommission)} >0";
}
if (dmodel.FinanceStatus == 1)
{
where += $@" and od.{nameof(RB_Goods_OrderDetail.LiveFinanceIds)} <> ''";
}
else if (dmodel.FinanceStatus == 2)
{
where += $@" and od.{nameof(RB_Goods_OrderDetail.LiveFinanceIds)} = ''";
}
string sql = $@"SELECT od.*,o.OrderNo FROM rb_goods_orderdetail od string sql = $@"SELECT od.*,o.OrderNo FROM rb_goods_orderdetail od
INNER JOIN rb_goods_order o on o.OrderId=od.OrderId INNER JOIN rb_goods_order o on o.OrderId=od.OrderId
where {where} order by o.CreateDate desc"; where {where} order by o.CreateDate desc";
...@@ -268,6 +281,19 @@ where {where} order by o.CreateDate desc"; ...@@ -268,6 +281,19 @@ where {where} order by o.CreateDate desc";
where += $@" and od.{nameof(RB_Goods_OrderDetail.ProductCode)} like '%{dmodel.ProductCode}%'"; where += $@" and od.{nameof(RB_Goods_OrderDetail.ProductCode)} like '%{dmodel.ProductCode}%'";
} }
if (dmodel.IsLiveOrder == 1)
{
where += $@" and od.{nameof(RB_Goods_OrderDetail.LiveCommission)} >0";
}
if (dmodel.FinanceStatus == 1)
{
where += $@" and od.{nameof(RB_Goods_OrderDetail.LiveFinanceIds)} <> ''";
}
else if (dmodel.FinanceStatus == 2)
{
where += $@" and od.{nameof(RB_Goods_OrderDetail.LiveFinanceIds)} = ''";
}
string sql = $@"SELECT od.*,o.OrderNo FROM rb_goods_orderdetail od string sql = $@"SELECT od.*,o.OrderNo FROM rb_goods_orderdetail od
INNER JOIN rb_goods_order o on o.OrderId=od.OrderId INNER JOIN rb_goods_order o on o.OrderId=od.OrderId
where {where} order by o.CreateDate desc"; where {where} order by o.CreateDate desc";
......
...@@ -1123,7 +1123,7 @@ as t GROUP BY t.CreateDate desc"; ...@@ -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, 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(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, 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 from rb_goods_orderdetail as b
LEFT JOIN rb_goods_order as A on a.OrderId=b.OrderId LEFT JOIN rb_goods_order as A on a.OrderId=b.OrderId
LEFT JOIN rb_supplier as f on f.ID=b.SupplierId LEFT JOIN rb_supplier as f on f.ID=b.SupplierId
...@@ -1302,7 +1302,7 @@ GROUP BY od.GoodsId,o.OrderId ...@@ -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, 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(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, 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 from rb_goods_orderdetail as b
LEFT JOIN rb_goods_order as A on a.OrderId=b.OrderId LEFT JOIN rb_goods_order as A on a.OrderId=b.OrderId
LEFT JOIN rb_supplier as f on f.ID=b.SupplierId LEFT JOIN rb_supplier as f on f.ID=b.SupplierId
......
...@@ -147,10 +147,10 @@ namespace Mall.WebApi.Controllers.AppletWeChat ...@@ -147,10 +147,10 @@ namespace Mall.WebApi.Controllers.AppletWeChat
foreach (var item in list) 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.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.NoPaid = item.ALLCommission; 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.GrossProfit = item.AllPrice - item.ALLCommission;
item.GrossProfitRate = item.AllPrice == 0 ? 0 : Math.Round((item.GrossProfit / item.AllPrice), 2, MidpointRounding.AwayFromZero); item.GrossProfitRate = item.AllPrice == 0 ? 0 : Math.Round((item.GrossProfit / item.AllPrice), 2, MidpointRounding.AwayFromZero);
} }
...@@ -345,9 +345,9 @@ namespace Mall.WebApi.Controllers.AppletWeChat ...@@ -345,9 +345,9 @@ namespace Mall.WebApi.Controllers.AppletWeChat
foreach (var item in list) 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.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.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.GrossProfit = item.AllPrice - item.ALLCommission;
item.GrossProfitRate = item.AllPrice == 0 ? 0 : Math.Round((item.GrossProfit / item.AllPrice), 2, MidpointRounding.AwayFromZero); item.GrossProfitRate = item.AllPrice == 0 ? 0 : Math.Round((item.GrossProfit / item.AllPrice), 2, MidpointRounding.AwayFromZero);
} }
...@@ -393,11 +393,16 @@ namespace Mall.WebApi.Controllers.AppletWeChat ...@@ -393,11 +393,16 @@ namespace Mall.WebApi.Controllers.AppletWeChat
commissionInfo += ("[" + itemCommi.GradeDescription + ":" + itemCommi.Commission + itemCommi.UserName + "]"); 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?"待返":"已返")); // 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: commissionInfo) { });//返佣信息
datarow.ExcelRows.Add(new ExcelColumn(value: item.OtherPrice.ToString("#0.00")) { }); 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.Paid.ToString("#0.00")) { });
datarow.ExcelRows.Add(new ExcelColumn(value: item.NoPaid.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")) { }); datarow.ExcelRows.Add(new ExcelColumn(value: item.GrossProfit.ToString("#0.00")) { });
......
...@@ -172,7 +172,7 @@ namespace Mall.WebApi.Controllers.MallBase ...@@ -172,7 +172,7 @@ namespace Mall.WebApi.Controllers.MallBase
{ {
demodel.TenantId = Convert.ToInt32(parms.uid); demodel.TenantId = Convert.ToInt32(parms.uid);
demodel.MallBaseId = parms.MallBaseId; demodel.MallBaseId = parms.MallBaseId;
if (!(demodel.OrderStatus > 0)) if (!(demodel.OrderStatus > 0))
{ {
demodel.IsNotSelectCancel = 1; demodel.IsNotSelectCancel = 1;
} }
...@@ -895,7 +895,7 @@ namespace Mall.WebApi.Controllers.MallBase ...@@ -895,7 +895,7 @@ namespace Mall.WebApi.Controllers.MallBase
} }
else 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) if (flag)
{ {
return ApiResult.Success(); return ApiResult.Success();
...@@ -1037,8 +1037,159 @@ namespace Mall.WebApi.Controllers.MallBase ...@@ -1037,8 +1037,159 @@ namespace Mall.WebApi.Controllers.MallBase
return ApiResult.Failed(); 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 #endregion
#region 主播返佣
/// <summary>
/// 直播订单后台分页列表
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetLiveGoodsOrderPageList()
{
var parms = RequestParm;
ResultPageModel pagelist = JsonConvert.DeserializeObject<ResultPageModel>(parms.msg.ToString());
RB_Goods_OrderDetail_Extend demodel = JsonConvert.DeserializeObject<RB_Goods_OrderDetail_Extend>(parms.msg.ToString());
demodel.TenantId = parms.TenantId;
demodel.MallBaseId = parms.MallBaseId;
var list = orderModule.GetLiveGoodsOrderPageList(pagelist.pageIndex, pagelist.pageSize, out long count, demodel);
pagelist.count = Convert.ToInt32(count);
pagelist.pageData = list.Select(y => new
{
y.OrderId,
y.OrderNo,
OrderDetailId = y.Id,
y.CoverImage,
y.GoodsName,
SpecificationList = JsonConvert.DeserializeObject<List<string>>(y.Specification),
y.Final_Price,
y.Number,
y.Unit_Price,
y.LiveCommission,
y.LivePeopleNum,
y.LiveFinanceIds
});
return ApiResult.Success("", pagelist);
}
/// <summary>
/// 直播订单创建财务单据
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult SetLiveGoodsOrderFinance() {
var req = RequestParm;
JObject parms = JObject.Parse(req.msg.ToString());
int IsPublic = parms.GetInt("IsPublic", 0);//账户类型
string AccountIds = parms.GetStringValue("AccountIds");//账户ids
string OrderDetailIds = parms.GetStringValue("OrderDetailIds");//订单明细ids
if (string.IsNullOrEmpty(AccountIds)) {
return ApiResult.ParamIsNull("账户不存在");
}
if (string.IsNullOrEmpty(OrderDetailIds)) {
return ApiResult.ParamIsNull("订单明细不存在");
}
List<int> AccountIdList = new List<int>();
List<int> OrderdetailIdList = new List<int>();
try
{
AccountIdList = JsonConvert.DeserializeObject<List<int>>(AccountIds);
}
catch (Exception)
{
return ApiResult.ParamIsNull("账户格式有误");
}
try
{
OrderdetailIdList = JsonConvert.DeserializeObject<List<int>>(OrderDetailIds);
}
catch (Exception)
{
return ApiResult.ParamIsNull("订单明细格式有误");
}
if (!AccountIdList.Any()) {
return ApiResult.ParamIsNull("请选择账户");
}
if (!OrderdetailIdList.Any()) {
return ApiResult.ParamIsNull("请选择订单列表");
}
string msg = orderModule.SetLiveGoodsOrderFinance(IsPublic, AccountIdList, OrderdetailIdList, req.TenantId, req.MallBaseId, req.ERPEmpId);
if (msg == "")
{
return ApiResult.Success();
}
else {
return ApiResult.Failed(msg);
}
}
#endregion #endregion
#region 会员购买 #region 会员购买
...@@ -1567,7 +1718,8 @@ namespace Mall.WebApi.Controllers.MallBase ...@@ -1567,7 +1718,8 @@ namespace Mall.WebApi.Controllers.MallBase
}, },
ColumnHight = 30 ColumnHight = 30
}; };
for (var i = 0; i < QNum; i++) { for (var i = 0; i < QNum; i++)
{
datarow.ExcelRows.Add(new ExcelColumn(value: "") { }); datarow.ExcelRows.Add(new ExcelColumn(value: "") { });
} }
} }
...@@ -1580,7 +1732,8 @@ namespace Mall.WebApi.Controllers.MallBase ...@@ -1580,7 +1732,8 @@ namespace Mall.WebApi.Controllers.MallBase
IsOCFirst = false; IsOCFirst = false;
} }
} }
else { else
{
datarow.ExcelRows.Add(new ExcelColumn(value: "") { }); datarow.ExcelRows.Add(new ExcelColumn(value: "") { });
datarow.ExcelRows.Add(new ExcelColumn(value: "") { }); datarow.ExcelRows.Add(new ExcelColumn(value: "") { });
datarow.ExcelRows.Add(new ExcelColumn(value: "") { }); datarow.ExcelRows.Add(new ExcelColumn(value: "") { });
...@@ -1655,7 +1808,7 @@ namespace Mall.WebApi.Controllers.MallBase ...@@ -1655,7 +1808,7 @@ namespace Mall.WebApi.Controllers.MallBase
Name = y.OrderIntroduction?.Name ?? "", Name = y.OrderIntroduction?.Name ?? "",
Commission = y.OrderIntroduction?.Commission ?? 0, Commission = y.OrderIntroduction?.Commission ?? 0,
CommissionState = y.OrderIntroduction?.CommissionState ?? 1, CommissionState = y.OrderIntroduction?.CommissionState ?? 1,
Remark = y.OrderIntroduction?.Remark , Remark = y.OrderIntroduction?.Remark,
} }
}), }),
x.Consignee, x.Consignee,
...@@ -1820,12 +1973,14 @@ namespace Mall.WebApi.Controllers.MallBase ...@@ -1820,12 +1973,14 @@ namespace Mall.WebApi.Controllers.MallBase
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
[HttpPost] [HttpPost]
public ApiResult SetRecommendOrdersCommission() { public ApiResult SetRecommendOrdersCommission()
{
var req = RequestParm; var req = RequestParm;
JObject parms = JObject.Parse(req.msg.ToString()); JObject parms = JObject.Parse(req.msg.ToString());
int OrderDetailId = parms.GetInt("OrderDetailId", 0); int OrderDetailId = parms.GetInt("OrderDetailId", 0);
decimal Commission = parms.GetDecimal("Commission"); decimal Commission = parms.GetDecimal("Commission");
if (OrderDetailId <= 0) { if (OrderDetailId <= 0)
{
return ApiResult.ParamIsNull("请传递订单明细id"); return ApiResult.ParamIsNull("请传递订单明细id");
} }
...@@ -1834,7 +1989,8 @@ namespace Mall.WebApi.Controllers.MallBase ...@@ -1834,7 +1989,8 @@ namespace Mall.WebApi.Controllers.MallBase
{ {
return ApiResult.Success(); return ApiResult.Success();
} }
else { else
{
return ApiResult.Failed(); return ApiResult.Failed();
} }
} }
...@@ -2024,7 +2180,7 @@ namespace Mall.WebApi.Controllers.MallBase ...@@ -2024,7 +2180,7 @@ namespace Mall.WebApi.Controllers.MallBase
if (item2.SmallShopsCommission != null) if (item2.SmallShopsCommission != null)
{ {
datarow.ExcelRows.Add(new ExcelColumn(value: item2.SmallShopsCommission.Name) { }); 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()) { }); datarow.ExcelRows.Add(new ExcelColumn(value: (item2.SmallShopsCommission.Commission ?? 0).ToString()) { });
slist.Add(datarow); slist.Add(datarow);
} }
...@@ -2096,7 +2252,8 @@ namespace Mall.WebApi.Controllers.MallBase ...@@ -2096,7 +2252,8 @@ namespace Mall.WebApi.Controllers.MallBase
demodel.TenantId = parms.TenantId; demodel.TenantId = parms.TenantId;
demodel.MallBaseId = parms.MallBaseId; demodel.MallBaseId = parms.MallBaseId;
if ((demodel.UserId ?? 0) <= 0) { if ((demodel.UserId ?? 0) <= 0)
{
return ApiResult.Failed("请选择用户id"); return ApiResult.Failed("请选择用户id");
} }
var list = orderModule.GetRecommendOrdersCommissionPageList(pagelist.pageIndex, pagelist.pageSize, out long count, demodel); var list = orderModule.GetRecommendOrdersCommissionPageList(pagelist.pageIndex, pagelist.pageSize, out long count, demodel);
...@@ -2104,7 +2261,7 @@ namespace Mall.WebApi.Controllers.MallBase ...@@ -2104,7 +2261,7 @@ namespace Mall.WebApi.Controllers.MallBase
pagelist.pageData = list.Select(y => new pagelist.pageData = list.Select(y => new
{ {
y.OrderId, y.OrderId,
y.OrderNo, y.OrderNo,
y.Id, y.Id,
y.CoverImage, y.CoverImage,
y.GoodsName, y.GoodsName,
......
...@@ -236,6 +236,9 @@ namespace Mall.WebApi.Controllers.User ...@@ -236,6 +236,9 @@ namespace Mall.WebApi.Controllers.User
var parms = JObject.Parse(re.msg.ToString()); var parms = JObject.Parse(re.msg.ToString());
int RemitId = parms.GetInt("RemitId", 0); int RemitId = parms.GetInt("RemitId", 0);
int ErpEmpId = parms.GetInt("ErpEmpId", 0);//erp用户id int ErpEmpId = parms.GetInt("ErpEmpId", 0);//erp用户id
if (ErpEmpId <= 0) {
ErpEmpId = re.ERPEmpId;
}
int Type = parms.GetInt("Type", 0);//1审核通过 2打款 3驳回 int Type = parms.GetInt("Type", 0);//1审核通过 2打款 3驳回
string Remark = parms.GetStringValue("Remark"); string Remark = parms.GetStringValue("Remark");
if (RemitId <= 0) if (RemitId <= 0)
......
...@@ -1873,6 +1873,9 @@ namespace Mall.WebApi.Controllers.User ...@@ -1873,6 +1873,9 @@ namespace Mall.WebApi.Controllers.User
var parms = JObject.Parse(re.msg.ToString()); var parms = JObject.Parse(re.msg.ToString());
int RemitId = parms.GetInt("RemitId", 0); int RemitId = parms.GetInt("RemitId", 0);
int ErpEmpId = parms.GetInt("ErpEmpId", 0);//erp用户id int ErpEmpId = parms.GetInt("ErpEmpId", 0);//erp用户id
if (ErpEmpId <= 0) {
ErpEmpId = re.ERPEmpId;
}
int Type = parms.GetInt("Type", 0);//1审核通过 2打款 3驳回 int Type = parms.GetInt("Type", 0);//1审核通过 2打款 3驳回
string Remark = parms.GetStringValue("Remark"); string Remark = parms.GetStringValue("Remark");
if (RemitId <= 0) if (RemitId <= 0)
......
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