From 6e56c64e4b6b77b8acc61d34392c1fa0418ff499 Mon Sep 17 00:00:00 2001
From: doum <doum>
Date: 星期三, 25 二月 2026 18:38:44 +0800
Subject: [PATCH] 经销商管理

---
 mini-program/pages/distributor/distributor.vue |  438 ++++++++++++++++++++++++++++++++++++++++++------------
 1 files changed, 339 insertions(+), 99 deletions(-)

diff --git a/mini-program/pages/distributor/distributor.vue b/mini-program/pages/distributor/distributor.vue
index 6c4968f..ee386ad 100644
--- a/mini-program/pages/distributor/distributor.vue
+++ b/mini-program/pages/distributor/distributor.vue
@@ -13,7 +13,7 @@
 			<view class="user">
 				<view class="user-left">
 					<view class="user-left-image">
-						<image :src="shop.imgurl||'/static/logo.png'" mode="widthFix"></image>
+						<image :src="shop.imgurl||'/static/icon/default3.png'" mode="widthFix"></image>
 					</view>
 					<view class="user-left-info">
 						<view class="user-left-info-title">{{shop.name||''}}</view>
@@ -23,11 +23,11 @@
 						</view>
 					</view>
 				</view>
-				<view class="user-qrcode">
+				<view class="user-qrcode" @click="openQrcode()">
 					<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 +43,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>
@@ -74,44 +76,44 @@
 				</view>
 			</view>
 			<view class="func">
-				<view class="func-item" style="margin-bottom: 30rpx;">
+				<view class="func-item" style="margin-bottom: 30rpx;" @click="jumpGoodsList">
 					<image src="/static/icon/ic_shangpingl@2x.png" mode="widthFix"></image>
 					<text>鍟嗗搧绠$悊</text>
 				</view>
-				<view class="func-item" style="margin-bottom: 30rpx;">
+				<view class="func-item" style="margin-bottom: 30rpx;" @click="jumpOrderList">
 					<image src="/static/icon/ic_dingdanguanli@2x.png" mode="widthFix"></image>
 					<text>璁㈠崟绠$悊</text>
 				</view>
-				<view class="func-item" style="margin-bottom: 30rpx;">
+				<view class="func-item" style="margin-bottom: 30rpx;" @click="jumpAccount">
 					<image src="/static/icon/ic_xunizhanghu@2x.png" mode="widthFix"></image>
 					<text>铏氭嫙璐﹀彿</text>
 				</view>
-				<view class="func-item" style="margin-bottom: 30rpx;">
+				<view class="func-item" style="margin-bottom: 30rpx;" @click="jumpWriteoff">
 					<image src="/static/icon/ic_zitihexiao@2x.png" mode="widthFix"></image>
 					<text>鑷彁鏍搁攢</text>
 				</view>
-				<view class="func-item">
+				<view class="func-item" @click="jumpZizhi">
 					<image src="/static/icon/ic_wodezizhi@2x.png" mode="widthFix"></image>
 					<text>鎴戠殑璧勮川</text>
 				</view>
-				<view class="func-item">
+				<view class="func-item" @click="jumpMemberList">
 					<image src="/static/icon/ic_wodehuiyuan@2x.png" mode="widthFix"></image>
 					<text>鎴戠殑浼氬憳</text>
 				</view>
-				<view class="func-item">
+				<view class="func-item" @click="openHaibao">
 					<image src="/static/icon/ic_zhuanshuhaibao@2x.png" mode="widthFix"></image>
 					<text>涓撳睘娴锋姤</text>
 				</view>
 				<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">
+					<view class="a"   @click="jumpOrderDetail(item.id)">
 						<view class="a-left">
-							<view class="a-left-tips">{{item.receiveType==1?'鑷彁':'蹇�掗厤閫�'}}</view>
-							<text>璁㈠崟鍙凤細{{item.id}}</text>
+							<view :class="'a-left-tips '+(item.receiveType==1?'shop-top-tips-a':'shop-top-tips-b')">{{item.receiveType==1?'鑷彁':'閰嶉��'}}</view>
+							<text>璁㈠崟鍙凤細{{item.code}}</text>
 						</view>
 						<text v-if="item.status ==0" class="a-right">寰呮敮浠�</text>
 						<text  v-if="item.status ==1" class="a-right">{{item.receiveType==1?'寰呰嚜鎻�':'寰呭彂璐�'}}</text>
