From e2691c2d02649d66b49b0802f508818413e4364c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A1=D0=95=D0=9C=D0=90?= Date: Mon, 7 Sep 2026 15:12:53 +0300 Subject: [PATCH] =?UTF-8?q?=D0=A2=D0=B0=D1=80=D0=B8=D1=84=D1=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/lib/PrintMenu.svelte | 45 ++++++++++++++++++++++++++++++++++++---- update_nvm.sh | 11 ++++++++++ 2 files changed, 52 insertions(+), 4 deletions(-) create mode 100755 update_nvm.sh diff --git a/src/lib/PrintMenu.svelte b/src/lib/PrintMenu.svelte index c6e112e..d486821 100644 --- a/src/lib/PrintMenu.svelte +++ b/src/lib/PrintMenu.svelte @@ -33,7 +33,6 @@ let isPrinting = $state(false); let uid = 0; - const PRICE_PER_PAGE = 9; const qualities = [ { id: 'low', label: 'Эконом' }, @@ -46,6 +45,13 @@ { id: 'color', label: 'Цвет' } ]; + // ── Тарифная сетка ── + function getPricePerPage(pagesCount) { + if (pagesCount >= 1000) return 4; + if (pagesCount >= 25) return 9; + return 10; + } + // ── Вспомогательная функция для реактивного обновления ── function updateFile(id, changes) { files = files.map(f => f.id === id ? { ...f, ...changes } : f); @@ -300,14 +306,17 @@ function qualityFillFor(file) { return Math.round((file.qualityIndex / (qualities.length - 1)) * 100); } function updateQuality(file, val) { updateFile(file.id, { qualityIndex: val }); } - // ── Расчет цены ── + // ── Расчет цены (ОБНОВЛЕННАЯ ЛОГИКА) ── const totalPrice = $derived(() => { let sum = 0; for (const f of files) { const pagesCount = f.selectedPages ? f.selectedPages.size : 0; - sum += pagesCount * f.copies; + if (pagesCount > 0) { + const pricePerPage = getPricePerPage(pagesCount); + sum += pagesCount * f.copies * pricePerPage; + } } - return sum * PRICE_PER_PAGE; + return sum; }); const extraCopies = $derived(files.reduce((sum, f) => sum + (f.copies - 1), 0)); @@ -484,6 +493,14 @@ {#if extraCopies > 0}, {extraCopies} {plCopies(extraCopies)}{/if}

{/if} + + +
+ (f.selectedPages?.size || 0) < 25)}>10р/л от 1 + { const s = f.selectedPages?.size || 0; return s >= 25 && s < 1000; })}>9р/л от 25 + (f.selectedPages?.size || 0) >= 1000)}>4р/л от 1000 +
+
Итого {totalPrice()}₽ @@ -607,6 +624,26 @@ .action-btn:disabled { opacity: 0.6; cursor: wait; } .action-btn.primary { background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%); box-shadow: 0 8px 24px -6px rgba(99, 102, 241, 0.5); } .action-btn.secondary { background: linear-gradient(135deg, #5b8cff 0%, #38c6ff 100%); box-shadow: 0 8px 24px -6px rgba(72, 150, 255, 0.4); } + + /* ── Стили расценки ── */ + .pricing-info { + display: flex; + justify-content: center; + gap: 12px; + font-size: 10px; + line-height: 1.2; + color: rgba(255, 255, 255, 0.25); + margin-bottom: 4px; + user-select: none; + flex-wrap: wrap; + } + .price-tier { + transition: color 0.2s ease; + } + .price-tier.active { + color: rgba(255, 255, 255, 0.6); + } + .price-summary { display: flex; justify-content: space-between; align-items: baseline; width: 100%; } .summary-itogo { font-size: 30px; font-weight: 700; color: #8b93a1; } .summary-price { font-size: 38px; font-weight: 800; color: #fff; } diff --git a/update_nvm.sh b/update_nvm.sh new file mode 100755 index 0000000..848d957 --- /dev/null +++ b/update_nvm.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +# Загружаем nvm +export NVM_DIR="$HOME/.nvm" +[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" + +# Устанавливаем LTS версию Node.js +nvm install --lts + +# Обновляем npm до последней версии +npm install -g npm@latest