Цены

Здесь вы найдёте самую свежую информацию о нашей компании и её последних разработках. Здесь вы найдёте самую свежую информацию о нашей компании и её...

Эксклюзивное предложение

6400₽

  • 10 творческих идей
  • Коммерческий
  • Академические программы

Эксклюзивное предложение

12800₽

  • 10 творческих идей
  • Коммерческий
  • Академические программы

Эксклюзивное предложение

19200₽

  • 10 творческих идей
  • Коммерческий
  • Академические программы
import React, { useState, useEffect } from 'react'; // Изменен импорт ReactDOM на import * as ReactDOM from 'react-dom/client'; import * as ReactDOM from 'react-dom/client'; // Main App component for the car import cost calculator function App() { // State variables for all input fields const [carPrice, setCarPrice] = useState(''); // Стоимость авто на аукционе const [selectedCountry, setSelectedCountry] = useState('Литва'); // Страна отправки const [carBodyCategory, setCarBodyCategory] = useState('1'); // Категория авто const [carAgeCategory, setCarAgeCategory] = useState('1'); // Год выпуска const [engineVolume, setEngineVolume] = useState(''); // Объем двигателя const [notRunning, setNotRunning] = useState(false); // Авто не на ходу const [discount, setDiscount] = useState(false); // Льготная растаможка (140-указ) const [myServiceFee, setMyServiceFee] = useState(''); // Моя услуга const [otherCustomsExpenses, setOtherCustomsExpenses] = useState(''); // Прочие расходы на таможне // Exchange rate and API key const [eurToBynRate, setEurToBynRate] = useState(null); // ВНИМАНИЕ: Для реального использования API ключ должен храниться безопасно, // а не в открытом коде. Здесь он используется для демонстрации. const apiKey = "e173a14863433b89b7bc5bdf"; // Ваш API ключ для exchangerate-api.com // State variables for calculated results const [deliveryCost, setDeliveryCost] = useState(0); const [customsDutyEUR, setCustomsDutyEUR] = useState(0); const [recyclingFeeBYN, setRecyclingFeeBYN] = useState(0); const [recyclingFeeEUR, setRecyclingFeeEUR] = useState(0); const [customsFeeBYN, setCustomsFeeBYN] = useState(0); const [customsFeeEUR, setCustomsFeeEUR] = useState(0); const [warehouseFeeBYN, setWarehouseFeeBYN] = useState(0); const [warehouseFeeEUR, setWarehouseFeeEUR] = useState(0); const [auctionCommissionEUR, setAuctionCommissionEUR] = useState(0); // Новая комиссия аукциона const [totalPriceEUR, setTotalPriceEUR] = useState(0); // Fetch exchange rate on component mount useEffect(() => { const getExchangeRate = () => { fetch(`https://v6.exchangerate-api.com/v6/${apiKey}/pair/EUR/BYN`) .then(response => response.json()) .then(data => { if (data.result === "success") { setEurToBynRate(data.conversion_rate); console.log("Курс EUR/BYN:", data.conversion_rate); } else { console.error("Ошибка получения курса:", data); } }) .catch(error => console.error("Ошибка получения курса:", error)); }; getExchangeRate(); }, []); // Run once on component mount // Illustrative Delivery Cost Rates (in EUR) // IMPORTANT: These rates are illustrative and simplified. Always consult official sources. const DELIVERY_COST_RATES = { "Литва": [600, 650, 750], // +100 EUR к исходным "Польша": [600, 650, 750], // +100 EUR к исходным "Германия": [1400, 1500, 1650], // +100 EUR к исходным "Бельгия": [1400, 1500, 1650], // +100 EUR к исходным "Нидерланды": [1400, 1500, 1650], // +100 EUR к исходным }; // Function to handle calculation const calculateCosts = () => { if (eurToBynRate === null) { alert("Курс валют еще не загружен. Пожалуйста, попробуйте еще раз."); return; } const price = parseFloat(carPrice) || 0; const vol = parseFloat(engineVolume) || 0; const currentCarAgeCategory = parseInt(carAgeCategory); // Convert to int for logic let currentDeliveryPrice = 0; const selectedDeliveryRates = DELIVERY_COST_RATES[selectedCountry]; if (selectedDeliveryRates) { currentDeliveryPrice = selectedDeliveryRates[parseInt(carBodyCategory) - 1] || 0; } const extraFee = notRunning ? 100 : 0; currentDeliveryPrice += extraFee; setDeliveryCost(currentDeliveryPrice); let calculatedCustomsDutyEUR = 0; // Logic for Customs Duty based on yearCategory from provided HTML if (currentCarAgeCategory === 1) { // До 3 лет const minDuty = [2.5, 3.5, 5.5, 7.5, 15, 20]; const percentage = [54, 48, 48, 48, 48, 48]; const priceBrackets = [8500, 16700, 42300, 84500, 169000]; let rateIndex = -1; for (let i = 0; i < priceBrackets.length; i++) { if (price <= priceBrackets[i]) { rateIndex = i; break; } } // Обработка случая, когда цена выше всех указанных скобок if (rateIndex === -1 && price > 169000) { rateIndex = priceBrackets.length - 1; } // Дополнительная проверка на случай, если price <= 0 или не определен rateIndex if (rateIndex === -1 && price <= 0) { rateIndex = 0; // Использовать самый низкий тариф для 0 или отрицательной цены } else if (rateIndex === -1) { // Если rateIndex все еще -1 (не пойман выше), использовать последний rateIndex = priceBrackets.length - 1; } if (rateIndex !== -1) { const percentRate = percentage[rateIndex] / 100; const cubicCmRate = minDuty[rateIndex]; calculatedCustomsDutyEUR = Math.max(price * percentRate, vol * cubicCmRate); } else { console.error('Ошибка: Не удалось определить ставку таможенной пошлины для указанных параметров (До 3 лет). price:', price, 'rateIndex:', rateIndex); alert('Ошибка: Не удалось определить ставку таможенной пошлины для указанных параметров (До 3 лет).'); setCustomsDutyEUR(0); return; } } else if (currentCarAgeCategory === 2) { // От 3 до 5 лет const rates = [1.5, 1.7, 2.5, 2.7, 3.0, 3.6]; const brackets = [1000, 1500, 1800, 2300, 3000]; let rateIndex = -1; for (let i = 0; i < brackets.length; i++) { if (vol <= brackets[i]) { rateIndex = i; break; } } if (rateIndex === -1 && vol > 3000) { // For volumes above the highest bracket rateIndex = brackets.length - 1; // Use the last rate for >3000 } else if (rateIndex === -1 && vol <= 0) { // If volume is 0 or negative rateIndex = 0; } else if (rateIndex === -1) { // Fallback if still not found rateIndex = brackets.length - 1; } if (rateIndex !== -1 && rates[rateIndex] !== undefined) { // Added check for rates[rateIndex] existence calculatedCustomsDutyEUR = vol * rates[rateIndex]; } else { console.error('Ошибка: Не удалось определить ставку таможенной пошлины для указанных параметров (От 3 до 5 лет). volume:', vol, 'rateIndex:', rateIndex); alert('Ошибка: Не удалось определить ставку таможенной пошлины для указанных параметров (От 3 до 5 лет).'); setCustomsDutyEUR(0); return; } } else if (currentCarAgeCategory === 3) { // Старше 5 лет const rates = [3.0, 3.2, 3.5, 4.8, 5.0, 5.7]; const brackets = [1000, 1500, 1800, 2300, 3000]; let rateIndex = -1; for (let i = 0; i < brackets.length; i++) { if (vol <= brackets[i]) { rateIndex = i; break; } } if (rateIndex === -1 && vol > 3000) { // For volumes above the highest bracket rateIndex = brackets.length - 1; // Use the last rate for >3000 } else if (rateIndex === -1 && vol <= 0) { // If volume is 0 or negative rateIndex = 0; } else if (rateIndex === -1) { // Fallback if still not found rateIndex = brackets.length - 1; } if (rateIndex !== -1 && rates[rateIndex] !== undefined) { // Added check for rates[rateIndex] existence calculatedCustomsDutyEUR = vol * rates[rateIndex]; } else { console.error('Ошибка: Не удалось определить ставку таможенной пошлины для указанных параметров (Старше 5 лет). volume:', vol, 'rateIndex:', rateIndex); alert('Ошибка: Не удалось определить ставку таможенной пошлины для указанных параметров (Старше 5 лет).'); setCustomsDutyEUR(0); return; } } setCustomsDutyEUR(discount ? calculatedCustomsDutyEUR / 2 : calculatedCustomsDutyEUR); // Calculate Auction Commission (5% of carPrice, but not less than 600 EUR) let calculatedAuctionCommission = Math.max(price * 0.05, 600); setAuctionCommissionEUR(calculatedAuctionCommission); // Fixed BYN fees (from original HTML) const currentRecyclingFeeBYN = (currentCarAgeCategory === 1) ? 544.5 : 1089; const currentCustomsFeeBYN = 120; const currentWarehouseFeeBYN = 400; setRecyclingFeeBYN(currentRecyclingFeeBYN); setCustomsFeeBYN(currentCustomsFeeBYN); setWarehouseFeeBYN(currentWarehouseFeeBYN); // Convert BYN fees to EUR const currentRecyclingFeeEUR = currentRecyclingFeeBYN / eurToBynRate; const currentCustomsFeeEUR = currentCustomsFeeBYN / eurToBynRate; const currentWarehouseFeeEUR = currentWarehouseFeeBYN / eurToBynRate; setRecyclingFeeEUR(currentRecyclingFeeEUR); setCustomsFeeEUR(currentCustomsFeeEUR); setWarehouseFeeEUR(currentWarehouseFeeEUR); // Calculate Total Price (including car price, delivery, all fees, auction commission, and my service fee) // Using state variables for myServiceFee and otherCustomsExpenses const myServiceFeeVal = parseFloat(myServiceFee) || 0; const otherCustomsExpensesVal = parseFloat(otherCustomsExpenses) || 0; const totalCalculatedCost = price + currentDeliveryPrice + calculatedCustomsDutyEUR + currentRecyclingFeeEUR + currentCustomsFeeEUR + currentWarehouseFeeEUR + calculatedAuctionCommission + myServiceFeeVal + otherCustomsExpensesVal; // Added myServiceFee and otherCustomsExpenses setTotalPriceEUR(totalCalculatedCost); }; return (