@@ -120,17 +122,7 @@
 						<text  v-if="item.status ==4"class="a-right">宸插彇娑�</text>
 						<text  v-if="item.status ==6" class="a-right">宸查��娆�</text>
 					</view>
-					<view class="b">
-						<view class="b-item" v-for="(item1, index1) in (item.goodsorderDetailList||[])">
-							<view class="b-item-image">
-								<image :src="item1.imgurl||'/static/logo.png'" mode="widthFix"></image>
-							</view>
-							<view class="b-item-title">{{item1.name||''}}</view>
-							<view class="b-item-jia">
-								<text>楼{{(item1.price||0).toFixed(2)}}</text>
-								<text>x{{item1.goodsNum||0}}</text>
-							</view>
-						</view>
+					<view class="b"   @click="jumpOrderDetail(item.id)">
 						<view class="b-item" v-for="(item1, index1) in (item.goodsorderDetailList||[])">
 							<view class="b-item-image">
 								<image :src="item1.imgurl||'/static/logo.png'" mode="widthFix"></image>
@@ -152,14 +144,14 @@
 						</view>
 						<view class="c-btns">
 							<view class="c-btns-item blue" @click="contactPhone(item)">鑱旂郴瀹㈡埛</view>
-							<view class="c-btns-item bg">鑷彁鏍搁攢</view>
+							<view class="c-btns-item bg" v-if="item.status == 1 && item.receiveType ==1" @click="hexiaoOrder(item)">鑷彁鏍搁攢</view>
 						</view>
 					</view>
-					<view class="d" v-if="item.memberInfo">
+					<view class="d" v-if="item.memberInfo"   @click="jumpOrderDetail(item.id)">
 						璁㈠崟澶囨敞锛歿{item.memberInfo||''}}
 					</view>
 				</view>
-				<view v-if="!hasNext" class="nomore">宸插姞杞藉叏閮�</view>
+				<view v-if="!hasNext" class="nomore">{{total>0?'宸插姞杞藉叏閮ㄦ暟鎹�':'鏆傛棤寰呭鐞嗚鍗�'}}</view>
 			</view>
 		</view>
 		<!-- 纭閫�鍑虹櫥闄� -->
@@ -192,13 +184,41 @@
 				</view> -->
 				 <view class="phone-item" >
 				 	<view>
-						<image src="/static/icon/ic_call@2x.png" mode="widthFix" @click="contactPhoneDo()"></image>
+						<image src="/static/icon/ic_call@2x.png" mode="widthFix" @click="contactPhoneDo()" ></image>
 						<text>{{linkItem.linkname}} </text> 
 						<text style="margin-left: 10px;"> {{linkItem.linkphone}}</text> 
 					</view> 
 				 </view>  
 				 <view style="width: 100%; height: 30rpx;"></view>
 				<!-- <view class="phone-botton"  @click="contactPhone()" >鍏抽棴</view> -->
+			</view>
+		</u-popup>
+		<u-popup :show="showQrcode" round="15" :safeAreaInsetBottom="false" mode="center" @close="openQrcode()" >
+			<view class="qrcode" >
+				<image :src="shop.programCode||''" mode="widthFix"></image>
+			</view>
+		</u-popup>
+		<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>
@@ -213,6 +233,8 @@
 		data() {
 			return { 
 				show:false,
+				showHaibao:false,
+				showQrcode:false,
 				active:0,
 				loading:false,
 				showMoney:false,
@@ -224,7 +246,7 @@
 				shop:{}, 
 				linkItem:{},
 				countData:{},
-				backgroundImage: require('@/static/images/bg_card@2x.png')
+				backgroundImage:null
 			};
 		},
 		onShow() {
@@ -232,14 +254,129 @@
 			 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
+			 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()
+					 }
+					 that.total=0
+					 that.hasNext=true
+					 that.currentPage = 0
+					 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
+				})
+			},
+			openQrcode(){
+				if(this.shop.programCode){
+					this.showQrcode = !this.showQrcode
+				}
+			},
+			openHaibao(){
+				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
 				 this.linkItem = item ||{}
@@ -328,16 +465,116 @@
 					that.jumpShopLogin()
 				} 
 			},
+			jumpOrderDetail(id){
+				uni.navigateTo({
+					url: '/pagesA/pages/order-details/order-details?userType=1&id='+id
+				})
+			},
 			jumpShopLogin() {
 				uni.navigateTo({
 					url: '/pages/login/login'
 				})
 			},
+			jumpZizhi() {
+				uni.navigateTo({
+					url: '/pagesA/pages/my-qualifications/my-qualifications'
+				})
+			},
+			jumpGoodsList() {
+				uni.navigateTo({
+					url: '/pagesA/pages/product-management/product-management'
+				})
+			},
+			jumpOrderList() {
+				uni.navigateTo({
+					url: '/pagesA/pages/order/order?userType=1'
+				})
+			},
+			jumpAccount() {
+				uni.navigateTo({
+					url: '/pagesA/pages/virtual-account/virtual-account'
+				})
+			},
+			jumpWriteoff() {
+				uni.navigateTo({
+					url: '/pagesA/pages/write-off/write-off'
+				})
+			},
+			jumpMemberList() {
+				uni.navigateTo({
+					url: '/pagesA/pages/my-membership/my-membership'
+				})
+			},
 			jumpShopIntegral() {
 				uni.navigateTo({
-					url: '/pagesA/shop_points/shop_points'
+					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>
@@ -398,12 +635,6 @@
 				width: 100%;
 				margin-top: 30rpx;
 				padding-bottom: 60rpx;
-				.nomore{
-					width: 100%;
-					text-align: center;
-					font-size: 24rpx;
-					color: #666666;
-				}
 				.list-item {
 					width: 100%;
 					padding: 30rpx;
@@ -422,16 +653,24 @@
 						.a-left {
 							display: flex;
 							align-items: center;
+							justify-content: center;
 							.a-left-tips {
 								padding: 0 6rpx;
 								height: 40rpx;
 								line-height: 40rpx;
-								background: #00B775;
 								border-radius: 8rpx;
 								font-weight: 400;
 								font-size: 22rpx;
 								color: #FFFFFF;
 								margin-right: 16rpx;
+							}
+							.shop-top-tips-a {
+								background: #00B775; 
+								border: 1rpx solid #00B775;
+							}
+							.shop-top-tips-b {
+								background: #004096;
+								border: 1rpx solid #004096;
 							}
 							text {
 								font-weight: 400;
@@ -706,6 +945,7 @@
 						.data-c-item-top {
 							display: flex;
 							align-items: center;
+							
 							text {
 								font-weight: 400;
 								font-size: 24rpx;
@@ -768,68 +1008,68 @@
 				}
 			}
 		}
-		.phone {
+	}
+	.qrcode{
+		text-align: center;
+		width: calc(100vw - 148rpx);
+		height: calc(100vw - 148rpx);
+		padding: 20px;
+		image{
+			width: calc(100vw - 188rpx);
+			height: calc(100vw - 188rpx);
+		}
+	}
+	.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%;
-			padding-top: 40rpx;
-			box-sizing: border-box;
-			.phone-botton {
-				width: 100%;
-				height: 88rpx;
-				line-height: 88rpx;
-				text-align: center;
-				font-weight: 500;
-				font-size: 32rpx;
-				color: #FFFFFF;
-				background: #00BC12;
-				border-radius: 44rpx;
-				margin-top: 60rpx;
-			}
-			.phone-head {
-				width: 100%;
-				text-align: center;
-				justify-content: space-between; 
-				margin-bottom: 40rpx;
-				text {
-					font-weight: 800;
-					font-size: 32rpx;
-					color: #222222;
-				}
-			}
-			 
-			.phone-item {
-				width: 100%;
-				text-align: center;
+			height: 264rpx;
+			background: #FFFFFF;
+			border-radius: 24rpx;
+			display: flex;
+			align-items:center;
+			justify-content: space-between;
+			.haibao-btn-item{
+				flex:1;
 				display: flex;
-				justify-content: center;
 				flex-direction: column;
-				// border-bottom: 1rpx solid #eeeeee;
-				line-height: 78rpx;
-				button{
-					border: 1rpx white solid;
-					display: inline;
-					width: 300rpx;
-					font-weight: 500;
-					font-size: 32rpx;
-					line-height: 32rpx;
-					color: #222222;
-				}
+				align-items:center;
+				justify-content: space-between;
 				image{
-					width: 28rpx;
-					height: 28rpx;
-					margin-right: 30rpx;
+					width: 88rpx;
+					height: 88rpx;
 				}
-				.line{
-					width: 100%;
-					height: 1rpx;
-					background-color: #f2f2f2
+				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: 500;
-					font-size: 28rpx;
-					line-height: 28rpx;
-					color: #222222;
+				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
+</style> 
\ No newline at end of file

--
Gitblit v1.9.3