Se agregan columnas y el calculo de promociones de tipo fijo

This commit is contained in:
Juan Pablo Vial
2025-04-08 19:04:46 -04:00
parent 76f69f3bda
commit 3c2b486083
2 changed files with 32 additions and 14 deletions

View File

@ -20,12 +20,18 @@
prices(units) {
const prices = []
units.forEach(unit => {
const price = unit.precio?.valor ?? 0
let price = unit.precio?.valor ?? 0
let amount = 1
let diff = 0
unit.promotions?.forEach(promotion => {
if (promotion.type === 1) {
diff += promotion.amount
return
}
amount /= 1/(1 - promotion.amount)
})
amount = 1 - amount
price += diff
prices.push({
id: unit.id,
base: price,