Skip to content

Commit b96c886

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

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
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() {

frontend/vite.config.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import { fileURLToPath, URL } from "url";
33
import { defineConfig } from "vite";
44
import vue from "@vitejs/plugin-vue";
55

6-
// https://vitejs.dev/config/
76
export default defineConfig({
87
plugins: [vue()],
98
test: {

0 commit comments

Comments
 (0)