Authored by 陈轩

fix

@@ -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,7 @@ @@ -60,8 +63,7 @@
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 - return true; 66 + return !hasSort;
65 } else if (cateVals.length >= 1) { 67 } else if (cateVals.length >= 1) {
66 return true; 68 return true;
67 } 69 }
@@ -93,7 +95,12 @@ @@ -93,7 +95,12 @@
93 * @param {[type]} val [description] 95 * @param {[type]} val [description]
94 */ 96 */
95 setParams: function(item) { 97 setParams: function(item) {
96 - 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);
97 }, 104 },
98 105
99 showLabel: function(key) { 106 showLabel: function(key) {
@@ -3,10 +3,10 @@ @@ -3,10 +3,10 @@
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-if="type !== 'brand' && type !== 'groupSort'" :data="data" :type="type" :val.sync="val" @select="selectItem"></normal-filter>  
9 - <sort-filter v-if="type === 'groupSort'" :category="data" :val.sync="val" @select="selectItem"></sort-filter> 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 </div>
12 </template> 12 </template>
@@ -49,7 +49,6 @@ @@ -49,7 +49,6 @@
49 transform: translate3d(100%, 0, 0); 49 transform: translate3d(100%, 0, 0);
50 background-color: $white; 50 background-color: $white;
51 z-index: 2010; 51 z-index: 2010;
52 - overflow: auto;  
53 52
54 &.filter-sub-open { 53 &.filter-sub-open {
55 transform: translate3d(0, 0, 0); 54 transform: translate3d(0, 0, 0);
@@ -92,4 +91,30 @@ @@ -92,4 +91,30 @@
92 91
93 } 92 }
94 } 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 +}
95 </style> 120 </style>