...
|
...
|
@@ -7,6 +7,7 @@ |
|
|
<order :config="orderConfig" :val="order" v-if="enableOrder"></order>
|
|
|
<List :data="productList" :state="listState"></List>
|
|
|
<Filter :config="filterConfig" v-ref:filter></Filter>
|
|
|
<shopping-bag :cart-count="cartCount" v-if="isApp"></shopping-bag>
|
|
|
</div>
|
|
|
</template>
|
|
|
<script>
|
...
|
...
|
@@ -22,6 +23,7 @@ |
|
|
const order = require('component/product/order.vue');
|
|
|
const list = require('component/product/list.vue');
|
|
|
const filter = require('component/product/filter.vue');
|
|
|
const shoppingBag = require('component/product/shopping-bag.vue');
|
|
|
|
|
|
let locationQuery = qs(decodeURIComponent(location.search.replace(/^\?/, '')));
|
|
|
|
...
|
...
|
@@ -33,6 +35,7 @@ |
|
|
el: '#product-list',
|
|
|
data: function() {
|
|
|
return {
|
|
|
isApp: yoho.isApp,
|
|
|
isiOS: yoho.isiOS,
|
|
|
sortName: locationQuery.title || locationQuery.sort_name, // 优先使用 title
|
|
|
orderConfig: [],
|
...
|
...
|
@@ -50,7 +53,8 @@ |
|
|
|
|
|
// state
|
|
|
inSearching: false, // 请求中
|
|
|
enableOrder: false
|
|
|
enableOrder: false,
|
|
|
cartCount: 0
|
|
|
};
|
|
|
},
|
|
|
computed: {
|
...
|
...
|
@@ -79,7 +83,8 @@ |
|
|
cheader,
|
|
|
list,
|
|
|
order,
|
|
|
filter
|
|
|
filter,
|
|
|
shoppingBag
|
|
|
},
|
|
|
methods: {
|
|
|
search: function() {
|
...
|
...
|
@@ -135,6 +140,14 @@ |
|
|
this.page = 0;
|
|
|
this.$set('productList', []);
|
|
|
this.search();
|
|
|
},
|
|
|
|
|
|
refreshCart: function() {
|
|
|
$.get('/product/cart-count.json').then(result=> {
|
|
|
if (result.code === 200) {
|
|
|
this.cartCount = result.data.cart_goods_count;
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
},
|
|
|
watch: {
|
...
|
...
|
@@ -175,6 +188,12 @@ |
|
|
self.enableOrder = true;
|
|
|
}
|
|
|
});
|
|
|
|
|
|
// 读取购物车数量
|
|
|
if (this.isApp) {
|
|
|
this.refreshCart();
|
|
|
bus.$on('app.shoppingcart.refresh', this.refreshCart);
|
|
|
}
|
|
|
}
|
|
|
};
|
|
|
|
...
|
...
|
|