| | |
| | | var channle = await _lifePayChannlesRep.FirstOrDefaultAsync(r => r.ChannlesNum == order.ChannelId); |
| | | CheckExtensions.IfTrueThrowUserFriendlyException(order == null, "订单不存在"); |
| | | var user = await _lifePayUserRepository.FirstOrDefaultAsync(x => x.Id == order.UserId); |
| | | var channlesRakePrice = (order.PayAmount - (order.PlatformDeductionAmount == null ? 0 : order.PlatformDeductionAmount)) * channle.ChannlesRakeRate / 100; |
| | | var orderpirce = await GetOrderPrice(order.RechargeAmount, order.PayAmount, order.PlatformRate, order.ChannleRate, order.ChannlesRakeRate, order.PremiumRate); |
| | | CheckExtensions.IfTrueThrowUserFriendlyException(user == null, "用户不存在"); |
| | | var orderpirce = await GetOrderPrice(order.RechargeAmount, order.PayAmount, order.PlatformRate ?? 0, order.ChannleRate ?? 0, order.ChannlesRakeRate ?? 0, order.PremiumRate ?? 0); |
| | | |
| | | |
| | | var result = new LifePayOrderOutput() |
| | |
| | | ChannlesRakePrice = orderpirce.ChannlesRakePrice, |
| | | PremiumRate = order.PremiumRate, |
| | | PremiumPrice = orderpirce.PremiumPrice, |
| | | Profit = orderpirce.Profit |
| | | Profit = orderpirce.Profit, |
| | | RefundOrderNo = order.RefundOrderNo, |
| | | }; |
| | | |
| | | return result; |
| | |
| | | dto.Status = input.Status; |
| | | #region 记录日志 |
| | | |
| | | await PublishLifePayOrderHistoryEvent("渠道管理", "编辑", input.Id.Value, TableType.LifePayChannles); |
| | | await LifePayOrderHistory("渠道管理", "编辑", input.Id.Value, TableType.LifePayChannles); |
| | | |
| | | #endregion |
| | | } |
| | |
| | | |
| | | #region 记录日志 |
| | | |
| | | await PublishLifePayOrderHistoryEvent("渠道管理", "新增", input.Id.Value, TableType.LifePayChannles); |
| | | await LifePayOrderHistory("渠道管理", "新增", input.Id.Value, TableType.LifePayChannles); |
| | | |
| | | #endregion |
| | | } |
| | |
| | | |
| | | #region 记录日志 |
| | | |
| | | await PublishLifePayOrderHistoryEvent("渠道管理", status.GetDescription(), id, TableType.LifePayChannles); |
| | | |
| | | await LifePayOrderHistory("渠道管理", status.GetDescription(), id, TableType.LifePayChannles); |
| | | #endregion |
| | | } |
| | | |
| | |
| | | }); |
| | | } |
| | | |
| | | public async Task<OrderPriceReturn> GetOrderPrice(decimal price, decimal priceAmount, decimal? platformRate,decimal? channleRate, |
| | | decimal? channlesRakeRate,decimal? premiumRate) |
| | | public async Task<OrderPriceReturn> GetOrderPrice(decimal price, decimal priceAmount, decimal platformRate, decimal channleRate, |
| | | decimal channlesRakeRate, decimal premiumRate) |
| | | { |
| | | /// 毛利 |
| | | var grossProfit = price * (channleRate - platformRate) / 100; |
| | |
| | | var platformPrice = price * platformRate / 100; |
| | | |
| | | /// 手续费 |
| | | var premiumPrice = priceAmount * premiumRate / 100; |
| | | var premiumPrice = priceAmount * (premiumRate) / 100; |
| | | |
| | | /// 渠道佣金 ((充值面额 * 渠道折扣比例)-(充值面额 * 平台折扣比例))* 佣金比例 |
| | | var channlesRakePrice = grossProfit * channlesRakeRate / 100; |
| | | var channlesRakePrice = grossProfit * (channlesRakeRate) / 100; |
| | | |
| | | /// 利润 |
| | | var profit = grossProfit - channlesRakePrice - premiumPrice; |
| | | var profit = grossProfit - channlesRakePrice - (premiumRate); |
| | | |
| | | return new OrderPriceReturn() |
| | | { |
| | | PlatformPrice = platformPrice.HasValue? platformPrice.Value :0, |
| | | PremiumPrice = premiumPrice.HasValue ? premiumPrice.Value : 0, |
| | | ChannlesRakePrice = channlesRakePrice.HasValue? channlesRakePrice.Value:0, |
| | | Profit = profit.HasValue ? profit.Value : 0 |
| | | PlatformPrice = platformPrice, |
| | | PremiumPrice = premiumPrice, |
| | | ChannlesRakePrice = channlesRakePrice, |
| | | Profit = profit |
| | | }; |
| | | } |
| | | |