Commit 8b1e407e authored by 黄奎's avatar 黄奎
parents 9612921d 181face0
......@@ -9026,13 +9026,13 @@ namespace Mall.Module.Product
}
else
{
keyValues.Add(nameof(RB_Goods_OrderDetail.RealMoney), (model.RealMoney ?? 0) + money);
keyValues.Add(nameof(RB_Goods_OrderDetail.YFMoney), (model.YFMoney ?? 0) + money);
}
}
else {
if (otherType == 21)
{
keyValues.Add(nameof(RB_Goods_OrderDetail.YFMoney), (model.YFMoney ?? 0) + money);
keyValues.Add(nameof(RB_Goods_OrderDetail.RealMoney), (model.RealMoney ?? 0) + money);
}
else
{
......
......@@ -6626,6 +6626,20 @@ namespace Mall.Module.Product
#endregion
#region 分销商
/// <summary>
/// 获取公司列表
/// </summary>
/// <param name="dmodel"></param>
/// <returns></returns>
public List<RB_Member_User_Extend> GetCompanyUserList(RB_Member_User_Extend dmodel)
{
return member_UserRepository.GetCompanyUserList(dmodel);
}
/// <summary>
/// 获取列表
/// </summary>
......
......@@ -335,6 +335,10 @@ namespace Mall.Module.User
}
/// <summary>
/// 分页列表
/// </summary>
......@@ -2219,11 +2223,14 @@ namespace Mall.Module.User
}
};
bool flag = distributor_RemitRepository.Update(keyValues, wheres);
if (flag) {
if (flag)
{
var remodel = distributor_RemitRepository.GetEntity<RB_Distributor_Remit_Extend>(remitId);
if (remodel.WithdrawalWay == DistrbutorWithdrawWayEnum.YETX) {
if (remodel.WithdrawalWay == DistrbutorWithdrawWayEnum.YETX)
{
var umodel = member_UserRepository.GetEntity(remodel.UserId);
if (umodel != null) {
if (umodel != null)
{
Dictionary<string, object> keyValues1 = new Dictionary<string, object>() {
{ nameof(RB_Member_User.Balance),(umodel.Balance??0)+(remodel.RemitMoney??0)}
};
......@@ -2235,7 +2242,8 @@ namespace Mall.Module.User
}
};
bool flag1 = member_UserRepository.Update(keyValues1, wheres1);
if (flag1) {
if (flag1)
{
//插入余额明细
member_BalanceRepository.Insert(new RB_Member_Balance()
{
......@@ -2404,9 +2412,12 @@ namespace Mall.Module.User
List<Model.Entity.Finance.RB_ECFinanceId_Relation> ECList = new List<Model.Entity.Finance.RB_ECFinanceId_Relation>();
if (!string.IsNullOrEmpty(remitModel.ReOrderIds) || !string.IsNullOrEmpty(remitModel.ReVipIds))
{
if (string.IsNullOrEmpty(remitModel.ReOrderIds)) { remitModel.ReOrderIds = "[]"; }
if (string.IsNullOrEmpty(remitModel.ReVipIds)) { remitModel.ReVipIds = "[]"; }
List<int> reorderIdList = JsonConvert.DeserializeObject<List<int>>(remitModel.ReOrderIds);
List<int> revipIdList = JsonConvert.DeserializeObject<List<int>>(remitModel.ReVipIds);
if (revipIdList.Any()) {
if (revipIdList.Any())
{
var vipbuycList = vipBuy_CommissionRepository.GetList(new RB_VipBuy_Commission_Extend() { TenantId = TenantId, MallBaseId = MallBaseId, VipIds = string.Join(",", revipIdList) });
//获取订单列表
if (vipbuycList.Where(x => x.ReOrderId > 0).Any())
......@@ -2414,10 +2425,12 @@ namespace Mall.Module.User
reorderIdList.AddRange(vipbuycList.Where(x => x.ReOrderId > 0).Select(x => x.ReOrderId ?? 0).ToList());
}
}
if (reorderIdList.Any()) {
if (reorderIdList.Any())
{
reorderIdList = reorderIdList.Distinct().ToList();
var orderDetailList = goods_OrderDetailRepository.GetOrderDetailList(new RB_Goods_OrderDetail_Extend() { TenantId = TenantId, MallBaseId = MallBaseId, OrderIds = string.Join(",", reorderIdList) });
foreach (var qitem in orderDetailList) {
foreach (var qitem in orderDetailList)
{
ECList.Add(new Model.Entity.Finance.RB_ECFinanceId_Relation()
{
ECOrderId = qitem.OrderId,
......@@ -2537,7 +2550,8 @@ namespace Mall.Module.User
item.IsPublic = 5;//默认平台虚拟账户
#region 查询所有的订单
List<Model.Entity.Finance.RB_ECFinanceId_Relation> ECList = new List<Model.Entity.Finance.RB_ECFinanceId_Relation>();
foreach (var qitem in list) {
foreach (var qitem in list)
{
ECList.Add(new Model.Entity.Finance.RB_ECFinanceId_Relation()
{
ECOrderId = qitem.OrderId,
......@@ -3715,7 +3729,8 @@ namespace Mall.Module.User
vipBuy_CommissionRepository.Update(keyValues2, wheres2, trans);
string OrderNo = item.OrderNo;
var vipoModel = vipolist.Where(x => x.OrderId == item.ReOrderId).FirstOrDefault();
if (vipoModel != null) {
if (vipoModel != null)
{
OrderNo = vipoModel.OrderNo ?? "";
}
OrderNos += "\"VIP " + OrderNo + "\":" + (item.Commission ?? 0) + "元,";
......@@ -5566,7 +5581,7 @@ namespace Mall.Module.User
/// <param name="mallBaseId"></param>
/// <param name="userId"></param>
/// <returns></returns>
public string GetWeiXinQRCodeForSmallShops(string path, int width, int mallBaseId,int userId)
public string GetWeiXinQRCodeForSmallShops(string path, int width, int mallBaseId, int userId)
{
var appletWeChatModel = miniProgramRepository.GetEntity(mallBaseId);
string token = CacheManager.AppletWeChat.WeiXinReidsCache.Get(appletWeChatModel.MiniAppId);
......@@ -6373,17 +6388,13 @@ namespace Mall.Module.User
//未结算返佣
decimal WJSCommission = goods_OrderCommissionRepository.GetUserOrderCommissionNoSettlement(userInfo.UserId);
if (userInfo.SmallShopId == 0)
{
return "微店不存在";
}
var umodel = smallShopsInfoRepository.GetEntity(userInfo.SmallShopId);
//下线数量
int smallShopsNum = 0;
//求其所有下线的数量
var UserIds = member_UserRepository.GetSmallShopChildIdStr(umodel.Id);
var UserIds = member_UserRepository.GetSmallShopChildIdStr(model.Id);
if (!string.IsNullOrEmpty(UserIds))
{
string[] arr = UserIds.Split(',');
......@@ -6432,10 +6443,10 @@ namespace Mall.Module.User
},
UserInfo = new
{
UserId = umodel.Id,
UserName = umodel.Name,
umodel.Logo,
umodel.Notice,
UserId = model.Id,
UserName = model.Name,
model.Logo,
Notice = string.IsNullOrWhiteSpace(model.Notice) ? "" : model.Notice,
GradeName = "",
CommissionWithdrawal = model.Commission ?? 0,//可提现佣金
TXCommission = commModel?.TXCommission ?? 0,//已提现佣金
......
......@@ -1362,6 +1362,10 @@ GROUP BY b.Id order by b.Id desc";
{
where += $" and b.GoodsId={dmodel.GoodsID} ";
}
if (dmodel.CompanyId > 0)
{
where += $" and b.CompanyId={dmodel.CompanyId} ";
}
if (!string.IsNullOrWhiteSpace(dmodel.StartDate))
{
......@@ -1396,7 +1400,7 @@ 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_member_user as muser on muser.id=b.CompanyId
left join rb_goods_orderaftersale oa on b.ID= oa.OrderDetialId and oa.Type=1 and oa.Status=0 and oa.ReOrderStatus in (2,3,4,5) {where}
GROUP BY b.Id ";
GROUP BY b.Id desc ";
return Get<OrderStatistics_Query>(sql).ToList();
}
......
......@@ -147,6 +147,74 @@ select * from RB_Member_User where {where} order by CreateDate desc
return Get<RB_Member_User_Extend>(sql).ToList();
}
/// <summary>
/// 获取列表
/// </summary>
/// <param name="dmodel"></param>
/// <returns></returns>
public List<RB_Member_User_Extend> GetCompanyUserList(RB_Member_User_Extend dmodel)
{
string where = " 1=1 and ID<20 ";
if (dmodel.TenantId > 0)
{
where += $@" and {nameof(RB_Member_User.TenantId)}={dmodel.TenantId}";
}
if (dmodel.MallBaseId > 0)
{
where += $@" and {nameof(RB_Member_User.MallBaseId)}={dmodel.MallBaseId}";
}
if (!string.IsNullOrEmpty(dmodel.Name))
{
where += $@" and {nameof(RB_Member_User.Name)} like '%{dmodel.Name}%'";
}
if (!string.IsNullOrEmpty(dmodel.UserNameStr))
{
where += $@" and {nameof(RB_Member_User.Name)} in({dmodel.UserNameStr})";
}
if (!string.IsNullOrEmpty(dmodel.AliasName))
{
where += $@" and {nameof(RB_Member_User.AliasName)} like '%{dmodel.AliasName}%'";
}
if (dmodel.Source > 0)
{
where += $@" and {nameof(RB_Member_User.Source)} ={(int)dmodel.Source}";
}
if (!string.IsNullOrEmpty(dmodel.Moblie))
{
where += $@" and {nameof(RB_Member_User.Moblie)} like '%{dmodel.Moblie}%'";
}
if (dmodel.MemberGrade > 0)
{
where += $@" and {nameof(RB_Member_User.MemberGrade)}={dmodel.MemberGrade}";
}
if (dmodel.SuperiorId > 0)
{
where += $@" and {nameof(RB_Member_User.SuperiorId)}={dmodel.SuperiorId}";
}
if (!string.IsNullOrEmpty(dmodel.UserIds))
{
where += $@" and {nameof(RB_Member_User.Id)} in({dmodel.UserIds})";
}
if (!string.IsNullOrEmpty(dmodel.StartTime))
{
where += $@" and {nameof(RB_Member_User.CreateDate)} >='{dmodel.StartTime}'";
}
if (!string.IsNullOrEmpty(dmodel.EndTime))
{
where += $@" and {nameof(RB_Member_User.CreateDate)} <='{dmodel.EndTime} 23:59:59'";
}
string sql = $@"
select * from RB_Member_User where {where} order by CreateDate desc
";
return Get<RB_Member_User_Extend>(sql).ToList();
}
/// <summary>
/// 获取列表(粉象)
/// </summary>
......
......@@ -73,6 +73,9 @@ where {where} order by di.Id desc";
{
where += $@" and g.{nameof(Model.Entity.Product.RB_Goods.Name)} like '%{demodel.GoodsName}%'";
}
if (demodel.SmallShopsId > 0) {
where += $@" and sp.{nameof(RB_SmallShops_Price_Extend.SmallShopsId)}={demodel.SmallShopsId}";
}
string sql = $@"
SELECT sp.GoodsId FROM rb_smallshops_price sp
......
......@@ -34,6 +34,8 @@ namespace Mall.WebApi.Controllers.AppletWeChat
private readonly SupplierModule supplierModule = new SupplierModule();
private readonly ProductModule productModule = new ProductModule();
#region 直播房间信息
[HttpPost]
[AllowAnonymous]
......@@ -149,7 +151,9 @@ namespace Mall.WebApi.Controllers.AppletWeChat
// 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.LiveCommission + item.OtherPrice;
item.NoPaid = item.ALLCommission;
item.Paid = item.PaidCostMoney + item.RemitFXCommission + (!string.IsNullOrWhiteSpace(item.LiveFinanceIds) ? item.LiveCommission : 0);
item.RemitFXCommission = item.RemitFXCommission + (!string.IsNullOrWhiteSpace(item.LiveFinanceIds) ? item.LiveCommission : 0);
item.Paid = item.PaidCostMoney + item.RemitFXCommission ;
item.GrossProfit = (item.AllPrice + item.RealMoney) - item.CouponMoney - item.RefundActual - item.ALLCommission - item.PayMoney;
item.GrossProfitRate = (item.AllPrice + item.RealMoney) == 0 ? 0 : Math.Round((item.GrossProfit / (item.AllPrice + item.RealMoney - item.RefundActual)), 2, MidpointRounding.AwayFromZero);
}
......@@ -302,7 +306,7 @@ namespace Mall.WebApi.Controllers.AppletWeChat
List<ExcelDataSource> slist = new List<ExcelDataSource>();
ExcelDataSource header = new ExcelDataSource()
{
ExcelRows = new List<ExcelColumn>(31) {
ExcelRows = new List<ExcelColumn>(32) {
new ExcelColumn(value: "序号") { CellWidth = 15, HAlignmentEnum = HAlignmentEnum.CENTER, VAlignmentEnum = VAlignmentEnum.CENTER },
new ExcelColumn(value: "订单号") { CellWidth = 15, HAlignmentEnum = HAlignmentEnum.CENTER, VAlignmentEnum = VAlignmentEnum.CENTER },
new ExcelColumn(value: "数量") { CellWidth = 15, HAlignmentEnum = HAlignmentEnum.CENTER, VAlignmentEnum = VAlignmentEnum.CENTER },
......@@ -327,8 +331,10 @@ namespace Mall.WebApi.Controllers.AppletWeChat
new ExcelColumn(value: "应付") { CellWidth = 15, HAlignmentEnum = HAlignmentEnum.CENTER, VAlignmentEnum = VAlignmentEnum.CENTER },
new ExcelColumn(value: "优惠金额") { CellWidth = 15, HAlignmentEnum = HAlignmentEnum.CENTER, VAlignmentEnum = VAlignmentEnum.CENTER },
new ExcelColumn(value: "实际退款金额") { CellWidth = 15, HAlignmentEnum = HAlignmentEnum.CENTER, VAlignmentEnum = VAlignmentEnum.CENTER },
new ExcelColumn(value: "其他实际收入") { CellWidth = 15, HAlignmentEnum = HAlignmentEnum.CENTER, VAlignmentEnum = VAlignmentEnum.CENTER },
new ExcelColumn(value: "其他实际支出") { CellWidth = 15, HAlignmentEnum = HAlignmentEnum.CENTER, VAlignmentEnum = VAlignmentEnum.CENTER },
new ExcelColumn(value: "其他应收") { CellWidth = 15, HAlignmentEnum = HAlignmentEnum.CENTER, VAlignmentEnum = VAlignmentEnum.CENTER },
new ExcelColumn(value: "其他实收") { CellWidth = 15, HAlignmentEnum = HAlignmentEnum.CENTER, VAlignmentEnum = VAlignmentEnum.CENTER },
new ExcelColumn(value: "其他应付") { CellWidth = 15, HAlignmentEnum = HAlignmentEnum.CENTER, VAlignmentEnum = VAlignmentEnum.CENTER },
new ExcelColumn(value: "其他实付") { CellWidth = 15, HAlignmentEnum = HAlignmentEnum.CENTER, VAlignmentEnum = VAlignmentEnum.CENTER },
new ExcelColumn(value: "毛利") { CellWidth = 15, HAlignmentEnum = HAlignmentEnum.CENTER, VAlignmentEnum = VAlignmentEnum.CENTER },
new ExcelColumn(value: "分公司名称") { CellWidth = 15, HAlignmentEnum = HAlignmentEnum.CENTER, VAlignmentEnum = VAlignmentEnum.CENTER },
new ExcelColumn(value: "分公司结算") { CellWidth = 15, HAlignmentEnum = HAlignmentEnum.CENTER, VAlignmentEnum = VAlignmentEnum.CENTER },
......@@ -352,7 +358,8 @@ namespace Mall.WebApi.Controllers.AppletWeChat
// 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.LiveCommission + item.OtherPrice;
item.NoPaid = item.ALLCommission;
item.Paid = item.PaidCostMoney + item.RemitFXCommission + (!string.IsNullOrWhiteSpace(item.LiveFinanceIds) ? item.LiveCommission : 0);
item.RemitFXCommission = item.RemitFXCommission + (!string.IsNullOrWhiteSpace(item.LiveFinanceIds) ? item.LiveCommission : 0);
item.Paid = item.PaidCostMoney + item.RemitFXCommission;
item.GrossProfit = (item.AllPrice + item.RealMoney) - item.CouponMoney - item.RefundActual - item.ALLCommission - item.PayMoney;
item.GrossProfitRate = (item.AllPrice + item.RealMoney) == 0 ? 0 : Math.Round((item.GrossProfit / (item.AllPrice + item.RealMoney - item.RefundActual)), 2, MidpointRounding.AwayFromZero);
//item.GrossProfit = item.AllPrice - item.ALLCommission;
......@@ -414,11 +421,13 @@ namespace Mall.WebApi.Controllers.AppletWeChat
datarow.ExcelRows.Add(new ExcelColumn(value: item.NoPaid.ToString("#0.00")) { });
datarow.ExcelRows.Add(new ExcelColumn(value: item.CouponMoney.ToString("#0.00")) { });
datarow.ExcelRows.Add(new ExcelColumn(value: item.RefundActual.ToString("#0.00")) { });
datarow.ExcelRows.Add(new ExcelColumn(value: item.YSMoney.ToString("#0.00")) { });
datarow.ExcelRows.Add(new ExcelColumn(value: item.RealMoney.ToString("#0.00")) { });
datarow.ExcelRows.Add(new ExcelColumn(value: item.YFMoney.ToString("#0.00")) { });
datarow.ExcelRows.Add(new ExcelColumn(value: item.PayMoney.ToString("#0.00")) { });
datarow.ExcelRows.Add(new ExcelColumn(value: item.GrossProfit.ToString("#0.00")) { });
datarow.ExcelRows.Add(new ExcelColumn(value: item.CompanyName) { });
datarow.ExcelRows.Add(new ExcelColumn(value: Math.Round((item.GrossProfit * item.CompanyProfitRate), 2, MidpointRounding.AwayFromZero).ToString("#0.00")) { });
datarow.ExcelRows.Add(new ExcelColumn(value: Math.Round((item.GrossProfit * (item.CompanyProfitRate / 100)), 2, MidpointRounding.AwayFromZero).ToString("#0.00")) { });
datarow.ExcelRows.Add(new ExcelColumn(value: item.GrossProfitRate.ToString("#0.00")) { });
slist.Add(datarow);
}
......@@ -501,7 +510,8 @@ namespace Mall.WebApi.Controllers.AppletWeChat
item.ALLCommission = item.CostFreight + item.CostMoney + item.PackingMoney + item.GoodsFreight + item.FXCommission + item.LiveCommission + item.OtherPrice;
// item.ALLCommission = item.CostFreight + item.CostMoney + item.PackingMoney + item.GoodsFreight + item.OneCommission + item.TwoCommission + item.OtherPrice;
item.NoPaid = item.ALLCommission;
item.Paid = item.PaidCostMoney + item.RemitFXCommission + (!string.IsNullOrWhiteSpace(item.LiveFinanceIds) ? item.LiveCommission : 0);
item.RemitFXCommission = item.RemitFXCommission + (!string.IsNullOrWhiteSpace(item.LiveFinanceIds) ? item.LiveCommission : 0);
item.Paid = item.PaidCostMoney + item.RemitFXCommission;
item.GrossProfit = (item.AllPrice + item.RealMoney) - item.CouponMoney - item.RefundActual - item.ALLCommission - item.PayMoney;
item.GrossProfitRate = (item.AllPrice + item.RealMoney) == 0 ? 0 : Math.Round((item.GrossProfit / (item.AllPrice + item.RealMoney - item.RefundActual)), 2, MidpointRounding.AwayFromZero);
//item.GrossProfit = item.AllPrice - item.ALLCommission;
......@@ -535,7 +545,7 @@ namespace Mall.WebApi.Controllers.AppletWeChat
TotalRealMoney = list.Sum(x => x.RealMoney),//其他实收
TotalPayMoney = list.Sum(x => x.PayMoney),//其他实付
TotalCouponMoney = list.Sum(x => x.CouponMoney),//优惠金额
TotalCompanyProfit = list.Sum(x => Math.Round((x.GrossProfit * x.CompanyProfitRate), 2, MidpointRounding.AwayFromZero)),//公司结算金额
TotalCompanyProfit = list.Sum(x => Math.Round((x.GrossProfit * (x.CompanyProfitRate / 100)), 2, MidpointRounding.AwayFromZero)),//公司结算金额
};
......@@ -563,6 +573,29 @@ namespace Mall.WebApi.Controllers.AppletWeChat
/// <summary>
/// 获取用户下拉列表
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetCompanyUserList(object requestMsg)
{
var requestParm = JsonConvert.DeserializeObject<RequestParm>(requestMsg.ToString());
RB_Member_User_Extend demodel = JsonConvert.DeserializeObject<RB_Member_User_Extend>(requestParm.msg.ToString());
demodel.TenantId = requestParm.TenantId;
demodel.MallBaseId = requestParm.MallBaseId;
var list = productModule.GetCompanyUserList(demodel);
var result = list.Select(x => new
{
x.Id,
x.Name,
x.Moblie,
x.Photo
});
return ApiResult.Success("", result);
}
#endregion
}
......
......@@ -242,7 +242,7 @@ namespace Mall.WebApi.Controllers.User
SuperiorId = umodel.SuperiorId ?? 0,
Token = token,
SmallShopId =(smallShopsInfoModle != null && smallShopsInfoModle.AuditStatus == DistributorAuditStatusEnum.Audited) ? smallShopsInfoModle.Id : 0,
UserSmallShopId = demodel.SmallShopId
UserSmallShopId = umodel.SmallShopId
};
UserReidsCache.AppletUserInfoSet(UserModuleCacheKeyConfig.Applet_Login_Info + umodel.Id, appletUserInfo, Config.JwtExpirTime);
return ApiResult.CouponSuccess(ResultCode.Fail, "", "", appletUserInfo);
......
......@@ -951,7 +951,7 @@ namespace Mall.WebApi.Controllers.User
demodel.UserId = userInfo.UserId;
demodel.TenantId = userInfo.TenantId;
demodel.MallBaseId = userInfo.MallBaseId;
demodel.SmallShopId = userInfo.SmallShopId;
demodel.SmallShopId = userInfo.UserSmallShopId;
var list = couponModule.GetAllCouponList(pagelist.pageIndex, pagelist.pageSize, out long count, demodel);
pagelist.count = Convert.ToInt32(count);
pagelist.pageData = list.Select(x => new
......
......@@ -2144,6 +2144,8 @@ namespace Mall.WebApi.Controllers.User
});
return ApiResult.Success("", result);
}
/// <summary>
......
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