Skip to content

Commit d789045

Browse files
author
root
committed
fix: исправлен расчет цены пиццы (размер теперь множитель, а не слагаемое)
1 parent 2f6ff7d commit d789045

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

frontend/src/modules/constructor/PizzaCanvas.vue

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -124,18 +124,14 @@ export default {
124124
},
125125
126126
totalPrice() {
127-
let price = 0;
127+
let basePrice = 0;
128128
129129
if (this.selectedDough) {
130-
price += this.selectedDough.price || 0;
131-
}
132-
133-
if (this.selectedSize) {
134-
price += this.selectedSize.price || 0;
130+
basePrice += this.selectedDough.price || 0;
135131
}
136132
137133
if (this.selectedSauce) {
138-
price += this.selectedSauce.price || 0;
134+
basePrice += this.selectedSauce.price || 0;
139135
}
140136
141137
Object.entries(this.selectedIngredients).forEach(
@@ -144,12 +140,16 @@ export default {
144140
(ing) => ing.id == ingredientId,
145141
);
146142
if (ingredient && count > 0) {
147-
price += (ingredient.price || 0) * count;
143+
basePrice += (ingredient.price || 0) * count;
148144
}
149145
},
150146
);
151147
152-
return price;
148+
if (this.selectedSize && this.selectedSize.multiplier) {
149+
basePrice *= this.selectedSize.multiplier;
150+
}
151+
152+
return Math.round(basePrice);
153153
},
154154
155155
canOrder() {

0 commit comments

Comments
 (0)