From 78bce548fbe951fec87e580944994bcc7b50374b Mon Sep 17 00:00:00 2001
From: Enzo <1284707383@qq.com>
Date: Sat, 9 Oct 2021 14:48:38 +0800
Subject: [PATCH 1/2] =?UTF-8?q?=E4=B8=80=E7=B3=BB=E5=88=97=E4=BC=98?=
 =?UTF-8?q?=E5=8C=96?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
 pages/discover/discover.vue                   | 122 ++++++++++++++++--
 pages/discover/discoverdetails.vue            |   5 +-
 pages/index/category/category.vue             | 106 ++++++++++++++-
 pages/index/collectCoupons/collectCoupons.vue |   6 +
 pages/order/newdetail/newdetail.vue           |   6 +-
 pages/shop/goodsdetail.vue                    |  70 +++++++++-
 pages/shop/shopdetail.vue                     |   2 +-
 pages/user/my/center.vue                      | 106 ++++++++++++++-
 8 files changed, 400 insertions(+), 23 deletions(-)
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 @@