Struttura Scheda Prodotti...

This commit is contained in:
Surya Paolo
2023-11-30 14:27:46 +01:00
parent dffcc28690
commit 39e21600ca
16 changed files with 136 additions and 58 deletions

View File

@@ -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,
}
}
})