Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

168
Views
Aplying discount in cascade - VueJS

I need to show discounts on discounts, so far I have managed to show the main discount on the product, but I need this discount to accumulate in the values.

Please could someone help me to apply these discounts correctly.

Here an example of the discount at the moment:

Applying discount for each discount on the product

<template>
    <div class="samurai-single-product-dcto">
        <p v-for="discount in discounts" :key="discount.id">
            <span class="title-promotion">{{discount.titulo}}:</span> 
            <strong class="price-promotion"> 
              {{discountPrice(singleProduct.selectedProduct.precio,discount.descuentoCupon) | toCurrency }}
            </strong> 
           <strong class="text-iva">{{$store.getters.showIva}}</strong>
        </p>
    </div>
</template>
<script>
import { mapState } from 'vuex';
import _ from 'lodash';
export default {
    name:'SamuraiSingleProductDcto',
    computed:{
        ...mapState({
            singleProduct:'singleProduct',
            discounts(state){

                let result = state.singleProduct.selectedProduct.descuentos.filter(element => (element.tipoCupon && !element.codigoCupon));

                return _.uniqBy(result, 'id');
            }
        })
    },
    methods:{
        discountPrice(price, discount){
            let priceResult = this.$store.getters.removeIva(price);
            let discountResult = 1 - (discount / 100);
            return Math.round( priceResult * discountResult);
        }
    }
}
</script>
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!