|
|
@ -1,7 +1,9 @@ |
|
|
|
using BBWYB.Client.APIServices; |
|
|
|
using BBWYB.Client.Models; |
|
|
|
using BBWYB.Client.Views.Purchase; |
|
|
|
using BBWYB.Common.Trigger; |
|
|
|
using CommunityToolkit.Mvvm.Input; |
|
|
|
using CommunityToolkit.Mvvm.Messaging; |
|
|
|
using System; |
|
|
|
using System.Collections.Generic; |
|
|
|
using System.Collections.ObjectModel; |
|
|
@ -48,7 +50,7 @@ namespace BBWYB.Client.ViewModels |
|
|
|
private PurchaseAccount purchaseAccount; |
|
|
|
|
|
|
|
private IList<PurchaseScheme> purchaseSchemeList; |
|
|
|
private OrderViewModel orderListViewModel; |
|
|
|
private OrderViewModel orderVM; |
|
|
|
private GlobalContext globalContext; |
|
|
|
private bool isLoading; |
|
|
|
private PurchaseService purchaseService; |
|
|
@ -68,17 +70,16 @@ namespace BBWYB.Client.ViewModels |
|
|
|
private string town; |
|
|
|
private string prucahseRemark; |
|
|
|
private PurchaseOrderMode purchaseOrderMode = PurchaseOrderMode.代发; |
|
|
|
private string tradeMode; |
|
|
|
/// <summary>
|
|
|
|
/// 扩展数据,暂用于拳探
|
|
|
|
/// </summary>
|
|
|
|
private string extensions; |
|
|
|
|
|
|
|
public OnlinePurchaseViewModel(PurchaseService purchaseService, |
|
|
|
PurchaseOrderService purchaseOrderService, |
|
|
|
PurchaseProductAPIService purchaseProductAPIService, |
|
|
|
GlobalContext globalContext, |
|
|
|
OrderViewModel orderListViewModel) |
|
|
|
PurchaseOrderService purchaseOrderService, |
|
|
|
PurchaseProductAPIService purchaseProductAPIService, |
|
|
|
GlobalContext globalContext, |
|
|
|
OrderViewModel orderVM) |
|
|
|
{ |
|
|
|
this.purchaseOrderService = purchaseOrderService; |
|
|
|
this.purchaseProductAPIService = purchaseProductAPIService; |
|
|
@ -90,7 +91,7 @@ namespace BBWYB.Client.ViewModels |
|
|
|
FastCreateOrderCommand = new RelayCommand(FastCreateOrder); |
|
|
|
PreviewOrderCommand = new RelayCommand(PreviewOrder); |
|
|
|
this.globalContext = globalContext; |
|
|
|
this.orderListViewModel = orderListViewModel; |
|
|
|
this.orderVM = orderVM; |
|
|
|
//PurchaseOrderMode = PurchaseOrderMode.代发;
|
|
|
|
} |
|
|
|
|
|
|
@ -158,7 +159,6 @@ namespace BBWYB.Client.ViewModels |
|
|
|
|
|
|
|
purchaseSchemeList.Clear(); |
|
|
|
PurchaseSchemeProductSkuList.Clear(); |
|
|
|
tradeMode = string.Empty; |
|
|
|
extensions = string.Empty; |
|
|
|
ProductAmount = FreightAmount = TotalAmount = 0; |
|
|
|
ContactName = Address = Mobile = Province = City = County = Town = PrucahseRemark = string.Empty; |
|
|
@ -238,14 +238,14 @@ namespace BBWYB.Client.ViewModels |
|
|
|
if (!r.Success) |
|
|
|
{ |
|
|
|
ProductAmount = FreightAmount = TotalAmount = 0; |
|
|
|
tradeMode = string.Empty; |
|
|
|
extensions = string.Empty; |
|
|
|
App.Current.Dispatcher.Invoke(() => MessageBox.Show(r.Msg, "预览订单报价")); |
|
|
|
return; |
|
|
|
} |
|
|
|
ProductAmount = r.Data.ProductAmount; |
|
|
|
FreightAmount = r.Data.FreightAmount; |
|
|
|
TotalAmount = r.Data.TotalAmount; |
|
|
|
tradeMode = r.Data.OrderTradeType?.Code; |
|
|
|
//tradeMode = r.Data.OrderTradeType?.Code;
|
|
|
|
extensions = r.Data.Extensions; |
|
|
|
}); |
|
|
|
} |
|
|
@ -270,6 +270,11 @@ namespace BBWYB.Client.ViewModels |
|
|
|
MessageBox.Show("收货人信息不全", "下单"); |
|
|
|
return; |
|
|
|
} |
|
|
|
if (string.IsNullOrEmpty(extensions)) |
|
|
|
{ |
|
|
|
MessageBox.Show("缺少报价扩展数据", "下单"); |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
IsLoading = true; |
|
|
|
Task.Factory.StartNew(() => purchaseOrderService.FastCreateOrder(new Consignee() |
|
|
@ -286,15 +291,10 @@ namespace BBWYB.Client.ViewModels |
|
|
|
purchaseAccount.PurchasePlatformId, |
|
|
|
purchaseAccount, |
|
|
|
PurchaseOrderMode, |
|
|
|
tradeMode, |
|
|
|
PrucahseRemark, |
|
|
|
order.Id, |
|
|
|
globalContext.User.Shop.ShopId, |
|
|
|
purchaseAccount.Id, |
|
|
|
purchaseAccount.AccountName, |
|
|
|
purchaseSchemeList[0].PurchaserName, |
|
|
|
purchaser.Id, |
|
|
|
globalContext.User.Shop.PlatformCommissionRatio ?? 0.05M, |
|
|
|
extensions)).ContinueWith(t => |
|
|
|
{ |
|
|
|
IsLoading = false; |
|
|
@ -307,9 +307,11 @@ namespace BBWYB.Client.ViewModels |
|
|
|
|
|
|
|
//刷新订单列表
|
|
|
|
//orderListViewModel.RefreshOrder(order.Id);
|
|
|
|
orderVM.RefreshOrder(order.Id); |
|
|
|
|
|
|
|
//关闭当前窗口
|
|
|
|
//GalaSoft.MvvmLight.Messaging.Messenger.Default.Send<object>(null, "OnlinePurchase_Close");
|
|
|
|
WeakReferenceMessenger.Default.Send(new Message_OnlinePurchase_Close(null)); |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|