Showing
5 changed files
with
155 additions
and
8 deletions
@@ -37,7 +37,7 @@ | @@ -37,7 +37,7 @@ | ||
37 | </li> | 37 | </li> |
38 | </ul> | 38 | </ul> |
39 | 39 | ||
40 | - <div class="goods-box"> | 40 | + <div class="goods-box list-items"> |
41 | <ul class="cardlist card-large clearfix"> | 41 | <ul class="cardlist card-large clearfix"> |
42 | {{#list}} | 42 | {{#list}} |
43 | <li class="card"> | 43 | <li class="card"> |
public/vue/component/product/list-filter.vue
0 → 100644
1 | +<template> | ||
2 | + <div class="top-filter clearfix"> | ||
3 | + <ul class="filter-type"> | ||
4 | + <li class="type-item" @click="toggleRec">推荐<i class="icon" :class="recClass"></i></li> | ||
5 | + <li class="type-item" @click="toggleFilter">筛选<i class="icon" :class="filterClass"></i></li> | ||
6 | + </ul> | ||
7 | + <div class="recommend-detail" v-show="!recDown"> | ||
8 | + <ul class="rec-items"> | ||
9 | + <li class="item active">推荐</li> | ||
10 | + <li class="item">新品</li> | ||
11 | + <li class="item">价格从高到低</li> | ||
12 | + <li class="item">价格从低到高</li> | ||
13 | + </ul> | ||
14 | + </div> | ||
15 | + <div class="recommend-detail" v-show="!filterDown"> | ||
16 | + <ul class="rec-items"> | ||
17 | + <li class="item">价格从高到低</li> | ||
18 | + <li class="item">价格从低到高</li> | ||
19 | + </ul> | ||
20 | + </div> | ||
21 | + </div> | ||
22 | +</template> | ||
23 | +<script> | ||
24 | +const bus = require('common/vue-bus'); | ||
25 | + | ||
26 | +module.exports = { | ||
27 | + props: { | ||
28 | + val: String | ||
29 | + }, | ||
30 | + data(){ | ||
31 | + return { | ||
32 | + recDown: true, | ||
33 | + filterDown: true | ||
34 | + } | ||
35 | + }, | ||
36 | + components: { | ||
37 | + simple, | ||
38 | + updown | ||
39 | + }, | ||
40 | + computed: { | ||
41 | + recClass(){ | ||
42 | + return { | ||
43 | + down: this.recDown, | ||
44 | + 'icon-sort-up': !this.recDown, | ||
45 | + 'icon-sort-down': this.recDown | ||
46 | + } | ||
47 | + }, | ||
48 | + filterClass(){ | ||
49 | + return { | ||
50 | + down: this.filterDown, | ||
51 | + 'icon-sort-up': !this.filterDown, | ||
52 | + 'icon-sort-down': this.filterDown | ||
53 | + } | ||
54 | + } | ||
55 | + }, | ||
56 | + methods: { | ||
57 | + toggleRec(){ | ||
58 | + this.filterDown = true; | ||
59 | + this.recDown = !this.recDown; | ||
60 | + | ||
61 | + }, | ||
62 | + toggleFilter(){ | ||
63 | + this.recDown = true; | ||
64 | + this.filterDown = !this.filterDown; | ||
65 | + } | ||
66 | + }, | ||
67 | + watch: { | ||
68 | + val: function(newVal) { | ||
69 | + bus.$emit('order.change', { | ||
70 | + val: newVal, | ||
71 | + ref: this._uid | ||
72 | + }); | ||
73 | + } | ||
74 | + } | ||
75 | +}; | ||
76 | +</script> | ||
77 | +<style> | ||
78 | +@import "../../../scss/common/_color.css"; | ||
79 | + | ||
80 | +.top-filter { | ||
81 | + position: relative; | ||
82 | + height: 81px; | ||
83 | + border-bottom: 1px solid #eee; | ||
84 | + | ||
85 | + .filter-type { | ||
86 | + font-size: 0; | ||
87 | + list-style: none; | ||
88 | + padding: 16px 30px 0; | ||
89 | + | ||
90 | + .type-item { | ||
91 | + display: inline-block; | ||
92 | + width: 344px; | ||
93 | + font-size: 32px; | ||
94 | + text-align: center; | ||
95 | + font-weight: bold; | ||
96 | + border-right: 1px solid $grey; | ||
97 | + | ||
98 | + &:nth-child(2n) { | ||
99 | + border-right: none; | ||
100 | + } | ||
101 | + } | ||
102 | + | ||
103 | + .icon { | ||
104 | + position: relative; | ||
105 | + top: 14px; | ||
106 | + left: 20px; | ||
107 | + font-size: 40px; | ||
108 | + font-weight: bold; | ||
109 | + | ||
110 | + &.down { | ||
111 | + top: -10px; | ||
112 | + } | ||
113 | + } | ||
114 | + } | ||
115 | + | ||
116 | + .recommend-detail { | ||
117 | + position: absolute; | ||
118 | + top: 81px; | ||
119 | + left: 0; | ||
120 | + right: 0; | ||
121 | + } | ||
122 | + | ||
123 | + .rec-items { | ||
124 | + .item { | ||
125 | + height: 90px; | ||
126 | + color: $black; | ||
127 | + font-size: 32px; | ||
128 | + text-align: center; | ||
129 | + line-height: 89px; | ||
130 | + border-bottom: 1px solid #eee; | ||
131 | + background-color: #fff; | ||
132 | + | ||
133 | + &.active { | ||
134 | + background: $grey; | ||
135 | + } | ||
136 | + } | ||
137 | + } | ||
138 | +} | ||
139 | +</style> |
@@ -4,8 +4,8 @@ | @@ -4,8 +4,8 @@ | ||
4 | <i v-if="isiOS" class="icon icon-filter" slot="right" @touchstart="openFilter"></i> | 4 | <i v-if="isiOS" class="icon icon-filter" slot="right" @touchstart="openFilter"></i> |
5 | <i v-else class="icon icon-filter" slot="right" @click="openFilter"></i> | 5 | <i v-else class="icon icon-filter" slot="right" @click="openFilter"></i> |
6 | </cheader> | 6 | </cheader> |
7 | - <order :config="orderConfig" :val="order" v-if="enableOrder"></order> | ||
8 | - <List :data="productList" :state="listState"></List> | 7 | + <list-filter :val="order" v-if="enableOrder"></list-filter> |
8 | + <List :data="productList" :state="listState" class="list-items"></List> | ||
9 | <Filter :config="filterConfig" v-ref:filter></Filter> | 9 | <Filter :config="filterConfig" v-ref:filter></Filter> |
10 | <shopping-bag :cart-count="cartCount" v-if="isApp"></shopping-bag> | 10 | <shopping-bag :cart-count="cartCount" v-if="isApp"></shopping-bag> |
11 | </div> | 11 | </div> |
@@ -20,7 +20,7 @@ | @@ -20,7 +20,7 @@ | ||
20 | const bus = require('common/vue-bus'); | 20 | const bus = require('common/vue-bus'); |
21 | const tip = require('common/tip'); | 21 | const tip = require('common/tip'); |
22 | const cheader = require('component/header.vue'); | 22 | const cheader = require('component/header.vue'); |
23 | - const order = require('component/product/order.vue'); | 23 | + const listFilter = require('component/product/list-filter.vue'); |
24 | const list = require('component/product/list.vue'); | 24 | const list = require('component/product/list.vue'); |
25 | const filter = require('component/product/filter.vue'); | 25 | const filter = require('component/product/filter.vue'); |
26 | const shoppingBag = require('component/product/shopping-bag.vue'); | 26 | const shoppingBag = require('component/product/shopping-bag.vue'); |
@@ -82,7 +82,7 @@ | @@ -82,7 +82,7 @@ | ||
82 | components: { | 82 | components: { |
83 | cheader, | 83 | cheader, |
84 | list, | 84 | list, |
85 | - order, | 85 | + listFilter, |
86 | filter, | 86 | filter, |
87 | shoppingBag | 87 | shoppingBag |
88 | }, | 88 | }, |
@@ -194,6 +194,7 @@ | @@ -194,6 +194,7 @@ | ||
194 | this.refreshCart(); | 194 | this.refreshCart(); |
195 | bus.$on('app.shoppingcart.refresh', this.refreshCart); | 195 | bus.$on('app.shoppingcart.refresh', this.refreshCart); |
196 | } | 196 | } |
197 | + | ||
197 | } | 198 | } |
198 | }; | 199 | }; |
199 | 200 | ||
@@ -202,4 +203,8 @@ | @@ -202,4 +203,8 @@ | ||
202 | .list-header { | 203 | .list-header { |
203 | background-color: white; | 204 | background-color: white; |
204 | } | 205 | } |
206 | + | ||
207 | + .list-items { | ||
208 | + padding-top: 30px; | ||
209 | + } | ||
205 | </style> | 210 | </style> |
@@ -2,7 +2,7 @@ | @@ -2,7 +2,7 @@ | ||
2 | <div> | 2 | <div> |
3 | <Order :config="orderConfig" :val="order" v-if="enableOrder"> | 3 | <Order :config="orderConfig" :val="order" v-if="enableOrder"> |
4 | </Order> | 4 | </Order> |
5 | - <List :data="productList" :state="listState"></List> | 5 | + <List :data="productList" :state="listState" class="list-items"></List> |
6 | </div> | 6 | </div> |
7 | </template> | 7 | </template> |
8 | <script> | 8 | <script> |
@@ -142,3 +142,8 @@ | @@ -142,3 +142,8 @@ | ||
142 | } | 142 | } |
143 | }; | 143 | }; |
144 | </script> | 144 | </script> |
145 | +<style> | ||
146 | + .list-items { | ||
147 | + padding-top: 30px; | ||
148 | + } | ||
149 | +</style> |
-
Please register or login to post a comment