diff --git a/BBWY.Client/APIServices/OrderService.cs b/BBWY.Client/APIServices/OrderService.cs index fadd1f85..1021ba78 100644 --- a/BBWY.Client/APIServices/OrderService.cs +++ b/BBWY.Client/APIServices/OrderService.cs @@ -310,5 +310,24 @@ namespace BBWY.Client.APIServices endTime = endDate }, null, HttpMethod.Post); } + + /// + /// 获取订单优惠详情 + /// + /// + /// + /// + public ApiResponse GetOrderCouponDetail(string orderId, Shop shop) + { + return SendRequest(globalContext.BBYWApiHost, "api/order/GetOrderCouponDetail", new + { + orderId, + shop.ShopId, + shop.Platform, + shop.AppKey, + shop.AppSecret, + shop.AppToken + }, null, HttpMethod.Post); + } } } diff --git a/BBWY.Client/App.xaml.cs b/BBWY.Client/App.xaml.cs index 7e47ace0..57856af3 100644 --- a/BBWY.Client/App.xaml.cs +++ b/BBWY.Client/App.xaml.cs @@ -126,6 +126,7 @@ namespace BBWY.Client serviceCollection.AddTransient(); serviceCollection.AddTransient(); serviceCollection.AddTransient(); + serviceCollection.AddTransient(); #region 注册拳探SDK相关类 serviceCollection.AddSingleton(); #endregion diff --git a/BBWY.Client/Models/APIModel/Response/Order/OrderCouponDetailResponse.cs b/BBWY.Client/Models/APIModel/Response/Order/OrderCouponDetailResponse.cs new file mode 100644 index 00000000..9b5a3165 --- /dev/null +++ b/BBWY.Client/Models/APIModel/Response/Order/OrderCouponDetailResponse.cs @@ -0,0 +1,204 @@ +using System.Collections.Generic; + +namespace BBWY.Client.Models +{ + public class OrderCouponDetailGroupItemResponse + { + /// + /// 发起方 + /// + public string Initiator { get; set; } + + /// + /// 优惠券或活动类型 + /// + public string CouponOrPromotionType { get; set; } + + /// + /// 优惠金额 + /// + public decimal? PreferentialAmount { get; set; } + + /// + /// 商家承担金额 + /// + public decimal? UndertakenByMerchantAmount { get; set; } + + /// + /// 平台承担金额 + /// + public decimal? UndertakenByPlatformAmount { get; set; } + } + + public class OrderCouponDetailGroupResponse + { + /// + /// 发起方 + /// + public string Initiator { get; set; } + + /// + /// 优惠明细集合 + /// + public IList ItemList { get; set; } + } + + public class OrderCouponDetailResponse + { /// + /// 合计优惠金额 + /// + public decimal TotalPreferentialAmount { get; set; } + + /// + /// 合计商家承担金额 + /// + public decimal? TotalUndertakenByMerchantAmount { get; set; } + + /// + /// 合计平台承担金额 + /// + public decimal? TotalUndertakenByPlatformAmount { get; set; } + + public IList GroupList { get; set; } + + /// + /// 合计单品金额 + /// + public decimal? TotalItemPrice { get; set; } + + /// + /// 合计基础优惠 + /// + public decimal? TotalBaseDiscount { get; set; } + + /// + /// 合计满减 + /// + public decimal? TotalManJian { get; set; } + + /// + /// 合计商家运费 + /// + public decimal? TotalVenderFee { get; set; } + + /// + /// 合计基础运费 + /// + public decimal? TotalBaseFee { get; set; } + + /// + /// 合计偏远运费 + /// + public decimal? TotalRemoteFee { get; set; } + + /// + /// 合计优惠券 + /// + public decimal? TotalCoupon { get; set; } + + /// + /// 合计京豆 + /// + public decimal? TotalJingDou { get; set; } + + /// + /// 合计余额 + /// + public decimal? TotalBalance { get; set; } + + /// + /// 合计超级红包 + /// + public decimal? TotalSuperRedEnvelope { get; set; } + + /// + /// 合计plus会员95折优惠 + /// + public decimal? TotalPlus95 { get; set; } + + /// + /// 合计退换货无忧 + /// + public decimal? TotalTuiHuanHuoWuYou { get; set; } + + /// + /// 合计全球购税费 + /// + public decimal? TotalTaxFee { get; set; } + + /// + /// 合计落地配服务 + /// + public decimal? TotalLuoDiPeiService { get; set; } + + /// + /// 合计应付金额 + /// + public decimal? TotalShouldPay { get; set; } + + /// + /// 合计京券 + /// + public decimal? TotalJingQuan { get; set; } + + /// + /// 合计东券 + /// + public decimal? TotalDongQuan { get; set; } + + /// + /// 合计限品类京券 + /// + public decimal? TotalXianPinLeiJingQuan { get; set; } + + /// + /// 合计限品类东券 + /// + public decimal? TotalXianPinLeiDongQuan { get; set; } + + /// + /// 合计按比例平台承担优惠券 + /// + public decimal? TotalPingTaiChengDanYouHuiQuan { get; set; } + + /// + /// 合计礼金优惠 + /// + public decimal? TotalLiJinYouHui { get; set; } + + /// + /// 合计支付营销优惠 + /// + public decimal? TotalZhiFuYingXiaoYouHui { get; set; } + + /// + /// 合计京东支付优惠 + /// + public decimal? TotalJdZhiFuYouHui { get; set; } + + /// + /// 合计全球购一般税 + /// + public decimal? TotalGlobalGeneralTax { get; set; } + + /// + /// 合计全球购一般包税 + /// + public decimal? TotalGlobalGeneralIncludeTax { get; set; } + + /// + /// 合计京享礼金 + /// + public decimal? TotalJingXiangLiJin { get; set; } + + /// + /// 合计跨店满减促销 + /// + public decimal? TotalPromotionDiscount { get; set; } + + /// + /// 合计满期赠促销 + /// + public decimal? TotalExpiryGiftDiscount { get; set; } + } +} diff --git a/BBWY.Client/ViewModels/Order/OrderCouponDetailViewModel.cs b/BBWY.Client/ViewModels/Order/OrderCouponDetailViewModel.cs new file mode 100644 index 00000000..bc09c76d --- /dev/null +++ b/BBWY.Client/ViewModels/Order/OrderCouponDetailViewModel.cs @@ -0,0 +1,42 @@ +using BBWY.Client.APIServices; +using BBWY.Client.Models; +using System.Threading.Tasks; +using System.Windows; + +namespace BBWY.Client.ViewModels +{ + public class OrderCouponDetailViewModel : BaseVM + { + private string orderId; + private OrderService orderService; + private Shop shop; + + public OrderCouponDetailViewModel(OrderService orderService) + { + this.orderService = orderService; + } + + public string OrderId { get => orderId; set { Set(ref orderId, value); } } + + public OrderCouponDetailResponse Coupon { get => coupon; set { Set(ref coupon, value); } } + + private OrderCouponDetailResponse coupon; + + public void SetData(string orderId, Shop shop) + { + this.OrderId = orderId; + this.shop = shop; + Task.Factory.StartNew(() => orderService.GetOrderCouponDetail(orderId, shop)) + .ContinueWith(t => + { + var r = t.Result; + if (!r.Success) + { + MessageBox.Show(r.Msg, "优惠券明细"); + return; + } + this.Coupon = r.Data; + }); + } + } +} diff --git a/BBWY.Client/ViewModels/Order/OrderListViewModel.cs b/BBWY.Client/ViewModels/Order/OrderListViewModel.cs index 3372a4c3..dcf743a0 100644 --- a/BBWY.Client/ViewModels/Order/OrderListViewModel.cs +++ b/BBWY.Client/ViewModels/Order/OrderListViewModel.cs @@ -135,6 +135,8 @@ namespace BBWY.Client.ViewModels public ICommand OpenSkuDetailCommand { get; set; } + public ICommand OpenOrderCouponDetailCommand { get; set; } + /// /// 当前条件利润汇总 /// @@ -214,6 +216,7 @@ namespace BBWY.Client.ViewModels //EditAfterSaleOrderRefundPurchaseAmountCommand = new RelayCommand(EditAfterSaleOrderRefundPurchaseAmount); //FindAfterSaleOrderCommand = new RelayCommand(FindAfterSaleOrder); OpenSkuDetailCommand = new RelayCommand(OpenSkuDetail); + OpenOrderCouponDetailCommand = new RelayCommand(OpenOrderCouponDetail); SearchOrderCommand.Execute(null); } /// @@ -1106,5 +1109,11 @@ namespace BBWY.Client.ViewModels } } + + private void OpenOrderCouponDetail(string orderId) + { + var w = new OrderCouponDetailWindow(orderId, globalContext.User.Shop); + w.ShowDialog(); + } } } diff --git a/BBWY.Client/ViewModels/ViewModelLocator.cs b/BBWY.Client/ViewModels/ViewModelLocator.cs index 0aa86d5c..5eb090c3 100644 --- a/BBWY.Client/ViewModels/ViewModelLocator.cs +++ b/BBWY.Client/ViewModels/ViewModelLocator.cs @@ -20,7 +20,7 @@ namespace BBWY.Client.ViewModels public bool IsCreateOrderList { get; private set; } public bool IsCreateBatchPurchaseOrderList { get; private set; } - + @@ -385,6 +385,14 @@ namespace BBWY.Client.ViewModels } } + public OrderCouponDetailViewModel OrderCouponDetailVM + { + get + { + using var s = sp.CreateScope(); + return s.ServiceProvider.GetRequiredService(); + } + } //public ShopSealBoxListViewModel ShopSealBoxListVM //{ diff --git a/BBWY.Client/Views/Order/OrderCouponDetailWindow.xaml b/BBWY.Client/Views/Order/OrderCouponDetailWindow.xaml new file mode 100644 index 00000000..f8beea34 --- /dev/null +++ b/BBWY.Client/Views/Order/OrderCouponDetailWindow.xaml @@ -0,0 +1,144 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/BBWY.Client/Views/Order/OrderCouponDetailWindow.xaml.cs b/BBWY.Client/Views/Order/OrderCouponDetailWindow.xaml.cs new file mode 100644 index 00000000..d7f89bd8 --- /dev/null +++ b/BBWY.Client/Views/Order/OrderCouponDetailWindow.xaml.cs @@ -0,0 +1,18 @@ +using BBWY.Client.Models; +using BBWY.Client.ViewModels; +using BBWY.Controls; + +namespace BBWY.Client.Views.Order +{ + /// + /// OrderCouponDetailWindow.xaml 的交互逻辑 + /// + public partial class OrderCouponDetailWindow : BWindow + { + public OrderCouponDetailWindow(string orderId, Shop shop) + { + InitializeComponent(); + (this.DataContext as OrderCouponDetailViewModel).SetData(orderId, shop); + } + } +} diff --git a/BBWY.Client/Views/Order/OrderListControl.xaml b/BBWY.Client/Views/Order/OrderListControl.xaml index 3903100b..a7c5864f 100644 --- a/BBWY.Client/Views/Order/OrderListControl.xaml +++ b/BBWY.Client/Views/Order/OrderListControl.xaml @@ -365,8 +365,10 @@ + - + diff --git a/BBWY.Server.Business/Order/OrderBusiness.cs b/BBWY.Server.Business/Order/OrderBusiness.cs index 112ffd4c..f4894b60 100644 --- a/BBWY.Server.Business/Order/OrderBusiness.cs +++ b/BBWY.Server.Business/Order/OrderBusiness.cs @@ -1282,8 +1282,8 @@ namespace BBWY.Server.Business ItemList = g.ToList() }).ToList(), TotalPreferentialAmount = itemList.Sum(x => x.PreferentialAmount ?? 0), - TotalUndertakenByMerchantAmount = itemList.Where(x => x.Initiator == "商家").Sum(x => x.PreferentialAmount ?? 0), - TotalUndertakenByPlatformAmount = itemList.Where(x => x.Initiator == "平台").Sum(x => x.PreferentialAmount ?? 0), + TotalUndertakenByMerchantAmount = itemList.Where(x => x.Initiator == "商家").Sum(x => x.UndertakenByMerchantAmount ?? 0), + TotalUndertakenByPlatformAmount = itemList.Where(x => x.Initiator == "平台").Sum(x => x.UndertakenByPlatformAmount ?? 0), TotalBalance = couponDetailVoJToken.Value("totalBalance"), TotalBaseDiscount = couponDetailVoJToken.Value("totalBaseDiscount"), TotalBaseFee = couponDetailVoJToken.Value("totalBaseFee"),