|
|
<template>
|
|
|
<tab v-bind:page="'cate'"></tab>
|
|
|
<div class="cate-page" id='cate-page'>
|
|
|
<div class="cate-container clearfix">
|
|
|
<div class="content" style="height: 522px;">
|
...
|
...
|
@@ -199,11 +198,6 @@ |
|
|
}
|
|
|
</style>
|
|
|
<script>
|
|
|
const $ = require('jquery');
|
|
|
const tip = require('common/tip');
|
|
|
const tab = require('channel/tab.vue');
|
|
|
const contentCode = require('content-code');
|
|
|
const qs = require('yoho-qs');
|
|
|
const bus = require('common/vue-bus');
|
|
|
|
|
|
const channelTrans = {
|
...
|
...
|
@@ -222,45 +216,37 @@ |
|
|
};
|
|
|
|
|
|
module.exports = {
|
|
|
props: [],
|
|
|
props: {
|
|
|
category: {
|
|
|
type: Object
|
|
|
},
|
|
|
jump: {
|
|
|
type: Boolean
|
|
|
}
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
brandCate: [],
|
|
|
cateNavLeftData: [],
|
|
|
cateNavRightData: [],
|
|
|
topcurrent: 0,
|
|
|
widthli: 33.33,
|
|
|
leftcurrent: 0,
|
|
|
page: 'cate',
|
|
|
gender: '1,2,3',
|
|
|
rightAll: {},
|
|
|
contentCode: contentCode.brand[qs.channel || 'men']
|
|
|
brandCate: [], // 频道切换时取数据使用
|
|
|
cateNavLeftData: [], // 左侧分类数据
|
|
|
cateNavRightData: [], // 右侧分类数据
|
|
|
leftcurrent: 0, // 标记当前左侧选中条目
|
|
|
gender: '1,2,3', // 跳转到商品列表页的参数
|
|
|
rightAll: {} // 全部XX
|
|
|
};
|
|
|
},
|
|
|
methods: {
|
|
|
getCateList() {
|
|
|
let data = {
|
|
|
channel: ''
|
|
|
};
|
|
|
|
|
|
$.ajax({
|
|
|
url: '/cate/list.json',
|
|
|
data: data
|
|
|
}).then(result => {
|
|
|
if (result.code === 200 && result.data) {
|
|
|
this.$set('brandCate', result.data);
|
|
|
this.$set('cateNavLeftData', result.data['MEN男士']);
|
|
|
this.$set('cateNavRightData', result.data['MEN男士'] ? result.data['MEN男士'][0].sub : []);
|
|
|
watch: {
|
|
|
category() {
|
|
|
this.$set('brandCate', this.category);
|
|
|
this.$set('cateNavLeftData', this.category['MEN男士']);
|
|
|
this.$set('cateNavRightData', this.category['MEN男士'] ? this.category['MEN男士'][0].sub : []);
|
|
|
|
|
|
this.$set('rightAll', result.data['MEN男士'] ? {
|
|
|
sortId: result.data['MEN男士'][0].relationParameter.sort,
|
|
|
categoryName: result.data['MEN男士'][0].categoryName
|
|
|
} : {});
|
|
|
}
|
|
|
}).fail(() => {
|
|
|
tip('网络错误');
|
|
|
});
|
|
|
},
|
|
|
this.$set('rightAll', this.category['MEN男士'] ? {
|
|
|
sortId: this.category['MEN男士'][0].relationParameter.sort,
|
|
|
categoryName: this.category['MEN男士'][0].categoryName
|
|
|
} : {});
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
cateNavLeftFun(index, categoryId, categoryName) {
|
|
|
this.leftcurrent = index;
|
|
|
this.cateNavRightData = this.cateNavLeftData[index].sub;
|
...
|
...
|
@@ -270,12 +256,7 @@ |
|
|
};
|
|
|
}
|
|
|
},
|
|
|
components: {
|
|
|
tab
|
|
|
},
|
|
|
created() {
|
|
|
this.getCateList();
|
|
|
|
|
|
bus.$on('channel.change', (page, channel) => {
|
|
|
this.gender = channelTrans[channel].code;
|
|
|
this.cateNavLeftData = this.brandCate[channelTrans[channel].key];
|
...
|
...
|
|