From 9c6092262c08515c502d35738d8c5d9845dbe87c Mon Sep 17 00:00:00 2001 From: Andrey Smakotin Date: Sat, 29 Nov 2025 22:29:28 +0300 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=B0=20=D0=B0=D0=B2=D1=82=D0=BE=D0=BF=D0=BE=D0=B4=D1=81?= =?UTF-8?q?=D1=82=D0=B0=D0=BD=D0=BE=D0=B2=D0=BA=D0=B0=20=D1=81=D1=83=D0=BC?= =?UTF-8?q?=D0=BC=D1=8B=20=D0=B4=D0=BB=D1=8F=20=D0=BE=D0=BF=D0=BB=D0=B0?= =?UTF-8?q?=D1=82=D1=8B=20=D1=81=20=D0=BA=D0=BE=D1=88=D0=B5=D0=BB=D1=8C?= =?UTF-8?q?=D0=BA=D0=B0=20=D0=B8=20=D0=BF=D0=BE=D0=B4=D1=81=D0=BA=D0=B0?= =?UTF-8?q?=D0=B7=D0=BA=D0=B0=20=D0=BF=D1=80=D0=B8=20=D0=BD=D1=83=D0=BB?= =?UTF-8?q?=D0=B5=D0=B2=D0=BE=D0=BC=20=D0=B1=D0=B0=D0=BB=D0=B0=D0=BD=D1=81?= =?UTF-8?q?=D0=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../orders/templates/orders/order_form.html | 23 ++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/myproject/orders/templates/orders/order_form.html b/myproject/orders/templates/orders/order_form.html index 8fb01c3..1d0f2ae 100644 --- a/myproject/orders/templates/orders/order_form.html +++ b/myproject/orders/templates/orders/order_form.html @@ -695,6 +695,10 @@ + + @@ -884,6 +888,7 @@ document.addEventListener('DOMContentLoaded', function() { const amountInput = document.getElementById('unified-amount'); const amountHint = document.getElementById('amount-hint'); const amountMaxSpan = document.getElementById('amount-max'); + const walletEmptyHint = document.getElementById('wallet-empty-hint'); const refundReasonWrap = document.getElementById('refund-reason-wrap'); const refundReasonInput = document.getElementById('refund-reason'); @@ -974,12 +979,28 @@ document.addEventListener('DOMContentLoaded', function() { // Выбор способа (не активируем по умолчанию) methodButtons.forEach(btn => { btn.addEventListener('click', () => { + const methodCode = btn.dataset.code; + + // Скрываем подсказку перед проверкой + if (walletEmptyHint) walletEmptyHint.style.display = 'none'; + + // Проверяем баланс кошелька для платежа + if (currentMode === 'payment' && methodCode === 'account_balance' && walletBalance === 0) { + if (walletEmptyHint) walletEmptyHint.style.display = 'block'; + return; + } + methodButtons.forEach(b => b.classList.remove('active')); btn.classList.add('active'); methodHidden.value = btn.dataset.id; - currentMethodCode = btn.dataset.code; + currentMethodCode = methodCode; if (currentMode === 'payment') { + // Для кошелька: подставляем максимум из (остаток к оплате, баланс) + if (methodCode === 'account_balance') { + const max = Math.min(amountDue, walletBalance); + amountInput.value = max.toFixed(2); + } updateLimitsForPayment(); } else { updateLimitsForRefund();