From ea7457be6870e35cd385e163ca9bba26d7621d66 Mon Sep 17 00:00:00 2001
From: yangan <yangan0921@163.com>
Date: 星期四, 27 二月 2025 17:08:06 +0800
Subject: [PATCH] feat:无人值守h5增加门卫端

---
 pages/public-page/faYunstatisticsDetails/faYunstatisticsDetails.vue |   62 +++++++++++++++++++++++++++++-
 1 files changed, 59 insertions(+), 3 deletions(-)

diff --git a/pages/public-page/faYunstatisticsDetails/faYunstatisticsDetails.vue b/pages/public-page/faYunstatisticsDetails/faYunstatisticsDetails.vue
index 8801bbf..9a58dd9 100644
--- a/pages/public-page/faYunstatisticsDetails/faYunstatisticsDetails.vue
+++ b/pages/public-page/faYunstatisticsDetails/faYunstatisticsDetails.vue
@@ -81,11 +81,18 @@
 					</view>
 				</view>
 			</view>
+			<!-- 澧炲姞鐢靛瓙纾呭崟涓嬭浇 -->
+			<!-- v-if="roleType === 3" -->
+			<view class="weigh-button">	<u-button text="涓嬭浇鐢靛瓙纾呭崟"
+					@click="downloadTmFile"
+					type="primary"
+					shape="circle"></u-button></view>
 		</view>
 	</view>
 </template>
 
 <script>
+	import { BaseUrl } from '@/api/publicInterface.js';
 	import combinedTitle from '@/components/combined-title/combined-title.vue';
 	export default {
 		components: {
@@ -101,7 +108,49 @@
 				isSpecial: null //1 鏄壒娈� 0涓嶆槸鐗规畩
 			};
 		},
-		methods: {},
+		methods: {
+			//涓嬭浇鐢靛瓙纾呭崟
+			downloadTmFile(){
+				uni.showLoading({
+					title: '鍔犺浇涓�'
+				});
+				this.$reqGetId('downLoadTm',this.id).then(res=>{
+					console.log(res,'result')
+					this.$u.toast('涓嬭浇鎴愬姛锛�')
+					uni.hideLoading();
+					const result =    res.data.url;
+					let that = this;
+					const fileExtName = ".pdf";
+					const randfile = new Date().getTime() +res.data.fileName;
+					const newPath = `${wx.env.USER_DATA_PATH}/${randfile}`;
+					if(result){
+								wx.downloadFile({
+								url: `${BaseUrl}${result}`,
+								filePath:wx.env.USER_DATA_PATH+`/${randfile}`,
+								header: {
+									Authorization: 'Bearer' + ' ' + uni.getStorageSync('token'),
+									CLIENT_TOC: 'Y'
+								},
+								success(res){
+									const filePath = res.tempFilePath;
+									wx.openDocument({
+									filePath: res.filePath,
+									showMenu: true,
+									fileType: 'pdf',
+									success: function (res) {}
+									})
+									uni.hideLoading();
+
+								},
+								fail(err){
+									console.log(err,'涓嬭浇鏂囦欢澶辫触')
+								}
+					})
+							}
+
+				})
+			},
+		},
 		onLoad(params) {
 			this.id = params.id;
 		},
@@ -114,7 +163,12 @@
 					this.$u.toast('鑾峰彇鏁版嵁澶辫触');
 				}
 			});
-		}
+		},
+	  	computed:{
+		roleType() {
+				return uni.getStorageSync('roleType');
+			},
+	  }
 	};
 </script>
 
@@ -125,7 +179,9 @@
 		justify-content: space-between;
 		align-items: center;
 	}
-
+	.weigh-button{
+		margin-top: 30rpx;
+	}
 	.main {
 		width: 100%;
 		margin-top: vww(10);

--
Gitblit v1.9.1