Commit 5fc637e4 authored by liudong1993's avatar liudong1993

直播佣金

parent 00a4b7c7
......@@ -5937,7 +5937,7 @@ namespace Mall.Module.Product
/// <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)
public string SetLiveGoodsOrderFinance(int isPublic, List<int> accountIdList, List<int> orderdetailIdList, string LiveTime, int tenantId, int mallBaseId, int erpEmpId)
{
int accountNum = accountIdList.Count();
string orderdetailIds = string.Join(",", orderdetailIdList);
......@@ -5975,7 +5975,7 @@ namespace Mall.Module.Product
decimal dMoney = (qitem.LiveCommission ?? 0) / accountNum;
detailList.Add(new
{
CostTypeId = item.RemitCostTypeId,
CostTypeId = 65,//写死 其他费用
Number = 1,
OriginalMoney = dMoney,
UnitPrice = dMoney,
......@@ -5997,7 +5997,7 @@ namespace Mall.Module.Product
OrderSource = 16,
OtherType = 20,
ReFinanceId = 0,
Remark = DateTime.Now.ToString("yyyy年MM月dd日") + "自动生成财务单据(主播订单佣金)",
Remark = DateTime.Now.ToString("yyyy年MM月dd日") + "自动生成财务单据(主播订单佣金) 直播日期:"+ LiveTime,
detailList,
RB_Depart_Id = Config.ExpendDepartment
};
......
......@@ -301,7 +301,68 @@ where {where} order by o.CreateDate desc";
}
/// <summary>
/// 获取直播订单分页列表
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="count"></param>
/// <param name="dmodel"></param>
/// <returns></returns>
public List<RB_Goods_OrderDetail_Extend> GetLiveGoodsOrderPageList(int pageIndex, int pageSize, out long count, RB_Goods_OrderDetail_Extend dmodel)
{
string where = $" 1=1 and o.{nameof(RB_Goods_Order.Status)}=0 and and o.OrderStatus =5 and o.Recycled=2 and oa.ReOrderId is null ";
if (dmodel.TenantId > 0)
{
where += $@" and o.{nameof(RB_Goods_Order.TenantId)}={dmodel.TenantId}";
}
if (dmodel.MallBaseId > 0)
{
where += $@" and o.{nameof(RB_Goods_Order.MallBaseId)}={dmodel.MallBaseId}";
}
if (!string.IsNullOrEmpty(dmodel.StartTime))
{
where += $@" and o.{nameof(RB_Goods_Order.CreateDate)} >='{dmodel.StartTime}'";
}
if (!string.IsNullOrEmpty(dmodel.EndTime))
{
where += $@" and o.{nameof(RB_Goods_Order.CreateDate)} <='{dmodel.EndTime} 23:59:59'";
}
if (!string.IsNullOrEmpty(dmodel.OrderNo))
{
where += $@" and o.{nameof(RB_Goods_Order.OrderNo)} like '%{dmodel.OrderNo}%'";
}
if (!string.IsNullOrEmpty(dmodel.GoodsName))
{
where += $@" and od.{nameof(RB_Goods_OrderDetail.GoodsName)} like '%{dmodel.GoodsName}%'";
}
if (!string.IsNullOrEmpty(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
INNER JOIN rb_goods_order o on o.OrderId=od.OrderId
left join rb_goods_orderaftersale oa on od.Id= oa.OrderDetialId and oa.Type=1 and oa.Status=0 and oa.ReOrderStatus in (1,2,3,4,5)
where {where} order by o.CreateDate desc";
return GetPage<RB_Goods_OrderDetail_Extend>(pageIndex, pageSize, out count, sql).ToList();
}
/// <summary>
/// 获取订单商品列表
......
......@@ -1118,6 +1118,7 @@ namespace Mall.WebApi.Controllers.MallBase
demodel.TenantId = parms.TenantId;
demodel.MallBaseId = parms.MallBaseId;
demodel.IsLiveOrder = 1;
var list = orderModule.GetLiveGoodsOrderPageList(pagelist.pageIndex, pagelist.pageSize, out long count, demodel);
pagelist.count = Convert.ToInt32(count);
pagelist.pageData = list.Select(y => new
......@@ -1148,6 +1149,7 @@ namespace Mall.WebApi.Controllers.MallBase
JObject parms = JObject.Parse(req.msg.ToString());
int IsPublic = parms.GetInt("IsPublic", 0);//账户类型
int ErpEmpId = parms.GetInt("ErpEmpId", 0);
string LiveTime = parms.GetStringValue("LiveTime");//直播时间
if (ErpEmpId <= 0) {
ErpEmpId = req.ERPEmpId;
}
......@@ -1185,7 +1187,7 @@ namespace Mall.WebApi.Controllers.MallBase
return ApiResult.ParamIsNull("请选择订单列表");
}
string msg = orderModule.SetLiveGoodsOrderFinance(IsPublic, AccountIdList, OrderdetailIdList, req.TenantId, req.MallBaseId, ErpEmpId);
string msg = orderModule.SetLiveGoodsOrderFinance(IsPublic, AccountIdList, OrderdetailIdList, LiveTime, req.TenantId, req.MallBaseId, ErpEmpId);
if (msg == "")
{
return ApiResult.Success();
......
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