|
|
@@ -2,7 +2,7 @@
|
|
|
<div class="container">
|
|
|
<categroy-nav></categroy-nav>
|
|
|
<category-property @loadCmpGoodsByBrandEvent="listemBrandFilter" @loadCmpGoodsByTypeEvent="listemProTypeFilter"></category-property>
|
|
|
- <component-goods></component-goods>
|
|
|
+ <component-goods :brandid="brandid" :propertyJSON="propertyJSON"></component-goods>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
@@ -11,6 +11,12 @@
|
|
|
|
|
|
export default {
|
|
|
layout: 'main',
|
|
|
+ data () {
|
|
|
+ return {
|
|
|
+ brandid: '',
|
|
|
+ propertyJSON: {}
|
|
|
+ }
|
|
|
+ },
|
|
|
fetch ({store, route}) {
|
|
|
return Promise.all([
|
|
|
store.dispatch('product/loadKindParentsWithBothers', {id: route.params.id}),
|
|
|
@@ -27,18 +33,29 @@
|
|
|
loadPage (id) {
|
|
|
this.$store.dispatch('product/pageComGoods', {kindid: this.$route.params.id, brandid: id})
|
|
|
},
|
|
|
- listemBrandFilter (brandid) {
|
|
|
+ listemBrandFilter (brandid, propertyJSON) {
|
|
|
+ this.brandid = brandid
|
|
|
+ this.propertyJSON = propertyJSON
|
|
|
+ console.log(this.brandid)
|
|
|
if (brandid) {
|
|
|
- this.$store.dispatch('product/pageComGoods', {kindid: this.$route.params.id, brandid: brandid})
|
|
|
+ if (propertyJSON !== null && Object.getOwnPropertyNames(propertyJSON).length > 3) {
|
|
|
+ this.$store.dispatch('product/pageComGoods', {kindid: this.$route.params.id, brandid: brandid, properties: propertyJSON})
|
|
|
+ } else {
|
|
|
+ this.$store.dispatch('product/pageComGoods', {kindid: this.$route.params.id, brandid: brandid})
|
|
|
+ }
|
|
|
+ } else if (propertyJSON !== null && Object.getOwnPropertyNames(propertyJSON).length > 3) {
|
|
|
+ this.$store.dispatch('product/pageComGoods', {kindid: this.$route.params.id, properties: propertyJSON})
|
|
|
} else {
|
|
|
this.$store.dispatch('product/pageComGoods', {kindid: this.$route.params.id})
|
|
|
}
|
|
|
},
|
|
|
- listemProTypeFilter (propertyJSON) {
|
|
|
- if (propertyJSON !== {}) {
|
|
|
- this.$store.dispatch('product/pageComGoods', propertyJSON == null ? {kindid: this.$route.params.id} : {kindid: this.$route.params.id, properties: propertyJSON})
|
|
|
+ listemProTypeFilter (propertyJSON, brandid) {
|
|
|
+ this.brandid = brandid
|
|
|
+ this.propertyJSON = propertyJSON
|
|
|
+ if (propertyJSON !== null && Object.getOwnPropertyNames(propertyJSON).length > 3) {
|
|
|
+ this.$store.dispatch('product/pageComGoods', {kindid: this.$route.params.id, brandid: brandid, properties: propertyJSON})
|
|
|
} else {
|
|
|
- this.$store.dispatch('product/pageComGoods', {kindid: this.$route.params.id})
|
|
|
+ this.$store.dispatch('product/pageComGoods', {kindid: this.$route.params.id, brandid: brandid})
|
|
|
}
|
|
|
}
|
|
|
}
|