123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107 |
- <template lang="pug">
- modal(
- name='pricelist-modal'
- transition='nice-modal-fade'
- width='400px'
- height='600px'
- :classes="['v--modal', 'pricelist-modal']"
- @before-close='beforeClose'
- )
- .pricelist-content
- h1 Lista de precios
- .pricelist-items-wrapper
- ul.pricelist-items
- li.pricelist-item(
- v-for='item in items'
- :key='item.id'
- @click.prevent='onApply(item)'
- )
- h3 {{ computePrice(item) }}
- h1 {{ item.pricelistName }}
- .pricelist-options
- button.pricelist-option(
- @click.prevent='onCancel'
- ) Cancelar
- </template>
- <script>
- export default {
- props: {
- show: {
- type: Boolean,
- default: false
- },
- items: {
- type: Array,
- default: []
- }
- },
- watch: {
- show(canShow) {
- if (canShow) {
- this.$modal.show('pricelist-modal')
- return
- }
- this.$modal.hide('pricelist-modal')
- }
- },
- methods: {
- beforeClose(e) {
- if(this.show) {
- e.stop()
- }
- },
- computePrice(item) {
- return (item.productPrice * (1 + item.priceDiscount)) + item.priceSurcharge
- },
- onApply(item) {
- const price = this.computePrice(item)
- this.$emit('onApply', price)
- },
- onCancel(e) {
- this.$emit('onCancel')
- }
- }
- }
- </script>
- <style lang="sass">
- @import '../../assets/variables'
- .pricelist-modal
- .pricelist-content
- width: 100%
- height: 100%
- padding: 15px
- h1
- font-size: 12pt
- color: #757575
- .pricelist-items-wrapper
- width: 100%
- height: calc(100% - 95px)
- overflow-y: auto
- .pricelist-items
- width: 100%
- padding-left: 0
- a
- .pricelist-item
- list-style: none
- padding: 0
- border-bottom: 1px solid #d3d3d3
- h1
- font-size: 10pt
- &:hover
- cursor: pointer
- border-bottom: 2px solid $app-main-color
- .pricelist-options
- float: right
- .pricelist-option
- width: 160px
- height: 40px
- border: none
- box-shadow: none
- border-radius: 0
- margin-right: 5px
- background: $app-main-color
- color: $app-bg-color
- </style>
|