PCB lista categorie

This commit is contained in:
Surya Paolo
2023-11-28 14:12:45 +01:00
parent b29caade62
commit 2314b07428
14 changed files with 216 additions and 78 deletions

View File

@@ -43,7 +43,7 @@ export default defineComponent({
return cart.items || null
}
function getNumItems() {
function getNumItems(): number {
const cart = productStore.getCart()
if (!!cart.items)
return cart.items.length || 0
@@ -51,7 +51,7 @@ export default defineComponent({
return 0
}
function getCart() {
function getCart(): ICart {
return productStore.getCart()
}
@@ -70,21 +70,21 @@ export default defineComponent({
const aggiorna = fieldname !== 'status'
tools.saveFieldToServer($q, 'carts', mycart.value._id, mydata, aggiorna)
myrec.value = oldrec.value
oldrec.value[fieldname] = myrec.value[fieldname]
}
}
function myTotalPrice() {
function myTotalPrice(): string {
if (productStore.cart && productStore.cart.totalPrice) {
return productStore.cart.totalPrice.toFixed(2)
} else {
return 0
return '0'
}
}
function myTotalQty() {
function myTotalQty(): number {
if (productStore.cart) {
return productStore.cart.totalQty
return productStore.cart.totalQty!
} else {
return 0
}
@@ -93,6 +93,7 @@ export default defineComponent({
async function load() {
mycart.value = getCart()
myrec.value = Object.keys(mycart)
oldrec.value = myrec.value
note.value = mycart.value.note!
if (mycart.value)