From 5e782ca0358af8a10998b5aa131af8b744f3ff0d Mon Sep 17 00:00:00 2001
From: yangan <yangan0921@163.com>
Date: 星期五, 13 十二月 2024 15:58:01 +0800
Subject: [PATCH] feat:电子磅单司机下载历史

---
 pages/public-page/faYunstatisticsDetails/faYunstatisticsDetails.vue |   74 +++++++++++++++++++++++++++++++++---
 1 files changed, 67 insertions(+), 7 deletions(-)

diff --git a/pages/public-page/faYunstatisticsDetails/faYunstatisticsDetails.vue b/pages/public-page/faYunstatisticsDetails/faYunstatisticsDetails.vue
index 104a898..9a58dd9 100644
--- a/pages/public-page/faYunstatisticsDetails/faYunstatisticsDetails.vue
+++ b/pages/public-page/faYunstatisticsDetails/faYunstatisticsDetails.vue
@@ -38,7 +38,8 @@
 						<view class="">{{ faYunDetailobj.clean || '' }}</view>
 					</view>
 				</view>
-				<view class="body-container">
+				<view class="body-container"
+					v-if="!isSpecial">
 					<view class="container-block">
 						<view class="">璁㈠崟鍓╀綑閲�</view>
 						<view class="">{{ faYunDetailobj.allowance || '' }}</view>
@@ -50,7 +51,8 @@
 						<view class="">{{ faYunDetailobj.code || '' }}</view>
 					</view>
 				</view>
-				<view class="body-container last">
+				<view class="body-container last"
+					v-if="!isSpecial">
 					<view class="container-block">
 						<view class="">璁㈠崟缂栧彿</view>
 						<view class="">{{ faYunDetailobj.orderCode || '' }}</view>
@@ -79,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: {
@@ -94,11 +103,54 @@
 				id: '',
 				faYunDetailobj: {},
 				coalStatus: ['棰嗗彇', '棰勭害', '绛惧埌', '鍏ュ満', '绉扮毊', '绉版瘺', '绂诲満', '鍏ョ鎴�', '鍑虹鎴�', '鍏ョ叅浠�', '鍑虹叅浠�', '鏀剧┖', '浣滃簾', '鍏ュ満鐢宠',
-					'杩涘叆鍦洪櫌', '寮傚父瀹℃牳涓�', '鎵撳嵃涓�', '鎵撳嵃涓�'
-				]
+					'杩涘叆鍦洪櫌', '寮傚父瀹℃牳涓�', '鎵撳嵃涓�', '鎵撳嵃涓�', '濉啓'
+				],
+				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;
 		},
@@ -106,11 +158,17 @@
 			this.$reqGet('getTakeCoal', { takeCoalId: this.id }).then(res => {
 				if (res.code == 0) {
 					this.faYunDetailobj = res.data;
+					this.isSpecial = res.data.isSpecial
 				} else {
 					this.$u.toast('鑾峰彇鏁版嵁澶辫触');
 				}
 			});
-		}
+		},
+	  	computed:{
+		roleType() {
+				return uni.getStorageSync('roleType');
+			},
+	  }
 	};
 </script>
 
@@ -121,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