Commit 05ece9f5 authored by Garima Jain's avatar Garima Jain

updated the cart page

parent 56172b05
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
{ {
"name": "mcart", "name": "mcart",
"version": "0.1.15", "version": "0.1.27",
"private": false, "private": false,
"main": "./dist/mComponents.common.js", "main": "./dist/mComponents.common.js",
"files": [ "files": [
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<div class="justify-content-md-center row"> <div class="justify-content-md-center row">
<div class="col col-lg-8"> <div class="col col-lg-8">
<top-bar></top-bar> <top-bar></top-bar>
<list-cart-items displaying="block" :message="test"></list-cart-items> <list-cart-items displaying="block" :test="test" @delete-cart-items='removeItem' @qty-dropdown='getQty'></list-cart-items>
<banner> <banner>
<div <div
class="card" class="card"
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
</div> </div>
</div> </div>
</banner> </banner>
<frequently-view> <!-- <frequently-view>
<div class="card"> <div class="card">
<h3>Current Offers</h3> <h3>Current Offers</h3>
<p> <p>
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
</p> </p>
<list-cart-items displaying="none"></list-cart-items> <list-cart-items displaying="none"></list-cart-items>
</div> </div>
</frequently-view> </frequently-view> -->
<suggest-product <suggest-product
title="Customers Also Shopped" title="Customers Also Shopped"
:list="list" :list="list"
...@@ -53,7 +53,7 @@ import TopBar from "./components/TopBar.vue"; ...@@ -53,7 +53,7 @@ import TopBar from "./components/TopBar.vue";
import Promo from "./components/Promo.vue"; import Promo from "./components/Promo.vue";
import CheckoutInfo from "./components/CheckoutInfo.vue"; import CheckoutInfo from "./components/CheckoutInfo.vue";
import Banner from "./components/Banner.vue"; import Banner from "./components/Banner.vue";
import FrequentlyView from "./components/FrequentlyView.vue"; //import FrequentlyView from "./components/FrequentlyView.vue";
import ListCartItems from "./components/ListCartItems.vue"; import ListCartItems from "./components/ListCartItems.vue";
import SuggestProduct from "./components/SuggestProduct.vue"; import SuggestProduct from "./components/SuggestProduct.vue";
...@@ -74,10 +74,21 @@ export default { ...@@ -74,10 +74,21 @@ export default {
Promo, Promo,
CheckoutInfo, CheckoutInfo,
Banner, Banner,
FrequentlyView, //FrequentlyView,
ListCartItems, ListCartItems,
SuggestProduct, SuggestProduct,
}, },
created() {
console.log("===dsaf===", this.test)
},
methods: {
removeItem(id){
this.$emit('delete-cart-items', id)
},
getQty(e, item) {
this.$emit('qty-dropdown',e, item)
}
},
mounted() { mounted() {
this.loading = true; //the loading begin this.loading = true; //the loading begin
fetch("https://fakestoreapi.com/products?limit=5") fetch("https://fakestoreapi.com/products?limit=5")
......
<template> <template>
<div> <div>
<div class="card" v-if="loading"> <div class="card" v-if="loading">loading.....</div>
loading..... <div class="card" v-else-if="test == undefined"><p>No item into cart </p></div>
</div>
<div <div
v-else v-else
class="overflow-hidden mb-2 card" class="overflow-hidden mb-2 card"
v-for="item in message" v-for="item in test"
v-bind:key="item.id" v-bind:key="item.id"
> >
<div class="card-body"> <div class="card-body">
...@@ -19,37 +18,27 @@ ...@@ -19,37 +18,27 @@
<div class="card-text"> <div class="card-text">
<b>{{ item.title }}</b> <b>{{ item.title }}</b>
<p>{{ item.description }}</p> <p>{{ item.description }}</p>
<!-- <p>This is Dynamic {{ message }}</p> -->
</div> </div>
<br /> <br />
<br /> <br />
<div class="card-text"> <div class="card-text">Size: M</div>
Size: M <div class="card-text">Color: Red</div>
</div>
<div class="card-text">
Color: Red
</div>
</div> </div>
</div> </div>
<div class="col col-lg-2"> <div class="col col-lg-2">
<select v-model="selected"> <select v-model="item.qty" @change="switchSelect($event, item)">
<option value="1">1</option> <option value="1">1</option>
<option value="2">2</option> <option value="2">2</option>
<option value="3">3</option> <option value="3">3</option>
<option value="4">4</option> <option value="4">4</option>
<option value="5">5</option> <option value="5">5</option>
<option value="6">5</option>
</select> </select>
</div> </div>
<div class="col col-lg-2"> <div class="col col-lg-2">
<div class="card-text"> <div class="card-text">
<p>Orig. {{ item.price }}</p> <p>Orig. {{ item.price }}</p>
<p class="red">Now {{ item.price }}</p> <p class="grey">Subtotal {{ item.newPrice }}</p>
<p class="grey">Subtotal {{ item.price }}</p>
<br />
<br />
<p>
<b>Total {{ item.price * selected }} </b>
</p>
</div> </div>
</div> </div>
</div> </div>
...@@ -64,11 +53,12 @@ ...@@ -64,11 +53,12 @@
<div class="links"> <div class="links">
<a href="">Save For later </a> <a href="">Save For later </a>
<a href="">Move to List </a> <a href="">Move to List </a>
<a href="#" @click="deleteCartItem(item.id)">Remove </a> <a href="#" @click="$emit('delete-cart-items', item.id)">Remove </a>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</template> </template>
...@@ -79,18 +69,16 @@ export default { ...@@ -79,18 +69,16 @@ export default {
return { return {
list: [], list: [],
loading: false, loading: false,
selected: "1", priceCalculate: 0,
}; };
}, },
props: ["displaying", "message"], props: {
computed: { test: Array,
getTotal: function(price) { displaying: String
return price + this.selected;
},
}, },
methods: { methods: {
deleteCartItem(id) { switchSelect(e, item){
this.$emit('delete_cart_item', id) this.$emit('qty-dropdown', e.target.value, item)
} }
}, },
mounted() { mounted() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment