Files
FrontOffice/src/FrontOffice.Main/Pages/Store/OrderDetail.razor.cs

50 lines
1.5 KiB
C#
Raw Normal View History

using FrontOffice.BFF.UserOrder.Protobuf.Protos.UserOrder;
using FrontOffice.Main.Utilities;
using Microsoft.AspNetCore.Components;
namespace FrontOffice.Main.Pages.Store;
public partial class OrderDetail : ComponentBase
{
[Inject] private OrderService OrderService { get; set; } = default!;
[Parameter] public long id { get; set; }
private GetUserOrderResponse? _order;
private bool _loading;
protected override async Task OnParametersSetAsync()
{
_loading = true;
_order = await OrderService.GetOrderAsync(id);
_loading = false;
}
private static string FormatPrice(long price) => string.Format("{0:N0} تومان", price);
private string GetStatusText(PaymentStatus orderPaymentStatus)
{
return orderPaymentStatus switch
{
PaymentStatus.Pending => "در انتظار پرداخت",
PaymentStatus.Success => "پرداخت شده",
PaymentStatus.Reject => "پرداخت ناموفق",
_ => "نامشخص",
};
}
private string GetPaymentMethodText(PaymentMethod orderPaymentMethod)
{
return orderPaymentMethod switch
{
PaymentMethod.Wallet => "کیف پول",
PaymentMethod.Ipg => "درگاه پرداخت اینترنتی",
_ => "نامشخص",
};
}
private static string GetProductImageUrl(string? imageUrl)
=> string.IsNullOrWhiteSpace(imageUrl) ? "/images/product-placeholder.svg" : UrlUtility.DownloadUrl+imageUrl;
}