From 5bd778d9a1899422ba1e9b67fbe578d759c86685 Mon Sep 17 00:00:00 2001
From: yangan <yangan0921@163.com>
Date: 星期四, 21 十二月 2023 10:19:16 +0800
Subject: [PATCH] 点击称重完成,修改提示信息

---
 pages/driver-page/driver-index/bill-of-lading-details/weighDetail/weighDetail.vue |  189 ++++++++++++++++++++++++++++++++++++++---------
 1 files changed, 153 insertions(+), 36 deletions(-)

diff --git a/pages/driver-page/driver-index/bill-of-lading-details/weighDetail/weighDetail.vue b/pages/driver-page/driver-index/bill-of-lading-details/weighDetail/weighDetail.vue
index a555225..a5f128c 100644
--- a/pages/driver-page/driver-index/bill-of-lading-details/weighDetail/weighDetail.vue
+++ b/pages/driver-page/driver-index/bill-of-lading-details/weighDetail/weighDetail.vue
@@ -46,7 +46,7 @@
 						class="count-input">
 						<u--input placeholder="璇疯緭鍏ユ墸娓�"
 							border="bottom"
-							type="number"
+							type="digit"
 							clearable
 							v-model="item.cinderWeight"
 							@input='v=>discountInputHandle(v,i,item.clean)'></u--input>
@@ -59,12 +59,29 @@
 					<view class="label-text">
 						鎵f福鍚庡噣閲�
 					</view>
-					<view class="count">{{ item.weight  || item.clean}}</view>
+					<view class="count">{{ item.weight }}</view>
 				</view>
 			</view>
 		</view>
 			<!-- 鍒ゆ柇鏄惁妫�楠岃川閲� -->
 			<view v-if="isShow(item) && isYanz()">
+				<view class="level">
+					<view style="width: 180rpx;">
+					<u--text text="渚涘簲鍟�"
+						size='32'></u--text>
+						
+				</view>
+				<view style="font-size: 35rpx;">{{ coalDetailsData.customerName || '' }}</view>
+				</view>
+
+				<view class="level">
+					<view style="width: 180rpx;">
+					<u--text text="鐗╂枡鍚嶇О"
+						size='32'></u--text>
+						
+				</view>
+				<view style="font-size: 35rpx;">{{ (coalDetailsData.coalName ? coalDetailsData.coalName: '') }}</view>
+				</view>
 				<view class="level">
 				<view style="width: 180rpx;">
 					<u--text text="鐗╄祫鏄庣粏"
@@ -171,7 +188,7 @@
 				</view>
 			</view>
 			<!-- 鏂板鎵g綒绉嶇被銆� 鎵g綒閲戦锛屼笉鍚堟牸鍒ゅ畾绉嶇被-->
-			<view class="notice-num">	
+			<!-- <view class="notice-num">	
 					<view class="num-text"
 					style="margin-left: 10rpx;">
 					<u--text text="鎵g綒绉嶇被"
@@ -187,11 +204,11 @@
 				</view>
 				<view class="num-show"
 					v-else-if="flag">
-					{{item.penaltyType}}
+					{{item.penaltyType == '0' ? '鏃犳墸缃�' : '鍏朵粬鎵g綒'}}
 				</view>
-			</view>
+			</view> -->
 			<!-- 鎵g綒閲戦 -->
-			<view class="notice-num" v-if="item.penaltyType == '鍏朵粬鎵g綒'">	
+			<view class="notice-num">	
 					<view class="num-text"
 					style="margin-left: 10rpx;">
 					<u--text text="鎵g綒閲戦"
@@ -211,7 +228,7 @@
 				</view>
 			</view>
 			<!--涓嶅悎鏍煎垽瀹氱绫�  -->
-			<view class="notice-num" v-if="item.penaltyType == '鍏朵粬鎵g綒'" >	
+			<!-- <view class="notice-num" v-if="item.penaltyType == '鍏朵粬鎵g綒'" >	
 					<view class="num-text"
 					style="margin-left: 10rpx;">
 					<u--text text="涓嶅悎鏍煎垽瀹�"
@@ -232,7 +249,7 @@
 					v-else-if="flag">
 					<text> {{item.unqualifiedType == 1 ? '闀垮害鎵g綒' : item.unqualifiedType == 2 ? '鍘氬害鎵g綒' :item.unqualifiedType == 3 ? '瀵嗛棴鍣�' : null }} </text>
 				</view>
-			</view>
+			</view> -->
 			</view>
 			<u-empty v-if=" isYanz() && !isShow(item) " icon-size="200"  text="''" >
 				<text>鏆傛湭楠岃川</text>
