calc
This commit is contained in:
parent
7791eb4bc4
commit
663702b8f5
|
@ -92,46 +92,64 @@ const roubleSign = new Intl.NumberFormat('ru-RU', {
|
||||||
currency: 'RUB',
|
currency: 'RUB',
|
||||||
});
|
});
|
||||||
const total_txt = computed(() => {
|
const total_txt = computed(() => {
|
||||||
const { mortgage, pillar, lamella, rivets, bar, guide } = calculatorData.value
|
let { mortgage, pillar, lamella, rivets, bar, guide } = calculatorData.value
|
||||||
|
mortgage = parseFloat(mortgage)
|
||||||
|
pillar = parseFloat(pillar)
|
||||||
|
lamella = parseFloat(lamella)
|
||||||
|
rivets = parseFloat(rivets)
|
||||||
|
bar = parseFloat(bar)
|
||||||
|
guide = parseFloat(guide)
|
||||||
const sections = section_count.value as number
|
const sections = section_count.value as number
|
||||||
const extra_mm = extra_section.value as number
|
const extra_mm = extra_section.value as number
|
||||||
|
const length_mm = fence_section.value as number
|
||||||
|
const lam_count = lamelles_count.value as number
|
||||||
|
|
||||||
const pillar_count = mortgage + 1
|
const prices = {
|
||||||
const pil = (parseFloat(mortgage) + parseFloat(pillar)) * pillar_count
|
pillar: mortgage + pillar,
|
||||||
|
lamella: rivets * 2 + lamella * length_mm,
|
||||||
const length = fence_section.value
|
lamella_extra: rivets * 2 + lamella * extra_mm,
|
||||||
|
guide: guide * lam_count * 0.115,
|
||||||
const lam_count = lamelles_count.value * sections
|
top: bar * length_mm,
|
||||||
const lam = (lam_count * length * parseFloat(lamella)) + parseFloat(rivets)
|
top_extra: bar * extra_mm
|
||||||
|
}
|
||||||
const top_count = section_count.value as number
|
|
||||||
const top = top_count * bar
|
|
||||||
|
|
||||||
const guides_count = sections * 2
|
|
||||||
const guides = guides_count * parseFloat(guide) * lam_count * 0.115
|
|
||||||
|
|
||||||
|
|
||||||
const extra = {
|
const extra = {
|
||||||
pillar: !remove_pillar.value && {
|
pillar: !remove_pillar.value && {
|
||||||
txt: 'Дополнительная секция, столб, 1 шт',
|
txt: 'Дополнительная секция, столб, 1шт',
|
||||||
value: ((parseFloat(mortgage) + parseFloat(pillar)) * 1)
|
value: prices.pillar * 1
|
||||||
},
|
},
|
||||||
lamella: {
|
lamella: {
|
||||||
txt: `Дополнительная секция, ламели, ${lamelles_count.value} шт`,
|
txt: `Дополнительная секция, ламели, ${lam_count}шт`,
|
||||||
value: ((parseFloat(mortgage) + parseFloat(pillar)) * top_count)
|
value: prices.lamella_extra * lam_count
|
||||||
|
},
|
||||||
|
guide: {
|
||||||
|
txt: 'Направляющие, 2шт',
|
||||||
|
value: prices.guide * 2
|
||||||
|
},
|
||||||
|
top: {
|
||||||
|
txt: 'Верхняя планка',
|
||||||
|
value: prices.top * 1
|
||||||
},
|
},
|
||||||
guide: { txt: 'Направляющие', value: 2 * parseFloat(guide) * lam_count * 0.115 },
|
|
||||||
top: { txt: 'Верхняя планка', value: 1 * bar },
|
|
||||||
|
|
||||||
}
|
}
|
||||||
const regular = {
|
const regular = {
|
||||||
pillar: !remove_pillar.value && {
|
pillar: !remove_pillar.value && {
|
||||||
txt: `Столб`,
|
txt: `Столб, ${(1 + sections)}шт`,
|
||||||
value: (parseFloat(mortgage) + parseFloat(pillar)) * pillar_count
|
value: prices.pillar * (1 + sections)
|
||||||
|
},
|
||||||
|
lamella: {
|
||||||
|
txt: `Ламели, ${(lam_count * sections)}`,
|
||||||
|
value: prices.lamella * (lam_count * sections)
|
||||||
|
},
|
||||||
|
guide: {
|
||||||
|
txt: `Направляющие`,
|
||||||
|
value: prices.guide * (2 * sections)
|
||||||
|
},
|
||||||
|
top: {
|
||||||
|
txt: `Верхняя планка`,
|
||||||
|
value: prices.top * sections
|
||||||
},
|
},
|
||||||
lamella: { txt: 'Ламели', value: (lam_count * length * parseFloat(lamella)) + parseFloat(rivets) },
|
|
||||||
guide: { txt: 'Направляющие', value: guides_count * parseFloat(guide) * lam_count * 0.115 },
|
|
||||||
top: { txt: 'Верхняя планка', value: top_count * lamella },
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const total = [extra, regular].map(item => Object.values(item).map(el => el ? el.value : 0)).flat().reduce((a, b) => a + b, 0)
|
const total = [extra, regular].map(item => Object.values(item).map(el => el ? el.value : 0)).flat().reduce((a, b) => a + b, 0)
|
||||||
|
|
Loading…
Reference in New Issue