| | |
| | | var channleRate = await _lifePayChannlesRep.FirstOrDefaultAsync(r => r.ChannlesNum == order.ChannelId); |
| | | var premiumRate = await _lifePayPremiumRepository.Where(x => x.IsDeleted == false && x.PremiumType == order.LifePayType).FirstOrDefaultAsync(); |
| | | CheckExtensions.IfTrueThrowUserFriendlyException(order == null, "订单不存在"); |
| | | var channlesRakePrice = (order.PayAmount - (order.PlatformDeductionAmount == null ? 0 : order.PlatformDeductionAmount)) * channleRate.ChannlesRakeRate / 100; |
| | | var result = new LifePayOrderOutput() |
| | | { |
| | | DiscountAmount = order.DiscountAmount, |
| | |
| | | PlatformPrice = order.PlatformDeductionAmount, |
| | | ChannleRate = channleRate.ChannlesRate, |
| | | ChannlesRakeRate = channleRate.ChannlesRakeRate, |
| | | ChannlesRakePrice = (order.PayAmount - order.PlatformDeductionAmount) * channleRate.ChannlesRakeRate / 100, |
| | | PremiumRate = premiumRate == null ? default : premiumRate.Rate, |
| | | PremiumPrice = premiumRate == null ? default : Math.Round(order.PayAmount * premiumRate.Rate, 2), |
| | | ChannlesRakePrice = channlesRakePrice.HasValue ? 0 : Math.Round(channlesRakePrice.Value, 2), |
| | | PremiumRate = premiumRate == null ? 0 : premiumRate.Rate, |
| | | PremiumPrice = premiumRate == null ? 0 : Math.Round(order.PayAmount * premiumRate.Rate, 2), |
| | | Profit = (order.PayAmount - order.PlatformDeductionAmount) * (1.00m - channleRate.ChannlesRakeRate / 100) - (premiumRate == null ? 0 : Math.Round(order.PayAmount * premiumRate.Rate, 2)) |
| | | }; |
| | | |