Showing
5 changed files
with
40 additions
and
24 deletions
@@ -43,19 +43,19 @@ | @@ -43,19 +43,19 @@ | ||
43 | <li class="card"> | 43 | <li class="card"> |
44 | <div class="card-pic"> | 44 | <div class="card-pic"> |
45 | <a href="{{goodsUrl this}}"> | 45 | <a href="{{goodsUrl this}}"> |
46 | - <img src="{{resizeImage default_images 372 499}}" alt="{{product_name}}"> | 46 | + <img src="{{resizeImage default_images 330 440}}" alt="{{product_name}}"> |
47 | </a> | 47 | </a> |
48 | </div> | 48 | </div> |
49 | <div class="card-bd"> | 49 | <div class="card-bd"> |
50 | <h2 class="card-label"> | 50 | <h2 class="card-label"> |
51 | - <a href="{{goodsUrl this}}" class="line-clamp-2">{{product_name}}</a> | 51 | + <a href="{{goodsUrl this}}" class="line-clamp-1">{{product_name}}</a> |
52 | </h2> | 52 | </h2> |
53 | + <span class="good-price {{#if market_price}}sale-price{{/if}}">¥ {{toFixed sales_price}}</span> | ||
53 | {{#if marketPrice}} | 54 | {{#if marketPrice}} |
54 | <span class="good-price" class="old-price"> | 55 | <span class="good-price" class="old-price"> |
55 | ¥ {{toFixed market_price}} | 56 | ¥ {{toFixed market_price}} |
56 | </span> | 57 | </span> |
57 | {{/if}} | 58 | {{/if}} |
58 | - <span class="good-price {{#if market_price}}sale-price{{/if}}">¥ {{toFixed sales_price}}</span> | ||
59 | </div> | 59 | </div> |
60 | </li> | 60 | </li> |
61 | {{/list}} | 61 | {{/list}} |
@@ -4,18 +4,18 @@ | @@ -4,18 +4,18 @@ | ||
4 | <li class="card" v-for="item in data"> | 4 | <li class="card" v-for="item in data"> |
5 | <div class="card-pic"> | 5 | <div class="card-pic"> |
6 | <a href="{{item | goodsUrl}}"> | 6 | <a href="{{item | goodsUrl}}"> |
7 | - <img v-bind:src="item.default_images | resize 372 499" alt="{{item.product_name}}"> | 7 | + <img v-bind:src="item.default_images | resize 330 440" alt="{{item.product_name}}"> |
8 | </a> | 8 | </a> |
9 | </div> | 9 | </div> |
10 | <div class="card-bd"> | 10 | <div class="card-bd"> |
11 | <h2 class="card-label"> | 11 | <h2 class="card-label"> |
12 | - <a href="{{item | goodsUrl}}" class="line-clamp-2">{{item.product_name}}</a> | 12 | + <a href="{{item | goodsUrl}}" class="line-clamp-1">{{item.product_name}}</a> |
13 | </h2> | 13 | </h2> |
14 | <h2 class="card-label-desc" v-if="item.product_name1"> | 14 | <h2 class="card-label-desc" v-if="item.product_name1"> |
15 | - <a href="{{item | goodsUrl}}" class="line-clamp-2">{{item.product_name}}</a> | 15 | + <a href="{{item | goodsUrl}}" class="line-clamp-1">{{item.product_name}}</a> |
16 | </h2> | 16 | </h2> |
17 | - <span class="good-price" :class="{'old-price': item.market_price}" v-if="item.market_price">¥ {{item.market_price | toFixed}}</span> | ||
18 | <span class="good-price" :class="{'sale-price': item.market_price}">¥ {{item.sales_price | toFixed}}</span> | 17 | <span class="good-price" :class="{'sale-price': item.market_price}">¥ {{item.sales_price | toFixed}}</span> |
18 | + <span class="good-price" :class="{'old-price': item.market_price}" v-if="item.market_price">¥ {{item.market_price | toFixed}}</span> | ||
19 | </div> | 19 | </div> |
20 | </li> | 20 | </li> |
21 | </ul> | 21 | </ul> |
@@ -82,11 +82,11 @@ | @@ -82,11 +82,11 @@ | ||
82 | 82 | ||
83 | .card { | 83 | .card { |
84 | float: left; | 84 | float: left; |
85 | - width: 374px; | ||
86 | - margin-right: 2px; | 85 | + width: 330px; |
86 | + margin: 0 30px; | ||
87 | 87 | ||
88 | &:nth-child(2n) { | 88 | &:nth-child(2n) { |
89 | - margin-right: 0; | 89 | + margin: 0; |
90 | } | 90 | } |
91 | } | 91 | } |
92 | 92 | ||
@@ -104,18 +104,14 @@ | @@ -104,18 +104,14 @@ | ||
104 | 104 | ||
105 | .card-bd { | 105 | .card-bd { |
106 | min-height: 180px; | 106 | min-height: 180px; |
107 | - margin-left: 30px; | ||
108 | - margin-right: 30px; | ||
109 | - padding-top: 26px; | ||
110 | - text-align: center; | 107 | + padding-top: 40px; |
111 | font-size: 0; | 108 | font-size: 0; |
112 | } | 109 | } |
113 | 110 | ||
114 | .card-label { | 111 | .card-label { |
115 | - margin: 0 0 14px; | 112 | + margin: 0 0 30px; |
116 | font-size: 24px; | 113 | font-size: 24px; |
117 | line-height: 1.4; | 114 | line-height: 1.4; |
118 | - height: 67.1999999999px; | ||
119 | font-weight: normal; | 115 | font-weight: normal; |
120 | } | 116 | } |
121 | 117 | ||
@@ -133,7 +129,7 @@ | @@ -133,7 +129,7 @@ | ||
133 | } | 129 | } |
134 | 130 | ||
135 | .good-price { | 131 | .good-price { |
136 | - color: #000; | 132 | + color: #b0b0b0; |
137 | margin-right: 14px; | 133 | margin-right: 14px; |
138 | font-size: 24px; | 134 | font-size: 24px; |
139 | 135 | ||
@@ -142,12 +138,13 @@ | @@ -142,12 +138,13 @@ | ||
142 | } | 138 | } |
143 | 139 | ||
144 | &.old-price { | 140 | &.old-price { |
145 | - text-decoration: line-through; | 141 | + font-size: 18px; |
146 | color: #b0b0b0; | 142 | color: #b0b0b0; |
143 | + text-decoration: line-through; | ||
147 | } | 144 | } |
148 | 145 | ||
149 | &.sale-price { | 146 | &.sale-price { |
150 | - color: #000; | 147 | + color: #d0021b; |
151 | } | 148 | } |
152 | } | 149 | } |
153 | 150 |
@@ -352,7 +352,7 @@ | @@ -352,7 +352,7 @@ | ||
352 | topNav: require('./top-nav.vue'), | 352 | topNav: require('./top-nav.vue'), |
353 | shareBottom: require('component/tool/share-bottom.vue'), | 353 | shareBottom: require('component/tool/share-bottom.vue'), |
354 | preferList: require('component/product/prefer-list.vue'), | 354 | preferList: require('component/product/prefer-list.vue'), |
355 | - shoppingBag: require('./shopping-bag.vue'), | 355 | + shoppingBag: require('component/product/shopping-bag.vue'), |
356 | operationBar: require('./operation-bar.vue') | 356 | operationBar: require('./operation-bar.vue') |
357 | }, | 357 | }, |
358 | methods: { | 358 | methods: { |
@@ -7,6 +7,7 @@ | @@ -7,6 +7,7 @@ | ||
7 | <order :config="orderConfig" :val="order" v-if="enableOrder"></order> | 7 | <order :config="orderConfig" :val="order" v-if="enableOrder"></order> |
8 | <List :data="productList" :state="listState"></List> | 8 | <List :data="productList" :state="listState"></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 | </div> | 11 | </div> |
11 | </template> | 12 | </template> |
12 | <script> | 13 | <script> |
@@ -22,6 +23,7 @@ | @@ -22,6 +23,7 @@ | ||
22 | const order = require('component/product/order.vue'); | 23 | const order = require('component/product/order.vue'); |
23 | const list = require('component/product/list.vue'); | 24 | const list = require('component/product/list.vue'); |
24 | const filter = require('component/product/filter.vue'); | 25 | const filter = require('component/product/filter.vue'); |
26 | + const shoppingBag = require('component/product/shopping-bag.vue'); | ||
25 | 27 | ||
26 | let locationQuery = qs(decodeURIComponent(location.search.replace(/^\?/, ''))); | 28 | let locationQuery = qs(decodeURIComponent(location.search.replace(/^\?/, ''))); |
27 | 29 | ||
@@ -33,6 +35,7 @@ | @@ -33,6 +35,7 @@ | ||
33 | el: '#product-list', | 35 | el: '#product-list', |
34 | data: function() { | 36 | data: function() { |
35 | return { | 37 | return { |
38 | + isApp: yoho.isApp, | ||
36 | isiOS: yoho.isiOS, | 39 | isiOS: yoho.isiOS, |
37 | sortName: locationQuery.title || locationQuery.sort_name, // 优先使用 title | 40 | sortName: locationQuery.title || locationQuery.sort_name, // 优先使用 title |
38 | orderConfig: [], | 41 | orderConfig: [], |
@@ -50,7 +53,8 @@ | @@ -50,7 +53,8 @@ | ||
50 | 53 | ||
51 | // state | 54 | // state |
52 | inSearching: false, // 请求中 | 55 | inSearching: false, // 请求中 |
53 | - enableOrder: false | 56 | + enableOrder: false, |
57 | + cartCount: 0 | ||
54 | }; | 58 | }; |
55 | }, | 59 | }, |
56 | computed: { | 60 | computed: { |
@@ -79,7 +83,8 @@ | @@ -79,7 +83,8 @@ | ||
79 | cheader, | 83 | cheader, |
80 | list, | 84 | list, |
81 | order, | 85 | order, |
82 | - filter | 86 | + filter, |
87 | + shoppingBag | ||
83 | }, | 88 | }, |
84 | methods: { | 89 | methods: { |
85 | search: function() { | 90 | search: function() { |
@@ -135,6 +140,14 @@ | @@ -135,6 +140,14 @@ | ||
135 | this.page = 0; | 140 | this.page = 0; |
136 | this.$set('productList', []); | 141 | this.$set('productList', []); |
137 | this.search(); | 142 | this.search(); |
143 | + }, | ||
144 | + | ||
145 | + refreshCart: function() { | ||
146 | + $.get('/product/cart-count.json').then(result=> { | ||
147 | + if (result.code === 200) { | ||
148 | + this.cartCount = result.data.cart_goods_count; | ||
149 | + } | ||
150 | + }); | ||
138 | } | 151 | } |
139 | }, | 152 | }, |
140 | watch: { | 153 | watch: { |
@@ -175,6 +188,12 @@ | @@ -175,6 +188,12 @@ | ||
175 | self.enableOrder = true; | 188 | self.enableOrder = true; |
176 | } | 189 | } |
177 | }); | 190 | }); |
191 | + | ||
192 | + // 读取购物车数量 | ||
193 | + if (this.isApp) { | ||
194 | + this.refreshCart(); | ||
195 | + bus.$on('app.shoppingcart.refresh', this.refreshCart); | ||
196 | + } | ||
178 | } | 197 | } |
179 | }; | 198 | }; |
180 | 199 |
-
Please register or login to post a comment