From ac33a3140ef8ef20dfd2537fce2dfdd0f374f30e Mon Sep 17 00:00:00 2001
From: MrShi <1878285526@qq.com>
Date: 星期四, 26 二月 2026 17:42:10 +0800
Subject: [PATCH] 调试

---
 mini-program/pages/distributor/distributor.vue |  299 +++++++++++++++++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 275 insertions(+), 24 deletions(-)

diff --git a/mini-program/pages/distributor/distributor.vue b/mini-program/pages/distributor/distributor.vue
index 1ecd56c..282f8e4 100644
--- a/mini-program/pages/distributor/distributor.vue
+++ b/mini-program/pages/distributor/distributor.vue
@@ -4,10 +4,15 @@
 			<view class="head-bar" :style="{ height: navHeight + statusbarHeight + 'px' }">
 				<view :style="{ width: '100%', height: statusbarHeight + 'px' }"></view>
 				<view class="head-bar-nav" :style="{ height: navHeight + 'px' }">
-					<view class="loginOut" @click="logoutCom()">
+					<view class="loginOut" >
+						<u-icon  class="icon" margin="5" name="home" label="鍟嗗煄" @click="jumpIndex()"label-color="#004096" label-size="13" size="13" mode="widthFix"></u-icon>
+						<text style="margin: 0rpx 10rpx 0 15rpx;font-size: 20rpx;">|</text>
+						<u-icon  class="icon" margin="5" name="bell" @click="logoutCom()" label="鐧诲嚭" label-color="#004096" label-size="13" size="13" mode="widthFix"></u-icon>
+					</view>
+					<!-- <view class="loginOut" @click="logoutCom()">
 						<image src="/static/icon/ic_tixing@2x.png" mode="widthFix"></image>
 						<text>鐧诲嚭</text>
-					</view>
+					</view> -->
 				</view>
 			</view>
 			<view class="user">
@@ -27,7 +32,7 @@
 					<image src="/static/icon/ic_QRcode@2x.png" mode="widthFix"></image>
 				</view>
 			</view>
-			<view class="data" :style="{ backgroundImage: 'url(' + backgroundImage + ')' }">
+			<view class="data" :style="{ 'background-image': 'url(' + backgroundImage + ')' }">
 				<view class="data-a">
 					<view class="data-a-left">
 						<view :class="'data-a-left-item '+(active ==0?'active':'')" @click="changeActive(0)">浠婃棩</view>
@@ -43,9 +48,11 @@
 				<view class="data-c">
 					<view class="data-c-item">
 						<view class="data-c-item-top">
-							<text>閿�鍞(鍏�)</text>
-							<image :src="showMoney?'/static/icon/ic_visible@2x.png':'/static/icon/ic_invisible@2x.png'" @click="showMoney=!showMoney" mode="widthFix"></image>
-						</view>
+							<text  style="margin-right: 10rpx; ">閿�鍞(鍏�)</text>
+							<u-icon v-if="showMoney" name="eye" color="#ffffff" size="18"  @click="showMoney = !showMoney"></u-icon>
+							<u-icon v-if="!showMoney" name="eye-off" color="#eeeeee" size="18"  @click="showMoney = !showMoney"></u-icon>
+<!-- 							<image :src="showMoney?'/static/icon/ic_visible@2x.png':'/static/icon/ic_invisible@2x.png'" @click="showMoney=!showMoney" mode="widthFix"></image>
+ -->						</view>
 						<view class="data-c-item-bottom">
 							<text v-if="showMoney">{{(countData.saleTotalNum||0).toFixed(0)}}</text>
 							<text  v-if="showMoney">{{countData.saleTotalFloat || '.00'}}</text>
@@ -105,8 +112,8 @@
 				<view style="width: 25%; height: 0;"></view>
 				<view style="width: 25%; height: 0;"></view>
 			</view>
-			<view class="title"  v-if="!show">寰呭鐞嗚鍗� ({{total}})</view>
-			<view class="list"  v-if="!show">
+			<view class="title"  v-if="!show&&!showQrcode &&!showHaibao">寰呭鐞嗚鍗� ({{total}})</view>
+			<view class="list"  v-if="!show&&!showQrcode &&!showHaibao">
 				<view class="list-item" v-for="(item, index) in dataList" :key="index">
 					<view class="a"   @click="jumpOrderDetail(item.id)">
 						<view class="a-left">
@@ -196,9 +203,27 @@
 				<image :src="shop.programCode||''" mode="widthFix"></image>
 			</view>
 		</u-popup>
-		<u-popup :show="showHaibao" round="15" :safeAreaInsetBottom="false" mode="bottom" @close="openHaibao()" >
-			<view class="qrcode" >
-				<image :src="shop.programCode||''" mode="widthFix"></image>
+		<u-popup :show="showHaibao"border-radius="15" round="15" :safeAreaInsetBottom="false" mode="center" @close="openHaibao()" >
+			<view class="haibao" >
+				<view class="haibao-img" @click="openHaibao()" >
+					<image :src="shop.posterImgCode||''" mode="widthFix"></image>
+				</view>
+				<view class="haibao-btn">
+					<view class="haibao-btn-item" @click="shareDo(0) ">
+						<image  src="/static/icon/share_ic_wechat@2x.png" mode="widthFix"></image>
+					<!-- 	<button open-type="share" plain="true" >灏忕▼搴忓垎浜�</button> -->
+						<text>灏忕▼搴忓垎浜�</text>
+					</view>
+					<view class="haibao-btn-item" style="color: red;" @click="shareDo(1) ">
+						<image  src="/static/icon/share_ic_friends@2x.png" mode="widthFix"></image>
+						<!-- <button open-type="share" plain="true" >鍒嗕韩鍒版湅鍙嬪湀</button> -->
+						<text>鍒嗕韩鍒版湅鍙嬪湀</text>
+					</view>
+					<view class="haibao-btn-item" style="color: red;" @click="shareDo(2)">
+						<image  src="/static/icon/share_ic_download@2x.png" mode="widthFix"></image>
+						<text>涓嬭浇娴锋姤</text>
+					</view>
+				</view> 
 			</view>
 		</u-popup>
 	</view>
@@ -226,7 +251,7 @@
 				shop:{}, 
 				linkItem:{},
 				countData:{},
-				backgroundImage: require('@/static/images/bg_card@2x.png')
+				backgroundImage:null
 			};
 		},
 		onShow() {
@@ -234,18 +259,35 @@
 			 this.checkShopLogin()
 			 this.active=0
 			 this.shop = this.shopInfo || {}
-			 this.getCountData()
+			 this.getCountData(0)
 			 this.total=0
 			 this.hasNext=true
 			 this.currentPage = 0
 			 this.getOrderList()
+			 // this.getBase64Img('/static/images/bg_card@2x.png')
+			 console.log(require('@/static/images/bg_card@2x.png'))
+		},
+		onShareAppMessage() {
+		  return { 
+		    title:'榧庡厓鍐滄満寰晢鍩�',
+		    path: '/pages/index/index',
+		    imageUrl: this.shop.posterImgCode
+		  }
+		},
+		onShareTimeline() {
+		  return { 
+		    title:'榧庡厓鍐滄満寰晢鍩�',
+		    query: `ref=${Date.now()}`,
+		    imageUrl: this.shop.posterImgCode
+		  }
 		},
 		onReachBottom(){ 
 			this.getOrderList( );
 		},
 		onLoad() {
 			 var that =this
-			uni.$on('updateOrder',function(data){
+			 this.getBase64Img('/static/images/bg_card@2x.png')
+			 uni.$on('updateOrder',function(data){
 				if(data.info!=null && data.info.orderId!=null && data.info.orderStatus ==3){
 					 if(data.info.orderStatus ==3){
 						 that.getCountData()
@@ -256,8 +298,56 @@
 					 that.getOrderList()
 				 }
 			 }) 
-		},
+		}, 
 		methods:{ 
+			getBase64Img(path){
+				var that =this
+				uni.getFileSystemManager().readFile({
+				  filePath: path, // 鏇挎崲涓轰綘鐨勫浘鐗囪矾寰�
+				  encoding: 'base64',
+				  success: (res) => {
+				    const base64Data = 'data:image/png;base64,' + res.data; // 鎷兼帴鍓嶇紑锛岀敤浜庨〉闈㈡樉绀�
+				    console.log('鍥剧墖Base64缂栫爜:', base64Data);
+				    // 鍙互灏� base64Data 缁戝畾鍒� data 涓紝鐢ㄤ簬椤甸潰灞曠ず
+				    that.backgroundImage = base64Data;
+				  },
+				  fail: (err) => {
+				    console.error('璇诲彇鍥剧墖澶辫触:', err);
+				  }
+				});
+			},
+			shareDo(flag){
+				if(flag ==0){
+					if(!this.shop.posterImgCode){
+						return
+					}
+					wx.downloadFile({
+					  url: this.shop.posterImgCode,
+					  success: (res) => {
+					    wx.showShareImageMenu({
+					      path: res.tempFilePath
+					    })
+					  }
+					})
+				}else if(flag ==1){
+					if(!this.shop.posterImgCode){
+						return
+					}
+					wx.downloadFile({
+					  url: this.shop.posterImgCode,
+					  success: (res) => {
+					    wx.showShareImageMenu({
+					      path: res.tempFilePath
+					    })
+					  }
+					})
+				}else if(flag ==2){
+					if(!this.shop.posterImgCode){
+						return
+					}
+					this.downloadAndSaveToAlbum(this.shop.posterImgCode)
+				}
+			},
 			hexiaoOrder(item){
 				uni.navigateTo({
 					url:'/pagesA/pages/write-off-a/write-off-a?id='+item.id
@@ -269,9 +359,28 @@
 				}
 			},
 			openHaibao(){
-				if(this.shop.programCode){
-					this.showHaibao = !this.showHaibao
+				if(!this.shop.posterImgCode){
+					return
 				}
+				wx.downloadFile({
+				  url: this.shop.posterImgCode,
+				  success: (res) => {
+				    if (res.statusCode === 200) {
+						wx.showShareImageMenu({
+						  path: res.tempFilePath,
+						  needShowEntrance:false
+						})
+				    } else {
+						reject(new Error('娴锋姤涓嬭浇澶辫触'));
+				    }
+				  },
+				  fail: (err) => {
+				    reject(new Error('娴锋姤涓嬭浇澶辫触'));
+				  }
+				})
+				/* if(this.shop.programCode){
+					this.showHaibao = !this.showHaibao
+				} */
 			},
 			contactPhone(item){
 				 this.showPhone = !this.showPhone
@@ -352,6 +461,11 @@
 					
 				}
 			}, 
+			jumpIndex(){
+				uni.switchTab({
+					url:"/pages/index/index"
+				})
+			},
 			async  logout(){ 
 				var that =this
 				let res = await that.$u.api.shopLogout({tokenType:1  })
@@ -367,7 +481,7 @@
 				})
 			},
 			jumpShopLogin() {
-				uni.navigateTo({
+				uni.redirectTo({
 					url: '/pages/login/login'
 				})
 			},
@@ -405,7 +519,72 @@
 				uni.navigateTo({
 					url: '/pagesA/pages/shop_points/shop_points'
 				})
-			} 
+			} ,
+			async downloadAndSaveToAlbum(url) {
+			  try {
+				// 1. 涓嬭浇鍥剧墖
+				const { tempFilePath } = await new Promise((resolve, reject) => {
+				  uni.downloadFile({
+					url: url,
+					success: (res) => {
+					  if (res.statusCode === 200) {
+						resolve(res);
+					  } else {
+						reject(new Error('涓嬭浇澶辫触'));
+					  }
+					},
+					fail: (err) => {
+					  reject(err);
+					}
+				  });
+				});
+		
+				// 2. 鑾峰彇鐩稿唽鏉冮檺
+				await new Promise((resolve, reject) => {
+				  uni.getSetting({
+					success: (res) => {
+					  if (!res.authSetting['scope.writePhotosAlbum']) {
+						uni.authorize({
+						  scope: 'scope.writePhotosAlbum',
+						  success: resolve,
+						  fail: () => {
+							uni.showToast({
+							  title: '璇峰紑鍚浉鍐屾潈闄�',
+							  icon: 'none'
+							});
+							reject(new Error('鏈巿鏉冨啓鍏ョ浉鍐�'));
+						  }
+						});
+					  } else {
+						resolve();
+					  }
+					}
+				  });
+				});
+		
+				// 3. 淇濆瓨鍥剧墖鍒扮浉鍐�
+				await new Promise((resolve, reject) => {
+				  uni.saveImageToPhotosAlbum({
+					filePath: tempFilePath,
+					success: resolve,
+					fail: (err) => {
+					  reject(err);
+					}
+				  });
+				});
+		
+				uni.showToast({
+				  title: '淇濆瓨鎴愬姛'
+				});
+		
+			  } catch (err) {
+				uni.showToast({
+				  title: '淇濆瓨澶辫触',
+				  icon: 'none'
+				});
+				console.error(err);
+			  }
+			}
 		}
 	}
 </script>
@@ -430,13 +609,29 @@
 			background: linear-gradient(180deg, #C8F3FF 0%, #ffffff 100%);
 		
 			.head-bar {
-				width: 100%;
-		
+				width: 100%; 
 				.head-bar-nav {
 					width: 100%;
-					
+					display: flex;
+					align-items: center;
+					justify-content: left;
+					.home {
+						width: 52rpx;
+						height: 52rpx;
+						background: #C3E6F5;
+						border-radius: 26rpx;
+						margin-right: 20rpx;
+						display: flex;
+						align-items: center;
+						justify-content: center;
+						text {
+							font-weight: 400;
+							font-size: 26rpx;
+							color: #004096;
+						}
+					}
 					.loginOut {
-						width: 120rpx;
+						width: 240rpx;
 						height: 52rpx;
 						background: #C3E6F5;
 						border-radius: 26rpx;
@@ -484,6 +679,7 @@
 						.a-left {
 							display: flex;
 							align-items: center;
+							justify-content: center;
 							.a-left-tips {
 								padding: 0 6rpx;
 								height: 40rpx;
@@ -775,6 +971,7 @@
 						.data-c-item-top {
 							display: flex;
 							align-items: center;
+							
 							text {
 								font-weight: 400;
 								font-size: 24rpx;
@@ -839,6 +1036,7 @@
 		}
 	}
 	.qrcode{
+		text-align: center;
 		width: calc(100vw - 148rpx);
 		height: calc(100vw - 148rpx);
 		padding: 20px;
@@ -847,4 +1045,57 @@
 			height: calc(100vw - 188rpx);
 		}
 	}
-</style>
\ No newline at end of file
+	.haibao{
+		border-radius: 24rpx;
+		background-color: #f2f2f2;
+		text-align: center;
+		.haibao-img{
+			padding: 54rpx 44rpx 44rpx 44rpx;
+			text-align: center;
+			width: calc(100vw - 148rpx);
+			image{
+				border-radius: 24rpx;
+				width: calc(100vw - 188rpx);
+			}
+		}
+		.haibao-btn{
+			width: 100%;
+			height: 264rpx;
+			background: #FFFFFF;
+			border-radius: 24rpx;
+			display: flex;
+			align-items:center;
+			justify-content: space-between;
+			.haibao-btn-item{
+				flex:1;
+				display: flex;
+				flex-direction: column;
+				align-items:center;
+				justify-content: space-between;
+				image{
+					width: 88rpx;
+					height: 88rpx;
+				}
+				button{
+					border:none;
+					font-weight: 400;
+					font-size: 26rpx;
+					margin-top:12rpx;
+					color: #333333;
+					line-height: 36rpx;
+					text-align: center;
+					font-style: normal;
+				}
+				text{
+					font-weight: 400;
+					font-size: 26rpx;
+					margin-top:12rpx;
+					color: #333333;
+					line-height: 36rpx;
+					text-align: center;
+					font-style: normal;
+				}
+			}
+		}
+	}
+</style> 
\ No newline at end of file

--
Gitblit v1.9.3