From 3d739bbf2dc360d550a41c9372f17c28dc2ebfd8 Mon Sep 17 00:00:00 2001
From: yangan <yangan0921@163.com>
Date: 星期五, 15 十二月 2023 19:00:19 +0800
Subject: [PATCH] 质检扣罚代码提交

---
 pages/driver-page/driver-index/bill-of-lading-details/weighDetail/weighDetail.vue |  263 +++++++++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 249 insertions(+), 14 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 2b75704..8eb27d4 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>
@@ -66,7 +66,24 @@
 			<!-- 鍒ゆ柇鏄惁妫�楠岃川閲� -->
 			<view v-if="isShow(item) && isYanz()">
 				<view class="level">
-				<view style="width: 140rpx;">
+					<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="鐗╄祫鏄庣粏"
 						size='32'></u--text>
 				</view>
@@ -92,7 +109,7 @@
 					</text>
 				</view>
 			</view>
-			<view class="unqualifiedBreed">
+			<!-- <view class="unqualifiedBreed">
 				<view style="width: 180rpx;">
 					<u--text text="涓嶅悎鏍煎搧鍚�"
 						size='32'></u--text>
@@ -121,7 +138,8 @@
 					v-else-if="flag">
 					{{item.unqualifiedWeight}}
 				</view>
-			</view>
+			</view> -->
+
 			<view class="notice-num">
 				<view class="num-text"
 					style="margin-left: 10rpx;">
@@ -186,7 +204,7 @@
 				</view>
 				<view class="num-show"
 					v-else-if="flag">
-					{{item.penaltyType}}
+					{{item.penaltyType == '0' ? '鏃犳墸缃�' : '鍏朵粬鎵g綒'}}
 				</view>
 			</view>
 			<!-- 鎵g綒閲戦 -->
@@ -267,6 +285,68 @@
 					:previewFullImage="true">
 				</u-upload>
 			</view>
+			<u--list
+			:height="0"
+			style="	margin-left: 50rpx;margin-top: 30rpx;"
+			>
+				<u--list-item
+				
+				    v-for="(el,index) in unqualifiedArr(i) "
+				    style=" box-shadow: 0px 0 0 0px #ccc;"
+					:key="index"
+					:height="0"
+				>
+					<u-cell
+						:title="(index + 1) +  '.' + '涓嶅悎鏍煎搧绫�'"
+						style="text-indent: 30RPX;"
+						@click="editItem(i,index)"
+					>
+					<text slot="value" @click.stop="deleteItem(i,index)" style="color: red;">鍒犻櫎</text>
+				</u-cell>
+		
+			<view>
+				<view class="unqualifiedBreed">
+				<view style="width: 180rpx;">
+					<u--text text="涓嶅悎鏍煎搧鍚�"
+						size='32'></u--text>
+				</view>
+				<view class="tag-select">
+					<text>
+						<!-- {{!flag?(globalShowWeigh[i].unqualifiedBreed?globalShowWeigh[i].unqualifiedBreed:item.unqualifiedBreed):(item.unqualifiedBreed||"璇烽�夋嫨")}} -->
+						{{  el.unqualifiedBreed  }}
+					</text>
+				</view>
+			</view>
+			</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"
+>					{{el.unqualifiedWeight || ''}}
+				</view>
+				</view>
+				<view class="num-show"
+					v-else-if="flag">
+					{{el.unqualifiedWeight || ''}}
+				</view>
+			</view>
+			</view>
+			</u--list-item>
+		</u--list>
+		<!-- 澧炲姞涓嶅悎鏍艰鐭� -->
+
+		<button  class="addBtn"  type="primary"   :plain="false"  @click="addUnqualified(i)">娣诲姞涓嶅悎鏍煎搧绫�</button>
 			<!-- 鐗╄祫鏄庣粏 -->
 			<u-action-sheet :actions="goodsList"
 				:show="goodsShow"
@@ -353,7 +433,7 @@
 			v-for="(item,i) in goodsList"
 			:key="item.id">
 			<view class="level">
-				<view style="width: 140rpx;">
+				<view style="width: 180rpx;">
 					<u--text text="鐗╄祫鍚嶇О"
 						size='32'></u--text>
 				</view>
@@ -449,6 +529,7 @@
 		data() {
 			return {
 				qualityInstructions:"",
+			    indexFlag:0, // 涓嬫爣鏍囧織浣�
 				remarks:'',
 				selectlist:[
 					{
@@ -556,13 +637,46 @@
 				}
 					 // 宸茬粡楠岃川
 				}
+			},
+			//璁$畻涓嶅悎鏍艰鏍兼暟缁�
+			unqualifiedArr(){
+				return function(index){
+					let arr = [];
+					let temp = [];
+					const item = this.globalShowWeigh[index];
+					if(item){
+					if(item.unqualifiedBreed){
+						arr = item.unqualifiedBreed.split(",");
+						if(item.unqualifiedWeights){
+							temp = item.unqualifiedWeights.toString().split(',');
+						}
+					  
+						 let result =  arr.length && arr.map((el,index)=>{
+						let obj = {unqualifiedBreed:el,unqualifiedWeight:temp[index]}
+						return obj
+					   })
+					   console.log(result,temp,'arr')
+					   return result;
+						
+					}else{
+						return []
+					}
+					}
+					
+
+				}
 			}
+
+		},
+		onShow(){
+			this.numAll(this.globalShowWeigh[this.indexFlag].unqualifiedWeights.split(","),this.indexFlag,this.showWeigh[this.indexFlag].clean)
 		},
 		mounted() {
-			this.roleType === 1 ? this.GetOrderPlan() : this.getTakeCoal()
+			this.roleType === 1 ? this.GetOrderPlan() : this.getTakeCoal();
+			
 		},
 		onLoad(params) {
-			console.log(params,this.showWeighCopyStorge,'params璺敱')
+			console.log(params,this.showWeighCopyStorge,this.globalShowWeigh,'params璺敱')
 			this.orderPlanId = params.orderPlanId ? params.orderPlanId : '';
 			this.flag = params.flag ? params.flag : false;
 			this.ModifiedOrderIndex = params.index
@@ -573,6 +687,34 @@
 		},
 		methods: {
 			...mapMutations(['changeglobalShowWeigh']),
+			numAll(value, index, clean){
+				console.log(value,'valusess')
+				// 璁$畻鎵f福鍑�閲�
+				// 鍒ゆ柇鏄笉鏄湁鍑�閲嶆墠杩涜璁$畻
+				let x = new BigNumber(clean - 0)
+				// let y = new BigNumber(value - 0) // 鍥犱负value 鏄� 0 鎵�浠ラ渶瑕佸惊鐜� 鍙栧噺
+				let z = new BigNumber(this.showWeigh[index].cinderWeight -  0);
+				let y;
+				if(value.filter(Boolean) .length){
+					 y = value.reduce((p,n)=>{ 
+				return (p - 0) + (n - 0);
+ 				},0);
+				
+				}else{
+					 y = 0;
+				}
+				console.log(value,y,'yyyyyyyyy')
+				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) ;
+					}
+				
+
+
+
+			},
 			getTakeCoal() {
 				uni.showLoading({
 					title: '鍔犺浇涓�'
@@ -655,7 +797,7 @@
 			// 鐐瑰嚮纭
 			confirmInput() {
 				this.loading = true;
-				let params = {};
+				let params = {},unqualifiedWeightAll;
 				params.qualityInstructions = this.qualityInstructions;
 				params.remarks = this.remarks;
 				this.showWeigh = this.showWeigh.map((v, i) => {
@@ -663,14 +805,21 @@
 						v.penaltyAmount = '';
 						v.unqualifiedType = '';
 					}
+					if(this.globalShowWeigh[i].unqualifiedWeights){
+					unqualifiedWeightAll = this.globalShowWeigh[i].unqualifiedWeights.split(",").reduce((p,n)=>{return (p - 0) + (n - 0)},0)  || ''
+					}else{
+						unqualifiedWeightAll =''
+					}
 					return {
 						...v,
 						unqualifiedBreed: this.globalShowWeigh[i].unqualifiedBreed ? this.globalShowWeigh[i]
 							.unqualifiedBreed : v.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(',')
-
+						inspectionJpg: v.fileList.map(v => v.url.replace(BaseUrl, '')).join(','),
+						unqualifiedWeights :this.globalShowWeigh[i].unqualifiedWeights,
+						unqualifiedWeight :unqualifiedWeightAll
+						
 					}
 				})
 				params.tmTaskCoalItems = this.showWeigh;
@@ -746,12 +895,36 @@
 			},
 			// 鎶樻墸鐜囪緭鍏�
 			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; // 璁板綍鏍囪瘑浣�
+				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鐨勫��
+			
+				
 				this.showWeigh[index].cinderWeight = (value - 0)
 					let x = new BigNumber(clean - 0)
 					let y = new BigNumber(value - 0)
-					let z =  new BigNumber(this.showWeigh[index].unqualifiedWeight - 0)
-					console.log(clean,value,this.showWeigh[index].unqualifiedWeight - 0,'鎵f福');
+					let z =  new BigNumber(znums.reduce((p,n)=>{
+						return (p - 0) + (n - 0)
+					},0))
+					console.log(clean,value,'鎵f福');
 					if(x.minus(y).minus(z).toFixed(2) <= 0){
 						this.showWeigh[index].weight = '0';
 						this.$u.toast('褰撳墠鍑�閲嶄笉鍚堟牸锛岃妫�鏌ョ毊閲嶏紝姣涢噸鏄惁鍑嗙‘')
@@ -767,7 +940,7 @@
 					// this.unqualifiedShow = true
 					// this.unqualifiedIndex = index
 					uni.navigateTo({
-						url: `/pages/public-page/selectSpecifications/selectSpecifications?index=${index}&takeCoalId=${this.orderPlanId}&unqualified=${this.willUnqualified}`
+						url: `/pages/public-page/selectSpecifications/selectSpecifications?index=${index}&takeCoalId=${this.orderPlanId}&unqualified=${this.willUnqualified}&type=edit`
 					})
 				}
 			},
@@ -781,6 +954,7 @@
 			unqualifiedWeightInputHandle(value, index, clean) {
 				// 鍒ゆ柇鏄笉鏄湁鍑�閲嶆墠杩涜璁$畻
 				let x = new BigNumber(clean - 0)
+				this.indexFlag  = index; // 璁板綍鏍囪瘑浣�
 				let y = new BigNumber(value - 0)
 				let z = new BigNumber(this.showWeigh[index].cinderWeight -  0);
 				if(x.minus(y).minus(z).toFixed(2)  <= 0){
@@ -847,6 +1021,62 @@
 			},
 			closeEvent(){
 				this.focusSelect = false;
+			},
+			//澧炲姞涓嶅悎鏍艰鐭�
+			addUnqualified(i){
+				if (this.roleType === 4 && !this.flag) {
+					// this.unqualifiedShow = true
+					// this.unqualifiedIndex = index
+					this.indexFlag  = i; // 璁板綍鏍囪瘑浣�
+					uni.navigateTo({
+						url: `/pages/public-page/selectSpecifications/selectSpecifications?index=${i}&takeCoalId=${this.orderPlanId}&unqualified=${this.willUnqualified}&type=add`
+					})
+					console.log(this.globalShowWeigh[i],'2222')
+					this.numAll(this.globalShowWeigh[i].unqualifiedWeights.split(","),i,this.showWeigh[i].clean)
+				}
+			},
+			deleteItem(i,index){
+			  let {unqualifiedBreed,unqualifiedWeights} =  this.globalShowWeigh[i];
+			  this.indexFlag  = i; // 璁板綍鏍囪瘑浣�
+			  console.log(this.globalShowWeigh[i],'index')
+			  if (this.roleType === 4 && !this.flag) {
+				if( unqualifiedBreed !== void 0 && unqualifiedWeights!== void 0 ){
+				if(unqualifiedBreed.split(',').length > 1){
+					// unqualifiedBreed = unqualifiedBreed.split(',').splice(index ,1).join(",")
+					let strArr = unqualifiedBreed.split(',');
+					strArr.splice(index ,1)
+					unqualifiedBreed = strArr.join(",")
+				}else{
+					unqualifiedBreed = '';
+				}
+
+				if(unqualifiedWeights.split(',').length > 1){
+					// unqualifiedWeights = unqualifiedWeights.split(',').splice(index,1).join(",")
+					let strArr = unqualifiedWeights.split(',');
+					 strArr.splice(index ,1)
+					unqualifiedWeights = strArr.join(",")
+				}else{
+					unqualifiedWeights = '';
+				}
+				 this.globalShowWeigh[i].unqualifiedBreed = unqualifiedBreed;
+				 this.globalShowWeigh[i].unqualifiedWeights = unqualifiedWeights;
+				 this.globalShowWeigh[i].tempArr.splice(index,1)
+
+				 }
+				 this.numAll(this.globalShowWeigh[this.indexFlag].unqualifiedWeights.split(","),this.indexFlag,this.showWeigh[this.indexFlag].clean)
+				 console.log(this.globalShowWeigh[i],'deleteItem');
+			  }
+			 
+			},
+			editItem(i,index){
+				this.indexFlag  = i; // 璁板綍鏍囪瘑浣�
+				if (this.roleType === 4 && !this.flag) {
+					// this.unqualifiedShow = true
+					// this.unqualifiedIndex = index
+					uni.navigateTo({
+						url: `/pages/public-page/selectSpecifications/selectSpecifications?index=${i}&takeCoalId=${this.orderPlanId}&unqualified=${this.willUnqualified}&type=edit&indexTo=${index}`
+					})
+				}
 			}
 		},
 	}
@@ -863,6 +1093,11 @@
 	/deep/ .u-picker {
 		height: 600rpx;
 	}
+	.addBtn{
+		width: 65%;
+		font-size: 26rpx;
+		background-color: #3c9cff;;
+	}
 
 	.main {
 		width: 96%;

--
Gitblit v1.9.1