@@ -280,7 +297,7 @@
 					:height="0"
 				>
 					<u-cell
-						:title="(index + 1) +  '.' + '涓嶅悎鏍艰鏍�'"
+						:title="(index + 1) +  '.' + '涓嶅悎鏍煎搧绫�'"
 						style="text-indent: 30RPX;"
 						@click="editItem(i,index)"
 					>
@@ -316,20 +333,45 @@
 						readonly
 						@input='v=>unqualifiedWeightInputHandle(v,i,item.clean)'></u--input> -->
 						<view class="num-show"
->	{{el.unqualifiedWeight}}
+>					{{el.unqualifiedWeight || ''}}
 				</view>
 				</view>
 				<view class="num-show"
 					v-else-if="flag">
-					{{el.unqualifiedWeight}}
+					{{el.unqualifiedWeight || ''}}
 				</view>
+				
 			</view>
+			<view class="notice-num">
+				<view class="num-text">
+					<u--text text="涓嶅悎鏍煎搧鍒ゅ畾"
+						size='32'></u--text>
+				</view>
+				<view class="num-input"
+					v-if='roleType===4&&!flag'>
+					<!-- <u--input placeholder="璇疯緭鍏ヤ笉鍚堟牸閲嶉噺"
+						border="bottom"
+						clearable
+						v-model="el.unqualifiedWeight"
+						readonly
+						@input='v=>unqualifiedWeightInputHandle(v,i,item.clean)'></u--input> -->
+						<view class="num-show">
+							{{selectlist.find(item=>item.value ==el.unqualifiedType ) ? selectlist.find(item=>item.value ==el.unqualifiedType ).name : ''  }}
+				</view>
+				</view>
+				<view class="num-show"
+					v-else-if="flag">
+					{{selectlist.find(item=>item.value ==el.unqualifiedType ) ? selectlist.find(item=>item.value ==el.unqualifiedType ).name : ''  }}
+				</view>
+				
+			</view>
+			
 			</view>
 			</u--list-item>
 		</u--list>
 		<!-- 澧炲姞涓嶅悎鏍艰鐭� -->
 
-		<button  class="addBtn"  type="primary"   :plain="false"  @click="addUnqualified(i)">娣诲姞涓嶅悎鏍艰鐭�</button>
+		<button  class="addBtn" v-if="isShow(item) && isYanz()" type="primary"   :plain="false"  @click="addUnqualified(i)">娣诲姞涓嶅悎鏍煎搧绫�</button>
 			<!-- 鐗╄祫鏄庣粏 -->
 			<u-action-sheet :actions="goodsList"
 				:show="goodsShow"
@@ -626,14 +668,25 @@
 				return function(index){
 					let arr = [];
 					let temp = [];
+					let noPin = [];
 					const item = this.globalShowWeigh[index];
+					console.log(this.globalShowWeigh[index],'index')
 					if(item){
 					if(item.unqualifiedBreed){
 						arr = item.unqualifiedBreed.split(",");
-						
-					    temp = item.unqualifiedWeights.toString().split(',');
+						if(item.unqualifiedWeights){
+							temp = item.unqualifiedWeights.toString().split(',');
+						}
+						if(item.unqualifiedType){
+							noPin = item.unqualifiedType.toString().split(',');
+
+						}
+						//  if(item.penaltyType){
+						// 	noPin = item.penaltyType.toString().split(',');
+						// }
+					  
 						 let result =  arr.length && arr.map((el,index)=>{
-						let obj = {unqualifiedBreed:el,unqualifiedWeight:temp[index]}
+						let obj = {unqualifiedBreed:el,unqualifiedWeight:temp[index],unqualifiedType:noPin[index]}
 						return obj
 					   })
 					   console.log(result,temp,'arr')
@@ -649,7 +702,8 @@
 			}
 
 		},
-		onShow(){
+		onShow(params){
+			console.log(params,'paramss')
 			this.numAll(this.globalShowWeigh[this.indexFlag].unqualifiedWeights.split(","),this.indexFlag,this.showWeigh[this.indexFlag].clean)
 		},
 		mounted() {
@@ -665,6 +719,12 @@
 			this.alterUnqualified = params.unqualified === "true" || false
 			this.havedSubmit = params.havedSubmit === "true" || false;
 			console.log(this.havedSubmit,'this.havedSubmit')
+			uni.$on("handClick", res => {
+				console.log(res.tempArr);
+				this.showWeigh[res.index].tempArr = res.tempArr;
+				// 娓呴櫎鐩戝惉
+				
+			})
 		},
 		methods: {
 			...mapMutations(['changeglobalShowWeigh']),
@@ -684,13 +744,15 @@
 				}else{
 					 y = 0;
 				}
-				console.log(value,y,'yyyyyyyyy')
-				if(x.minus(y).minus(z).toFixed(2)  <= 0){
+				if(clean){
+					if(x.minus(y).minus(z).toFixed(2)  <= 0){
 						this.showWeigh[index].weight = '0';
 						this.$u.toast('褰撳墠鍑�閲嶄笉鍚堟牸锛岃妫�鏌ョ毊閲嶏紝姣涢噸鏄惁鍑嗙‘')
 					}else{
 						this.showWeigh[index].weight = x.minus(y).minus(z).toFixed(2) ;
 					}
+				}
+				
 				
 
 
@@ -709,24 +771,36 @@
 						this.orderCode = res.data.orderCode
 						this.showWeigh = this.coalDetailsData.tmTaskCoalItems ? this.coalDetailsData
 							.tmTaskCoalItems : [];
-						this.showWeigh = this.showWeigh.map(v => {
-							if(!v.penaltyType) v.penaltyType = '0'
+						this.showWeigh = this.showWeigh.map((v,i) => {
+							if(!v.tempArr){
+								v.tempArr = ''
+							}else{
+								v.tempArr = JSON.parse(v.tempArr)
+							}
+
 							return {
 								...v,
 								modifyProductName: '',
 								modifygoodsName: '',
 								fileList: [],
 								inspectionJpg: v.inspectionJpg.split(','),
-								isImage: v.inspectionJpg
+								isImage: v.inspectionJpg,
+								unqualifiedType:v.penaltyType,
+								tempArr:v.tempArr
 							}
 						})
 						this.showWeighCopy = JSON.parse(JSON.stringify(this.showWeigh))
 						uni.setStorageSync("showWeighCopyStorge", this.showWeighCopy)
-						if (this.havedSubmit) {
-							this.changeglobalShowWeigh(uni.getStorageSync('showWeighCopyStorgeOther'))
-						} else {
-							this.changeglobalShowWeigh(uni.getStorageSync('showWeighCopyStorge'))
-						}
+						uni.setStorageSync('showWeighCopyStorgeOther',this.showWeighCopy)
+						// if (this.havedSubmit) {
+						// 	this.changeglobalShowWeigh(uni.getStorageSync('showWeighCopyStorge'))
+						// 	this.changeglobalShowWeigh(uni.getStorageSync('showWeighCopyStorgeOther'))
+						// } else {
+						// 	this.changeglobalShowWeigh(uni.getStorageSync('showWeighCopyStorgeOther'))
+						// 	this.changeglobalShowWeigh(uni.getStorageSync('showWeighCopyStorge'))
+						// }
+						this.changeglobalShowWeigh(uni.getStorageSync('showWeighCopyStorge'))
+						 	this.changeglobalShowWeigh(uni.getStorageSync('showWeighCopyStorgeOther'))
 						//绉伴噸鏄庣粏鏃犳暟鎹椂鏄剧ず鐗╄祫鏄庣粏
 						if(!this.coalDetailsData.tmTaskCoalItems.length){
 							this.current = 0; 
@@ -777,27 +851,33 @@
 			},
 			// 鐐瑰嚮纭
 			confirmInput() {
-				this.loading = true;
-				let params = {};
+				let params = {},unqualifiedWeightAll;
 				params.qualityInstructions = this.qualityInstructions;
 				params.remarks = this.remarks;
 				this.showWeigh = this.showWeigh.map((v, i) => {
 					if(!v.penaltyType) {
-						v.penaltyAmount = '';
 						v.unqualifiedType = '';
+					}
+					if(this.globalShowWeigh[i].unqualifiedWeights){
+					unqualifiedWeightAll = this.globalShowWeigh[i].unqualifiedWeights.split(",").reduce((p,n)=>{return (p - 0) + (n - 0)},0).toFixed(2)  || ''
+					}else{
+						unqualifiedWeightAll =''
 					}
 					return {
 						...v,
-						unqualifiedBreed: this.globalShowWeigh[i].unqualifiedBreed ? this.globalShowWeigh[i]
-							.unqualifiedBreed : v.unqualifiedBreed,
+						unqualifiedBreed: this.globalShowWeigh[i].unqualifiedBreed ,
 						breed: this.globalShowWeigh[i].modifyProductName ? this.globalShowWeigh[i].breed : v.breed,
 						spec: this.globalShowWeigh[i].modifyProductName ? this.globalShowWeigh[i].spec : v.spec,
 						inspectionJpg: v.fileList.map(v => v.url.replace(BaseUrl, '')).join(','),
 						unqualifiedWeights :this.globalShowWeigh[i].unqualifiedWeights,
-						unqualifiedWeight :this.globalShowWeigh[i].unqualifiedWeight.split(",").reduce((p,n)=>{return (p - 0) + (n - 0)},0)
+						unqualifiedWeight :unqualifiedWeightAll,
+						penaltyType:this.globalShowWeigh[i].unqualifiedType,
+						tempArr:this.globalShowWeigh[i].tempArr ? JSON.stringify(this.globalShowWeigh[i].tempArr) : ''
 						
 					}
-				})
+				});
+				console.log(this.globalShowWeigh,this.showWeigh,'this.gloa')
+				this.loading = true;
 				params.tmTaskCoalItems = this.showWeigh;
 				this.$reqPost('updateTmTaskCoalItem', params, 'json').then(
 					res => {
@@ -871,12 +951,34 @@
 			},
 			// 鎶樻墸鐜囪緭鍏�
 			discountInputHandle(value, index, clean) {
+				let znums;
+				if(this.globalShowWeigh[index].unqualifiedWeights){
+					znums = this.globalShowWeigh[index].unqualifiedWeights.split(',')
+				}else{
+					znums = []
+				}
 				console.log('璁$畻鍑�閲�',value, index, clean)
 				this.indexFlag  = index; // 璁板綍鏍囪瘑浣�
-				this.showWeigh[index].cinderWeight = (value - 0)
+				if (
+					value &&
+					value.indexOf(".") < 0 &&
+					value != ""
+			) {
+				value = parseFloat(value);
+				value = value + ""; // 鍙樺洖涓哄瓧绗︿覆
+			}else{
+				value =  value.replace(/^(-)*(\d+)\.(\d\d).*$/,"$1$2.$3");
+				this.$nextTick(()=>{
+					this.showWeigh[index].cinderWeight  = value.replace(/[^\d.]/g, "");
+				});
+			} // 濡傛灉娌℃湁灏忔暟鐐癸紝棣栦綅涓嶈兘涓虹被浼间簬 01銆�02鐨勫��
+			
+				// 濡傛灉娌℃湁鍑�閲� 锛屽垯涓嶈繘琛岃绠�
+				if(clean){
+					this.showWeigh[index].cinderWeight = (value - 0)
 					let x = new BigNumber(clean - 0)
 					let y = new BigNumber(value - 0)
-					let z =  new BigNumber(this.globalShowWeigh[index].unqualifiedWeights.split(',').reduce((p,n)=>{
+					let z =  new BigNumber(znums.reduce((p,n)=>{
 						return (p - 0) + (n - 0)
 					},0))
 					console.log(clean,value,'鎵f福');
@@ -886,6 +988,10 @@
 					}else{
 						this.showWeigh[index].weight = x.minus(y).minus(z).toFixed(2)
 					}
+				}else{
+					this.$u.toast('褰撳墠鏃犲噣閲�')
+				}
+				
 				
 				
 			},
@@ -991,7 +1097,7 @@
 				}
 			},
 			deleteItem(i,index){
-			  let {unqualifiedBreed,unqualifiedWeights} =  this.globalShowWeigh[i];
+			  let {unqualifiedBreed,unqualifiedWeights,unqualifiedType} =  this.globalShowWeigh[i];
 			  this.indexFlag  = i; // 璁板綍鏍囪瘑浣�
 			  console.log(this.globalShowWeigh[i],'index')
 			  if (this.roleType === 4 && !this.flag) {
@@ -1013,9 +1119,20 @@
 				}else{
 					unqualifiedWeights = '';
 				}
+
+				if(unqualifiedType.split(",").length > 1){
+					let strArr = unqualifiedType.split(',');
+					 strArr.splice(index ,1)
+					 unqualifiedType = strArr.join(",")
+				}else{
+					unqualifiedType = '';
+				}
 				 this.globalShowWeigh[i].unqualifiedBreed = unqualifiedBreed;
 				 this.globalShowWeigh[i].unqualifiedWeights = unqualifiedWeights;
+				 this.globalShowWeigh[i].unqualifiedType = unqualifiedType; 
 				 this.globalShowWeigh[i].tempArr.splice(index,1)
+				 console.log(this.globalShowWeigh[i].unqualifiedBreed,'unqualifiedBreed')
+				 this.changeglobalShowWeigh(this.globalShowWeigh)
 
 				 }
 				 this.numAll(this.globalShowWeigh[this.indexFlag].unqualifiedWeights.split(","),this.indexFlag,this.showWeigh[this.indexFlag].clean)

--
Gitblit v1.9.1