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 UnitPrice { get; set; }
|
||||||
|
|
||||||
|
public decimal OldUnitPrice { get; set; }
|
||||||
|
|
||||||
|
public bool HasNewPrice
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return OldUnitPrice != 0.0m;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public int Quantity
|
public int Quantity
|
||||||
{
|
{
|
||||||
get { return _quantity; }
|
get { return _quantity; }
|
||||||
|
@ -34,6 +34,9 @@ namespace eShopOnContainers.Core.Models.Orders
|
|||||||
[JsonProperty("country")]
|
[JsonProperty("country")]
|
||||||
public string ShippingCountry { get; set; }
|
public string ShippingCountry { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("zipCode")]
|
||||||
|
public string ShippingZipCode { get; set; }
|
||||||
|
|
||||||
public int CardTypeId { get; set; }
|
public int CardTypeId { get; set; }
|
||||||
|
|
||||||
public string CardNumber { get; set; }
|
public string CardNumber { get; set; }
|
||||||
|
@ -78,7 +78,9 @@ namespace eShopOnContainers.Core.ViewModels
|
|||||||
|
|
||||||
if (basket != null && basket.Items != null && basket.Items.Any())
|
if (basket != null && basket.Items != null && basket.Items.Any())
|
||||||
{
|
{
|
||||||
|
BadgeCount = 0;
|
||||||
BasketItems.Clear();
|
BasketItems.Clear();
|
||||||
|
|
||||||
foreach (var basketItem in basket.Items)
|
foreach (var basketItem in basket.Items)
|
||||||
{
|
{
|
||||||
BadgeCount += basketItem.Quantity;
|
BadgeCount += basketItem.Quantity;
|
||||||
|
@ -90,7 +90,7 @@ namespace eShopOnContainers.Core.ViewModels
|
|||||||
ZipCode = userInfo?.ZipCode,
|
ZipCode = userInfo?.ZipCode,
|
||||||
State = userInfo?.State,
|
State = userInfo?.State,
|
||||||
Country = userInfo?.Country,
|
Country = userInfo?.Country,
|
||||||
City = string.Empty
|
City = userInfo?.Address
|
||||||
};
|
};
|
||||||
|
|
||||||
// Create Payment Info
|
// Create Payment Info
|
||||||
@ -117,7 +117,8 @@ namespace eShopOnContainers.Core.ViewModels
|
|||||||
ShippingState = _shippingAddress.State,
|
ShippingState = _shippingAddress.State,
|
||||||
ShippingCountry = _shippingAddress.Country,
|
ShippingCountry = _shippingAddress.Country,
|
||||||
ShippingStreet = _shippingAddress.Street,
|
ShippingStreet = _shippingAddress.Street,
|
||||||
ShippingCity = _shippingAddress.City,
|
ShippingCity = _shippingAddress.City,
|
||||||
|
ShippingZipCode = _shippingAddress.ZipCode,
|
||||||
Total = CalculateTotal(CreateOrderItems(orderItems))
|
Total = CalculateTotal(CreateOrderItems(orderItems))
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -44,5 +44,16 @@ namespace eShopOnContainers.Core.Views
|
|||||||
await profileViewModel.InitializeAsync(null);
|
await profileViewModel.InitializeAsync(null);
|
||||||
ProfileView.BindingContext = profileViewModel;
|
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.ColumnDefinitions>
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="*" />
|
<RowDefinition Height="*" />
|
||||||
|
<RowDefinition Height="Auto" />
|
||||||
<RowDefinition Height="1" />
|
<RowDefinition Height="1" />
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
<!-- IMAGE -->
|
<!-- IMAGE -->
|
||||||
@ -131,10 +132,24 @@
|
|||||||
Text="{Binding Total, StringFormat='${0:N}'}"
|
Text="{Binding Total, StringFormat='${0:N}'}"
|
||||||
Style="{StaticResource OrderTotalStyle}"/>
|
Style="{StaticResource OrderTotalStyle}"/>
|
||||||
</Grid>
|
</Grid>
|
||||||
<Grid
|
<Grid
|
||||||
Grid.Column="0"
|
Grid.Column="0"
|
||||||
Grid.ColumnSpan="2"
|
Grid.ColumnSpan="2"
|
||||||
Grid.Row="1"
|
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"/>
|
BackgroundColor="Gray"/>
|
||||||
</Grid>
|
</Grid>
|
||||||
</ContentView.Content>
|
</ContentView.Content>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user