From 3fd84886a15713ece1ba34954f49fd1e075ef7be Mon Sep 17 00:00:00 2001
From: qingyiay <2386314947@qq.com>
Date: 星期三, 19 四月 2023 17:38:48 +0800
Subject: [PATCH] 改变称重监听,增加发运详情,修复电子提煤单错误

---
 pages/driver-page/driver-index/bill-of-lading-details/weighingDevice/weighingDevice.vue       |   14 ++
 pages.json                                                                                    |    9 +
 pages/public-page/faYunstatisticsDetails/faYunstatisticsDetails.vue                           |  100 ++++++++++++++++++++
 pages/customer-page/customer-index/fayunPlanDetails/fayunPlanDetails.vue                      |    2 
 pages/tabbar-page/index-tabbar/index-tabbar.vue                                               |   35 ++++++-
 pages/driver-page/driver-index/bill-of-lading-details/coal-pick-up-bill/coal-pick-up-bill.vue |    2 
 pages/customer-page/customer-my/faYunstatistics/faYunstatistics.vue                           |   78 ++++++++++++++-
 pages/driver-page/driver-index/bill-of-lading-details/bill-of-lading-details.vue              |    6 
 store/index.js                                                                                |    2 
 9 files changed, 226 insertions(+), 22 deletions(-)

diff --git a/pages.json b/pages.json
index c69b5d9..f48dd50 100644
--- a/pages.json
+++ b/pages.json
@@ -211,6 +211,15 @@
                 }
                 
                 }
+                ,{
+                    "path" : "faYunstatisticsDetails/faYunstatisticsDetails",
+                    "style" :                                                                                    
+                {
+                    "navigationBarTitleText": "",
+                    "enablePullDownRefresh": false
+                }
+                
+                }
             ]
 		}, {
 			"root": "pages/driver-page/appointment",
diff --git a/pages/customer-page/customer-index/fayunPlanDetails/fayunPlanDetails.vue b/pages/customer-page/customer-index/fayunPlanDetails/fayunPlanDetails.vue
index 866478c..5746de9 100644
--- a/pages/customer-page/customer-index/fayunPlanDetails/fayunPlanDetails.vue
+++ b/pages/customer-page/customer-index/fayunPlanDetails/fayunPlanDetails.vue
@@ -45,7 +45,7 @@
 					<view class="label-title">浣欓噺</view>
 					<view class="label-value">{{ item.allowance || 0 }}</view>
 				</view>
-				<view class="more-button"><u-button type="success" text="鏇村" @click="showMore(index)"></u-button></view>
+				<view class="more-button"><u-button type="success" text="璇︽儏" @click="showMore(index)"></u-button></view>
 			</view>
 		</view>
 	</view>
diff --git a/pages/customer-page/customer-my/faYunstatistics/faYunstatistics.vue b/pages/customer-page/customer-my/faYunstatistics/faYunstatistics.vue
index 83f3c08..1da3993 100644
--- a/pages/customer-page/customer-my/faYunstatistics/faYunstatistics.vue
+++ b/pages/customer-page/customer-my/faYunstatistics/faYunstatistics.vue
@@ -4,7 +4,7 @@
 			<view class="content-statistics">
 				<view class="content-text">鍙戣繍缁熻</view>
 				<view class="content-text">鍏眥{ totalLength }}杞�</view>
-				<view class="content-text">鍏眥{ totalTon }}鍚�</view>
+				<view class="content-text">鍏眥{ totalTon.toFixed(2) }}鍚�</view>
 			</view>
 		</view>
 		<view class="collapse-main">
@@ -119,6 +119,24 @@
 								</view>
 							</view>
 						</view>
+						<view class="filter-body" v-if="roleType == 2">
+							<view class="condition-name">杞︾墝鍙凤細</view>
+							<view class="filter-name">
+								<view class="filter-button" v-for="(item, index) in carNoList" :key="index" @click="filterCondition(6, index, item.condition)">
+									<u-button shape="circle" :text="item.condition" :type="item.active ? 'success' : ''" size="small"></u-button>
+								</view>
+								<view class="toggle-button">
+									<u-button
+										shape="circle"
+										:text="carNoShow < carNoTotal ? '鏌ョ湅鏇村' : '鏀惰捣'"
+										type="primary"
+										size="small"
+										@click="toggle(6)"
+										v-if="carNoTotal > 3"
+									></u-button>
+								</view>
+							</view>
+						</view>
 						<view class="filter-body">
 							<view class="condition-name">鏃ユ湡锛�</view>
 							<view class="filter-name">
@@ -156,10 +174,10 @@
 					</view>
 				</view>
 				<view class="card-main" v-for="(value, i) in item.taskCoalList" :key="i">
-					<view class="arrow-right"><u-icon name="arrow-right" size="50"></u-icon></view>
+					<view class="arrow-right" @click="faYunDetail(value.id)"><u-icon name="arrow-right" size="50"></u-icon></view>
 					<view class="main-body">
 						<view class="coal-name">鐓ょ:{{ value.coalName || '' }}</view>
-						<view class="clean">鎵ц閲�:{{ value.clean || 0 }}</view>
+						<view class="clean">鎵ц閲�:{{ value.clean.toFixed(2) || 0 }}</view>
 						<view class="out-time">鍑哄満鏃堕棿:{{ value.outTime || '' }}</view>
 						<view class="car-number">杞︾墝鍙�:{{ value.carNo || '' }}</view>
 						<view class="filedName">鐭垮満:{{ value.filedName || '' }}</view>
@@ -181,6 +199,7 @@
 			forwarderList: [],
 			fleetList: [],
 			filedList: [],
+			carNoList: [],
 			isactive: false,
 			info: {
 				lunar: false,
@@ -201,12 +220,18 @@
 			forwarderShow: 3,
 			fleetShow: 3,
 			filedShow: 3,
+			carNoShow: 3,
 			coalToggeleState: false,
 			typeToggeleState: false,
 			customerToggeleState: false,
 			forwarderToggeleState: false,
 			fleetToggeleState: false,
-			filedToggeleState: false
+			filedToggeleState: false,
+			carNoToggeleState: false,
+			// 鐐瑰嚮鍙崇澶磋鎯呭脊绐�
+			faYunDetailobj: {},
+			modalShow: false,
+			coalStatus: ['棰嗗彇', '棰勭害', '绛惧埌', '鍏ュ満', '绉扮毊', '绉版瘺', '绂诲満', '鍏ョ鎴�', '鍑虹鎴�', '鍏ョ叅鍦�', '鍑虹叅浠�']
 		};
 	},
 	onShow() {
@@ -283,6 +308,14 @@
 							active: false
 						};
 					});
+				this.carNoList = res.data
+					.filter(v => v.conditionType == 6)
+					.map(item => {
+						return {
+							...item,
+							active: false
+						};
+					});
 			});
 		},
 		// 鑾峰彇鏁版嵁
@@ -328,6 +361,9 @@
 				case 5:
 					this.filedList[i].active = !this.filedList[i].active;
 					break;
+				case 6:
+					this.carNoList[i].active = !this.carNoList[i].active;
+					break;
 			}
 
 			const validateFn = key => (v, arr) => {
@@ -343,7 +379,8 @@
 				customerName: this.customerList.filter(v => v.active == true).map(item => item.condition),
 				xsUser2Name: this.forwarderList.filter(v => v.active == true).map(item => item.condition),
 				fleetName: this.fleetList.filter(v => v.active == true).map(item => item.condition),
-				filedName: this.filedList.filter(v => v.active == true).map(item => item.condition)
+				filedName: this.filedList.filter(v => v.active == true).map(item => item.condition),
+				carNo: this.carNoList.filter(v => v.active == true).map(item => item.condition)
 			};
 
 			const mapping = {
@@ -352,7 +389,8 @@
 				customerName: validateFn('customerName'),
 				xsUser2Name: validateFn('xsUser2Name'),
 				fleetName: validateFn('fleetName'),
-				filedName: validateFn('filedName')
+				filedName: validateFn('filedName'),
+				carNo: validateFn('carNo')
 			};
 			this.filterList = this.taskList.map(val => {
 				return {
@@ -439,7 +477,25 @@
 						this.filedToggeleState = false;
 					}
 					break;
+				case 6:
+					if (!this.carNoToggeleState) {
+						this.carNoShow = this.carNoTotal;
+						this.carNoToggeleState = true;
+					} else {
+						this.carNoShow = 3;
+						this.carNoToggeleState = false;
+					}
+					break;
 			}
+		},
+		// 璺宠浆鍙戣繍璇︽儏
+		faYunDetail(takeCoalId) {
+			uni.navigateTo({
+				url: `/pages/public-page/faYunstatisticsDetails/faYunstatisticsDetails?id=${takeCoalId}`
+			});
+		},
+		confirm() {
+			this.modalShow = false;
 		}
 	},
 	computed: {
@@ -469,6 +525,9 @@
 		},
 		filedTotal() {
 			return this.filedList.length;
+		},
+		carNoTotal() {
+			return this.carNoList.length;
 		}
 	},
 	watch: {
@@ -513,7 +572,7 @@
 			justify-content: space-between;
 			align-items: center;
 			.content-text {
-				width: vww(80);
+				width: 33.3%;
 				height: vww(30);
 				font-size: vww(20);
 				color: #393a3c;
@@ -560,7 +619,10 @@
 						}
 					}
 					.toggle-button {
-						margin-top: vww(12);
+						margin: vww(12) auto;
+						position: relative;
+						left: -10%;
+						transform: translateX(-50%);
 					}
 				}
 			}
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 3b31d83..e541d34 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
@@ -100,7 +100,8 @@
 				sceneId: '',
 				gateCameraId: '',
 				equipmentCode: '',
-				weigh: 0
+				weigh: 0,
+				sceneInOut: ''
 			},
 			// 鍘熷彂淇℃伅
 			primarySkin: null,
@@ -254,13 +255,14 @@
 					this.weighData.sceneId = res.data.id;
 					this.weighData.gateCameraId = res.data.lastEquipmentId;
 					this.weighData.equipmentCode = res.data.lastEquipmentCode;
+					this.weighData.sceneInOut = res.data.sceneInOut;
 					this.weighHouseCode = res.data.code;
 					uni.navigateTo({
 						url: `/pages/driver-page/driver-index/bill-of-lading-details/weighingDevice/weighingDevice?takeCoalId=${this.orderPlanId}&sceneId=${
 							res.data.id
 						}&gateCameraId=${res.data.lastEquipmentId}&gateCameraCode=${res.data.lastEquipmentCode}&weighHouseCode=${res.data.code}&primarySkin=${
 							this.primarySkin
-						}&primaryHair=${this.primaryHair}&primaryClean=${this.primaryClean}`
+						}&primaryHair=${this.primaryHair}&psrimaryClean=${this.primaryClean}&sceneInOut=${res.data.sceneInOut}`
 					});
 				} else {
 					this.$u.toast('鏈湪纾呮埧锛岃鍓嶅線纾呮埧鍚庡啀璇曪紒锛�');
diff --git a/pages/driver-page/driver-index/bill-of-lading-details/coal-pick-up-bill/coal-pick-up-bill.vue b/pages/driver-page/driver-index/bill-of-lading-details/coal-pick-up-bill/coal-pick-up-bill.vue
index e0fdead..14413d5 100644
--- a/pages/driver-page/driver-index/bill-of-lading-details/coal-pick-up-bill/coal-pick-up-bill.vue
+++ b/pages/driver-page/driver-index/bill-of-lading-details/coal-pick-up-bill/coal-pick-up-bill.vue
@@ -43,7 +43,7 @@
 			this.$reqGet('getTakeCoal', { takeCoalId: this.orderPlanId }).then(res => {
 				console.log('鑾峰彇鎻愮叅鍗曡鎯�', res);
 				if (res.code == 0) {
-					this.coalData = res.data[0];
+					this.coalData = res.data;
 				} else {
 					this.$u.toast('鍔犺浇澶辫触');
 				}
diff --git a/pages/driver-page/driver-index/bill-of-lading-details/weighingDevice/weighingDevice.vue b/pages/driver-page/driver-index/bill-of-lading-details/weighingDevice/weighingDevice.vue
index 81b3e58..a68ff45 100644
--- a/pages/driver-page/driver-index/bill-of-lading-details/weighingDevice/weighingDevice.vue
+++ b/pages/driver-page/driver-index/bill-of-lading-details/weighingDevice/weighingDevice.vue
@@ -72,13 +72,13 @@
 let socket = null;
 import { webSocketUrl } from '@/api/request.js';
 import { mapState, mapMutations } from 'vuex';
-import toast from '../../../../../uni_modules/uview-ui/libs/config/props/toast';
 export default {
 	onLoad(params) {
 		this.takeCoalId = params.takeCoalId;
 		this.weighData.sceneId = params.sceneId;
 		this.weighData.gateCameraId = params.gateCameraId;
 		this.weighData.equipmentCode = params.gateCameraCode;
+		this.weighData.sceneInOut = params.sceneInOut;
 		this.weighHouseCode = params.weighHouseCode;
 		this.primarySkin = params.primarySkin;
 		this.primaryHair = params.primaryHair;
@@ -96,7 +96,8 @@
 				gateCameraId: '',
 				equipmentCode: '',
 				weigh: 0,
-				tmCode: ''
+				tmCode: '',
+				sceneInOut: ''
 			},
 			takeCoalId: null,
 			weighHouseCode: '',
@@ -154,8 +155,13 @@
 			}
 		},
 		// 鐩戝惉閲嶉噺鍙樺寲
-		globalweigh(v) {
-			this.weighData.weigh = this.realTimeWeigh = v;
+		globalweigh: {
+			handler(v) {
+				this.weighData.weigh = this.realTimeWeigh = v;
+				console.log(this.realTimeWeigh, '鐪熷疄閲嶉噺鏀瑰彉浜�');
+			},
+			immediate: true,
+			deep: true
 		}
 	},
 	onShow() {
diff --git a/pages/public-page/faYunstatisticsDetails/faYunstatisticsDetails.vue b/pages/public-page/faYunstatisticsDetails/faYunstatisticsDetails.vue
new file mode 100644
index 0000000..ceb911d
--- /dev/null
+++ b/pages/public-page/faYunstatisticsDetails/faYunstatisticsDetails.vue
@@ -0,0 +1,100 @@
+<template>
+	<view>
+		<combined-title title="鍙戣繍璇︽儏"></combined-title>
+		<view class="compDetails">
+			<uni-table border stripe emptyText="鏆傛棤鏇村鏁版嵁">
+				<uni-tr>
+					<uni-th align="left">鎻愮叅鍗曠紪鍙�</uni-th>
+					<uni-td align="left">{{ faYunDetailobj.code || '' }}</uni-td>
+				</uni-tr>
+				<uni-tr>
+					<uni-th align="left">鎻愮叅鍗曠姸鎬�</uni-th>
+					<uni-td align="left">{{ coalStatus[faYunDetailobj.status] }}</uni-td>
+				</uni-tr>
+				<uni-tr>
+					<uni-th align="left">杞︾墝鍙�</uni-th>
+					<uni-td align="left">{{ faYunDetailobj.carNo || '' }}</uni-td>
+				</uni-tr>
+				<uni-tr>
+					<uni-th align="left">鍏ュ満鏃堕棿</uni-th>
+					<uni-td align="left">{{ faYunDetailobj.inTime || '' }}</uni-td>
+				</uni-tr>
+				<uni-tr>
+					<uni-th align="left">鍑哄満鏃堕棿</uni-th>
+					<uni-td align="left">{{ faYunDetailobj.outTime || '' }}</uni-td>
+				</uni-tr>
+				<uni-tr>
+					<uni-th align="left">鐨噸</uni-th>
+					<uni-td align="left">{{ faYunDetailobj.skin || 0 }}</uni-td>
+				</uni-tr>
+				<uni-tr>
+					<uni-th align="left">姣涢噸</uni-th>
+					<uni-td align="left">{{ faYunDetailobj.hair || 0 }}</uni-td>
+				</uni-tr>
+				<uni-tr>
+					<uni-th align="left">鍑�閲�</uni-th>
+					<uni-td align="left">{{ faYunDetailobj.clean || 0 }}</uni-td>
+				</uni-tr>
+				<uni-tr>
+					<uni-th align="left">璁㈠崟缂栧彿</uni-th>
+					<uni-td align="left">{{ faYunDetailobj.orderCode || '' }}</uni-td>
+				</uni-tr>
+				<uni-tr>
+					<uni-th align="left">璁㈠崟鍓╀綑閲�</uni-th>
+					<uni-td align="left">{{ faYunDetailobj.allowance || 0 }}</uni-td>
+				</uni-tr>
+			</uni-table>
+		</view>
+	</view>
+</template>
+
+<script>
+export default {
+	data() {
+		return {
+			id: '',
+			faYunDetailobj: {},
+			coalStatus: ['棰嗗彇', '棰勭害', '绛惧埌', '鍏ュ満', '绉扮毊', '绉版瘺', '绂诲満', '鍏ョ鎴�', '鍑虹鎴�', '鍏ョ叅鍦�', '鍑虹叅浠�']
+		};
+	},
+	methods: {},
+	onLoad(params) {
+		this.id = params.id;
+	},
+	onShow() {
+		this.$reqGet('getTakeCoal', { takeCoalId: this.id }).then(res => {
+			if (res.code == 0) {
+				this.faYunDetailobj = res.data;
+			} else {
+				this.$u.toast('鑾峰彇鏁版嵁澶辫触');
+			}
+		});
+	}
+};
+</script>
+
+<style scoped lang="scss">
+.uni-table {
+	.uni-table-tr {
+		padding: 0;
+		border: vww(1) solid #c6c6c6;
+		.uni-table-th {
+			font-size: vww(14);
+			height: vww(30);
+			line-height: vww(30);
+			padding: vww(5) vww(10);
+			color: #111111;
+			font-weight: 500;
+			background: #e2e2e2;
+		}
+		.uni-table-td {
+			font-size: vww(14);
+			font-weight: 400;
+			height: vww(30);
+			line-height: vww(30);
+			padding: vww(5) vww(10);
+			color: #111111;
+		}
+	}
+}
+</style>
diff --git a/pages/tabbar-page/index-tabbar/index-tabbar.vue b/pages/tabbar-page/index-tabbar/index-tabbar.vue
index 8b873b4..a4ff57e 100644
--- a/pages/tabbar-page/index-tabbar/index-tabbar.vue
+++ b/pages/tabbar-page/index-tabbar/index-tabbar.vue
@@ -13,7 +13,9 @@
 		<driver-index v-if="roleType == 3" ref="driverIndexRef" :indexdriverBillOfLoadingData="indexdriverBillOfLoadingData"></driver-index>
 		<tab-bar :current="0"></tab-bar>
 		<!-- 鎺ㄩ�佹秷鎭脊绐� -->
-		<u-modal :show="messagePushShow" :title="messageList.title" :content="messageList.content" @confirm="messageconfirm"></u-modal>
+		<u-modal :show="messagePushShow" :title="messageList.title" @confirm="messageconfirm">
+			<view class="slot-content"><rich-text :nodes="messageList.content"></rich-text></view>
+		</u-modal>
 	</view>
 </template>
 
@@ -122,6 +124,17 @@
 		}
 		this.userAuthorization();
 	},
+	onHide() {
+		console.log('椤甸潰闅愯棌');
+		if (!this.isconnect) {
+			this.initWebsocket();
+		}
+	},
+	onUnload() {
+		console.log('椤甸潰鍗歌浇');
+		socket.close();
+		clearInterval(this.intervalId);
+	},
 	methods: {
 		...mapMutations(['pushMessage', 'changeWeigh', 'changeinfraredStatus']),
 		messagePage() {
@@ -208,10 +221,19 @@
 			});
 			socket.onOpen(() => {
 				console.log('onOpen');
+				this.intervalId = setInterval(() => {
+					socket.send({
+						data: JSON.stringify({ type: 'ping' }),
+						success(e) {
+							console.log(e, '鍙戦�佸績璺虫垚鍔�');
+						}
+					});
+				}, 30000);
 			});
+
 			// 鑾峰彇鏈嶅姟鍣ㄤ紶鏉ョ殑鏁版嵁锛屽仛鐩稿簲澶勭悊
 			socket.onMessage(res => {
-				console.log('socketWeigh', res);
+				console.log('message', res);
 				if (res.data.startsWith('weigh')) {
 					let nowWeighObj = JSON.parse(res.data.slice(7));
 					if (this.globalweighHouseCode && nowWeighObj.eqCode == this.globalweighHouseCode) {
@@ -223,13 +245,16 @@
 							this.changeWeigh(nowWeighObj.weigh);
 						}
 					}
-				} else {
+				} else if (res.data.startsWith('msg')) {
 					this.messageList = JSON.parse(res.data.slice(5));
 					this.messagePushShow = true;
+				} else {
+					console.log('websocket杩樺湪娲荤潃');
 				}
 			});
-			socket.onClose(() => {
-				console.log('webSocketClose');
+			socket.onClose(e => {
+				console.log('webSocketClose', e);
+				this.$u.toast('杩炴帴宸叉柇寮�锛岃閲嶆柊杩涘叆璇ラ〉闈紝閲嶈瘯锛侊紒');
 				this.isconnect = false;
 			});
 			socket.onError(err => {
diff --git a/store/index.js b/store/index.js
index 1321749..badfcb9 100644
--- a/store/index.js
+++ b/store/index.js
@@ -67,7 +67,7 @@
 		// 鏀瑰彉閲嶉噺
 		changeWeigh(state, payload) {
 			state.globalweigh = payload
-			console.log(state.globalweigh, '閲嶉噺鏀瑰彉浜�')
+			console.log(state.globalweigh, '鍏ㄥ眬閲嶉噺鏀瑰彉浜�')
 		},
 		// 娑堟伅鎺ㄩ��
 		pushMessage(state, payload) {

--
Gitblit v1.9.1