feat: show total cart item count

This commit is contained in:
Vlad Stan 2023-07-07 10:13:46 +03:00
parent 2b0664b613
commit e1b2a4a479
2 changed files with 13 additions and 5 deletions

View file

@ -124,6 +124,10 @@ const market = async () => {
},
canEditConfig() {
return this.account && this.account.pubkey == this.config?.pubkey
},
allCartsItemCount() {
return this.shoppingCarts.map(s => s.products).flat().reduce((t, p) => t + p.orderedQuantity, 0)
}
},
async created() {
@ -567,8 +571,6 @@ const market = async () => {
},
addProductToCart(item) {
console.log('### addProductToCart:', item)
let stallCart = this.shoppingCarts.find(s => s.id === item.stall_id)
if (!stallCart) {
stallCart = {