Vue
HTML
<div id="app">
<input type="number" placeholder="в миллиметрах" v-model="heightInterstore">
<input type="number" placeholder="в миллиметрах" v-model="additionalFencing">
<input type="checkbox" v-model="risers"> Подступенки
<br>
<div v-for="i in turns">
<h3 class="text-center stairs-item_title">{{ i.name }}</h3>
<div class="text-center">
<ul class="stairs-item_material-list">
<li class="stairs-item_material-item">Сосна <b>{{ constWork.pine + costAllFences.pine + constWorkRiser.pine + (costOneTurn * i.count) }}</b> руб.</li>
<li class="stairs-item_material-item">Берёза <b>{{ constWork.birch + costAllFences.birch + constWorkRiser.birch + (costOneTurn * i.count) }}</b> руб.</li>
<li class="stairs-item_material-item">Бук <b>{{ constWork.beech + costAllFences.beech + constWorkRiser.beech + (costOneTurn * i.count) }}</b> руб.</li>
<li class="stairs-item_material-item">Дуб, Ясень <b>{{ constWork.oak + costAllFences.oak + constWorkRiser.oak + (costOneTurn * i.count) }}</b> руб.</li>
</ul>
</div>
<br>
</div>
</div>
Vue
var app = new Vue({
el: '#app',
data: {
heightInterstore: 3100, // Высота межэтажного проема
numberFeet: 16, // Колличество ступенек
additionalFencing: 0, // Длинна доп огорождения
risers: false, // Подступенки
numberRiser: 0, // Колличество подступенкек
costOneTurn: 13500, // Стоимость 1 поворота
// Стоимость одного подъема
costPerLift: {
pine: 4000,
birch: 5500,
beech: 6800,
oak: 8000
},
costOneFences: {
pine: 3500,
birch: 4500,
beech: 6000,
oak: 7500
},
costOneRiser: {
pine: 1500,
birch: 1650,
beech: 1800,
oak: 2000
},
turns: [
{
count: 1,
name: "Лестница 90° - Г-образная"
},
{
count: 2,
name: "Лестница 180° - П-образная"
},
{
count: 3,
name: "Лестница 270°"
},
{
count: 4,
name: "Лестница 360° - Винтовая"
}
],
// Стоимость основная
constWork: {},
// Стоимость всего доп. Ограждения
costAllFences: {},
// Стоимость основная c подступенкаи
constWorkRiser: {},
},
created: function () {
this.calcNumberFeet;
this.calcConstWork;
this.calcCostAllFences;
this.calcConstWorkRiser;
},
watch: {
heightInterstore: function() {
this.calcNumberFeet;
this.calcConstWork;
},
risers: function() {
this.calcNumberRiser;
this.calcConstWorkRiser;
},
additionalFencing: function() {
this.calcNumberFeet;
this.calcCostAllFences;
},
},
computed: {
// Расчет количества ступенек
calcNumberFeet: function() {
this.numberFeet = Math.round((this.heightInterstore / 180) -1);
},
// Расчет стоимости монтажа
calcConstWork: function() {
for(let i in this.costPerLift) {
this.constWork[i] = this.costPerLift[i] * this.numberFeet + (this.costPerLift.birch * this.numberFeet / 100 * 17);
}
},
...