From 47d56a8b0f22fb15a46b69dfd46fac23560ad2cd Mon Sep 17 00:00:00 2001
From: MrShi <1878285526@qq.com>
Date: 星期二, 12 五月 2026 09:07:49 +0800
Subject: [PATCH] 改bug

---
 mini-program/pages/mine/mine.vue |  270 +++++++++++++++++++++++++++++++++++++++++------------
 1 files changed, 208 insertions(+), 62 deletions(-)

diff --git a/mini-program/pages/mine/mine.vue b/mini-program/pages/mine/mine.vue
index 0c81658..f83e1ba 100644
--- a/mini-program/pages/mine/mine.vue
+++ b/mini-program/pages/mine/mine.vue
@@ -6,39 +6,39 @@
 				<view class="head-bar-nav" :style="{ height: navHeight + 'px' }"></view>
 			</view>
 			<view class="user">
-				<view class="user-left">
+				<view class="user-left"  @click="jumpSettings">
 					<view class="user-image">
-						<image :src="userInfo.imgFullUrl" mode="widthFix"></image>
+						<image :src="userInfo.imgFullUrl?userInfo.imgFullUrl:'/static/icon/default.png'" mode="widthFix"></image>
 					</view>
 					<view class="user-name">
 						<button open-type="getPhoneNumber" @getphonenumber="getphonenumber" v-if="!userInfo">鑾峰彇鎵嬫満鍙�</button>
-						{{userInfo ? userInfo.nickname : '鐐瑰嚮鐧诲綍'}}
+						{{userInfo ? maskPhone(userInfo.phone) : '鐐瑰嚮鐧诲綍'}}
 					</view>
 				</view>
 				<view class="user-right" v-if="userInfo">
-					<view class="user-right-item" @click="jumpSettings">
-						<image src="/static/icon/ic_option@2x.png" mode="widthFix"></image>
+					<view class="user-right-item" @click="showQrCodePopup">
+						<image src="/static/icon/ic_QRcode@2x.png" mode="widthFix"></image>
 					</view>
 					<view class="user-right-item" @click="jumpNotice">
-						<view class="user-right-item-tips" v-if="objNum && objNum.unRead === 1"></view>
+						<view class="user-right-item-tips" v-if="objNum && objNum.unRead === 0"></view>
 						<image src="/static/icon/ic_notice@2x.png" mode="widthFix"></image>
 					</view>
 				</view>
 			</view>
 			<view class="cate">
-				<view class="cate-item">
+				<view class="cate-item" @click="jumpTo(1)">
 					<text>{{objNum ? objNum.cartTypeNum : 0}}</text>
 					<text>璐墿杞�</text>
 				</view>
-				<view class="cate-item">
+				<view class="cate-item" @click="jumpTo(2)">
 					<text>{{objNum ? objNum.member.integral : 0}}</text>
 					<text>绉垎</text>
 				</view>
-				<view class="cate-item">
+				<view class="cate-item" @click="jumpTo(3)">
 					<text>{{objNum ? objNum.couponNum : 0}}</text>
 					<text>浼樻儬鍒�</text>
 				</view>
-				<view class="cate-item">
+				<view class="cate-item" @click="jumpTo(4)">
 					<text>{{objNum ? objNum.collectNum : 0}}</text>
 					<text>鏀惰棌</text>
 				</view>
@@ -46,70 +46,168 @@
 			<view class="func">
 				<view class="func-top">
 					<view class="func-top-title">鎴戠殑璁㈠崟</view>
-					<view class="func-top-to" @click="jumpOrder">
+					<view class="func-top-to" @click="jumpOrder(0)">
 						鍏ㄩ儴璁㈠崟
 						<image src="/static/icon/ic_ar2@2x.png" mode="widthFix"></image>
 					</view>
 				</view>
 				<view class="func-list">
-					<view class="func-list-item" @click="jumpOrder(0)">
-						<view class="func-list-item-num" v-if="orderNum && orderNum.waitPayOrders > 0">{{orderNum.waitPayOrders}}</view>
-						<image src="/static/icon/mine_ic_daifukuan@2x.png" mode="widthFix"></image>
+					<view class="func-list-item" @click="jumpOrder(1)">
+						<view class="func-list-item-image">
+							<image src="/static/icon/mine_ic_daifukuan@2x.png" mode="widthFix"></image>
+							<view class="func-list-item-num" v-if="orderNum && orderNum.waitPayOrders > 0">{{orderNum.waitPayOrders > 99 ? '99+' : orderNum.waitPayOrders}}</view>
+						</view>
 						<text>寰呮敮浠�</text>
 					</view>
-					<view class="func-list-item" @click="jumpOrder(1)">
-						<view class="func-list-item-num" v-if="orderNum && orderNum.waitOrders > 0">{{orderNum.waitOrders}}</view>
-						<image src="/static/icon/mine_ic_daifahuo@2x.png" mode="widthFix"></image>
+					<view class="func-list-item" @click="jumpOrder(2)">
+						<view class="func-list-item-image">
+							<view class="func-list-item-num" v-if="orderNum && orderNum.waitOrders > 0">{{orderNum.waitOrders > 99 ? '99+' : orderNum.waitOrders}}</view>
+							<image src="/static/icon/mine_ic_daifahuo@2x.png" mode="widthFix"></image>
+						</view>
 						<text>寰呭彂璐�/鑷彁</text>
 					</view>
