|
@@ -1,7 +1,7 @@
|
|
|
<template lang="pug">
|
|
|
- .product-card(@click="selectProduct({ data })")
|
|
|
- h2.product-title {{ data.name }}
|
|
|
- img.product-image(:src="this.data.image_medium ? 'data:image/png;base64,' + this.data.image_medium : '/web/static/src/img/placeholder.png'")
|
|
|
+ .product-card(@click="selectProduct({ item })")
|
|
|
+ h2.product-title {{ item.name }}
|
|
|
+ img.product-image(:src="this.item.image_medium ? 'data:image/png;base64,' + this.item.image_medium : '/web/static/src/img/placeholder.png'")
|
|
|
.product-price
|
|
|
span {{ getPrice() }}
|
|
|
.product-qty
|
|
@@ -12,7 +12,7 @@
|
|
|
|
|
|
export default {
|
|
|
props: {
|
|
|
- data: {
|
|
|
+ item: {
|
|
|
type: Object,
|
|
|
default: () => {
|
|
|
return {}
|
|
@@ -42,16 +42,7 @@
|
|
|
},
|
|
|
methods: {
|
|
|
getPrice() {
|
|
|
- return accounting.formatMoney(this.data.list_price, this.symbol, this.decimals, this.separator, ',')
|
|
|
- },
|
|
|
- drawImage() {
|
|
|
- let ctx = this.$el.querySelector('.product-image').getContext('2d')
|
|
|
- let img = new Image()
|
|
|
- img.onload = () => {
|
|
|
- ctx.drawImage(img, 0, 0, 80, 80)
|
|
|
- }
|
|
|
- console.log(this.data.image_medium)
|
|
|
- img.src = this.data.image_medium ? 'data:image/png;base64,' + this.data.image_medium : '/web/static/src/img/placeholder.png'
|
|
|
+ return accounting.formatMoney(this.item.list_price, this.symbol, this.decimals, this.separator, ',')
|
|
|
},
|
|
|
selectVariant() {
|
|
|
this.$modal.show('variant-selector')
|
|
@@ -59,10 +50,6 @@
|
|
|
...mapActions([
|
|
|
'selectProduct'
|
|
|
])
|
|
|
- },
|
|
|
- mounted() {
|
|
|
- // this.drawImage()
|
|
|
- // console.log(this)
|
|
|
}
|
|
|
}
|
|
|
</script>
|