body { font-family: sans-serif; direction: rtl; max-width: 600px; margin: 20px auto; background: #f3f3f3; padding: 20px; border-radius: 8px; }
label, select, input { display: block; width: 100%; margin-bottom: 15px; padding: 8px; }
#result { font-size: 1.3em; margin-top: 15px; font-weight: bold; }
📐 محاسبه قیمت میز
همکار
عمومی
بدون قاب
با قاب آلومینیومی
میز ۴ سانتی
میز ۵ سانتی
۸ میلیمتر
۱۱ میلیمتر
۱۵ میلیمتر
const prices = {
co: {
simple: { “8”: 310, “11”: 270, “15”: 250 },
aluminum: { “8”: 325, “11”: 285, “15”: 265 },
table4: 550,
table5: 550
},
regular: {
simple: { “8”: 370, “11”: 340, “15”: 310 },
aluminum: { “8”: 380, “11”: 350, “15”: 320 },
table4: 600,
table5: 600
}
};
function toggleMeshOptions() {
const model = document.getElementById(“model”).value;
document.getElementById(“meshGroup”).style.display = (model === ‘table4’ || model === ‘table5’) ? “none” : “block”;
}
function calculate() {
const customer = document.getElementById(“customerType”).value;
const model = document.getElementById(“model”).value;
const mesh = document.getElementById(“mesh”).value;
const length = parseFloat(document.getElementById(“length”).value) || 0;
const width = parseFloat(document.getElementById(“width”).value) || 0;
const area = length * width;
let unitPrice;
if (model === “table4” || model === “table5”) {
unitPrice = prices[customer][model];
} else {
unitPrice = prices[customer][model][mesh];
}
const total = area * unitPrice;
document.getElementById(“result”).innerText = `قیمت نهایی: ${total.toLocaleString(‘fa-IR’)} تومان`;
}
toggleMeshOptions();