-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added discount and electronic and gamer pages and updated Home page
- Loading branch information
1 parent
acafaa2
commit 4016ae7
Showing
10 changed files
with
291 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
<template> | ||
<div class="row"> | ||
<section class="col-12 col-sm-10"> | ||
<breadcrumb activeText="Special discounts" /> | ||
<productList :items="changeProducts ? discountProducts:Products" /> | ||
</section> | ||
<section class="col-sm-2"> | ||
<asideLayout> | ||
<div slot="beforeDivider"> | ||
<div v-for="i in allCategories" :key="i"> | ||
<input | ||
type="checkbox" | ||
:id="i" | ||
:value="i" | ||
v-model="checkedCategory" | ||
@change="filtredCategory()" | ||
/> | ||
<label :for="i" class="form-label">{{ i }}</label> | ||
</div> | ||
</div> | ||
</asideLayout> | ||
</section> | ||
</div> | ||
</template> | ||
<script> | ||
import breadcrumb from "@/components/breadcrumb.vue"; | ||
import productList from "@/components/productList.vue"; | ||
export default { | ||
data() { | ||
return { | ||
changeProducts:false, | ||
checkedCategory: [], | ||
}; | ||
}, | ||
computed: { | ||
allCategories() { | ||
return this.$store.state.allCategories; | ||
}, | ||
}, | ||
methods:{ | ||
filtredCategory(){ | ||
const Products=this.Products | ||
const filtredCategory=this.checkedCategory | ||
const filteredProducts={} | ||
if (filtredCategory.length === 0 ) { | ||
this.changeProducts=false | ||
}else{ | ||
for (let category of filtredCategory) { | ||
for (let i in Products) { | ||
if (Products[i].some((item)=>item.category===category)) { | ||
filteredProducts[i]=Products[i].filter((item)=>item.category===category) | ||
} | ||
} | ||
} | ||
this.discountProducts=filteredProducts; | ||
this.changeProducts=true | ||
} | ||
} | ||
}, | ||
components: { | ||
breadcrumb, | ||
productList, | ||
}, | ||
asyncData({ store }) { | ||
const products = {}; | ||
function filteredProduct(product,category) { | ||
const Products = product; | ||
for (let key in Products) { | ||
const filtered=Products[key].filter((item)=> | ||
item.special===true | ||
).map((item)=>{ | ||
return { | ||
...item, | ||
category:category | ||
} | ||
}); | ||
products[key] = filtered; | ||
} | ||
} | ||
const allProducts={ | ||
Digital:store.state.Digital.Products, | ||
Fashion:store.state.Fashion.Products, | ||
Beauty:store.state.Beauty.Products, | ||
House:store.state.House.Products | ||
}; | ||
for (let key in allProducts) { | ||
filteredProduct(allProducts[key],key); | ||
} | ||
return { | ||
Products: products, | ||
discountProducts:{} | ||
}; | ||
}, | ||
}; | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<template> | ||
<div> | ||
<section> | ||
<category :products="digitalCategory" subRoute="/Products/Digital/" :products2="houseCategory" subRoute2="/Products/House/" /> | ||
</section> | ||
<section> | ||
<breadcrumb activeText="Electronic needs" /> | ||
<productList :items="Products" /> | ||
</section> | ||
</div> | ||
</template> | ||
<script> | ||
import category from "@/components/category.vue"; | ||
import breadcrumb from "@/components/breadcrumb.vue"; | ||
import productList from "@/components/productList.vue"; | ||
export default { | ||
computed: { | ||
digitalCategory() { | ||
return this.$store.state.categories.allCategories["Digital products"].products; | ||
}, | ||
houseCategory() { | ||
return this.$store.state.categories.allCategories["House"].products; | ||
}, | ||
}, | ||
components: { | ||
category, | ||
breadcrumb, | ||
productList | ||
}, | ||
asyncData({store}) { | ||
const products={}; | ||
const digitalProducts=store.state.Digital.Products; | ||
const houseProducts=store.state.House.Products; | ||
for ( let key in digitalProducts) { | ||
products[key]=digitalProducts[key] | ||
} | ||
for ( let key in houseProducts) { | ||
products[key]=houseProducts[key] | ||
} | ||
return { | ||
Products:products | ||
} | ||
}, | ||
} | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<template> | ||
<div> | ||
<section> | ||
<category :products="digitalCategory" subRoute="/Products/Digital/" :products2="houseCategory" subRoute2="/Products/House/" /> | ||
</section> | ||
<section> | ||
<breadcrumb activeText="For gamers" /> | ||
<productList :items="Products" /> | ||
</section> | ||
</div> | ||
</template> | ||
<script> | ||
import category from "@/components/category.vue"; | ||
import breadcrumb from "@/components/breadcrumb.vue"; | ||
import productList from "@/components/productList.vue"; | ||
export default { | ||
computed: { | ||
digitalCategory() { | ||
const digitalCategory={}; | ||
const digitalProducts=this.$store.state.categories.allCategories["Digital products"].products["laptop"]; | ||
digitalCategory['laptop']=digitalProducts; | ||
return digitalCategory; | ||
}, | ||
houseCategory() { | ||
const houseCategory={}; | ||
const houseProducts=this.$store.state.categories.allCategories["House"].products["video-audio"]; | ||
houseCategory['video-audio']=houseProducts; | ||
return houseCategory; | ||
}, | ||
}, | ||
components: { | ||
category, | ||
breadcrumb, | ||
productList | ||
}, | ||
asyncData({store}) { | ||
const products={}; | ||
const digitalProducts=store.state.Digital.Products['laptop']; | ||
products['laptop']=digitalProducts; | ||
const houseProducts=store.state.House.Products['video-audio']; | ||
products['video-audio']=houseProducts; | ||
return { | ||
Products:products | ||
} | ||
}, | ||
} | ||
</script> |
Oops, something went wrong.