-					<view class="func-list-item" @click="jumpOrder(2)">
-						<view class="func-list-item-num" v-if="orderNum && orderNum.waitOrders > 0">{{orderNum.waitReceivedOrders}}</view>
-						<image src="/static/icon/mine_ic_daishouhuo@2x.png" mode="widthFix"></image>
+					<view class="func-list-item" @click="jumpOrder(3)">
+						<view class="func-list-item-image">
+							<view class="func-list-item-num" v-if="orderNum && orderNum.waitReceivedOrders > 0">{{orderNum.waitReceivedOrders > 99 ? '99+' : orderNum.waitReceivedOrders}}</view>
+							<image src="/static/icon/mine_ic_daishouhuo@2x.png" mode="widthFix"></image>
+						</view>
 						<text>寰呮敹璐�</text>
 					</view>
 				</view>
 			</view>
-			<view class="guanggao">
-				<image src="/static/images/share@2x.png" mode="widthFix"></image>
-			</view>
+			<!-- <view class="guanggao" @click="jumpShare()">
+				<image :src="share"  mode="widthFix"></image>
+			</view> -->
 			<view class="gn">
 				<view class="gn-item" @click="jump()">
 					<text>鎴戞槸缁忛攢鍟�</text>
 					<image src="/static/icon/ic_ar2@2x.png" mode="widthFix"></image>
 				</view>
 				<view class="gn-item">
+					<button open-type="contact">瀹㈡湇</button>
 					<text>鍦ㄧ嚎瀹㈡湇</text>
 					<image src="/static/icon/ic_ar2@2x.png" mode="widthFix"></image>
 				</view>
-				<view class="gn-item">
+				<view class="gn-item" @click="jumpAbout">
 					<text>鍏充簬鎴戜滑</text>
+					<image src="/static/icon/ic_ar2@2x.png" mode="widthFix"></image>
+				</view>
+				<view class="gn-item" @click="jumpSettings">
+					<text>璁剧疆</text>
 					<image src="/static/icon/ic_ar2@2x.png" mode="widthFix"></image>
 				</view>
 			</view>
 		</view>
+		<u-popup :show="showQrCode" round="15" :closeable="true" @close="showQrCode = false" mode="bottom">
+			<view class="qr-code-popup">
+				<view class="qr-code-title">閭�璇蜂簩缁寸爜</view>
+				<view class="qr-code-image">
+					<image :src="qrCodeUrl" mode="widthFix"></image>
+				</view>
+			</view>
+		</u-popup>
+		<Login ref="login" />
 	</view>
 </template>
 
 <script>
 	import { mapState } from 'vuex'
