Struttura Scheda Prodotti...
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import { ref, onMounted, onBeforeMount, PropType, reactive, watch } from 'vue'
|
||||
import { CCardState } from '../CCardState'
|
||||
|
||||
import { computed, defineComponent } from 'vue'
|
||||
@@ -50,6 +51,12 @@ export default defineComponent({
|
||||
globalStore.rightCartOpen = false
|
||||
}
|
||||
|
||||
function mounted() {
|
||||
products.loadOrders()
|
||||
}
|
||||
|
||||
onMounted(mounted)
|
||||
|
||||
return {
|
||||
myCart,
|
||||
myTotalPrice,
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
<template>
|
||||
<div>
|
||||
MyCart:<br>
|
||||
<div id="mycontainer">
|
||||
<div class="myheader row justify-between">
|
||||
<div class="col-6">
|
||||
|
||||
@@ -80,23 +80,23 @@ export default defineComponent({
|
||||
function addtoCart() {
|
||||
|
||||
if (!userStore.isLogged) {
|
||||
tools.showNeutralNotif($q, 'Devi prima accedere alla tua Area Personale')
|
||||
tools.showNeutralNotif($q, t('ecomm.area_personale'))
|
||||
globalStore.rightDrawerOpen = true
|
||||
return false
|
||||
}
|
||||
|
||||
// Controlla se esiste già nel carrello il prodotto
|
||||
if (products.existProductInCart(myproduct.value._id)) {
|
||||
tools.showNegativeNotif($q, 'Questo prodotto è stato già aggiunto al Carrello')
|
||||
tools.showNegativeNotif($q, t('ecomm.already_in_cart'))
|
||||
} else {
|
||||
products.addToCart({ product: myproduct.value, order: props.order }).then((ris) => {
|
||||
let strprod = 'prodotto'
|
||||
let strprod = t('ecomm.prodotto')
|
||||
if (myorder.value.quantity! > 1)
|
||||
strprod = 'prodotti'
|
||||
strprod = t('ecomm.prodotti')
|
||||
if (ris)
|
||||
tools.showPositiveNotif($q, 'Hai Aggiunto ' + myorder.value.quantity + ' ' + strprod + ' al Carrello')
|
||||
tools.showPositiveNotif($q, t('ecomm.haveadded') + ' ' + myorder.value.quantity + ' ' + strprod + ' ' + t('ecomm.tocart'))
|
||||
else
|
||||
tools.showNegativeNotif($q, 'Errore durante l\'inserimento del prodotto sul carrello, riprovare.')
|
||||
tools.showNegativeNotif($q, t('ecomm.error_cart'))
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -110,7 +110,10 @@ export default defineComponent({
|
||||
|
||||
function getSingleStorehouse() {
|
||||
const mystore = myproduct.value.storehouses[0]
|
||||
return mystore.name + ' (' + mystore.city + ')'
|
||||
if (mystore)
|
||||
return mystore.name + ' (' + mystore.city + ')'
|
||||
else
|
||||
return ''
|
||||
}
|
||||
|
||||
function getStorehouses() {
|
||||
@@ -182,6 +185,8 @@ export default defineComponent({
|
||||
checkifCartDisable,
|
||||
myproduct,
|
||||
myorder,
|
||||
tools,
|
||||
t,
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
@@ -1,17 +1,14 @@
|
||||
<template>
|
||||
<q-card :class="getmycardcl()" v-if="!!myproduct">
|
||||
<div v-if="myorder">
|
||||
qta: {{ myorder.quantity }}
|
||||
</div>
|
||||
|
||||
<q-img :src="`` + myproduct.img" :alt="myproduct.name" :class="getclimg()"></q-img>
|
||||
|
||||
<q-card-section>
|
||||
<q-btn
|
||||
v-if="!complete"
|
||||
fab
|
||||
color="primary"
|
||||
icon="fas fa-info"
|
||||
class="absolute"
|
||||
style="top: 0; right: 12px; transform: translateY(-50%);"
|
||||
:to="`/product/`+ myproduct.code"
|
||||
/>
|
||||
<q-btn v-if="!complete" fab color="primary" icon="fas fa-info" class="absolute"
|
||||
style="top: 0; right: 12px; transform: translateY(-50%);" :to="`/product/` + myproduct.code" />
|
||||
|
||||
<div class="row items-center centeritems">
|
||||
<div class="text-h7 boldhigh">
|
||||
@@ -24,18 +21,23 @@
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<div v-if="complete">
|
||||
<div v-if="complete && myproduct.producer.city">
|
||||
<div class="text-grey text-title row items-center q-mt-sm">
|
||||
<q-icon name="map" class="q-mr-xs"/>
|
||||
Origine: <span class="text-blue q-ml-xs text-h8"> {{ myproduct.producer.city }} ({{
|
||||
<q-icon name="map" class="q-mr-xs" />
|
||||
{{ t('products.origine') }}: <span class="text-blue q-ml-xs text-h8"> {{ myproduct.producer.city }} ({{
|
||||
myproduct.producer.region
|
||||
}})</span>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div v-if="complete" class="text-grey text-title row items-center">
|
||||
<q-icon name="place" class="q-mr-xs"/>
|
||||
Produttore: <span class="text-black q-ml-xs text-h8"> {{ myproduct.producer.name }}</span>
|
||||
<div v-if="complete && myproduct.producer.name" class="text-grey text-title row items-center">
|
||||
<q-icon name="place" class="q-mr-xs" />
|
||||
{{ t('products.producer') }}: <span class="text-black q-ml-xs text-h8"> {{ myproduct.producer.name }}</span>
|
||||
</div>
|
||||
<div v-if="complete && myproduct.weight" class="text-grey text-title row items-center">
|
||||
<q-icon name="fas fa-balance-scale" class="q-mr-xs" />
|
||||
{{ t('products.weight') }}: <span class="text-black q-ml-xs text-h8"> {{ myproduct.weight }} {{
|
||||
tools.getUnitsMeasure(myproduct.unit, true) }}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -58,17 +60,14 @@
|
||||
</div>
|
||||
<div v-if="complete || getnumstore() > 1">
|
||||
<div class="text-blue text-title row items-center q-mr-md centeritems">
|
||||
<q-icon size="sm" name="fas fa-shipping-fast" class="q-mr-sm"/>
|
||||
Ritiro presso:
|
||||
<q-icon size="sm" name="fas fa-shipping-fast" class="q-mr-sm" />
|
||||
{{ t('products.ritiro_presso') }}:
|
||||
</div>
|
||||
<div class="text-green-6 text-title row items-center q-my-sm centeritems">
|
||||
|
||||
<div v-if="getnumstore() > 1">
|
||||
<q-select
|
||||
:behavior="$q.platform.is.ios === true ? 'dialog' : 'menu'"
|
||||
outlined v-model="order.idStorehouse"
|
||||
:options="getStorehouses()"
|
||||
label="Magazzino:" emit-value map-options>
|
||||
<q-select :behavior="$q.platform.is.ios === true ? 'dialog' : 'menu'" outlined v-model="order.idStorehouse"
|
||||
:options="getStorehouses()" :label="t('products.magazzino') + `:`" emit-value map-options>
|
||||
</q-select>
|
||||
</div>
|
||||
<div v-else>
|
||||
@@ -78,12 +77,11 @@
|
||||
</div>
|
||||
</q-card-section>
|
||||
|
||||
<q-separator/>
|
||||
<q-separator />
|
||||
|
||||
<q-card-actions vertical align="center">
|
||||
<q-btn
|
||||
icon="fas fa-cart-plus" color="primary" :disable="checkifCartDisable()" rounded size="md"
|
||||
label="Aggiungi al Carrello" @click="addtoCart">
|
||||
<q-btn icon="fas fa-cart-plus" color="primary" :disable="checkifCartDisable()" rounded size="md"
|
||||
:label="t('products.addcart')" @click="addtoCart">
|
||||
</q-btn>
|
||||
<!--
|
||||
<q-btn :icon="iconWhishlist(myproduct)" flat color="primary" rounded label="Lista Desideri">
|
||||
|
||||
Reference in New Issue
Block a user