Aggiungi il codice alla cassa in automatico
This commit is contained in:
@@ -79,41 +79,15 @@ export default defineComponent({
|
||||
return 'fas fa-heart'
|
||||
}
|
||||
}
|
||||
function addtoCart(add: boolean) {
|
||||
async function addtoCart(add: boolean) {
|
||||
|
||||
if (!userStore.isLogged) {
|
||||
tools.showNeutralNotif($q, t('ecomm.area_personale'))
|
||||
globalStore.rightDrawerOpen = true
|
||||
return false
|
||||
}
|
||||
await products.addtoCartBase({ $q, t, code: myproduct.value.code!, order: myorder, addqty: add })
|
||||
|
||||
products.addToCart({ product: myproduct.value, order: myorder, addqty: add }).then((ris) => {
|
||||
let strprod = t('ecomm.prodotto')
|
||||
|
||||
if (myorder.quantity > 1 || myorder.quantity === 0)
|
||||
strprod = t('ecomm.prodotti')
|
||||
|
||||
let msg = ''
|
||||
if (ris === null)
|
||||
msg = t('ecomm.error_cart')
|
||||
else {
|
||||
|
||||
if (myorder.quantity === 0) {
|
||||
msg = t('ecomm.prodotto_tolto')
|
||||
} else {
|
||||
msg = t('ecomm.prod_sul_carrello', { strprod, qty: myorder.quantity })
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
updateproduct()
|
||||
|
||||
if (ris === null || myorder.quantity === 0)
|
||||
tools.showNotif($q, msg)
|
||||
else
|
||||
tools.showPositiveNotif($q, msg)
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
function getnumstore() {
|
||||
@@ -139,14 +113,14 @@ export default defineComponent({
|
||||
}
|
||||
|
||||
function updateproduct() {
|
||||
myproduct.value = products.getProduct(props.code)
|
||||
myproduct.value = products.getProductByCode(props.code)
|
||||
products.updateQuantityAvailable(myproduct.value._id)
|
||||
}
|
||||
|
||||
function getStorehouses() {
|
||||
if (!myproduct.value)
|
||||
return []
|
||||
|
||||
|
||||
const myarr: any = []
|
||||
let ind = 1
|
||||
myproduct.value.storehouses.forEach((store) => {
|
||||
|
||||
Reference in New Issue
Block a user