|
@@ -0,0 +1,104 @@
|
|
|
+<template lang="pug">
|
|
|
+ modal(name="product-discount" transition="nice-modal-fade" @before-close="beforeClose" :classes="['v--modal', 'product-discount']")
|
|
|
+ form.discount-form
|
|
|
+ .discount-item
|
|
|
+ label.discount-label Precio
|
|
|
+ input.discount-input(:value="formatAmount()")
|
|
|
+
|
|
|
+ .discount-item
|
|
|
+ label.discount-label Descuento
|
|
|
+ input.discount-input(:value="discount")
|
|
|
+
|
|
|
+ .discount-item
|
|
|
+ label.discount-label Precio Mínimo
|
|
|
+ input.discount-input(:value="format('min')")
|
|
|
+
|
|
|
+ .discount-item
|
|
|
+ label.discount-label Precio Máximo
|
|
|
+ input.discount-input(:value="format('max')")
|
|
|
+ .discount-options
|
|
|
+ button.discount-button(value="accept" @click="discountHandler()") Aceptar
|
|
|
+ button.discount-button(value="cancel" @click="discountHandler()") Cancelar
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+ import { mapGetters, mapActions } from 'vuex'
|
|
|
+
|
|
|
+ export default {
|
|
|
+ computed: {
|
|
|
+ discount: {
|
|
|
+ set(value) {
|
|
|
+ console.log(value)
|
|
|
+ },
|
|
|
+ get() {
|
|
|
+ return accounting.formatMoney(0, this.currencySymbol, 0, '.', ',')
|
|
|
+ }
|
|
|
+ },
|
|
|
+ ...mapGetters([
|
|
|
+ 'productToDiscount',
|
|
|
+ 'currencySymbol'
|
|
|
+ ])
|
|
|
+ },
|
|
|
+ watch: {
|
|
|
+ productToDiscount(value) {
|
|
|
+ if (value) {
|
|
|
+ this.$modal.show('product-discount')
|
|
|
+ } else {
|
|
|
+ this.$modal.hide('product-discount')
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ discountHandler(e) {
|
|
|
+ this.discountFromCart(null)
|
|
|
+ },
|
|
|
+ formatAmount() {
|
|
|
+ return accounting.formatMoney(this.productToDiscount ? this.productToDiscount.list_price : 0, this.currencySymbol, 0, '.', ',')
|
|
|
+ },
|
|
|
+ format(values) {
|
|
|
+ return accounting.formatMoney(0, this.currencySymbol, 0, '.', ',')
|
|
|
+ },
|
|
|
+ beforeClose(e) {
|
|
|
+ if (this.productToDiscount) {
|
|
|
+ e.stop()
|
|
|
+ }
|
|
|
+
|
|
|
+ },
|
|
|
+ ...mapActions([
|
|
|
+ 'discountFromCart'
|
|
|
+ ])
|
|
|
+ }
|
|
|
+ }
|
|
|
+</script>
|
|
|
+
|
|
|
+<style lang="sass">
|
|
|
+ .product-discount
|
|
|
+ .discount-form
|
|
|
+ width: 100%
|
|
|
+ height: 250px
|
|
|
+ padding: 15px
|
|
|
+ .discount-item
|
|
|
+ width: 100%
|
|
|
+ height: 45px
|
|
|
+ margin-bottom: 10px
|
|
|
+ .discount-label
|
|
|
+ width: 30%
|
|
|
+ height: 45px
|
|
|
+ font-size: 14pt
|
|
|
+ .discount-input
|
|
|
+ width: 70%
|
|
|
+ height: 45px
|
|
|
+ font-size: 28pt
|
|
|
+ text-align: right
|
|
|
+ .discount-options
|
|
|
+ float: right
|
|
|
+ .discount-button
|
|
|
+ width: 160px
|
|
|
+ height: 40px
|
|
|
+ border: none
|
|
|
+ box-shadow: none
|
|
|
+ border-radius: 0
|
|
|
+ margin-right: 5px
|
|
|
+ background: #0288d1
|
|
|
+ color: #fff
|
|
|
+</style>
|