+	import Login from '@/components/login/login.vue'
 	export default {
+		components: { Login },
 		computed: {
-			...mapState(['navHeight', 'statusbarHeight', 'openid', 'userInfo'])
+			...mapState(['navHeight', 'statusbarHeight', 'openid', 'userInfo', 'recshopid', 'recuserid'])
 		},
 		data() {
 			return {
 				objNum: null,
-				orderNum: null
+				orderNum: null,
+				share: '',
+				showQrCode: false,
+				qrCodeUrl: ''
 			};
 		},
-		onLoad() {
-			this.getMyInfo()
-			this.ordersStatistics()
+		async onLoad() {
+			await this.$onLaunched;
+			if (uni.getStorageSync('backgroundImage')) {
+				this.share = uni.getStorageSync('backgroundImage').centerInviteBg
+			}
+			// 閫�鍑�/娉ㄩ攢娓呴櫎鏁版嵁
+			uni.$on('loginOut', () => {
+				this.objNum = null
+				this.orderNum = null
+			})
+		},
+		async onShow() {
+			await this.$onLaunched;
+			if (this.userInfo) {
+				this.getMyInfo()
+				this.ordersStatistics()
+			} else {
+				this.objNum = null
+				this.orderNum = null
+			}
 		},
 		methods: {
+			async showQrCodePopup() {
+				if (!this.userInfo) {
+					this.$refs.login.open()
+					return
+				}
+				let res = await this.$u.api.getMemberShareCode({})
+				if (res.code === 200) {
+					this.qrCodeUrl = res.data
+					this.showQrCode = true
+				}
+			},
+			jumpAbout() {
+				uni.navigateTo({
+					url: '/pagesA/pages/rich-text-page/rich-text-page'
+				})
+			},
+			maskPhone(phone) {
+				if (!phone) return '';
+				// 鍋囪鎵嬫満鍙蜂负 11 浣嶏紝淇濈暀鍓� 3 浣嶅拰鍚� 4 浣�
+				return phone.slice(0, 3) + '****' + phone.slice(-4);
+			},
+			jumpUser() {
+				if (this.userInfo) {
+					uni.navigateTo({
+						url: '/pages/settings/settings'
+					})
+				}
+			},
+			jumpTo(type) {
+				if (!this.userInfo) {
+					this.$refs.login.open()
+					return
+				}
+				if (type === 1) {
+					uni.navigateTo({
+						url: '/pages/shopping-cart/shopping-cart'
+					})
+				} else if (type === 2) {
+					uni.navigateTo({
+						url: '/pages/my-points/my-points'
+					})
+				} else if (type === 3) {
+					uni.navigateTo({
+						url: '/pages/coupon/coupon'
+					})
+				} else if (type === 4) {
+					uni.navigateTo({
+						url: '/pages/my-collection/my-collection'
+					})
+				}
+			},
 			jump() {
 				uni.navigateTo({
 					url: '/pages/login/login'
+				})
+			},
+			jumpShare(){
+				uni.navigateTo({
+					url: '/pages/share/share'
 				})
 			},
 			// 璺宠浆娑堟伅
@@ -120,21 +218,42 @@
 			},
 			// 璺宠浆璁剧疆
 			jumpSettings() {
+				if(!this.userInfo && !this.userInfo.id){
+					return
+				}
 				uni.navigateTo({
 					url: '/pages/settings/settings'
 				})
 			},
 			// 鎺堟潈鎵嬫満鍙�
 			getphonenumber(e) {
-				this.$u.api.wxPhone({
-					code: e.detail.code,
-					openid: this.openid
-				}).then(res => {
-					if (res.code === 200) {
-						this.$store.commit('setUserInfo', res.data.member)
-						this.$store.commit('setToken', res.data.token)
-					}
-				})
+				var that = this;
+				if (e.detail.errMsg === 'getPhoneNumber:ok') {
+					uni.login({
+						provider: 'weixin',
+						success: async function (loginRes) {
+							let { code } = loginRes;
+							let res = await that.$u.api.wxLogin({ code })
+							if (res.code === 200) {
+								that.$u.api.wxPhone({
+									code: e.detail.code,
+									shopId:that.recshopid,
+									recId:that.recuserid,
+									openid: res.data.openid
+								}).then(res => {
+									if (res.code === 200) {
+										that.getMyInfo()
+										that.ordersStatistics()
+										that.$store.commit('setUserInfo', res.data.member)
+										that.$store.commit('setToken', res.data.token)
+										that.$store.commit('setRecShopId','')
+										that.$store.commit('setRecUserId','')
+									}
+								})
+							}
+						}
+					});
+				}
 			},
 			// 鑾峰彇鏀惰棌绛夋暟閲�
 			getMyInfo() {
@@ -156,15 +275,13 @@
 			},
 			// 璺宠浆璁㈠崟鍒楄〃
 			jumpOrder(status) {
-				if (status >= 0) {
-					uni.navigateTo({
-						url: '/pages/order/order?status=' + status
-					})
-				} else {
-					uni.navigateTo({
-						url: '/pages/order/order'
-					})
+				if (!this.userInfo) {
+					this.$refs.login.open()
+					return
 				}
+				uni.navigateTo({
+					url: '/pagesA/pages/order/order?userType=0&status=' + status
+				})
 			}
 		}
 	}
@@ -219,8 +336,18 @@
 					align-items: center;
 					justify-content: space-between;
 					border-bottom: 1rpx solid #E5E5E5;
+					position: relative;
 					&:last-child {
 						border: none !important;
+					}
+					button {
+						position: absolute;
+						top: 0;
+						left: 0;
+						width: 100%;
+						height: 100%;
+						opacity: 0;
+						z-index: 99;
 					}
 					text {
 						font-weight: 400;
@@ -274,24 +401,28 @@
 						flex-direction: column;
 						align-items: center;
 						justify-content: center;
-						position: relative;
-						.func-list-item-num {
-							position: absolute;
-							top: 0;
-							right: 0;
-							height: 32rpx;
-							line-height: 32rpx;
-							padding: 0 8rpx;
-							box-sizing: border-box;
-							border-radius: 50%;
-							background-color: #E4001D;
-							font-weight: 400;
-							font-size: 22rpx;
-							color: #FFFFFF;
-						}
-						image {
+						.func-list-item-image {
 							width: 60rpx;
 							height: 60rpx;
+							position: relative;
+							image {
+								width: 60rpx;
+								height: 60rpx;
+							}
+							.func-list-item-num {
+								position: absolute;
+								top: 0;
+								right: -10rpx;
+								width: 40rpx;
+								height: 40rpx;
+								line-height: 40rpx;
+								text-align: center;
+								border-radius: 50%;
+								background-color: #E4001D;
+								font-weight: 400;
+								font-size: 22rpx;
+								color: #FFFFFF;
+							}
 						}
 						text {
 							font-weight: 400;
@@ -388,4 +519,19 @@
 			}
 		}
 	}
+	.qr-code-popup {
+		padding: 40rpx;
+		.qr-code-title {
+			text-align: center;
+			font-size: 32rpx;
+			font-weight: bold;
+			margin-bottom: 40rpx;
+		}
+		.qr-code-image {
+			text-align: center;
+			image {
+				width: 400rpx !important;
+			}
+		}
+	}
 </style>
\ No newline at end of file

--
Gitblit v1.9.3