Se agregan columnas y el calculo de promociones de tipo fijo
This commit is contained in:
@ -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,
|
||||
|
Reference in New Issue
Block a user