From d8d44376d193d925582a0a12373e1403df49cf63 Mon Sep 17 00:00:00 2001 From: "Adam T. Carpenter" Date: Thu, 3 Dec 2020 19:25:12 -0500 Subject: basic cart subtotaling, sidebar with total and checkout controls, better navbar cart buttons --- iridescence/src/components/CartCheckout.vue | 16 +++++++++++----- iridescence/src/components/cart/CartItem.vue | 7 ++++++- iridescence/src/components/cart/Totals.vue | 25 +++++++++++++++++++++++++ 3 files changed, 42 insertions(+), 6 deletions(-) create mode 100644 iridescence/src/components/cart/Totals.vue (limited to 'iridescence/src/components') diff --git a/iridescence/src/components/CartCheckout.vue b/iridescence/src/components/CartCheckout.vue index 19ad706..cde78d9 100644 --- a/iridescence/src/components/CartCheckout.vue +++ b/iridescence/src/components/CartCheckout.vue @@ -1,10 +1,13 @@ @@ -18,6 +21,9 @@ export default { (acc, cur) => acc + cur, 0 ); + }, + cartTotal() { + return this.$store.getters.cartTotal; } } }; diff --git a/iridescence/src/components/cart/CartItem.vue b/iridescence/src/components/cart/CartItem.vue index 2c7655a..e31a109 100644 --- a/iridescence/src/components/cart/CartItem.vue +++ b/iridescence/src/components/cart/CartItem.vue @@ -19,6 +19,7 @@
+
Subtotal: {{ dollars }}

@@ -44,8 +45,9 @@

+
-
@@ -78,6 +80,9 @@ export default { methods: { incrementCartQuantity(by) { this.$store.commit("cartItem", { id: this.id, by }); + }, + removeAll() { + this.$store.commit("removeItemFromCart", this.id); } } }; diff --git a/iridescence/src/components/cart/Totals.vue b/iridescence/src/components/cart/Totals.vue new file mode 100644 index 0000000..7b95462 --- /dev/null +++ b/iridescence/src/components/cart/Totals.vue @@ -0,0 +1,25 @@ + + + -- cgit v1.2.3