10 changed files with 576 additions and 50 deletions
@ -0,0 +1,321 @@ |
|||||
|
using BBWYB.Client.APIServices; |
||||
|
using BBWYB.Client.Models; |
||||
|
using BBWYB.Common.Trigger; |
||||
|
using CommunityToolkit.Mvvm.Input; |
||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Collections.ObjectModel; |
||||
|
using System.Linq; |
||||
|
using System.Threading; |
||||
|
using System.Threading.Tasks; |
||||
|
using System.Windows; |
||||
|
using System.Windows.Input; |
||||
|
|
||||
|
namespace BBWYB.Client.ViewModels |
||||
|
{ |
||||
|
public class OnlinePurchaseViewModel : BaseVM |
||||
|
{ |
||||
|
public ICommand FastCreateOrderCommand { get; set; } |
||||
|
public ICommand PreviewOrderCommand { get; set; } |
||||
|
|
||||
|
public IList<PurchaseSchemeProductSku> PurchaseSchemeProductSkuList { get; set; } |
||||
|
|
||||
|
public bool IsLoading { get => isLoading; set { SetProperty(ref isLoading, value); } } |
||||
|
|
||||
|
public decimal ProductAmount { get => productAmount; set { SetProperty(ref productAmount, value); } } |
||||
|
public decimal FreightAmount { get => freightAmount; set { SetProperty(ref freightAmount, value); } } |
||||
|
public decimal TotalAmount { get => totalAmount; set { SetProperty(ref totalAmount, value); } } |
||||
|
public string ContactName { get => contactName; set { SetProperty(ref contactName, value); } } |
||||
|
public string Address { get => address; set { SetProperty(ref address, value); } } |
||||
|
public string Mobile { get => mobile; set { SetProperty(ref mobile, value); } } |
||||
|
public string Province { get => province; set { SetProperty(ref province, value); } } |
||||
|
public string City { get => city; set { SetProperty(ref city, value); } } |
||||
|
public string County { get => county; set { SetProperty(ref county, value); } } |
||||
|
public string Town { get => town; set { SetProperty(ref town, value); } } |
||||
|
public string PrucahseRemark { get => prucahseRemark; set { SetProperty(ref prucahseRemark, value); } } |
||||
|
|
||||
|
public PurchaseOrderMode PurchaseOrderMode |
||||
|
{ |
||||
|
get => purchaseOrderMode; set |
||||
|
{ |
||||
|
if (SetProperty(ref purchaseOrderMode, value)) |
||||
|
OnDelayTriggerExecute(Guid.NewGuid().ToString()); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
private Purchaser purchaser; |
||||
|
private Order order; |
||||
|
private PurchaseAccount purchaseAccount; |
||||
|
|
||||
|
private IList<PurchaseScheme> purchaseSchemeList; |
||||
|
private OrderViewModel orderListViewModel; |
||||
|
private GlobalContext globalContext; |
||||
|
private bool isLoading; |
||||
|
private PurchaseService purchaseService; |
||||
|
private PurchaseOrderService purchaseOrderService; |
||||
|
private PurchaseProductAPIService purchaseProductAPIService; |
||||
|
private DelayTrigger delayTrigger; |
||||
|
|
||||
|
private decimal productAmount; |
||||
|
private decimal freightAmount; |
||||
|
private decimal totalAmount; |
||||
|
private string contactName; |
||||
|
private string address; |
||||
|
private string mobile; |
||||
|
private string province; |
||||
|
private string city; |
||||
|
private string county; |
||||
|
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) |
||||
|
{ |
||||
|
this.purchaseOrderService = purchaseOrderService; |
||||
|
this.purchaseProductAPIService = purchaseProductAPIService; |
||||
|
this.purchaseService = purchaseService; |
||||
|
this.delayTrigger = new DelayTrigger(); |
||||
|
this.delayTrigger.OnExecute = OnDelayTriggerExecute; |
||||
|
PurchaseSchemeProductSkuList = new ObservableCollection<PurchaseSchemeProductSku>(); |
||||
|
purchaseSchemeList = new List<PurchaseScheme>(); |
||||
|
FastCreateOrderCommand = new RelayCommand(FastCreateOrder); |
||||
|
PreviewOrderCommand = new RelayCommand(PreviewOrder); |
||||
|
this.globalContext = globalContext; |
||||
|
this.orderListViewModel = orderListViewModel; |
||||
|
//PurchaseOrderMode = PurchaseOrderMode.代发;
|
||||
|
} |
||||
|
|
||||
|
public void SetData(Order order, Purchaser purchaser, PurchaseAccount purchaseAccount) |
||||
|
{ |
||||
|
this.order = order; |
||||
|
this.purchaser = purchaser; |
||||
|
this.purchaseAccount = purchaseAccount; |
||||
|
|
||||
|
this.ContactName = order.Consignee.ContactName; |
||||
|
this.Address = order.Consignee.Address; |
||||
|
this.Province = order.Consignee.Province; |
||||
|
this.City = order.Consignee.City; |
||||
|
this.County = order.Consignee.County; |
||||
|
this.Town = order.Consignee.Town; |
||||
|
this.Mobile = order.Consignee.Mobile; |
||||
|
} |
||||
|
|
||||
|
protected override void Load() |
||||
|
{ |
||||
|
IsLoading = true; |
||||
|
|
||||
|
Task.Factory.StartNew(() => purchaseService.GetPurchaseSchemeList(order.ItemList.Select(osku => osku.SkuId).ToList(), purchaser.Id, globalContext.User.Shop.ShopId)) |
||||
|
.ContinueWith(r => |
||||
|
{ |
||||
|
var purchaseSchemeResponse = r.Result; |
||||
|
if (!purchaseSchemeResponse.Success) |
||||
|
{ |
||||
|
IsLoading = false; |
||||
|
App.Current.Dispatcher.Invoke(() => MessageBox.Show(purchaseSchemeResponse.Msg, "获取采购方案")); |
||||
|
return; |
||||
|
} |
||||
|
|
||||
|
var waitList = new List<WaitHandle>(); |
||||
|
foreach (var purchaseSchemeApiModel in purchaseSchemeResponse.Data) |
||||
|
{ |
||||
|
var purchaseScheme = PurchaseScheme.Convert(purchaseSchemeApiModel); |
||||
|
purchaseSchemeList.Add(purchaseScheme); |
||||
|
foreach (var purchaseSchemeProduct in purchaseScheme.PurchaseSchemeProductList) |
||||
|
{ |
||||
|
var ewh = new ManualResetEvent(false); |
||||
|
waitList.Add(ewh); |
||||
|
var orderSku = order.ItemList.FirstOrDefault(osku => osku.SkuId == purchaseScheme.SkuId); |
||||
|
Task.Factory.StartNew(() => LoadPurchaseProduct(purchaseScheme.PurchasePlatform, purchaseSchemeProduct, orderSku, ewh)); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
WaitHandle.WaitAll(waitList.ToArray()); |
||||
|
//IsLoading = false;
|
||||
|
if (PurchaseSchemeProductSkuList.Count() > 0) |
||||
|
OnDelayTriggerExecute(Guid.NewGuid().ToString()); |
||||
|
else |
||||
|
{ |
||||
|
IsLoading = false; |
||||
|
App.Current.Dispatcher.Invoke(() => MessageBox.Show("采购方案商品加载失败,请重新打开预览窗口", "提示")); |
||||
|
} |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
protected override void Unload() |
||||
|
{ |
||||
|
order = null; |
||||
|
purchaser = null; |
||||
|
purchaseAccount = null; |
||||
|
|
||||
|
purchaseSchemeList.Clear(); |
||||
|
PurchaseSchemeProductSkuList.Clear(); |
||||
|
tradeMode = string.Empty; |
||||
|
extensions = string.Empty; |
||||
|
ProductAmount = FreightAmount = TotalAmount = 0; |
||||
|
ContactName = Address = Mobile = Province = City = County = Town = PrucahseRemark = string.Empty; |
||||
|
} |
||||
|
|
||||
|
private void LoadPurchaseProduct(Platform platform, PurchaseSchemeProduct purchaseSchemeProduct, OrderSku orderSku, ManualResetEvent ewh) |
||||
|
{ |
||||
|
var data = purchaseProductAPIService.GetProductInfo(platform, |
||||
|
purchaseSchemeProduct.ProductId, |
||||
|
purchaseSchemeProduct.SkuId, |
||||
|
purchaseSchemeProduct.PurchaseProductId, |
||||
|
PurchaseOrderMode, |
||||
|
PurchaseProductAPIMode.Spider); |
||||
|
if (data != null && data.Value.purchaseSchemeProductSkus != null && data.Value.purchaseSchemeProductSkus.Count > 0) |
||||
|
{ |
||||
|
App.Current.Dispatcher.Invoke(() => |
||||
|
{ |
||||
|
foreach (var purchaseSchemeProductSku in data.Value.purchaseSchemeProductSkus) |
||||
|
{ |
||||
|
if (purchaseSchemeProduct.SelectedSkuIdList.Any(s => s == purchaseSchemeProductSku.PurchaseSkuId)) |
||||
|
{ |
||||
|
PurchaseSchemeProductSkuList.Add(purchaseSchemeProductSku); |
||||
|
purchaseSchemeProductSku.ItemTotal = orderSku.ItemTotal; |
||||
|
purchaseSchemeProductSku.OnItemTotalChanged = OnItemTotalChanged; |
||||
|
} |
||||
|
} |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
ewh.Set(); |
||||
|
ewh.Dispose(); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
private void OnItemTotalChanged(int itemTotal) |
||||
|
{ |
||||
|
Console.WriteLine($"OnItemTotalChanged {DateTime.Now} {itemTotal}"); |
||||
|
this.delayTrigger.SetKey(itemTotal.ToString()); |
||||
|
} |
||||
|
|
||||
|
private void OnDelayTriggerExecute(string key) |
||||
|
{ |
||||
|
if (string.IsNullOrEmpty(key)) |
||||
|
{ |
||||
|
IsLoading = false; |
||||
|
return; |
||||
|
} |
||||
|
|
||||
|
if (string.IsNullOrEmpty(ContactName) || |
||||
|
string.IsNullOrEmpty(Address) || |
||||
|
string.IsNullOrEmpty(Mobile) || |
||||
|
string.IsNullOrEmpty(Province) || |
||||
|
string.IsNullOrEmpty(City) || |
||||
|
string.IsNullOrEmpty(County)) |
||||
|
{ |
||||
|
IsLoading = false; |
||||
|
MessageBox.Show("缺少完整的收货信息", "提示"); |
||||
|
return; |
||||
|
} |
||||
|
|
||||
|
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; |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
private void FastCreateOrder() |
||||
|
{ |
||||
|
if (IsLoading) |
||||
|
return; |
||||
|
if (TotalAmount == 0) |
||||
|
{ |
||||
|
MessageBox.Show("总金额为0不能提交订单", "提示"); |
||||
|
return; |
||||
|
} |
||||
|
if (string.IsNullOrEmpty(Mobile) || |
||||
|
string.IsNullOrEmpty(Address) || |
||||
|
string.IsNullOrEmpty(City) || |
||||
|
string.IsNullOrEmpty(Province) || |
||||
|
string.IsNullOrEmpty(County) || |
||||
|
string.IsNullOrEmpty(Town) || |
||||
|
string.IsNullOrEmpty(ContactName)) |
||||
|
{ |
||||
|
MessageBox.Show("收货人信息不全", "下单"); |
||||
|
return; |
||||
|
} |
||||
|
|
||||
|
IsLoading = true; |
||||
|
Task.Factory.StartNew(() => purchaseOrderService.FastCreateOrder(new Consignee() |
||||
|
{ |
||||
|
Address = Address, |
||||
|
City = City, |
||||
|
ContactName = ContactName, |
||||
|
County = County, |
||||
|
Mobile = Mobile, |
||||
|
Province = Province, |
||||
|
TelePhone = Mobile, |
||||
|
Town = Town |
||||
|
}, PurchaseSchemeProductSkuList, |
||||
|
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; |
||||
|
var r = t.Result; |
||||
|
if (!r.Success) |
||||
|
{ |
||||
|
App.Current.Dispatcher.Invoke(() => MessageBox.Show(r.Msg, "下单")); |
||||
|
return; |
||||
|
} |
||||
|
|
||||
|
//刷新订单列表
|
||||
|
//orderListViewModel.RefreshOrder(order.Id);
|
||||
|
|
||||
|
//关闭当前窗口
|
||||
|
//GalaSoft.MvvmLight.Messaging.Messenger.Default.Send<object>(null, "OnlinePurchase_Close");
|
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
private void PreviewOrder() |
||||
|
{ |
||||
|
OnDelayTriggerExecute(Guid.NewGuid().ToString()); |
||||
|
} |
||||
|
} |
||||
|
} |
@ -0,0 +1,140 @@ |
|||||
|
<c:BWindow x:Class="BBWYB.Client.Views.Purchase.OnlinePurchase" |
||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" |
||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" |
||||
|
xmlns:local="clr-namespace:BBWYB.Client.Views.Purchase" |
||||
|
xmlns:cmodel="clr-namespace:BBWYB.Client.Models" |
||||
|
xmlns:c="clr-namespace:SJ.Controls;assembly=SJ.Controls" |
||||
|
xmlns:b="http://schemas.microsoft.com/xaml/behaviors" |
||||
|
mc:Ignorable="d" |
||||
|
Title="提交订单" Height="600" Width="800" |
||||
|
Style="{StaticResource bwstyle}" |
||||
|
MinButtonVisibility="Collapsed" |
||||
|
MaxButtonVisibility="Collapsed" |
||||
|
DataContext="{Binding OnlinePurchase,Source={StaticResource Locator}}"> |
||||
|
<b:Interaction.Triggers> |
||||
|
<b:EventTrigger EventName="Loaded"> |
||||
|
<b:InvokeCommandAction Command="{Binding LoadCommand}"/> |
||||
|
</b:EventTrigger> |
||||
|
<b:EventTrigger EventName="Unloaded"> |
||||
|
<b:InvokeCommandAction Command="{Binding UnloadCommand}"/> |
||||
|
</b:EventTrigger> |
||||
|
</b:Interaction.Triggers> |
||||
|
<Grid> |
||||
|
<Grid.RowDefinitions> |
||||
|
<RowDefinition Height="30"/> |
||||
|
<RowDefinition/> |
||||
|
<RowDefinition Height="60"/> |
||||
|
<RowDefinition Height="100"/> |
||||
|
<RowDefinition Height="40"/> |
||||
|
</Grid.RowDefinitions> |
||||
|
|
||||
|
<c:RoundWaitProgress Play="{Binding IsLoading}" Panel.ZIndex="999" Grid.RowSpan="5"/> |
||||
|
|
||||
|
<Border BorderThickness="0,0,0,1" BorderBrush="{StaticResource MainMenu.BorderBrush}" |
||||
|
Background="{StaticResource Border.Background}"> |
||||
|
<TextBlock Text="提交订单" HorizontalAlignment="Center" VerticalAlignment="Center"/> |
||||
|
</Border> |
||||
|
|
||||
|
<DataGrid Grid.Row="1" |
||||
|
ItemsSource="{Binding PurchaseSchemeProductSkuList}" |
||||
|
RowHeight="90"> |
||||
|
<DataGrid.Columns> |
||||
|
<DataGridTemplateColumn Header="采购货品信息" HeaderStyle="{StaticResource ColumnHeaderStyle_Center}" Width="1*"> |
||||
|
<DataGridTemplateColumn.CellTemplate> |
||||
|
<DataTemplate> |
||||
|
<Grid Width="{Binding ActualWidth,ElementName=listbox_orerSku}"> |
||||
|
<Grid.ColumnDefinitions> |
||||
|
<ColumnDefinition Width="90"/> |
||||
|
<ColumnDefinition/> |
||||
|
</Grid.ColumnDefinitions> |
||||
|
|
||||
|
<!--{Binding Logo}--> |
||||
|
<c:BAsyncImage UrlSource="{Binding Logo}" |
||||
|
Width="80" DecodePixelWidth="80" |
||||
|
VerticalAlignment="Top" Margin="0,5,0,0"/> |
||||
|
<TextBlock Text="{Binding Title}" Grid.Column="1" |
||||
|
VerticalAlignment="Center"/> |
||||
|
</Grid> |
||||
|
</DataTemplate> |
||||
|
</DataGridTemplateColumn.CellTemplate> |
||||
|
</DataGridTemplateColumn> |
||||
|
<DataGridTextColumn Header="单价" HeaderStyle="{StaticResource ColumnHeaderStyle_Center}" Width="80" Binding="{Binding Price}" |
||||
|
ElementStyle="{StaticResource middleTextBlock}"/> |
||||
|
<DataGridTemplateColumn Header="数量" HeaderStyle="{StaticResource ColumnHeaderStyle_Center}" Width="100"> |
||||
|
<DataGridTemplateColumn.CellTemplate> |
||||
|
<DataTemplate> |
||||
|
<c:BTextBox Text="{Binding ItemTotal,Converter={StaticResource inputNumberConverter},Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" |
||||
|
Width="60"/> |
||||
|
</DataTemplate> |
||||
|
</DataGridTemplateColumn.CellTemplate> |
||||
|
</DataGridTemplateColumn> |
||||
|
<DataGridTextColumn Header="金额" HeaderStyle="{StaticResource ColumnHeaderStyle_Center}" Width="80" |
||||
|
Binding="{Binding SkuAmount,Mode=OneWay,UpdateSourceTrigger=PropertyChanged}" |
||||
|
ElementStyle="{StaticResource middleTextBlock}"/> |
||||
|
</DataGrid.Columns> |
||||
|
</DataGrid> |
||||
|
|
||||
|
<Grid Grid.Row="2" Margin="5,0"> |
||||
|
<Grid.ColumnDefinitions> |
||||
|
<ColumnDefinition Width="0.8*"/> |
||||
|
<ColumnDefinition Width="0.2*"/> |
||||
|
</Grid.ColumnDefinitions> |
||||
|
<c:BTextBox Text="{Binding PrucahseRemark,Mode=OneWayToSource,UpdateSourceTrigger=PropertyChanged}" |
||||
|
WaterRemark="留言信息" |
||||
|
Height="60" |
||||
|
VerticalContentAlignment="Top" |
||||
|
Padding="3,5,0,0" |
||||
|
TextWrapping="Wrap"/> |
||||
|
<TextBlock Grid.Column="1" HorizontalAlignment="Center" VerticalAlignment="Center"> |
||||
|
<Run Text="货品总金额"/> |
||||
|
<Run Text="{Binding ProductAmount,Mode=OneWay,UpdateSourceTrigger=PropertyChanged}" Foreground="#EC808D"/> |
||||
|
<Run Text="元"/> |
||||
|
<LineBreak/> |
||||
|
<Run Text="运费共计"/> |
||||
|
<Run Text="{Binding FreightAmount,Mode=OneWay,UpdateSourceTrigger=PropertyChanged}" Foreground="#EC808D"/> |
||||
|
<Run Text="元"/> |
||||
|
</TextBlock> |
||||
|
</Grid> |
||||
|
|
||||
|
<StackPanel HorizontalAlignment="Stretch" VerticalAlignment="Center" Grid.Row="3" Margin="5,0"> |
||||
|
<c:BTextBox Text="{Binding ContactName,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" WaterRemark="收货人"/> |
||||
|
<Grid> |
||||
|
<Grid.ColumnDefinitions> |
||||
|
<ColumnDefinition Width="80"/> |
||||
|
<ColumnDefinition Width="80"/> |
||||
|
<ColumnDefinition Width="80"/> |
||||
|
<ColumnDefinition Width="80"/> |
||||
|
<ColumnDefinition/> |
||||
|
</Grid.ColumnDefinitions> |
||||
|
<c:BTextBox Text="{Binding Province,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" WaterRemark="省" BorderThickness="1,1,0,1"/> |
||||
|
<c:BTextBox Text="{Binding City,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" WaterRemark="市" Grid.Column="1" BorderThickness="1,1,0,1"/> |
||||
|
<c:BTextBox Text="{Binding County,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" WaterRemark="区/县" Grid.Column="2" BorderThickness="1,1,0,1"/> |
||||
|
<c:BTextBox Text="{Binding Town,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" WaterRemark="镇" Grid.Column="3" BorderThickness="1,1,0,1"/> |
||||
|
<c:BTextBox Text="{Binding Address,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" Margin="0,2.5" WaterRemark="街道地址" Grid.Column="4"/> |
||||
|
</Grid> |
||||
|
|
||||
|
<c:BTextBox Text="{Binding Mobile,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" WaterRemark="电话"/> |
||||
|
</StackPanel> |
||||
|
|
||||
|
<TextBlock Grid.Row="4" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="5,0,0,0" FontSize="16"> |
||||
|
<Run Text="应付总额(含运费)"/> |
||||
|
<Run Text="{Binding TotalAmount,Mode=OneWay,UpdateSourceTrigger=PropertyChanged}" Foreground="#EC808D"/> |
||||
|
<Run Text="元"/> |
||||
|
</TextBlock> |
||||
|
<StackPanel Orientation="Horizontal" Grid.Row="4" VerticalAlignment="Center" HorizontalAlignment="Right"> |
||||
|
<RadioButton Content="批发" Padding="0" VerticalContentAlignment="Center" |
||||
|
GroupName="OrderMode" |
||||
|
IsChecked="{Binding PurchaseOrderMode,Converter={StaticResource enumToBooleanConverter},ConverterParameter={x:Static cmodel:PurchaseOrderMode.批发}}"/> |
||||
|
<RadioButton Content="分销" Padding="0" VerticalContentAlignment="Center" Margin="5,0,0,0" |
||||
|
GroupName="OrderMode" |
||||
|
IsChecked="{Binding PurchaseOrderMode,Converter={StaticResource enumToBooleanConverter},ConverterParameter={x:Static cmodel:PurchaseOrderMode.代发}}"/> |
||||
|
|
||||
|
<c:BButton Content="预览订单" Width="80" HorizontalAlignment="Right" Margin="5,0,0,0" |
||||
|
Command="{Binding PreviewOrderCommand}" Background="#1CC2A2"/> |
||||
|
<c:BButton Content="提交订单" Width="80" HorizontalAlignment="Right" |
||||
|
Command="{Binding FastCreateOrderCommand}" Margin="0,0,5,0"/> |
||||
|
</StackPanel> |
||||
|
</Grid> |
||||
|
</c:BWindow> |
@ -0,0 +1,47 @@ |
|||||
|
using BBWYB.Client.Models; |
||||
|
using BBWYB.Client.ViewModels; |
||||
|
using CommunityToolkit.Mvvm.Messaging; |
||||
|
using CommunityToolkit.Mvvm.Messaging.Messages; |
||||
|
using SJ.Controls; |
||||
|
|
||||
|
namespace BBWYB.Client.Views.Purchase |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// _1688Purchase.xaml 的交互逻辑
|
||||
|
/// </summary>
|
||||
|
public partial class OnlinePurchase : BWindow |
||||
|
{ |
||||
|
public OnlinePurchase(Models.Order order, Purchaser purchaser, PurchaseAccount purchaseAccount) |
||||
|
{ |
||||
|
InitializeComponent(); |
||||
|
(this.DataContext as OnlinePurchaseViewModel).SetData(order, purchaser, purchaseAccount); |
||||
|
this.Loaded += _1688Purchase_Loaded; |
||||
|
this.Unloaded += _1688Purchase_Unloaded; |
||||
|
} |
||||
|
|
||||
|
private void _1688Purchase_Unloaded(object sender, System.Windows.RoutedEventArgs e) |
||||
|
{ |
||||
|
//Messenger.Default.Unregister(this);
|
||||
|
WeakReferenceMessenger.Default.UnregisterAll(this); |
||||
|
} |
||||
|
|
||||
|
private void _1688Purchase_Loaded(object sender, System.Windows.RoutedEventArgs e) |
||||
|
{ |
||||
|
//Messenger.Default.Register<object>(this, "OnlinePurchase_Close", (x) => this.Dispatcher.Invoke(() => this.Close()));
|
||||
|
WeakReferenceMessenger.Default.Register<Message_OnlinePurchase_Close>(this, (o, x) => |
||||
|
{ |
||||
|
this.Dispatcher.Invoke(() => |
||||
|
{ |
||||
|
this.Dispatcher.Invoke(() => this.Close()); |
||||
|
}); |
||||
|
}); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
public class Message_OnlinePurchase_Close : ValueChangedMessage<object> |
||||
|
{ |
||||
|
public Message_OnlinePurchase_Close(object value) : base(value) |
||||
|
{ |
||||
|
} |
||||
|
} |
||||
|
} |
Loading…
Reference in new issue