|
|
|
@ -19,6 +19,7 @@ namespace BBWY.Client.ViewModels |
|
|
|
private GlobalContext globalContext; |
|
|
|
private PurchaseProductAPIService purchaseProductAPIService; |
|
|
|
private PurchaseService purchaseService; |
|
|
|
private BatchPurchaseService batchPurchaseService; |
|
|
|
private DelayTrigger delayTrigger; |
|
|
|
|
|
|
|
private bool isLoading; |
|
|
|
@ -34,6 +35,10 @@ namespace BBWY.Client.ViewModels |
|
|
|
private string town; |
|
|
|
private string prucahseRemark; |
|
|
|
private PurchaseOrderMode purchaseOrderMode = PurchaseOrderMode.代发; |
|
|
|
|
|
|
|
private string tradeMode; |
|
|
|
private string extensions; |
|
|
|
|
|
|
|
public bool IsLoading { get => isLoading; set { Set(ref isLoading, value); } } |
|
|
|
|
|
|
|
public decimal ProductAmount { get => productAmount; set { Set(ref productAmount, value); } } |
|
|
|
@ -70,11 +75,15 @@ namespace BBWY.Client.ViewModels |
|
|
|
|
|
|
|
public ICommand SubtractQuantityCommand { get; set; } |
|
|
|
|
|
|
|
public BatchPurchaseCreateNewOrderViewModel(PurchaseProductAPIService purchaseProductAPIService, PurchaseService purchaseService, GlobalContext globalContext) |
|
|
|
public BatchPurchaseCreateNewOrderViewModel(PurchaseProductAPIService purchaseProductAPIService, |
|
|
|
PurchaseService purchaseService, |
|
|
|
GlobalContext globalContext, |
|
|
|
BatchPurchaseService batchPurchaseService) |
|
|
|
{ |
|
|
|
this.globalContext = globalContext; |
|
|
|
this.purchaseProductAPIService = purchaseProductAPIService; |
|
|
|
this.purchaseService = purchaseService; |
|
|
|
this.batchPurchaseService = batchPurchaseService; |
|
|
|
ProductSkuWithSchemeList = new ObservableCollection<ProductSkuWithScheme>(); |
|
|
|
|
|
|
|
FastCreateOrderCommand = new RelayCommand(FastCreateOrder); |
|
|
|
@ -96,6 +105,15 @@ namespace BBWY.Client.ViewModels |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
if (ProductSkuWithSchemeList.Count() == 0) |
|
|
|
{ |
|
|
|
ProductAmount = 0; |
|
|
|
FreightAmount = 0; |
|
|
|
TotalAmount = 0; |
|
|
|
IsLoading = false; |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
if (string.IsNullOrEmpty(ContactName) || |
|
|
|
string.IsNullOrEmpty(Address) || |
|
|
|
string.IsNullOrEmpty(Mobile) || |
|
|
|
@ -108,45 +126,35 @@ namespace BBWY.Client.ViewModels |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
if (ProductSkuWithSchemeList.Count() == 0) |
|
|
|
{ |
|
|
|
ProductAmount = 0; |
|
|
|
FreightAmount = 0; |
|
|
|
TotalAmount = 0; |
|
|
|
IsLoading = false; |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
IsLoading = true; |
|
|
|
//IsLoading = true;
|
|
|
|
//Task.Factory.StartNew(() => purchaseOrderService.PreviewPurchaseOrder(new Consignee()
|
|
|
|
//{
|
|
|
|
// Address = Address,
|
|
|
|
// City = City,
|
|
|
|
// ContactName = ContactName,
|
|
|
|
// County = County,
|
|
|
|
// Mobile = Mobile,
|
|
|
|
// Province = Province,
|
|
|
|
// TelePhone = Mobile,
|
|
|
|
// Town = Town
|
|
|
|
//}, PurchaseSchemeProductSkuList, purchaseAccount.PurchasePlatformId, purchaseAccount, PurchaseOrderMode))
|
|
|
|
// .ContinueWith(t =>
|
|
|
|
// {
|
|
|
|
// IsLoading = false;
|
|
|
|
// var r = t.Result;
|
|
|
|
// if (!r.Success)
|
|
|
|
// {
|
|
|
|
// ProductAmount = FreightAmount = TotalAmount = 0;
|
|
|
|
// tradeMode = 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;
|
|
|
|
// extensions = r.Data.Extensions;
|
|
|
|
// });
|
|
|
|
Task.Factory.StartNew(() => batchPurchaseService.PreviewOrder(ProductSkuWithSchemeList, new Consignee() |
|
|
|
{ |
|
|
|
Address = Address, |
|
|
|
City = City, |
|
|
|
ContactName = ContactName, |
|
|
|
County = County, |
|
|
|
Mobile = Mobile, |
|
|
|
Province = Province, |
|
|
|
TelePhone = Mobile, |
|
|
|
Town = Town |
|
|
|
}, this.PurchaseOrderMode, globalContext.User.Shop.PurchaseAccountList)) |
|
|
|
.ContinueWith(t => |
|
|
|
{ |
|
|
|
IsLoading = false; |
|
|
|
var r = t.Result; |
|
|
|
if (!r.Success) |
|
|
|
{ |
|
|
|
ProductAmount = FreightAmount = TotalAmount = 0; |
|
|
|
tradeMode = 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; |
|
|
|
extensions = r.Data.Extensions; |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
private void PreviewOrder() |
|
|
|
|