From 2e7da5ab02ffa8b07fede7f6cd7e5dbbd90fac5f Mon Sep 17 00:00:00 2001 From: "Adam T. Carpenter" Date: Mon, 23 Nov 2020 17:29:58 -0500 Subject: finished up product detail functionality, started checkout and cart views --- iridescence/src/components/BusyBar.vue | 12 +---- iridescence/src/components/CartCheckout.vue | 25 +++++++--- iridescence/src/components/Navbar.vue | 16 +++--- iridescence/src/components/ProductDetail.vue | 75 +++++++++++++++++++++++----- iridescence/src/components/cart/CartItem.vue | 39 +++++++++++++++ 5 files changed, 126 insertions(+), 41 deletions(-) create mode 100644 iridescence/src/components/cart/CartItem.vue (limited to 'iridescence/src/components') diff --git a/iridescence/src/components/BusyBar.vue b/iridescence/src/components/BusyBar.vue index 721a5fd..a38cefa 100644 --- a/iridescence/src/components/BusyBar.vue +++ b/iridescence/src/components/BusyBar.vue @@ -5,13 +5,6 @@ max="100" v-if="isBusy" > - {{ progress }}% @@ -20,10 +13,7 @@ export default { name: "BusyBar", computed: { isBusy() { - return this.$store.getters.busy; - }, - progress() { - return this.$store.getters.progress; + return this.$store.state.busy; } } }; diff --git a/iridescence/src/components/CartCheckout.vue b/iridescence/src/components/CartCheckout.vue index ec72acf..19ad706 100644 --- a/iridescence/src/components/CartCheckout.vue +++ b/iridescence/src/components/CartCheckout.vue @@ -1,15 +1,24 @@ + diff --git a/iridescence/src/components/Navbar.vue b/iridescence/src/components/Navbar.vue index 60db834..3ef4ead 100644 --- a/iridescence/src/components/Navbar.vue +++ b/iridescence/src/components/Navbar.vue @@ -82,13 +82,12 @@ export default { }, categories() { //const raw = this.$store.getters.products.map(p => p.category.split("/")); - const raw = [ - [1, 2, 3], - [1, 2, 4], - [1, 5], - [6, 7] - ]; - console.log(this.generateCategories(raw)); + //const raw = [ + // [1, 2, 3], + // [1, 2, 4], + // [1, 5], + // [6, 7] + //]; return []; }, routeName() { @@ -96,9 +95,8 @@ export default { } }, methods: { - generateCategories(list) { + generateCategories() { let results = []; - console.log(list); return results; }, diff --git a/iridescence/src/components/ProductDetail.vue b/iridescence/src/components/ProductDetail.vue index 9802d84..430d78b 100644 --- a/iridescence/src/components/ProductDetail.vue +++ b/iridescence/src/components/ProductDetail.vue @@ -17,18 +17,56 @@
-
-

- {{ product.name }} -

-

- {{ dollars }} -

-

{{ stock }}

-
- -
- {{ product.description }} +
+
+

+ {{ product.name }} +

+ +

+ {{ product.description }} +

+
+
+

{{ dollars }}

+

{{ stock }}

+ + +
@@ -42,9 +80,12 @@ export default { name: "ProductDetail", computed: { + inCart() { + return this.$store.state.cart[this.product.id]; + }, product() { return this.$store.getters.products.find( - p => p.id == this.$store.getters.productDetailId + p => p.id == this.$store.state.productDetailId ); }, stock() { @@ -66,11 +107,19 @@ export default { return [process.env.VUE_APP_IMAGE_ROOT, this.product.photo_fullsize].join( "/" ); + }, + categories() { + let categories = this.product.category.split("/"); + categories.splice(0, 1, "All"); + return categories; } }, methods: { clearDetailId() { this.$store.commit("productDetailId", 0); + }, + incrementCartQuantity(by) { + this.$store.commit("cartItem", { id: this.product.id, by }); } } }; diff --git a/iridescence/src/components/cart/CartItem.vue b/iridescence/src/components/cart/CartItem.vue new file mode 100644 index 0000000..8c2de16 --- /dev/null +++ b/iridescence/src/components/cart/CartItem.vue @@ -0,0 +1,39 @@ + + + -- cgit v1.2.3