feat: remove from card
This commit is contained in:
parent
52c987b88e
commit
483fcedfd9
3 changed files with 12 additions and 3 deletions
|
|
@ -5,17 +5,18 @@ async function shoppingCartList(path) {
|
||||||
name: 'shopping-cart-list',
|
name: 'shopping-cart-list',
|
||||||
template,
|
template,
|
||||||
|
|
||||||
props: ['carts', 'products'],
|
props: ['carts'],
|
||||||
data: function () {
|
data: function () {
|
||||||
return {}
|
return {}
|
||||||
},
|
},
|
||||||
computed: {},
|
computed: {},
|
||||||
methods: {
|
methods: {
|
||||||
formatCurrency: function(value, unit){
|
formatCurrency: function (value, unit) {
|
||||||
return formatCurrency(value, unit)
|
return formatCurrency(value, unit)
|
||||||
},
|
},
|
||||||
removeProduct: function (stallId, productId) {
|
removeProduct: function (stallId, productId) {
|
||||||
console.log('### stallId, productId', stallId, productId)
|
console.log('### stallId, productId', stallId, productId)
|
||||||
|
this.$emit('remove-from-cart', { stallId, productId })
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() { }
|
created() { }
|
||||||
|
|
|
||||||
|
|
@ -588,6 +588,14 @@ const market = async () => {
|
||||||
|
|
||||||
this.$q.localStorage.set('nostrmarket.shoppingCarts', this.shoppingCarts)
|
this.$q.localStorage.set('nostrmarket.shoppingCarts', this.shoppingCarts)
|
||||||
console.log('### this.shoppingCarts', this.shoppingCarts)
|
console.log('### this.shoppingCarts', this.shoppingCarts)
|
||||||
|
},
|
||||||
|
|
||||||
|
removeProductFromCart(item) {
|
||||||
|
const stallCart = this.shoppingCarts.find(c => c.id === item.stallId)
|
||||||
|
if (stallCart) {
|
||||||
|
stallCart.products = stallCart.products.filter(p => p.id !== item.productId)
|
||||||
|
this.$q.localStorage.set('nostrmarket.shoppingCarts', this.shoppingCarts)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -205,7 +205,7 @@
|
||||||
<market-config v-if="activePage === 'market-config'" :merchants="merchants" @add-merchant="addMerchant"
|
<market-config v-if="activePage === 'market-config'" :merchants="merchants" @add-merchant="addMerchant"
|
||||||
@remove-merchant="removeMerchant"></market-config>
|
@remove-merchant="removeMerchant"></market-config>
|
||||||
<shopping-cart-list v-else-if="activePage === 'shopping-cart-list'" :carts="shoppingCarts"
|
<shopping-cart-list v-else-if="activePage === 'shopping-cart-list'" :carts="shoppingCarts"
|
||||||
:products="products"></shopping-cart-list>
|
@remove-from-cart="removeProductFromCart"></shopping-cart-list>
|
||||||
<customer-stall v-else-if="!isLoading && activeStall" :stall="stalls.find(stall => stall.id == activeStall)"
|
<customer-stall v-else-if="!isLoading && activeStall" :stall="stalls.find(stall => stall.id == activeStall)"
|
||||||
:products="filterProducts" :stall-products="products.filter(p => p.stall_id == activeStall)"
|
:products="filterProducts" :stall-products="products.filter(p => p.stall_id == activeStall)"
|
||||||
:product-detail="activeProduct" :relays="relays" :account="account" :pool="pool" :styles="config?.opts ?? {}"
|
:product-detail="activeProduct" :relays="relays" :account="account" :pool="pool" :styles="config?.opts ?? {}"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue