From a587937ce53f79b4680e930b5d5f7fee33de5311 Mon Sep 17 00:00:00 2001
From: xuxueyang <xuxy@fengyuntec.com>
Date: 星期三, 14 八月 2024 14:50:40 +0800
Subject: [PATCH] 标签

---
 components/footer/customer-footer.vue |   75 ++++++++++++++++++++++++++++---------
 1 files changed, 57 insertions(+), 18 deletions(-)

diff --git a/components/footer/customer-footer.vue b/components/footer/customer-footer.vue
index 7298a72..0627f98 100644
--- a/components/footer/customer-footer.vue
+++ b/components/footer/customer-footer.vue
@@ -1,25 +1,33 @@
 <template>
-	<view class="footer flex customer-footer" style="">
+	<view class="footer flex customer-footer flex-wrap-normal" style="">
 		<view v-for="(item,index) in tabBar" :key="index" class="footer-item">
-			<view class="item flex" :class="flg==index?'cur':''" @click="go(index,item)">
+			<view class="item" :class="flg==index?'cur':''" @click="go(index,item)">
 
 				<view v-if="index==0">
-					<image src="../../static/images/customer/footer/footer-home-1.png" class="footer-icon" v-if="flg==0"></image>
-					<image src="../../static/images/customer/footer/footer-home-0.png" class="footer-icon" v-if="flg!=0"></image>
+					<image src="../../static/images/customer/footer/footer-home-1.png" class="footer-icon"
+						v-if="flg==0"></image>
+					<image src="../../static/images/customer/footer/footer-home-0.png" class="footer-icon"
+						v-if="flg!=0"></image>
 				</view>
 				<view v-if="index==1">
-					<image src="../../static/images/customer/footer/footer-trade-1.png" class="footer-icon" v-if="flg==0"></image>
-					<image src="../../static/images/customer/footer/footer-trade-0.png" class="footer-icon" v-if="flg!=0"></image>
+					<image src="../../static/images/customer/footer/footer-trade-1.png" class="footer-icon"
+						v-if="flg==1"></image>
+					<image src="../../static/images/customer/footer/footer-trade-0.png" class="footer-icon"
+						v-if="flg!=1"></image>
 				</view>
 				<view v-if="index==2">
-					<image src="../../static/images/customer/footer/footer-shopping-1.png" class="footer-icon" v-if="flg==0">
+					<image src="../../static/images/customer/footer/footer-shopping-1.png" class="footer-icon"
+						v-if="flg==2">
 					</image>
-					<image src="../../static/images/customer/footer/footer-shopping-0.png" class="footer-icon" v-if="flg!=0">
+					<image src="../../static/images/customer/footer/footer-shopping-0.png" class="footer-icon"
+						v-if="flg!=2">
 					</image>
 				</view>
 				<view v-if="index==3">
-					<image src="../../static/images/customer/footer/footer-self-1.png" class="footer-icon" v-if="flg==1"></image>
-					<image src="../../static/images/customer/footer/footer-self-0.png" class="footer-icon" v-if="flg!=1"></image>
+					<image src="../../static/images/customer/footer/footer-self-1.png" class="footer-icon"
+						v-if="flg==3"></image>
+					<image src="../../static/images/customer/footer/footer-self-0.png" class="footer-icon"
+						v-if="flg!=3"></image>
 				</view>
 
 				<view>
@@ -38,18 +46,22 @@
 			return {
 				tabBar: [{
 
-						"text": "首页"
+						"text": "首页",
+						"pagePath": '/pages/home/home'
 					},
 					{
 
-						"text": "交易大厅"
+						"text": "交易大厅",
+						"pagePath": '/sub_pages/customer/trade/trade'
 					},
 					{
 
-						"text": "购物车"
+						"text": "购物车",
+						"pagePath": '/sub_pages/customer/shopping/shopping'
 					},
 					{
-						"text": "我的"
+						"text": "我的",
+						"pagePath": '/pages/user/supplier-user'
 					}
 				]
 			}
@@ -69,13 +81,40 @@
 		methods: {
 
 			go(index, item) {
-				if (this.flg == ('' + index)) {
+				if (this.flg == index) {
 					return
 				}
-				uni.redirectTo({
-					url: item.pagePath
+				if (index === 1 || index === 2) {
+					//交易大厅和购物车,这2个可以用跳转方式
+					if (index === 2) {
+						if (!this.currentInfo.id) {
+							this.$message.showToast('请先登录')
+							return
+						}
 
-				});
+					}
+					//判断,如果上上上级别,就是要跳转的,改为返回,避免堆栈太多
+					const pages = getCurrentPages();
+					//如果上一层就是购物车,那么就返回,而不是跳转
+					// console.log('toShopping',pages)
+					if (pages && pages.length >= 2) {
+						if ( ('/' + pages[pages.length - 2].route) === item.pagePath) {
+							uni.navigateBack()
+							return
+						}
+					}
+
+					uni.navigateTo({
+						url: item.pagePath
+					})
+
+				} else {
+					uni.reLaunch({
+						url: item.pagePath
+
+					});
+				}
+
 			},
 		}
 	}

--
Gitblit v1.9.3