From 76a7460699861269561d715b0ea1eed026edb5b4 Mon Sep 17 00:00:00 2001
From: qingyiay <2386314947@qq.com>
Date: 星期四, 03 八月 2023 08:15:59 +0800
Subject: [PATCH] 获取平均皮重参数修改

---
 pages/driver-page/driver-index/bill-of-lading-details/weighingDevice/weighingDevice.vue |  275 +++++++++++++++++++++++++++++++++++++++++++-----------
 1 files changed, 218 insertions(+), 57 deletions(-)

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 064437c..5ea444f 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
@@ -5,8 +5,8 @@
 		background-size: cover;">
 			<view class="top">
 				<view class="top_left">
-					<text>{{ realTimeWeigh }}</text>
-					<!-- <text>{{ globalweigh }}</text> -->
+					<!-- <text>{{ realTimeWeigh }}</text> -->
+					<text>{{ globalweigh }}</text>
 				</view>
 				<view class="top_right">
 					<view class="">
@@ -103,15 +103,36 @@
 			style="width: 100%;height: 40rpx;"></view>
 		<view class="bottom-block">
 			<view class="block-main">
-				<view class="main-information">
+				<view class="main-information"
+					v-if="weighList.orderType=='杞叆'||weighList.orderType=='杞嚭'">
+					<view class="prefix">
+						鍙戣揣鍦扮叅鍦�:
+					</view>
+					<view class="suffix">
+						{{ weighList.filedName || '' }}
+					</view>
+				</view>
+				<view class="main-information"
+					v-if="weighList.orderType=='杞叆'||weighList.orderType=='杞嚭'">
+					<view class="prefix">
+						鏀惰揣鍦扮叅鍦�:
+					</view>
+					<view class="suffix">
+						{{ weighList.toFiledName || '' }}
+					</view>
+				</view>
+				<view class="main-information"
+					v-if="weighList.orderType!=='杞叆'||weighList.orderType!=='杞嚭'">
 					<view class="prefix">瀹㈡埛:</view>
 					<view class="suffix">{{ weighList.customerName }}</view>
 				</view>
-				<view class="main-information">
-					<view class="prefix">鐭垮満锛�</view>
+				<view class="main-information"
+					v-if="weighList.orderType!=='杞叆'||weighList.orderType!=='杞嚭'">
+					<view class="prefix">鐭垮満:</view>
 					<view class="suffix">{{ weighList.deptName || '' }}</view>
 				</view>
-				<view class="main-information">
+				<view class="main-information"
+					v-if="weighList.orderType!=='杞叆'||weighList.orderType!=='杞嚭'">
 					<view class="prefix">鐓ゅ満:</view>
 					<view class="suffix">{{ weighList.filedName || '' }}</view>
 				</view>
@@ -154,7 +175,8 @@
 				:disabled="realTimeWeigh == 0 || globalinfraredStatus || isweigh || !isInputOrigin"
 				:loading="isConfirmWeighLoading"
 				loadingText="纭"
-				@click="confirmWeigh"></u-button>
+				@click="confirmWeigh"
+				v-show="!historyBtn"></u-button>
 			<u-button type="primary"
 				text="杩斿洖鍔犲噺鍚�"
 				:disabled="addAndSubtractCoalDisabled"
@@ -162,7 +184,29 @@
 				class="jiajian"
 				v-if="outBuy"></u-button>
 		</view>
-		<!-- <view class="four" v-if="weighList.orderType !== '澶栬喘'">濡傛偍闇�瑕佽皟鏁磋杞借揣鍝佸惃鏁帮紝璇风偣鍑昏繑鍥炲姞鍑忓惃</view> -->
+		<view style="width: 200rpx;margin: auto;position: relative;"
+			v-if="!historyBtn"><u-button type="primary"
+				text="鏄剧ず鍘嗗彶鐨噸"
+				@click.stop="displayHistory"></u-button></view>
+		<Transition name="slide-fade">
+			<view class="history-skin"
+				v-if="historyShow">
+				<view class="history-skin_item"
+					v-for="item in tmTaskCoalList">
+					<view class="createTime">
+						鏃ユ湡:{{item.createTime.slice(0,10)}}
+					</view>
+					<view class="skin">
+						<view class="">
+							鐨噸:
+						</view>
+						<view class="">
+							{{item.skin}}
+						</view>
+					</view>
+				</view>
+			</view>
+		</Transition>
 		<!-- 鏀剧┖寮圭獥 -->
 		<view class="evacuationModal">
 			<u-modal :show="evacuationModalShow"
@@ -171,6 +215,29 @@
 				:showCancelButton="true"
 				@confirm="evacuationConfirm"
 				@cancel="evacuationCancel"></u-modal>
+		</view>
+		<!-- 绉伴噸寮傚父寮圭獥 -->
+		<view class="">
+			<u-modal :show="abnormalModalShow"
+				title="寮傚父鍘熷洜"
+				:showCancelButton="true"
+				@confirm="abnormalConfirm"
+				@cancel="abnormalCancel"
+				confirmText="鎻愪氦">
+				<view class="slot-content">
+					<u--form labelPosition="top">
+						<u-form-item>
+							<u-textarea v-model="abnormalContent"
+								confirmType="done"
+								placeholder="璇疯緭鍏ュ紓甯稿師鍥�"
+								height='140'
+								count
+								border="surround"
+								autoHeight></u-textarea>
+						</u-form-item>
+					</u--form>
+				</view>
+			</u-modal>
 		</view>
 	</view>
 </template>
@@ -250,50 +317,62 @@
 				isfocus1: false,
 				isfocus2: false,
 				// 澶栬喘绗竴娆$О姣涢噸涓嶉渶瑕佸姞鍑忓惃
-				outBuy: true
+				outBuy: true,
+				// 鐨噸寮傚父鐩稿叧
+				abnormalContent: '',
+				avgSkin: null, // 骞冲潎鐨噸
+				tmTaskCoalList: [],
+				abnormalModalShow: false,
+				historyBtn: false,
+				historyShow: false
 			};
 		},
 		watch: {
 			realTimeWeigh(newV, oldV) {
-				if (this.weighList.orderType == '澶栭攢' || this.weighList.orderType == '鍐呴攢' || this.weighList.orderType ==
-					'杞嚭') {
-					if (this.weighList.skin == 0) {
-						// this.temporaryWeighObj.skin = this.realTimeWeigh;
-						this.temporaryWeighObj.skin = newV;
-						this.isweigh = this.temporaryWeighObj.skin > this.weighList.orderSurplus;
-					} else {
-						// this.temporaryWeighObj.hair = this.realTimeWeigh;
-						this.temporaryWeighObj.hair = newV;
-						this.temporaryWeighObj.clean = (this.temporaryWeighObj.hair - this.weighList.skin).toFixed(2);
-						this.isweigh = this.temporaryWeighObj.clean > this.weighList.orderSurplus || this.temporaryWeighObj
-							.clean < 0;
-					}
-				} else if (this.weighList.orderType == '澶栬喘' || this.weighList.orderType == '鍐呰喘' || this.weighList
-					.orderType == '杞叆') {
-					if (this.weighList.hair == 0) {
-						// this.temporaryWeighObj.hair = this.realTimeWeigh;
-						this.temporaryWeighObj.hair = newV;
-						this.isweigh = this.temporaryWeighObj.hair > this.weighList.orderSurplus;
-					} else {
-						// this.temporaryWeighObj.skin = this.realTimeWeigh;
-						this.temporaryWeighObj.skin = newV;
-						this.temporaryWeighObj.clean = (this.weighList.hair - this.temporaryWeighObj.skin).toFixed(2);
-						this.isweigh = this.temporaryWeighObj.clean > this.weighList.orderSurplus || this.temporaryWeighObj
-							.clean < 0;
-					}
-				}
+
 			},
 			// 鐩戝惉閲嶉噺鍙樺寲
-			// globalweigh: {
-			// 	handler(v) {
-			// 		this.weighData.weigh = this.realTimeWeigh = v;
-			// 		console.log(this.realTimeWeigh, '鐪熷疄閲嶉噺鏀瑰彉浜�');
-			// 	},
-			// 	deep: true
-			// },
-			globalweigh(newV) {
-				this.weighData.weigh = this.realTimeWeigh = newV;
-				console.log(this.realTimeWeigh, '鐪熷疄閲嶉噺鏀瑰彉浜�');
+			globalweigh: {
+				deep: true,
+				handler: function(newV) {
+					this.weighData.weigh = this.realTimeWeigh = newV;
+					if (this.weighList.orderType == '澶栭攢' || this.weighList.orderType == '鍐呴攢' || this.weighList
+						.orderType ==
+						'杞嚭') {
+						if (this.weighList.skin == 0) {
+							this.temporaryWeighObj.skin = newV;
+							this.getAverageSkin()
+							if (this.avgSkin < newV) {
+								this.abnormalModalShow = true
+								this.historyBtn = true
+							}
+						} else {
+							this.temporaryWeighObj.hair = newV;
+							this.temporaryWeighObj.clean = (this.temporaryWeighObj.hair - this.weighList.skin).toFixed(
+								2);
+							this.isweigh = this.temporaryWeighObj.clean > this.weighList.orderSurplus || this
+								.temporaryWeighObj
+								.clean < 0;
+						}
+					} else if (this.weighList.orderType == '澶栬喘' || this.weighList.orderType == '鍐呰喘' || this.weighList
+						.orderType == '杞叆') {
+						if (this.weighList.hair == 0) {
+							this.temporaryWeighObj.hair = newV;
+						} else {
+							this.temporaryWeighObj.skin = newV;
+							this.getAverageSkin()
+							if (this.avgSkin < newV) {
+								this.abnormalModalShow = true
+								this.historyBtn = true
+							}
+							this.temporaryWeighObj.clean = (this.weighList.hair - this.temporaryWeighObj.skin).toFixed(
+								2);
+							this.isweigh = this.temporaryWeighObj.clean > this.weighList.orderSurplus || this
+								.temporaryWeighObj
+								.clean < 0;
+						}
+					}
+				}
 			}
 		},
 		onShow() {
@@ -315,24 +394,17 @@
 			// 鍔犲噺鐓ゆ寜閽鐢ㄤ笌鍚�
 			addAndSubtractCoalDisabled() {
 				return this.realTimeWeigh == 0;
-				// if (this.weighList.orderType == '澶栭攢' || this.weighList.orderType == '鍐呴攢' || this.weighList.orderType == '杞嚭') {
-				// 	if (this.weighList.hair == 0) {
-				// 		return true;
-				// 	} else if (this.weighList.hair != 0) {
-				// 		return false;
-				// 	}
-				// }
 			},
 			// 鏄惁鏀剧┖鎸夐挳绂佺敤
 			isEvacuation() {
 				if (this.weighList.orderType == '澶栭攢' || this.weighList.orderType == '鍐呴攢' || this.weighList.orderType ==
 					'杞嚭') {
-					return this.weighList.skin == this.temporaryWeighObj.hair || this.temporaryWeighObj.skin == this
+					return (this.weighList.skin === 0 ? this.temporaryWeighObj.skin : this.weighList.skin) == this
 						.temporaryWeighObj.hair;
 				}
 				if (this.weighList.orderType == '澶栬喘' || this.weighList.orderType == '鍐呰喘' || this.weighList.orderType ==
 					'杞叆') {
-					return this.weighList.hair == this.temporaryWeighObj.skin || this.temporaryWeighObj.skin == this
+					return (this.weighList.hair === 0 ? this.temporaryWeighObj.skin : this.weighList.hair) == this
 						.temporaryWeighObj.hair;
 				}
 			},
@@ -343,10 +415,14 @@
 		methods: {
 			...mapMutations(['changeweighHouseCode', 'changeisLogin']),
 			init() {
+				uni.showLoading({
+					title: "鍔犺浇涓�"
+				})
 				// 鑾峰彇绉伴噸淇℃伅
 				this.$reqGet('weighList', { id: this.takeCoalId }).then(res => {
 					console.log(res, '鑾峰彇绉伴噸淇℃伅');
 					if (res.code == 0) {
+						uni.hideLoading()
 						this.weighList = res.data;
 						this.weighData.deptId = res.data.deptId;
 						this.weighData.tmId = res.data.id;
@@ -367,6 +443,9 @@
 						} else {
 							this.isInputOrigin = true;
 						}
+					} else {
+						uni.hideLoading()
+						this.$u.toast('鍔犺浇澶辫触')
 					}
 				});
 			},
@@ -421,7 +500,9 @@
 				this.$reqPost('addAndSubtractCoal', {
 					deptId: this.weighData.deptId,
 					sceneId: this.weighData.sceneId,
-					carNo: this.weighData.carNo
+					carNo: this.weighData.carNo,
+					tmId: this.weighData.tmId,
+					filedId: this.weighData.filedId
 				}, 'json').then(res => {
 					if (res.code == 0) {
 						this.$u.toast('鎿嶄綔鎴愬姛锛屽嵆灏嗚繑鍥炰笂涓�椤�');
@@ -473,6 +554,46 @@
 				if (this.weighData.coalContactHair > 0 && this.weighData.coalContactSkin > 0) {
 					this.isInputOrigin = true;
 				}
+			},
+			getAverageSkin() {
+				uni.showLoading({
+					title: "鍔犺浇涓�"
+				})
+				this.$reqGet('getAvgSkin', { xsUserId1: this.weighList.xsUserId1 }).then(res => {
+					if (res.code === 0) {
+						uni.hideLoading()
+						this.avgSkin = res.data.avgSkin
+						this.tmTaskCoalList = res.data.tmTaskCoalList
+					} else {
+						uni.hideLoading()
+						this.$u.toast('鍔犺浇澶辫触')
+					}
+				})
+			},
+			abnormalCancel() {
+				this.abnormalModalShow = false
+			},
+			abnormalConfirm() {
+				uni.showLoading({
+					title: "鎻愪氦涓�"
+				})
+				this.$reqPost('tmAbnormalTextAdd', { tmId: this.weighData.tmId, abnormalText: this.abnormalContent },
+					'params').then(
+					res => {
+						if (res.code == 0) {
+							uni.hideLoading()
+							this.$u.toast('鎻愪氦鎴愬姛')
+							this.abnormalModalShow = false
+						} else {
+							uni.hideLoading()
+							this.$u.toast('鎻愪氦澶辫触')
+							this.abnormalModalShow = true
+						}
+					})
+			},
+			displayHistory() {
+				this.historyShow = true
+
 			}
 		}
 	};
@@ -488,9 +609,14 @@
 
 	::v-deep.weighingDevice {
 		width: 100%;
-		height: 100vh;
+		height: 100%;
 		display: flex;
 		flex-direction: column;
+
+		.slot-content {
+			width: 96%;
+			border: 1rpx solid rgb(220, 223, 230);
+		}
 
 		.one {
 			// flex: 3;
@@ -711,6 +837,41 @@
 			margin-top: vww(5);
 			text-align: center;
 		}
+
+		.slide-fade-enter-active {
+			transition: all 0.3s ease-out;
+		}
+
+		.history-skin {
+			width: 96%;
+			height: vww(300);
+			margin: vww(50) auto;
+			margin-top: vww(10);
+			background: #ffffff;
+			box-shadow: 0rpx 0rpx 14rpx 0rpx rgba(73, 120, 240, 0.14), 0rpx 7rpx 45rpx 0rpx rgba(73, 120, 240, 0.12);
+			border-radius: 20rpx;
+			overflow: scroll;
+			color: #000;
+
+
+			.history-skin_item {
+				width: 80%;
+				height: vww(30);
+				@include flex;
+				margin: vww(10) auto;
+
+				.createTime {
+					color: rgb(60, 156, 255);
+				}
+
+				.skin {
+					color: #f81414;
+					@include flex;
+					width: 180rpx;
+					height: vww(30);
+				}
+			}
+		}
 	}
 
 	.secondary-confirmation__main {

--
Gitblit v1.9.1