Smart International Dropshipping Fee Calculator

Smart International Dropshipping Fee Calculator

Estimate your total costs and profit for international orders.

Product Details

$

Financial Details

$

Shipment Details

Fee Breakdown & Profit Analysis

Cost Component Amount (USD)

${formatCurrency(data.totalCost)}

Estimated Profit

${formatCurrency(data.profit)}

Profit Margin

${data.profitMargin.toFixed(1)}%

`; // Table breakdownTableBody.innerHTML = data.breakdown.map(row => ` ${row.item} ${formatCurrency(row.value)} ${row.note} `).join(''); // Add total row breakdownTableBody.innerHTML += ` Total Estimated Cost ${formatCurrency(data.totalCost)} `; document.getElementById('report-date').textContent = `Analysis generated on: ${new Date().toLocaleDateString()}`; } // --- Tab & Navigation Logic --- function switchTab(targetTabId) { if (targetTabId === 'breakdown') { const results = calculateFees(); if (!results) return; // Stay on details tab if form is invalid renderResults(results); } currentTab = targetTabId; tabs.forEach(tab => tab.classList.toggle('active', tab.dataset.tab === currentTab)); tabContents.forEach(content => content.classList.toggle('active', content.id === currentTab)); updateNavButtons(); } tabs.forEach(tab => tab.addEventListener('click', () => switchTab(tab.dataset.tab))); nextBtn.addEventListener('click', () => switchTab('breakdown')); prevBtn.addEventListener('click', () => switchTab('details')); function updateNavButtons() { if (currentTab === 'details') { nextBtn.textContent = 'Calculate Fees'; prevBtn.style.display = 'none'; pdfButtonContainer.style.display = 'none'; } else { nextBtn.textContent = 'Calculate Fees'; prevBtn.style.display = 'inline-flex'; pdfButtonContainer.style.display = 'block'; } } // --- PDF Download --- downloadPdfBtn.addEventListener('click', async () => { const { jsPDF } = window.jspdf; const doc = new jsPDF({ orientation: 'p', unit: 'mm', format: 'a4' }); const content = document.getElementById('pdf-content'); await new Promise(resolve => setTimeout(resolve, 0)); // Allow render doc.setFont('helvetica', 'bold'); doc.setFontSize(18); doc.text('International Dropshipping Fee Analysis', 14, 22); const canvas = await html2canvas(content, { scale: 2 }); const imgData = canvas.toDataURL('image/jpeg', 1.0); const imgProps = doc.getImageProperties(imgData); const pdfWidth = doc.internal.pageSize.getWidth() - 28; const pdfHeight = (imgProps.height * pdfWidth) / imgProps.width; doc.addImage(imgData, 'JPEG', 14, 30, pdfWidth, pdfHeight); doc.save(`Dropshipping-Analysis-${new Date().toISOString().slice(0,10)}.pdf`); }); // --- Initial Load --- populateCountries(); switchTab('details'); });
Scroll to Top