2025-11-28 05:12:55 +03:30
|
|
|
using FrontOffice.BFF.UserOrder.Protobuf.Protos.UserOrder;
|
2025-11-17 02:53:51 +03:30
|
|
|
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; }
|
|
|
|
|
|
2025-11-28 05:12:55 +03:30
|
|
|
private GetUserOrderResponse? _order;
|
2025-11-17 02:53:51 +03:30
|
|
|
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);
|
2025-11-28 05:12:55 +03:30
|
|
|
|
|
|
|
|
private string GetStatusText(PaymentStatus orderPaymentStatus)
|
2025-11-17 02:53:51 +03:30
|
|
|
{
|
2025-11-28 05:12:55 +03:30
|
|
|
return orderPaymentStatus switch
|
|
|
|
|
{
|
|
|
|
|
PaymentStatus.Pending => "در انتظار پرداخت",
|
|
|
|
|
PaymentStatus.Success => "پرداخت شده",
|
|
|
|
|
PaymentStatus.Reject => "پرداخت ناموفق",
|
|
|
|
|
_ => "نامشخص",
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private string GetPaymentMethodText(PaymentMethod orderPaymentMethod)
|
|
|
|
|
{
|
|
|
|
|
return orderPaymentMethod switch
|
|
|
|
|
{
|
|
|
|
|
PaymentMethod.Wallet => "کیف پول",
|
|
|
|
|
PaymentMethod.Ipg => "درگاه پرداخت اینترنتی",
|
|
|
|
|
_ => "نامشخص",
|
|
|
|
|
};
|
|
|
|
|
}
|
2025-11-28 13:35:26 +03:30
|
|
|
|
|
|
|
|
private static string GetProductImageUrl(string? imageUrl)
|
|
|
|
|
=> string.IsNullOrWhiteSpace(imageUrl) ? "/images/product-placeholder.svg" : UrlUtility.DownloadUrl+imageUrl;
|
2025-11-17 02:53:51 +03:30
|
|
|
}
|
|
|
|
|
|