Authored by 郭成尧

Merge branch 'develop' of git.yoho.cn:fe/yohoblk-wap into develop

@@ -202,8 +202,6 @@ @@ -202,8 +202,6 @@
202 } 202 }
203 </style> 203 </style>
204 <script> 204 <script>
205 - const bus = require('common/vue-bus');  
206 -  
207 module.exports = { 205 module.exports = {
208 props: { 206 props: {
209 category: { 207 category: {
@@ -226,13 +224,7 @@ @@ -226,13 +224,7 @@
226 }, 224 },
227 watch: { 225 watch: {
228 category() { 226 category() {
229 - this.$set('cateNavLeftData', this.category);  
230 - this.$set('cateNavRightData', this.cateNavLeftData ? this.cateNavLeftData[0].sub : []);  
231 -  
232 - this.$set('rightAll', this.cateNavLeftData ? {  
233 - sortId: this.cateNavLeftData[0].relationParameter.sort,  
234 - categoryName: this.cateNavLeftData[0].categoryName  
235 - } : {}); 227 + this.categoryChangeHandler();
236 } 228 }
237 }, 229 },
238 methods: { 230 methods: {
@@ -247,11 +239,28 @@ @@ -247,11 +239,28 @@
247 239
248 /* 筛选列表使用返回值 */ 240 /* 筛选列表使用返回值 */
249 noJumpReturn(categoryId, categoryName) { 241 noJumpReturn(categoryId, categoryName) {
250 - bus.$emit('category.result', { 242 + this.$dispatch('select', {
251 id: categoryId, 243 id: categoryId,
252 name: categoryName 244 name: categoryName
253 }); 245 });
  246 + },
  247 +
  248 + categoryChangeHandler() {
  249 + if (!this.category.length) {
  250 + return;
  251 + }
  252 +
  253 + this.$set('cateNavLeftData', this.category);
  254 + this.$set('cateNavRightData', this.cateNavLeftData ? this.cateNavLeftData[0].sub : []);
  255 +
  256 + this.$set('rightAll', this.cateNavLeftData ? {
  257 + sortId: this.cateNavLeftData[0].relationParameter.sort,
  258 + categoryName: this.cateNavLeftData[0].categoryName
  259 + } : {});
254 } 260 }
  261 + },
  262 + created() {
  263 + this.categoryChangeHandler();
255 } 264 }
256 }; 265 };
257 </script> 266 </script>
@@ -23,12 +23,15 @@ @@ -23,12 +23,15 @@
23 const bus = require('common/vue-bus'); 23 const bus = require('common/vue-bus');
24 const Overlay = require('common/overlay'); 24 const Overlay = require('common/overlay');
25 const filterSub = require('./filter/filter-sub.vue'); 25 const filterSub = require('./filter/filter-sub.vue');
  26 + const qs = require('yoho-qs/parse');
  27 + let locationQuery = qs(decodeURIComponent(location.search.replace(/^\?/, '')));
  28 + let hasSort = !!locationQuery.sort;
26 29
27 module.exports = { 30 module.exports = {
28 props: { 31 props: {
29 config: Object, 32 config: Object,
30 isVisible: Boolean, 33 isVisible: Boolean,
31 - action: '', 34 + action: ''
32 }, 35 },
33 data: function() { 36 data: function() {
34 return { 37 return {
@@ -60,8 +63,8 @@ @@ -60,8 +63,8 @@
60 showCate: function(cateName, cateVals) { 63 showCate: function(cateName, cateVals) {
61 if (toString.call(cateVals) === '[object Array]') { 64 if (toString.call(cateVals) === '[object Array]') {
62 if (cateName === 'groupSort') { 65 if (cateName === 'groupSort') {
63 - // TODO  
64 - } else if (cateVals.length > 1) { 66 + return !hasSort;
  67 + } else if (cateVals.length >= 1) {
65 return true; 68 return true;
66 } 69 }
67 } 70 }
@@ -92,7 +95,12 @@ @@ -92,7 +95,12 @@
92 * @param {[type]} val [description] 95 * @param {[type]} val [description]
93 */ 96 */
94 setParams: function(item) { 97 setParams: function(item) {
95 - this.$set(`params.${this.subType}`, item); 98 + let sortType = this.subType;
  99 +
  100 + if (this.subType === 'groupSort') {
  101 + sortType = 'sort';
  102 + }
  103 + this.$set(`params.${sortType}`, item);
96 }, 104 },
97 105
98 showLabel: function(key) { 106 showLabel: function(key) {
@@ -3,19 +3,21 @@ @@ -3,19 +3,21 @@
3 <c-header class="filter-sub-header" :title="type | filter-cn '选择'"> 3 <c-header class="filter-sub-header" :title="type | filter-cn '选择'">
4 <i class="icon icon-left" slot="left" @click="hide"></i> 4 <i class="icon icon-left" slot="left" @click="hide"></i>
5 </c-header> 5 </c-header>
6 - <div>  
7 - <brand-filter v-if="type === 'brand'" :data="data" :val.sync="val" @select="selectItem"></brand-filter>  
8 - <normal-filter v-else :data="data" :type="type" :val.sync="val" @select="selectItem"></normal-filter>  
9 - </div> 6 + <div class="filter-sub-select">
  7 + <brand-filter v-if="type === 'brand'" :data="data" @select="selectItem"></brand-filter>
  8 + <normal-filter v-if="type !== 'brand' && type !== 'groupSort'" :data="data" :type="type" @select="selectItem"></normal-filter>
  9 + <sort-filter class="filter-detail filter-sort" v-if="type === 'groupSort'" :category="data" @select="selectItem"></sort-filter>
  10 + </div>
10 </div> 11 </div>
11 </template> 12 </template>
12 <script> 13 <script>
13 const cHeader = require('component/header.vue'); 14 const cHeader = require('component/header.vue');
14 const brandFilter = require('./brand.vue'); 15 const brandFilter = require('./brand.vue');
15 const normalFilter = require('./normal.vue'); 16 const normalFilter = require('./normal.vue');
  17 + const sortFilter = require('channel/brand-cate.vue');
16 18
17 module.exports = { 19 module.exports = {
18 - components: {cHeader, brandFilter, normalFilter}, 20 + components: {cHeader, brandFilter, normalFilter, sortFilter},
19 props: ['type', 'data'], 21 props: ['type', 'data'],
20 data() { 22 data() {
21 return { 23 return {
@@ -47,7 +49,6 @@ @@ -47,7 +49,6 @@
47 transform: translate3d(100%, 0, 0); 49 transform: translate3d(100%, 0, 0);
48 background-color: $white; 50 background-color: $white;
49 z-index: 2010; 51 z-index: 2010;
50 - overflow: auto;  
51 52
52 &.filter-sub-open { 53 &.filter-sub-open {
53 transform: translate3d(0, 0, 0); 54 transform: translate3d(0, 0, 0);
@@ -90,4 +91,30 @@ @@ -90,4 +91,30 @@
90 91
91 } 92 }
92 } 93 }
  94 +
  95 +.filter-sub-select {
  96 + position: absolute;
  97 + top: 90px;
  98 + left: 0;
  99 + right: 0;
  100 + bottom: 0;
  101 +}
  102 +
  103 +.filter-detail {
  104 + height: 100%;
  105 + overflow: auto;
  106 +}
  107 +
  108 +.filter-sort {
  109 + .cate-container {
  110 + margin-top: 0;
  111 + height: 100%;
  112 + }
  113 + .content {
  114 + height: 100% !important;
  115 + }
  116 + .sub-level-container {
  117 + overflow: auto;
  118 + }
  119 +}
93 </style> 120 </style>