Xamarin clients: on basket view, show a message to user for every item that has its price updated
This commit is contained in:
parent
47b7cabdcd
commit
8f34999d66
@ -15,6 +15,16 @@ namespace eShopOnContainers.Core.Models.Basket
|
||||
|
||||
public decimal UnitPrice { get; set; }
|
||||
|
||||
public decimal OldUnitPrice { get; set; }
|
||||
|
||||
public bool HasNewPrice
|
||||
{
|
||||
get
|
||||
{
|
||||
return OldUnitPrice != 0.0m;
|
||||
}
|
||||
}
|
||||
|
||||
public int Quantity
|
||||
{
|
||||
get { return _quantity; }
|
||||
|
@ -34,6 +34,9 @@ namespace eShopOnContainers.Core.Models.Orders
|
||||
[JsonProperty("country")]
|
||||
public string ShippingCountry { get; set; }
|
||||
|
||||
[JsonProperty("zipCode")]
|
||||
public string ShippingZipCode { get; set; }
|
||||
|
||||
public int CardTypeId { get; set; }
|
||||
|
||||
public string CardNumber { get; set; }
|
||||
|
@ -78,7 +78,9 @@ namespace eShopOnContainers.Core.ViewModels
|
||||
|
||||
if (basket != null && basket.Items != null && basket.Items.Any())
|
||||
{
|
||||
BadgeCount = 0;
|
||||
BasketItems.Clear();
|
||||
|
||||
foreach (var basketItem in basket.Items)
|
||||
{
|
||||
BadgeCount += basketItem.Quantity;
|
||||
|
@ -90,7 +90,7 @@ namespace eShopOnContainers.Core.ViewModels
|
||||
ZipCode = userInfo?.ZipCode,
|
||||
State = userInfo?.State,
|
||||
Country = userInfo?.Country,
|
||||
City = string.Empty
|
||||
City = userInfo?.Address
|
||||
};
|
||||
|
||||
// Create Payment Info
|
||||
@ -117,7 +117,8 @@ namespace eShopOnContainers.Core.ViewModels
|
||||
ShippingState = _shippingAddress.State,
|
||||
ShippingCountry = _shippingAddress.Country,
|
||||
ShippingStreet = _shippingAddress.Street,
|
||||
ShippingCity = _shippingAddress.City,
|
||||
ShippingCity = _shippingAddress.City,
|
||||
ShippingZipCode = _shippingAddress.ZipCode,
|
||||
Total = CalculateTotal(CreateOrderItems(orderItems))
|
||||
};
|
||||
|
||||
|
@ -44,5 +44,16 @@ namespace eShopOnContainers.Core.Views
|
||||
await profileViewModel.InitializeAsync(null);
|
||||
ProfileView.BindingContext = profileViewModel;
|
||||
}
|
||||
|
||||
protected override async void OnCurrentPageChanged()
|
||||
{
|
||||
base.OnCurrentPageChanged();
|
||||
|
||||
if (CurrentPage is BasketView)
|
||||
{
|
||||
// Force basket view refresh every time we access it
|
||||
await (BasketView.BindingContext as ViewModelBase).InitializeAsync(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -83,6 +83,7 @@
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="1" />
|
||||
</Grid.RowDefinitions>
|
||||
<!-- IMAGE -->
|
||||
@ -131,10 +132,24 @@
|
||||
Text="{Binding Total, StringFormat='${0:N}'}"
|
||||
Style="{StaticResource OrderTotalStyle}"/>
|
||||
</Grid>
|
||||
<Grid
|
||||
<Grid
|
||||
Grid.Column="0"
|
||||
Grid.ColumnSpan="2"
|
||||
Grid.Row="1"
|
||||
IsVisible="{Binding HasNewPrice}"
|
||||
BackgroundColor="#F0AD4E">
|
||||
<Label
|
||||
HorizontalOptions="Fill"
|
||||
VerticalOptions="Fill"
|
||||
HorizontalTextAlignment="Center"
|
||||
VerticalTextAlignment="Center"
|
||||
HeightRequest="60"
|
||||
Text="{Binding OldUnitPrice, StringFormat='Note that the price of this article changed in our Catalog. The old price when you originally added it to the basket was ${0:N2}'}" />
|
||||
</Grid>
|
||||
<Grid
|
||||
Grid.Column="0"
|
||||
Grid.ColumnSpan="2"
|
||||
Grid.Row="2"
|
||||
BackgroundColor="Gray"/>
|
||||
</Grid>
|
||||
</ContentView.Content>
|
||||
|
Loading…
x
Reference in New Issue
Block a user