EATS IS AUTO

Загрузка лучших предложений...

Уведомление

Вопрос по авто?

Менеджер Александр онлайн

ГОРЯЧЕЕ ПРЕДЛОЖЕНИЕ

...

...

...
Финансовые гарантии
Доставка 14-21 день
AI-Подбор

Выбирайте Лучшее из Азии

Наведите на карточку, чтобы увидеть детали и цену "под ключ". Доставка от 14 дней.

Быстрый подбор авто

Скачайте ТОП-50 авто до 160 л.с.

Свежая подборка выгодных автомобилей. Обновлено сегодня.

Eats.Tech Ecosystem

Технологии Надежности

AI-Подбор

Нейросеть отбирает только лучшие лоты без ДТП.

SCANNING VIN...

GPS-Трекинг

Отслеживайте авто в реальном времени.

Финансовый Щит

Работаем через эскроу-счета. SWIFT-переводы с прозрачным трекингом. Полная страховка.

ESCROW PROTECTED

Видео-Отчеты

Детальные видео-обзоры 4K перед покупкой. Проверка толщиномером.

REC

Лидеры продаж 2025

const words = titlePlain.split(' '); const make = words.shift() || titlePlain; const model = words.join(' ').trim() || make; const priceChinaVal = acf.price_china ? Number(acf.price_china) : 0; const priceChina = priceChinaVal ? rubFormatter.format(priceChinaVal) : null; const priceCustomsVal = acf.price_customs ? Number(acf.price_customs) : 0; const priceCustoms = priceCustomsVal ? rubFormatter.format(priceCustomsVal) : null; const priceDeliveryVal = acf.price_delivery ? Number(acf.price_delivery) : 0; const priceDelivery = priceDeliveryVal ? rubFormatter.format(priceDeliveryVal) : null; const savingsVal = acf.market_savings ? Number(acf.market_savings) : 0; const savings = savingsVal ? rubFormatter.format(savingsVal) : null; return { id: item.id, title: titleRaw, titlePlain, price, img: imgSource, status: acf.status || 'В наличии', link: item.link || '#', year: acf.year || '—', mileage: acf.mileage || '—', engine: acf.engine_type || '—', drive: acf.drive_type || '—', features, gallery, description: item.acf.car_description || '', priceChina, priceCustoms, priceDelivery, savings, isHeroSlide: acf.is_hero_slide || false, techAcceleration: acf.tech_acceleration || '', techRange: acf.tech_range || '', isHot: acf.is_hot_deal || false, hotText: acf.hot_deal_text || '', make, model }; } function loadHeroSlider() { const heroContainer = document.getElementById('heroAccordion'); if (!heroContainer) { return; } // Фильтруем машины с isHeroSlide === true и берем первые 4 const heroCars = carDb.filter(car => car.isHeroSlide === true).slice(0, 4); if (heroCars.length === 0) { heroContainer.innerHTML = ''; return; } heroContainer.innerHTML = ''; heroCars.forEach((car, index) => { const isActive = index === 0 ? 'active' : ''; const imgUrl = car.img || placeholderCarImage; const title = car.titlePlain || 'Автомобиль'; const acceleration = car.techAcceleration || '—'; const range = car.techRange || '—'; const savingsText = car.savings ? `-${car.savings}` : '—'; const priceText = car.price ? `${car.price} ₽` : 'Цена по запросу'; const cardHTML = `
${title.toUpperCase()}
${index === 0 ? 'ХИТ' : ''}

${title}

Разгон
${acceleration}
Запас
${range}
Выгода
${savingsText}
${priceText}
`; heroContainer.innerHTML += cardHTML; }); } async function loadBlogPosts() { const container = document.getElementById('blog-posts-container'); if (!container) { return; } container.innerHTML = '
Загружаем записи...
'; try { const response = await fetch(postApiEndpoint); if (!response.ok) { throw new Error('Network response was not ok'); } const posts = await response.json(); if (!posts.length) { container.innerHTML = '
Пока нет записей.
'; return; } container.innerHTML = posts.map((item) => { const cover = item._embedded?.['wp:featuredmedia']?.[0]?.source_url || placeholderCarImage; const title = item.title?.rendered || 'Новая запись'; const excerpt = item.excerpt?.rendered || ''; const dateLabel = item.date ? new Date(item.date).toLocaleDateString('ru-RU', { day: 'numeric', month: 'long' }) : 'Свежая публикация'; return `
${stripTags(title)}
${dateLabel}

${title}

${excerpt}
`; }).join(''); } catch (error) { console.error('Не удалось загрузить блог', error); container.innerHTML = '
Не удалось загрузить записи. Попробуйте позже.
'; } } function populateMakes() { if (!carDataMap) { return; } const makes = Object.keys(carDataMap).sort(); const selectIds = ['quick-search-make', 'catalog-filter-make']; selectIds.forEach((id) => { const select = document.getElementById(id); if (!select) { return; } const firstOption = select.querySelector('option')?.cloneNode(true); select.innerHTML = ''; if (firstOption) { select.appendChild(firstOption); } makes.forEach((make) => { const option = document.createElement('option'); option.value = make; option.textContent = make; select.appendChild(option); }); }); } function updateModels(makeSelectId, modelSelectId) { const makeSelect = document.getElementById(makeSelectId); const modelSelect = document.getElementById(modelSelectId); if (!makeSelect || !modelSelect) { return; } const selectedMake = makeSelect.value; modelSelect.innerHTML = ''; if (selectedMake && selectedMake !== 'all' && carDataMap[selectedMake]) { modelSelect.disabled = false; const placeholderOption = document.createElement('option'); placeholderOption.value = ''; placeholderOption.textContent = 'Любая модель'; modelSelect.appendChild(placeholderOption); carDataMap[selectedMake].forEach((model) => { const option = document.createElement('option'); option.value = model; option.textContent = model; modelSelect.appendChild(option); }); } else { modelSelect.disabled = true; const option = document.createElement('option'); option.value = ''; option.textContent = makeSelectId === 'catalog-filter-make' ? 'Сначала выберите марку' : 'Сначала выберите марку'; modelSelect.appendChild(option); } } function setActiveCard(card) { document.querySelectorAll('.hero-card').forEach((c) => c.classList.remove('active')); card.classList.add('active'); } function showNotification(title, message = '') { const container = document.getElementById('notification'); if (!container) { return; } const titleEl = document.getElementById('notification-title'); const messageEl = document.getElementById('notification-message'); if (titleEl) { titleEl.textContent = title; } if (messageEl) { messageEl.textContent = message; } container.classList.add('show'); setTimeout(() => container.classList.remove('show'), 3000); } function hideNotification() { const container = document.getElementById('notification'); if (container) { container.classList.remove('show'); } } function closeHotDeal() { const modal = document.getElementById('hot-deal-modal'); if (modal) { modal.classList.remove('show'); } } function initHotDeal() { // Ищем первую машину с isHot === true const hotCar = carDb.find(car => car.isHot === true); if (!hotCar) { // Если горячих машин нет - окно не показывается return; } const modal = document.getElementById('hot-deal-modal'); const imgEl = document.getElementById('hot-deal-img'); const titleEl = document.getElementById('hot-deal-title'); const textEl = document.getElementById('hot-deal-text'); const oldPriceEl = document.getElementById('hot-deal-old-price'); const priceEl = document.getElementById('hot-deal-price'); const btnEl = document.getElementById('hot-deal-btn'); if (!modal || !imgEl || !titleEl || !textEl || !priceEl || !btnEl) { return; } // Заполняем картинку imgEl.src = hotCar.img || placeholderCarImage; // Заполняем заголовок titleEl.textContent = hotCar.titlePlain || 'Автомобиль'; // Заполняем текст (используем hotText или savings) if (hotCar.hotText) { textEl.textContent = hotCar.hotText; } else if (hotCar.savings) { textEl.textContent = `Выгода ${hotCar.savings} ₽`; } else { textEl.textContent = 'Специальное предложение'; } // Заполняем цены if (hotCar.price) { priceEl.textContent = hotCar.price + ' ₽'; // Если есть старая цена (можно вычислить из savings или просто скрыть) if (hotCar.savings && hotCar.priceChina) { // Вычисляем старую цену как текущую + выгода const oldPriceVal = parseFloat(hotCar.price.replace(/\s/g, '').replace(/[,₽]/g, '')) + parseFloat(hotCar.savings.replace(/\s/g, '').replace(/[,₽]/g, '')); if (oldPriceVal && !isNaN(oldPriceVal)) { oldPriceEl.textContent = rubFormatter.format(oldPriceVal) + ' ₽'; oldPriceEl.style.display = 'block'; } else { oldPriceEl.style.display = 'none'; } } else { oldPriceEl.style.display = 'none'; } } else { priceEl.textContent = 'Цена по запросу'; oldPriceEl.style.display = 'none'; } // На кнопку вешаем onclick btnEl.onclick = () => { openProductPage(hotCar.id); }; // Показываем окно через 5 секунд setTimeout(() => { modal.classList.add('show'); }, 5000); } function closeManagerWidget() { const widget = document.getElementById('manager-widget'); if (widget) { widget.classList.remove('show'); } } function openPage(id) { const target = document.getElementById(id); if (!target) { return; } target.classList.remove('hidden'); if (id === 'catalog-view') { renderCatalog(); } } function closePage(id) { const target = document.getElementById(id); if (target) { target.classList.add('hidden'); } } function closeAllPages() { document.querySelectorAll('section[id^="page-"], #catalog-view, #product-view').forEach((el) => el.classList.add('hidden')); } function openMenu() { const panel = document.getElementById('menu-panel'); const content = document.getElementById('menu-content'); if (panel && content) { panel.classList.remove('hidden'); requestAnimationFrame(() => content.classList.remove('translate-x-full')); } } function closeMenu() { const panel = document.getElementById('menu-panel'); const content = document.getElementById('menu-content'); if (panel && content) { content.classList.add('translate-x-full'); setTimeout(() => panel.classList.add('hidden'), 300); } } function downloadLeadMagnet(e) { e.preventDefault(); const form = e.target; const button = form.querySelector('button[type="submit"]'); const phoneInput = document.getElementById('lead-phone'); const originalText = button?.innerHTML; if (button) { button.innerHTML = ' Отправка...'; } setTimeout(() => { if (button && originalText) { button.innerHTML = originalText; } if (phoneInput) { phoneInput.value = ''; } showNotification('Успешно!', 'Список отправлен в WhatsApp'); }, 1500); } function submitOrder(e) { e.preventDefault(); showNotification('Заявка принята!', 'Менеджер свяжется в течение 5 минут.'); e.target.reset(); } function startAIChat() { if (aiBootstrapped) { return; } aiBootstrapped = true; addAIMessage('Привет! Я AI-консультант EATS. Какой автомобиль ищем сегодня?', 300); const optionsContainer = document.getElementById('ai-options'); if (optionsContainer) { optionsContainer.innerHTML = ` `; } } function addAIMessage(text, delay = 0) { const container = document.getElementById('ai-chat-container'); if (!container) { return; } setTimeout(() => { const message = document.createElement('div'); message.className = 'ai-message animate-fade-in'; message.textContent = text; container.appendChild(message); container.scrollTop = container.scrollHeight; }, delay); } function handleUserOption(text) { const container = document.getElementById('ai-chat-container'); const optionsContainer = document.getElementById('ai-options'); if (!container) { return; } const userMessage = document.createElement('div'); userMessage.className = 'user-message animate-slide-up'; userMessage.textContent = text; container.appendChild(userMessage); container.scrollTop = container.scrollHeight; if (optionsContainer) { optionsContainer.innerHTML = ''; } addAIMessage('Анализирую базы Encar и Autohome...', 500); addAIMessage(`Нашёл 12 надежных вариантов в категории "${text}". Могу отправить отчёт в Telegram.`, 2500); setTimeout(() => { const linkWrapper = document.createElement('div'); linkWrapper.className = 'mt-4 text-center'; linkWrapper.innerHTML = ` Получить отчёт в Telegram `; container.appendChild(linkWrapper); container.scrollTop = container.scrollHeight; }, 4500); } function calculateCustoms() { const price = parseFloat(document.getElementById('calc-price')?.value || '0'); const currency = document.getElementById('calc-currency')?.value || 'CNY'; const volume = parseFloat(document.getElementById('calc-volume')?.value || '0'); const age = document.getElementById('calc-age')?.value || '3-5'; const engine = document.getElementById('calc-engine')?.value || 'petrol'; const rates = { CNY: 12.85, KRW: 0.071, USD: 92.45, EUR: 101.2 }; const baseCostRub = Math.round(price * (rates[currency] || 1)); const costEl = document.getElementById('calc-cost-rub'); if (costEl) { costEl.textContent = `${baseCostRub.toLocaleString('ru-RU')} ₽`; } let duty = 0; if (engine === 'electric') { duty = baseCostRub * 0.15; } else if (volume <= 1000) { duty = volume * 1.5 * rates.EUR; } else if (volume <= 1500) { duty = volume * 1.7 * rates.EUR; } else if (volume <= 1800) { duty = volume * 2.5 * rates.EUR; } else if (volume <= 2300) { duty = volume * 2.7 * rates.EUR; } else if (volume <= 3000) { duty = volume * 3.0 * rates.EUR; } else { duty = volume * 3.6 * rates.EUR; } const dutyEl = document.getElementById('calc-duty'); if (dutyEl) { dutyEl.textContent = `${Math.round(duty).toLocaleString('ru-RU')} ₽`; } let util = 5200; if (age === '7+' || volume > 3000) { util = 1279000; } const utilEl = document.getElementById('calc-util'); if (utilEl) { utilEl.textContent = `${Math.round(util).toLocaleString('ru-RU')} ₽`; } const total = baseCostRub + duty + util + 450000 + 65000 + 5000 + 50000; const totalEl = document.getElementById('calc-total'); if (totalEl) { totalEl.textContent = `${Math.round(total).toLocaleString('ru-RU')} ₽`; } } function renderCatalog() { const grid = document.getElementById('catalog-grid'); if (!grid) { return; } if (!carDb.length) { grid.innerHTML = '
Каталог обновляется...
'; return; } const makeSelect = document.getElementById('catalog-filter-make'); const modelSelect = document.getElementById('catalog-filter-model'); const selectedMake = makeSelect ? makeSelect.value : 'all'; const selectedModel = modelSelect ? modelSelect.value : ''; const filtered = carDb.filter((car) => { const matchMake = selectedMake === 'all' || car.make === selectedMake; const matchModel = !selectedModel || car.model === selectedModel; return matchMake && matchModel; }); if (!filtered.length) { grid.innerHTML = '
Нет автомобилей по выбранным параметрам.
'; return; } grid.innerHTML = filtered.map((car) => `
${car.titlePlain}
${car.status || 'В пути'}

${car.titlePlain}

Цена под ключ:
${car.price ? `${car.price} ₽` : 'По запросу'}
`).join(''); } function openProductPage(identifier) { let car = null; if (typeof identifier === 'number') { car = carDb.find((item) => item.id === identifier); } else if (typeof identifier === 'string') { const normalized = identifier.toLowerCase(); car = carDb.find((item) => item.titlePlain.toLowerCase().includes(normalized)); } if (!car) { car = { titlePlain: typeof identifier === 'string' ? identifier : 'Авто из каталога', price: null, img: placeholderCarImage, status: 'Под заказ', link: '#', year: '—', mileage: '—', engine: '—', drive: '—', features: [], gallery: [], description: '', priceChina: null, priceCustoms: null, priceDelivery: null, savings: null }; } const titleEl = document.getElementById('product-title'); const statusEl = document.getElementById('product-status'); const priceEl = document.getElementById('product-price'); const mainImg = document.getElementById('product-image-main'); const thumb = document.querySelector('.product-thumb'); const actionButton = document.getElementById('product-action-button'); if (titleEl) { titleEl.textContent = car.titlePlain; } if (statusEl) { statusEl.textContent = `● ${car.status || 'В пути'}`; } if (priceEl) { priceEl.textContent = car.price ? `${car.price} ₽` : 'Цена по запросу'; } if (mainImg) { mainImg.src = car.img || placeholderCarImage; mainImg.alt = car.titlePlain; } if (thumb) { thumb.src = car.img || placeholderCarImage; } // Заполнение характеристик document.getElementById('product-year').textContent = car.year || '—'; document.getElementById('product-mileage').textContent = car.mileage || '—'; document.getElementById('product-engine').textContent = car.engine || '—'; document.getElementById('product-drive').textContent = car.drive || '—'; // Заполнение детализации цены document.getElementById('product-price-china').textContent = car.priceChina ? `${car.priceChina} ₽` : '—'; document.getElementById('product-price-customs').textContent = car.priceCustoms ? `${car.priceCustoms} ₽` : '—'; document.getElementById('product-price-delivery').textContent = car.priceDelivery ? `${car.priceDelivery} ₽` : '—'; // Блок выгоды const savingsEl = document.getElementById('product-savings'); if (savingsEl) { if (car.savings) { savingsEl.textContent = `Ниже рынка на ${car.savings} ₽`; savingsEl.style.display = 'flex'; } else { savingsEl.style.display = 'none'; } } // Логика для описания const descBlock = document.getElementById('product-description-block'); const descText = document.getElementById('product-description-text'); if (descBlock && descText) { if (car.description) { descBlock.classList.remove('hidden'); descText.textContent = car.description; } else { descBlock.classList.add('hidden'); } } // Логика для списка опций const featList = document.getElementById('product-features-list'); if (featList) { featList.innerHTML = ''; if (car.features && car.features.length) { car.features.forEach(f => { // Учитываем, что repeater может возвращать объект или строку const txt = typeof f === 'object' ? (f.feature_name || f.feature || '') : f; if (txt) { featList.innerHTML += `
  • ${txt}
  • `; } }); } else { featList.innerHTML = '
  • Нет опций
  • '; } } // Логика для галереи const galleryGrid = document.getElementById('product-gallery-grid'); if (galleryGrid) { galleryGrid.innerHTML = ''; // Очищаем всё старое // Если есть доп. фото, выводим их if (car.gallery && car.gallery.length > 0) { // Берем первые 3 фото (чтобы влезло в дизайн) const photosToShow = car.gallery.slice(0, 3); photosToShow.forEach(imgUrl => { // Создаем миниатюру const div = document.createElement('div'); div.className = 'rounded-xl overflow-hidden h-24 cursor-pointer border border-transparent hover:border-brand-purple transition'; div.innerHTML = ``; galleryGrid.appendChild(div); }); // Если фоток больше 3, показываем счетчик "+N" if (car.gallery.length > 3) { const moreCount = car.gallery.length - 3; const moreDiv = document.createElement('div'); moreDiv.className = 'rounded-xl overflow-hidden h-24 bg-gray-100 flex items-center justify-center text-gray-500 font-bold cursor-pointer'; moreDiv.textContent = `+${moreCount}`; galleryGrid.appendChild(moreDiv); } } else { // Если галереи нет, пишем текст galleryGrid.innerHTML = '
    Нет дополнительных фото
    '; } } // Обновление счетчика фотографий const counterEl = document.getElementById('product-image-counter'); if (counterEl) { // Считаем: главное фото (1) + количество фото в галерее const totalPhotos = 1 + (car.gallery ? car.gallery.length : 0); // Если фото всего одно, можно вообще скрыть счетчик if (totalPhotos <= 1) { counterEl.style.display = 'none'; } else { counterEl.style.display = 'block'; counterEl.textContent = `1 / ${totalPhotos}`; } } if (actionButton) { if (car.link && car.link !== '#') { // Маркетинговое название кнопки actionButton.innerHTML = 'Забронировать автомобиль '; actionButton.onclick = () => window.location.href = car.link; } else { actionButton.textContent = 'Заказать осмотр'; actionButton.onclick = () => showNotification('Заявка принята!', 'Менеджер свяжется с вами.'); } } // Обработчик кнопки "Рассчитать кредит" const creditButton = document.querySelector('#product-view .btn-secondary'); if (creditButton) { creditButton.onclick = () => openCreditCalc(car); } openPage('product-view'); } function nextQuizStep(step) { for (let i = 1; i <= 3; i += 1) { const el = document.getElementById(`quiz-step-${i}`); if (el) { el.classList.toggle('hidden', i !== step); } } const progress = document.getElementById('quiz-progress'); if (progress) { progress.style.width = `${step * 33}%`; } } function finishQuiz(e) { e.preventDefault(); closePage('page-quiz'); showNotification('Подборка готова!', 'Отправили подборку в WhatsApp.'); e.target.reset(); } function openCreditCalc(car) { const calcSection = document.getElementById('page-credit-calculator'); const carNameEl = document.getElementById('credit-car-name'); const carPriceEl = document.getElementById('credit-car-price'); const downPaymentInput = document.getElementById('credit-down-payment'); const downPaymentRange = document.getElementById('credit-down-payment-range'); const monthlyPaymentEl = document.getElementById('credit-monthly-payment'); if (!calcSection || !car) { return; } // Подставляем название и цену if (carNameEl) { carNameEl.textContent = car.titlePlain || 'автомобиль'; } // Получаем числовое значение цены (убираем пробелы, запятые и символ валюты) let priceValue = 0; if (car.price) { const priceStr = car.price.toString().replace(/\s/g, '').replace(/[,₽]/g, '').replace(/руб/gi, '').trim(); priceValue = parseFloat(priceStr) || 0; } if (carPriceEl) { carPriceEl.value = priceValue; } // Устанавливаем начальное значение взноса (20% от цены) const initialDownPayment = Math.round(priceValue * 0.2); if (downPaymentInput) { downPaymentInput.value = initialDownPayment; } if (downPaymentRange) { downPaymentRange.value = initialDownPayment; downPaymentRange.max = Math.round(priceValue * 0.9); downPaymentRange.min = Math.round(priceValue * 0.1); } // Пересчитываем платеж calculateCreditPayment(); // Открываем секцию openPage('page-credit-calculator'); } function calculateCreditPayment() { const carPriceEl = document.getElementById('credit-car-price'); const downPaymentInput = document.getElementById('credit-down-payment'); const termSelect = document.getElementById('credit-term'); const monthlyPaymentEl = document.getElementById('credit-monthly-payment'); if (!carPriceEl || !downPaymentInput || !termSelect || !monthlyPaymentEl) { return; } const price = parseFloat(carPriceEl.value) || 0; const downPayment = parseFloat(downPaymentInput.value) || 0; const termYears = parseInt(termSelect.value) || 3; const termMonths = termYears * 12; if (price <= 0 || termMonths <= 0) { monthlyPaymentEl.textContent = '0 ₽'; return; } const loanAmount = price - downPayment; const monthlyPayment = Math.round((loanAmount / termMonths) * 1.15); monthlyPaymentEl.textContent = rubFormatter.format(monthlyPayment) + ' ₽'; }