From 0becab45282781f281ad5aa04202b83039ab275e Mon Sep 17 00:00:00 2001
From: qingyiay <2386314947@qq.com>
Date: 星期五, 14 四月 2023 17:42:08 +0800
Subject: [PATCH] 增加发运统计页面,修改websocket,增加消息推送

---
 pages/driver-page/driver-index/bill-of-lading-details/bill-of-lading-details.vue |   47 +++++++----------------------------------------
 1 files changed, 7 insertions(+), 40 deletions(-)

diff --git a/pages/driver-page/driver-index/bill-of-lading-details/bill-of-lading-details.vue b/pages/driver-page/driver-index/bill-of-lading-details/bill-of-lading-details.vue
index 53c8404..c5bc631 100644
--- a/pages/driver-page/driver-index/bill-of-lading-details/bill-of-lading-details.vue
+++ b/pages/driver-page/driver-index/bill-of-lading-details/bill-of-lading-details.vue
@@ -48,8 +48,8 @@
 </template>
 
 <script>
-let socket = null;
 import { webSocketUrl } from '@/api/request.js';
+import { mapState, mapMutations } from 'vuex';
 export default {
 	onLoad(value) {
 		if (value.orderPlanId && value.yyId) {
@@ -100,7 +100,7 @@
 				sceneId: '',
 				gateCameraId: '',
 				equipmentCode: '',
-				weigh: 30
+				weigh: 0
 			}
 		};
 	},
@@ -108,6 +108,7 @@
 		this.init();
 	},
 	computed: {
+		...mapState(['globalweigh', 'globalinfraredStatus']),
 		name() {
 			return uni.getStorageSync('name');
 		},
@@ -255,50 +256,16 @@
 				}
 			});
 		},
-		/**
-		 * 鍒濆鍖� weoSocket
-		 */
-		initWebSocket() {
-			let wsUrl = `${webSocketUrl}?access_token=${uni.getStorageSync('token')}`;
-			socket = uni.connectSocket({
-				url: wsUrl,
-				header: {
-					CLIENT_TOC: 'Y'
-				},
-				complete: res => {
-					console.log(res, 'socket缁撴灉');
-				}
-			});
-			socket.onOpen(() => {
-				console.log('onOpen');
-			});
-			// 鑾峰彇鏈嶅姟鍣ㄤ紶鏉ョ殑鏁版嵁锛屽仛鐩稿簲澶勭悊
-			socket.onMessage(res => {
-				console.log('socketWeigh', res);
-				let nowWeighObj = JSON.parse(res.data.slice(7));
-				if (nowWeighObj.eqCode == this.weighHouseCode) {
-					if (nowWeighObj.eqInfraredStatus) {
-						this.weighData.weigh = nowWeighObj.weigh;
-					} else {
-						this.weighData.weigh = nowWeighObj.weigh;
-					}
-				}
-			});
-			socket.onClose(() => {
-				console.log('webSocketClose');
-				this.$u.toast('纾呮埧涓柇');
-			});
-			socket.onError(err => {
-				console.log('socket鎶ラ敊', err);
-				this.$u.toast('鍑虹幇閿欒锛岃閲嶆柊杩涘叆璇ラ〉闈紝閲嶈瘯锛侊紒');
-			});
-		},
 		// 鏀剧┖
 		evacuation() {
 			this.evacuationModalShow = true;
 		},
 		// 鏀剧┖寮圭獥纭
 		evacuationConfirm() {
+			this.weighData = {
+				...this.weighData,
+				weigh: this.globalweigh
+			};
 			let mix = Object.assign(this.weighData, this.getWeightHouseObj);
 			this.$reqPost('getOneEvacuation', mix, 'json').then(res => {
 				console.log(res, '绗竴娆℃斁绌�');

--
Gitblit v1.9.1