Compare commits
No commits in common. "pages" and "main" have entirely different histories.
33
index.html
33
index.html
@ -36,7 +36,7 @@
|
|||||||
|
|
||||||
<section class="kt-ai-hero" data-align="center">
|
<section class="kt-ai-hero" data-align="center">
|
||||||
<div class="kt-ai-wrap">
|
<div class="kt-ai-wrap">
|
||||||
<h1 class="reveal" style="color: var(--kt-ai-ok)">Рассчитайте стоимость подключения</h1>
|
<h1 class="reveal">Рассчитайте стоимость подключения</h1>
|
||||||
<p class="kt-ai-hero-sub reveal">Выберите тариф, скорость и оборудование — сумма обновится автоматически</p>
|
<p class="kt-ai-hero-sub reveal">Выберите тариф, скорость и оборудование — сумма обновится автоматически</p>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
@ -67,10 +67,6 @@
|
|||||||
<div class="total-block reveal">
|
<div class="total-block reveal">
|
||||||
<span style="font-size: var(--kt-ai-text-lg); color: var(--kt-ai-fg-muted)">Итого в месяц</span>
|
<span style="font-size: var(--kt-ai-text-lg); color: var(--kt-ai-fg-muted)">Итого в месяц</span>
|
||||||
<div class="total-amount" id="totalAmount">0 ₸</div>
|
<div class="total-amount" id="totalAmount">0 ₸</div>
|
||||||
<label class="kt-ai-card" style="display: inline-flex; align-items: center; gap: var(--kt-ai-space-3); padding: var(--kt-ai-space-4) var(--kt-ai-space-5); margin: var(--kt-ai-space-5) 0; cursor: pointer">
|
|
||||||
<input type="checkbox" id="discountCheck" style="width: 18px; height: 18px">
|
|
||||||
<span style="font-weight: var(--kt-ai-weight-medium)">Скидка 10% для сотрудников КТ</span>
|
|
||||||
</label>
|
|
||||||
<button class="kt-ai-btn" data-variant="primary" data-size="lg" id="copyBtn">
|
<button class="kt-ai-btn" data-variant="primary" data-size="lg" id="copyBtn">
|
||||||
<svg class="kt-icon" style="margin-right: 8px"><use href="#copy"></use></svg>
|
<svg class="kt-icon" style="margin-right: 8px"><use href="#copy"></use></svg>
|
||||||
Скопировать расчёт
|
Скопировать расчёт
|
||||||
@ -118,8 +114,7 @@ const EQUIPMENT = [
|
|||||||
let state = {
|
let state = {
|
||||||
tariff: null,
|
tariff: null,
|
||||||
speed: null,
|
speed: null,
|
||||||
equipment: null,
|
equipment: null
|
||||||
discount: false
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Инициализация
|
// Инициализация
|
||||||
@ -129,7 +124,6 @@ function init() {
|
|||||||
updateTotal();
|
updateTotal();
|
||||||
renderJournal();
|
renderJournal();
|
||||||
setupReveal();
|
setupReveal();
|
||||||
setupDiscount();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Рендер опций
|
// Рендер опций
|
||||||
@ -189,10 +183,7 @@ function updateTotal() {
|
|||||||
const e = EQUIPMENT.find(x => x.id === state.equipment);
|
const e = EQUIPMENT.find(x => x.id === state.equipment);
|
||||||
total += e.price;
|
total += e.price;
|
||||||
}
|
}
|
||||||
if (state.discount) {
|
document.getElementById('totalAmount').textContent = total.toLocaleString() + ' ₸';
|
||||||
total = total * 0.9;
|
|
||||||
}
|
|
||||||
document.getElementById('totalAmount').textContent = Math.round(total).toLocaleString() + ' ₸';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// LocalStorage
|
// LocalStorage
|
||||||
@ -209,18 +200,6 @@ function loadState() {
|
|||||||
} catch (e) {}
|
} catch (e) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Скидка
|
|
||||||
function setupDiscount() {
|
|
||||||
const check = document.getElementById('discountCheck');
|
|
||||||
check.checked = state.discount;
|
|
||||||
check.addEventListener('change', () => {
|
|
||||||
state.discount = check.checked;
|
|
||||||
saveState();
|
|
||||||
updateTotal();
|
|
||||||
logAction();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// Журнал
|
// Журнал
|
||||||
function logAction() {
|
function logAction() {
|
||||||
const entry = {
|
const entry = {
|
||||||
@ -246,8 +225,7 @@ function calculateTotal() {
|
|||||||
if (state.tariff) total += TARIFFS.find(x => x.id === state.tariff).price;
|
if (state.tariff) total += TARIFFS.find(x => x.id === state.tariff).price;
|
||||||
if (state.speed) total += SPEEDS.find(x => x.id === state.speed).price;
|
if (state.speed) total += SPEEDS.find(x => x.id === state.speed).price;
|
||||||
if (state.equipment) total += EQUIPMENT.find(x => x.id === state.equipment).price;
|
if (state.equipment) total += EQUIPMENT.find(x => x.id === state.equipment).price;
|
||||||
if (state.discount) total = total * 0.9;
|
return total;
|
||||||
return Math.round(total);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function renderJournal() {
|
function renderJournal() {
|
||||||
@ -290,12 +268,11 @@ document.getElementById('copyBtn').addEventListener('click', () => {
|
|||||||
const e = EQUIPMENT.find(x => x.id === state.equipment);
|
const e = EQUIPMENT.find(x => x.id === state.equipment);
|
||||||
const total = calculateTotal();
|
const total = calculateTotal();
|
||||||
|
|
||||||
const discountText = state.discount ? '\n🎁 Скидка 10% (сотрудник КТ): применена' : '';
|
|
||||||
const text = `📊 Расчёт стоимости подключения:
|
const text = `📊 Расчёт стоимости подключения:
|
||||||
|
|
||||||
🔹 Тариф: ${t.name} — ${t.price.toLocaleString()} ₸
|
🔹 Тариф: ${t.name} — ${t.price.toLocaleString()} ₸
|
||||||
🔹 Скорость: ${s.name} — ${s.price === 0 ? 'Бесплатно' : '+' + s.price.toLocaleString() + ' ₸'}
|
🔹 Скорость: ${s.name} — ${s.price === 0 ? 'Бесплатно' : '+' + s.price.toLocaleString() + ' ₸'}
|
||||||
🔹 Оборудование: ${e.name} — ${e.price === 0 ? 'Бесплатно' : '+' + e.price.toLocaleString() + ' ₸/мес'}${discountText}
|
🔹 Оборудование: ${e.name} — ${e.price === 0 ? 'Бесплатно' : '+' + e.price.toLocaleString() + ' ₸/мес'}
|
||||||
|
|
||||||
💰 Итого: ${total.toLocaleString()} ₸ в месяц`;
|
💰 Итого: ${total.toLocaleString()} ₸ в месяц`;
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user