This commit is contained in:
MeysamMoghaddam
2025-10-13 18:38:02 +03:30
parent d68f0189f4
commit 15d9f7f96a
2 changed files with 78 additions and 57 deletions
+59 -48
View File
@@ -13,7 +13,7 @@
<MudStack Row="true" AlignItems="AlignItems.Center" Spacing="3">
<MudIcon Icon="@Icons.Material.Filled.ShoppingCart" Size="Size.Large" Color="Color.Primary" />
<div>
<MudText Typo="Typo.h4" >تکمیل خرید</MudText>
<MudText Typo="Typo.h4">تکمیل خرید</MudText>
<MudText Typo="Typo.body2" Class="mud-text-secondary">مرحله نهایی خرید پکیج</MudText>
</div>
</MudStack>
@@ -86,29 +86,41 @@
Elevation="@(_selectedAddress?.Id == address.Id ? 4 : 0)"
Class="pa-3 rounded-xl cursor-pointer"
Style="@(_selectedAddress?.Id == address.Id ? "border: 2px solid var(--mud-palette-primary);" : "")"
OnClick="() => SelectAddress(address)">
@onclick="() => SetAddressAsDefault(address.Id)">
<MudStack Spacing="1">
<MudStack Row="true" AlignItems="AlignItems.Center" Spacing="2">
<MudRadio T="long" Value="address.Id" Checked="@(_selectedAddress?.Id == address.Id)" />
<MudText Typo="Typo.subtitle2">@address.Title</MudText>
<MudCheckBox @bind-Value="address.IsDefault"
Disabled="true"
Color="Color.Primary" />
<MudText Typo="Typo.subtitle2">@(address.Title)</MudText>
@if (address.IsDefault)
{
<MudChip T="string" Color="Color.Success" Variant="Variant.Filled" Size="Size.Small">پیش‌فرض</MudChip>
}
@if (!address.IsDefault)
{
<MudButton Variant="Variant.Text"
Color="Color.Primary"
Size="Size.Small"
OnClick="() => SetAddressAsDefault(address.Id)">
تنظیم به عنوان پیش‌فرض
</MudButton>
@if (_isSettingDefaultAddress && _settingDefaultAddressId == address.Id)
{
<MudProgressCircular Size="Size.Small" Color="Color.Primary" Indeterminate="true" />
}
else
{
<MudButton Variant="Variant.Text"
Color="Color.Primary"
Size="Size.Small"
OnClick="() => SetAddressAsDefault(address.Id)">
تنظیم به عنوان پیش‌فرض
</MudButton>
}
}
</MudStack>
<MudText Typo="Typo.body2" Class="mud-text-secondary">@address.Address</MudText>
<MudText Typo="Typo.caption" Class="mud-text-secondary">کد پستی: @address.PostalCode</MudText>
<MudStack Row="true">
<MudText Typo="Typo.body2" Class="mud-text-secondary">@(address.Address)</MudText>
<MudSpacer />
<MudText Typo="Typo.caption" Class="mud-text-secondary">کد پستی: @(address.PostalCode)</MudText>
</MudStack>
</MudPaper>
</MudStack>
</MudPaper>
}
</MudStack>
}
@@ -140,23 +152,22 @@
<MudPaper Elevation="4" Class="pa-6">
<MudText Typo="Typo.h5" Class="mb-4">کد تخفیف</MudText>
<MudStack Spacing="3">
<MudStack Row="true" Spacing="2" AlignItems="AlignItems.Stretch">
<MudTextField @bind-Value="_discountCode"
Label="کد تخفیف"
Variant="Variant.Outlined"
Class="flex-grow-1"
Placeholder="کد تخفیف خود را وارد کنید" />
<MudButton Variant="Variant.Filled"
Color="Color.Secondary"
OnClick="ApplyDiscountCode"
Disabled="_isApplyingDiscount">
اعمال
</MudButton>
</MudStack>
<MudTextField @bind-Value="_discountCode"
Label="کد تخفیف"
Variant="Variant.Outlined"
Class="flex-grow-1"
Placeholder="کد تخفیف خود را وارد کنید" />
<MudButton Variant="Variant.Filled"
Color="Color.Secondary"
OnClick="ApplyDiscountCode"
Disabled="_isApplyingDiscount">
اعمال
</MudButton>
@if (!string.IsNullOrWhiteSpace(_discountMessage))
{
<MudText Typo="Typo.caption" Color="@(_discountApplied ? Color.Success : Color.Error)" Class="mt-2">
@_discountMessage
@(_discountMessage)
</MudText>
}
</MudStack>
@@ -170,37 +181,37 @@
<MudStack Spacing="3">
<MudStack Row="true" Justify="Justify.SpaceBetween">
<MudText Typo="Typo.body1">پکیج @(_selectedPackage.Title)</MudText>
<MudText Typo="Typo.body1">@_selectedPackage.Price.ToThousands().ToCurrencyUnitIRT()</MudText>
</MudStack>
<MudText Typo="Typo.body1">@(_selectedPackage.Title)</MudText>
<MudText Typo="Typo.body1">@(_selectedPackage.Price.ToThousands().ToCurrencyUnitIRT())</MudText>
</MudStack>
@if (_discountApplied && _discountAmount > 0)
@if (_discountApplied && _discountAmount > 0)
{
<MudStack Row="true" Justify="Justify.SpaceBetween">
<MudText Typo="Typo.body2" Color="Color.Success">تخفیف (@_discountCode)</MudText>
<MudText Typo="Typo.body2" Color="Color.Success">-@_discountAmount.ToThousands().ToCurrencyUnitIRT()</MudText>
</MudStack>
<MudText Typo="Typo.body2" Color="Color.Success">تخفیف (@(_discountCode))</MudText>
<MudText Typo="Typo.body2" Color="Color.Success">-@(_discountAmount.ToThousands().ToCurrencyUnitIRT())</MudText>
</MudStack>
}
<MudDivider />
<MudStack Row="true" Justify="Justify.SpaceBetween">
<MudText Typo="Typo.h6" >مجموع</MudText>
<MudText Typo="Typo.h6" Color="Color.Primary">@_finalPrice.ToThousands().ToCurrencyUnitIRT()</MudText>
</MudStack>
<MudText Typo="Typo.h6">مجموع</MudText>
<MudText Typo="Typo.h6" Color="Color.Primary">@(_finalPrice.ToThousands().ToCurrencyUnitIRT())</MudText>
</MudStack>
<MudButton Variant="Variant.Filled"
Color="Color.Success"
Size="Size.Large"
FullWidth="true"
StartIcon="@Icons.Material.Filled.Payment"
OnClick="ProcessPayment"
Disabled="@(!CanProceedToPayment || _isProcessingPayment)"
Class="mt-2">
@(_isProcessingPayment ? "در حال پردازش..." : "پرداخت آنلاین")
</MudButton>
<MudButton Variant="Variant.Filled"
Color="Color.Success"
Size="Size.Large"
FullWidth="true"
StartIcon="@Icons.Material.Filled.Payment"
OnClick="ProcessPayment"
Disabled="@(!CanProceedToPayment || _isProcessingPayment)"
Class="mt-2">
@(_isProcessingPayment ? "در حال پردازش..." : "پرداخت آنلاین")
</MudButton>
@if (!CanProceedToPayment)
@if (!CanProceedToPayment)
{
<MudText Typo="Typo.caption" Color="Color.Error" Align="Align.Center">
لطفاً پکیج و آدرس را انتخاب کنید.