diff --git a/pages/discover/discover.vue b/pages/discover/discover.vue
index d042f47..d09286c 100644
--- a/pages/discover/discover.vue
+++ b/pages/discover/discover.vue
@@ -63,11 +63,22 @@
-
+
+
+
+
+
+ 购物车
+
+ {{car_num || 0}}
+ 99+
+
+
+
@@ -99,7 +110,8 @@
scrollH: 0,
nav_height: 0,
isRefresher: true,
- pageSize: 10
+ pageSize: 10,
+ car_num: 0
}
},
computed: {
@@ -113,9 +125,41 @@
onLoad(){
let info = uni.getSystemInfoSync();
this.scrollH = info.screenHeight;
- this.getHotActivity()
+ this.getHotActivity();
+ this.getcarNum();
},
methods: {
+ getcarNum() {
+ this.$http
+ .get({
+ api: 'api/shopping/cart/count',
+ header: {
+ Authorization: this.$cookieStorage.get('user_token')
+ },
+ })
+ .then(res => {
+ if (res.data.code == 200) {
+ if(res.data.data == null) {
+ this.car_num = 0;
+ }else {
+ this.car_num = res.data.data;
+ }
+ } else {
+ wx.showModal({
+ content: '请下拉页面刷新重试',
+ showCancel: false
+ });
+ }
+ })
+ .catch(() => {
+ wx.stopPullDownRefresh();
+ wx.hideLoading();
+ wx.showModal({
+ content: '请求失败',
+ showCancel: false
+ });
+ });
+ },
scroll (e) {
//记录scroll 位置
this.oldScrollTop = e.detail.scrollTop;
@@ -395,6 +439,66 @@