Калькулятор стоимости авто в Беларуси

{/* Input Fields */}
setCarPrice(e.target.value)} className="p-3 border border-gray-300 rounded-lg focus:ring-blue-500 focus:border-blue-500 shadow-sm" placeholder="Например, 10000" />
setEngineVolume(e.target.value)} className="p-3 border border-gray-300 rounded-lg focus:ring-blue-500 focus:border-blue-500 shadow-sm" placeholder="Например, 2000" />

Дополнительные расходы:

setMyServiceFee(e.target.value)} // Обновляем состояние className="p-3 border border-gray-300 rounded-lg focus:ring-blue-500 focus:border-blue-500 shadow-sm" placeholder="Например, 300" />
setOtherCustomsExpenses(e.target.value)} // Обновляем состояние className="p-3 border border-gray-300 rounded-lg focus:ring-blue-500 focus:border-blue-500 shadow-sm" placeholder="Например, 200" />
{/* Results Display */}

Результаты расчета:

Стоимость авто на аукционе: {parseFloat(carPrice).toFixed(2)} EUR
Стоимость доставки: {deliveryCost.toFixed(2)} EUR
Комиссия аукциона (5%, мин. 600 EUR): {auctionCommissionEUR.toFixed(2)} EUR
Таможенная пошлина: {customsDutyEUR.toFixed(2)} EUR
Утилизационный сбор: {recyclingFeeBYN.toFixed(2)} BYN ({recyclingFeeEUR.toFixed(2)} EUR)
Таможенный сбор: {customsFeeBYN.toFixed(2)} BYN ({customsFeeEUR.toFixed(2)} EUR)
Расходы на СВХ: {warehouseFeeBYN.toFixed(2)} BYN ({warehouseFeeEUR.toFixed(2)} EUR)
Моя услуга: {(parseFloat(myServiceFee) || 0).toFixed(2)} EUR
Прочие расходы на таможне: {(parseFloat(otherCustomsExpenses) || 0).toFixed(2)} EUR
Общая стоимость авто в Беларуси: {totalPriceEUR.toFixed(2)} EUR

*Важно: Представленные ставки таможенных пошлин и утилизационного сбора являются иллюстративными и упрощенными для целей данного калькулятора. Для получения точной и актуальной информации всегда обращайтесь к официальным источникам Государственного таможенного комитета Республики Беларусь и Евразийской экономической комиссии. Курс валют обновляется автоматически при загрузке страницы.

); } export default App; // This is the part that makes the React component render in the browser. // It finds the root element in the HTML and renders the App component into it. const rootElement = document.getElementById('root'); if (rootElement) { // Использован ReactDOM.createRoot для совместимости с React 18 const root = ReactDOM.createRoot(rootElement); root.render(); } else { console.error('Root element with ID "root" not found. Cannot render React app.'); }