fix: don't allow adding more units than stock to cart
This commit is contained in:
parent
cf5d432998
commit
943a30f1e4
1 changed files with 8 additions and 0 deletions
|
|
@ -89,6 +89,14 @@ async function customerStall(path) {
|
||||||
let prod = this.cart.products
|
let prod = this.cart.products
|
||||||
if (prod.has(item.id)) {
|
if (prod.has(item.id)) {
|
||||||
let qty = prod.get(item.id).quantity
|
let qty = prod.get(item.id).quantity
|
||||||
|
if (qty == item.quantity) {
|
||||||
|
this.$q.notify({
|
||||||
|
type: 'warning',
|
||||||
|
message: `${item.name} only has ${item.quantity} units!`,
|
||||||
|
icon: 'production_quantity_limits'
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
prod.set(item.id, {
|
prod.set(item.id, {
|
||||||
...prod.get(item.id),
|
...prod.get(item.id),
|
||||||
quantity: qty + 1
|
quantity: qty + 1
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue