|
@@ -2,15 +2,15 @@
|
|
|
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
|
|
|
+ label.discount-label Precio unitario
|
|
|
input.discount-input(:value="formatPrice()" readonly)
|
|
|
.discount-item
|
|
|
- label.discount-label Precio Mínimo
|
|
|
+ label.discount-label Precio mínimo
|
|
|
input.discount-input(:value="formatMinPrice()" readonly)
|
|
|
.discount-item
|
|
|
- label.discount-label Precio Máximo
|
|
|
+ label.discount-label Precio máximo
|
|
|
input.discount-input(:value="formatMaxPrice()" readonly)
|
|
|
- //- hr
|
|
|
+ hr
|
|
|
.discount-item
|
|
|
label.discount-label Descuento
|
|
|
input.discount-input(:value="discount" v-model="discount" autofocus)
|
|
@@ -28,16 +28,14 @@
|
|
|
return this.productToDiscount ? this.productToDiscount.list_price : 0
|
|
|
},
|
|
|
minimumPrice() {
|
|
|
- let amount = this.productToDiscount ? Math.min(...this.productToDiscount.prices.map(x => x.price)) : 0
|
|
|
- return amount === Number.NEGATIVE_INFINITY || amount > this.price ? this.productToDiscount.list_price : amount
|
|
|
+ return this.productToDiscount ? this.productToDiscount.minimum_price : 0
|
|
|
},
|
|
|
maximumPrice() {
|
|
|
- let amount = this.productToDiscount ? Math.max(...this.productToDiscount.prices.map(x => x.price)) : 0
|
|
|
- return amount === Number.POSITIVE_INFINITY || amount < this.price ? this.productToDiscount.list_price : amount
|
|
|
+ return this.productToDiscount ? this.productToDiscount.maximum_price : 0
|
|
|
},
|
|
|
discount: {
|
|
|
get() {
|
|
|
- let value = (this.productToDiscount && this.productToDiscount.discount) || this.minimumPrice
|
|
|
+ let value = this.productToDiscount ? this.productToDiscount.discount : this.minimumPrice
|
|
|
return accounting.formatMoney(value, this.currencySymbol, 0, '.', ',')
|
|
|
},
|
|
|
set(value) {
|
|
@@ -70,14 +68,10 @@
|
|
|
formatMaxPrice() {
|
|
|
return accounting.formatMoney(this.maximumPrice, this.currencySymbol, 0, '.', ',')
|
|
|
},
|
|
|
- checkPrice() {
|
|
|
- return this.minimumPrice >= this.productToDiscount.discount <= this.maximumPrice
|
|
|
- },
|
|
|
beforeClose(e) {
|
|
|
if (this.productToDiscount) {
|
|
|
e.stop()
|
|
|
}
|
|
|
-
|
|
|
},
|
|
|
...mapActions([
|
|
|
'discountFromCart',
|
|
@@ -97,6 +91,20 @@
|
|
|
width: 100%
|
|
|
height: 45px
|
|
|
margin-bottom: 10px
|
|
|
+ &:nth-child(2), &:nth-child(3)
|
|
|
+ height: 35px
|
|
|
+ margin-bottom: 5px
|
|
|
+ .discount-label
|
|
|
+ width: 30%
|
|
|
+ height: 35px
|
|
|
+ font-size: 10pt
|
|
|
+ color: #666
|
|
|
+ .discount-input
|
|
|
+ width: 70%
|
|
|
+ height: 35px
|
|
|
+ font-size: 18pt
|
|
|
+ text-align: right
|
|
|
+ border-radius: 0
|
|
|
.discount-label
|
|
|
width: 30%
|
|
|
height: 45px
|
|
@@ -106,6 +114,7 @@
|
|
|
height: 45px
|
|
|
font-size: 28pt
|
|
|
text-align: right
|
|
|
+ border-radius: 0
|
|
|
.discount-options
|
|
|
float: right
|
|
|
.discount-button
|