From 46f245f4b189e9183ec7da099ee44c5043746b7e Mon Sep 17 00:00:00 2001
From: yangan <yangan0921@163.com>
Date: 星期四, 14 十二月 2023 15:43:59 +0800
Subject: [PATCH] 验质页面增加供应商,物料名称

---
 pages/driver-page/driver-index/bill-of-lading-details/weighDetail/weighDetail.vue |  520 +++++++++++++++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 482 insertions(+), 38 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 66e8f9d..99e76a1 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
@@ -36,6 +36,7 @@
 					<view class="num">{{ item.clean }}</view>
 				</view>
 			</view>
+				<view v-if="isShow(item) && isYanz()">
 			<view class="discount">
 				<view class="rate">
 					<view class="label-text">
@@ -45,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>
@@ -58,13 +59,31 @@
 					<view class="label-text">
 						鎵f福鍚庡噣閲�
 					</view>
-					<view class="count">{{ item.weight }}</view>
+					<view class="count">{{ item.weight  || item.clean}}</view>
 				</view>
 			</view>
+		</view>
 			<!-- 鍒ゆ柇鏄惁妫�楠岃川閲� -->
-			<view v-if="isShow(item)">
+			<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>
@@ -90,7 +109,7 @@
 					</text>
 				</view>
 			</view>
-			<view class="unqualifiedBreed">
+			<!-- <view class="unqualifiedBreed">
 				<view style="width: 180rpx;">
 					<u--text text="涓嶅悎鏍煎搧鍚�"
 						size='32'></u--text>
@@ -119,23 +138,29 @@
 					v-else-if="flag">
 					{{item.unqualifiedWeight}}
 				</view>
-			</view>
+			</view> -->
+
 			<view class="notice-num">
 				<view class="num-text"
 					style="margin-left: 10rpx;">
 					<u--text text="閫氱煡鏁伴噺"
 						size='32'></u--text>
 				</view>
-				<view class="num-input"
+				<view class="num-input "
 					v-if='roleType===4&&!flag'>
-					<u--input placeholder="璇疯緭鍏ラ�氱煡鏁伴噺"
+					<u-input placeholder="璇疯緭鍏ラ�氱煡鏁伴噺"
 						border="bottom"
 						clearable
-						v-model="item.num"></u--input>
+						style="width: 70%;"
+						v-model="item.num">
+					<template slot="suffix">
+						<text class="inp-unit">{{   item.numUnit}}</text>
+					</template>
+					</u-input>
 				</view>
 				<view class="num-show"
 					v-else-if="flag">
-					{{item.num}}
+					{{item.num + item.numUnit}}
 				</view>
 			</view>
 			<view class="notice-num">	
@@ -147,19 +172,90 @@
 				<view class="num-input"
 				v-if='roleType===4&&!flag'
 				>
-				<u--input placeholder="璇疯緭鍏ラ�氱煡閲嶉噺"
+				<u-input placeholder="璇疯緭鍏ラ�氱煡閲嶉噺"
 						border="bottom"
 						clearable
-						v-model="item.weight1"></u--input>
+						style="width: 70%;"
+						v-model="item.weight1">
+						<template slot="suffix">
+						<text class="inp-unit">{{   item.weightUnit  }}</text>
+					</template>
+					</u-input>
 				</view>
 				<view class="num-show"
 					v-else-if="flag">
-					{{item.weight1}}
+					{{item.weight1 + item.weightUnit }}
+				</view>
+			</view>
+			<!-- 鏂板鎵g綒绉嶇被銆� 鎵g綒閲戦锛屼笉鍚堟牸鍒ゅ畾绉嶇被-->
+			<view class="notice-num">	
+					<view class="num-text"
+					style="margin-left: 10rpx;">
+					<u--text text="鎵g綒绉嶇被"
+						size='32'></u--text>
+				</view>
+				<view class="num-radio"
+				v-if='roleType===4&&!flag'
+				>
+				<u-radio-group  size='34' v-model="item.penaltyType">
+				<u-radio  :label-size="32" :name="'0'"  :label="'鏃犳墸缃�'" :disabled="disabled">鏃犳墸缃�</u-radio>
+				<u-radio  :label-size="32"  :name="'鍏朵粬鎵g綒'"  :label="'鍏朵粬鎵g綒'" :disabled="disabled">鍏朵粬鎵g綒</u-radio>
+				</u-radio-group>
+				</view>
+				<view class="num-show"
+					v-else-if="flag">
+					{{item.penaltyType}}
+				</view>
+			</view>
+			<!-- 鎵g綒閲戦 -->
+			<view class="notice-num" v-if="item.penaltyType == '鍏朵粬鎵g綒'">	
+					<view class="num-text"
+					style="margin-left: 10rpx;">
+					<u--text text="鎵g綒閲戦"
+						size='32'></u--text>
+				</view>
+				<view class="num-input"
+				v-if='roleType===4&&!flag'
+				>
+				<u--input placeholder="璇疯緭鍏ユ墸缃氶噾棰�"
+						border="bottom"
+						clearable
+						v-model="item.penaltyAmount"></u--input>
+				</view>
+				<view class="num-show"
+					v-else-if="flag">
+					{{item.penaltyAmount}}
+				</view>
+			</view>
+			<!--涓嶅悎鏍煎垽瀹氱绫�  -->
+			<view class="notice-num" v-if="item.penaltyType == '鍏朵粬鎵g綒'" >	
+					<view class="num-text"
+					style="margin-left: 10rpx;">
+					<u--text text="涓嶅悎鏍煎垽瀹�"
+						size='32'></u--text>
+				</view>
+				<view class="num-radio"
+				v-if='roleType===4&&!flag'
+				@click.stop="onFoucus"
+				style="height: 50rpx;"
+				>
+				<u-radio-group  size='32' v-model="item.unqualifiedType">
+				<u-radio  :label-size="25" :name="1"  :label="'闀垮害鎵g綒'" :disabled="disabled">闀垮害鎵g綒</u-radio>
+				<u-radio  :label-size="25" :name="'2'" :label="'鍘氬害鎵g綒'" :disabled="disabled">鍘氬害鎵g綒</u-radio>
+				<u-radio  :label-size="25" :name="'3'" :label="'瀵嗛棴鍣�'" :disabled="disabled">瀵嗛棴鍣�</u-radio>
+				</u-radio-group>
+				</view>
+				<view class="num-show"
+					v-else-if="flag">
+					<text> {{item.unqualifiedType == 1 ? '闀垮害鎵g綒' : item.unqualifiedType == 2 ? '鍘氬害鎵g綒' :item.unqualifiedType == 3 ? '瀵嗛棴鍣�' : null }} </text>
 				</view>
 			</view>
 			</view>
-			<u-empty v-else icon-size="200"  text="''" >
+			<u-empty v-if=" isYanz() && !isShow(item) " icon-size="200"  text="''" >
 				<text>鏆傛湭楠岃川</text>
+			</u-empty>
+			<u-empty v-if="!isYanz()" icon-size="200"  text="''" >
+				<text>鏆傛棤鏁版嵁</text>
 			</u-empty>
 			<view style="display: flex;margin-top: 20rpx;margin-left: 20rpx;"
 				v-if="item.isImage">
@@ -189,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"
@@ -215,6 +373,49 @@
 					@select="selectUnqualifiedClick"></u-action-sheet>
 			</view>
 		</view>
+		<!-- 鏂板 楠岃川澶囨敞銆傞獙璐ㄨ鏄� -->
+		<view v-if=" isYanz()">
+			<view v-if="coalDetailsData.orderType == '澶栬喘'">
+		<view style="padding: 10rpx;">
+		<u-row  >
+                    <u-col span="24" >
+                        <view class="demo-layout bg-purple-light" style="display: flex;">
+							<text style="font-size: 32rpx;">楠岃川璇存槑锛�</text>
+							<view style="display: inline-block;"
+							v-if='roleType===4&&!flag'
+							>
+							<u--input placeholder="璇疯緭鍏ラ獙璐ㄨ鏄�"
+									border="bottom"
+									clearable
+									v-model="qualityInstructions"></u--input>
+							</view>
+							<view class="num-show"
+								v-else-if="flag">
+								{{ qualityInstructions }}
+							</view>
+						</view>
+                    </u-col>
+                </u-row>
+			</view>
+			<view style="padding: 10rpx;">
+				<u-row >
+                    <u-col span="24">
+                        <view class="demo-layout bg-purple-light" >
+							<text style="font-size: 32rpx;">楠岃川澶囨敞锛�</text>
+							<view style="width: 50%;"
+							v-if='roleType===4&&!flag'
+							>
+							<u-textarea border="surround" v-model="remarks" ref="textarea" placeholder="璇疯緭鍏ラ獙璐ㄥ娉�"></u-textarea>
+							</view>
+							<view class="num-show"
+								v-else-if="flag">
+							 {{ remarks }}
+							</view>
+						</view>
+                    </u-col>
+                </u-row>
+				</view>
+			</view>
 		<view class="confirm-button"
 			v-if='roleType===4&&!flag'>
 			<u-button type="primary"
@@ -224,13 +425,15 @@
 				:loading="loading"
 				loading-text="纭"></u-button>
 		</view></view>
+		</view>
+		
 		<!-- 鐗╂枡鏄庣粏 -->
 		<view v-if="!current">
 			<view class="main-block"
 			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>
@@ -325,8 +528,30 @@
 	export default {
 		data() {
 			return {
+				qualityInstructions:"",
+			    indexFlag:0, // 涓嬫爣鏍囧織浣�
+				remarks:'',
+				selectlist:[
+					{
+						value: '1',
+						name:'闀垮害鎵g綒',
+						fontSize:'40'
+					},
+					{
+						value: '2',
+						name:'鍘氬害鎵g綒',
+						fontSize:'40'
+
+					},
+					{
+						value: '3',
+						name:'瀵嗛棴鍣�',
+						fontSize:'40'
+					}
+				],
 				orderPlanId: "",
 				title: '绱犺儦鍕惧嫆鍑洪潚鑺憋紝绗旈攱娴撹浆娣�',
+				isWeighingType:'',
 			subTitle: '2020-05-15',
 			thumb: 'http://pic2.sc.chinaz.com/Files/pic/pic9/202002/hpic2119_s.jpg',
 				coalDetailsData: {},
@@ -395,13 +620,63 @@
 				return	 uni.getStorageSync('roleType')!== 4 && item.iszj == 1 ? true :  uni.getStorageSync('roleType')== 4 ? true : false;
 					 // 宸茬粡楠岃川
 				}
+			},
+			//鍒ゆ柇闇�涓嶉渶瑕侀獙璐�
+			isYanz(){
+				return function(item){
+				// return	  ( this.coalDetailsData.orderType !=='澶栬喘' ||   this.coalDetailsData.weighingType !=='鍥炵') ? false : true; 
+				if(this.coalDetailsData.orderType =='澶栬喘'){
+					if(this.coalDetailsData.weighingType == '鍥炵'){
+						return true
+					}else{
+						return false
+					}
+				}else if(this.coalDetailsData.orderType =='澶栭攢'){
+					return false;
+
+				}
+					 // 宸茬粡楠岃川
+				}
+			},
+			//璁$畻涓嶅悎鏍艰鏍兼暟缁�
+			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
@@ -412,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: '鍔犺浇涓�'
@@ -420,10 +723,13 @@
 					if (res.code == 0) {
 						uni.hideLoading()
 						this.coalDetailsData = res.data;
+						this.remarks  = res.data.remarks;
+						this.qualityInstructions = res.data.qualityInstructions
 						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'
 							return {
 								...v,
 								modifyProductName: '',
@@ -444,6 +750,7 @@
 						if(!this.coalDetailsData.tmTaskCoalItems.length){
 							this.current = 0; 
 						}
+						this.isWeighingType = res.data.weighingType //褰撳墠纾呭崟鏄惁鍥炵
 					} else {
 						this.$u.toast('鍔犺浇澶辫触')
 						uni.hideLoading()
@@ -489,19 +796,34 @@
 			},
 			// 鐐瑰嚮纭
 			confirmInput() {
-				this.loading = true
+				this.loading = true;
+				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].unqualifiedWeight){
+					unqualifiedWeightAll = this.globalShowWeigh[i].unqualifiedWeight.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
+						
 					}
 				})
-				this.$reqPost('updateTmTaskCoalItem', this.showWeigh, 'json').then(
+				params.tmTaskCoalItems = this.showWeigh;
+				this.$reqPost('updateTmTaskCoalItem', params, 'json').then(
 					res => {
 						if (res.code == 0) {
 							this.loading = false
@@ -516,6 +838,20 @@
 							this.$u.toast(res.msg ? res.msg : '鎿嶄綔澶辫触')
 						}
 					})
+			},
+			// 鏍¢獙鏁版嵁鏄惁鍚堟牸 
+			checkValue(data,target){
+				if(!data.length){
+					return
+				}
+				let flag = data.find(item=>item[target] <=0);
+				console.log(flag,'flag');
+			    if(flag){
+					return false 
+				}else{
+					return true;
+				}
+
 			},
 			// 鐗╄祫鏄庣粏
 			goodsPopoverShow(index) {
@@ -537,6 +873,7 @@
 				this.showWeigh[this.goodsIndex].breed = val.breed
 				this.showWeigh[this.goodsIndex].spec = val.spec
 				this.showWeigh[this.goodsIndex].weightUnit = val.weightUnit
+				this.showWeigh[this.goodsIndex].weight1 = val.weight;
 			},
 			// 鍝佸悕涓庤鏍�
 			productNamePopoverShow(index) {
@@ -558,14 +895,43 @@
 			},
 			// 鎶樻墸鐜囪緭鍏�
 			discountInputHandle(value, index, clean) {
-				console.log('璁$畻鍑�閲�',value, index, clean)
-				value = Number(value)
-				this.showWeigh[index].cinderWeight = Number(value)
-				if (clean) {
-					let x = new BigNumber(clean)
-					let y = new BigNumber(value)
-					this.showWeigh[index].weight = x.minus(y).toFixed(2)
+				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(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('褰撳墠鍑�閲嶄笉鍚堟牸锛岃妫�鏌ョ毊閲嶏紝姣涢噸鏄惁鍑嗙‘')
+					}else{
+						this.showWeigh[index].weight = x.minus(y).minus(z).toFixed(2)
+					}
+				
 				
 			},
 			// 閫夋嫨涓嶅悎鏍煎搧鍚�
@@ -574,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`
 					})
 				}
 			},
@@ -586,15 +952,19 @@
 			},
 			// 涓嶅悎鏍奸噸閲忚緭鍏�
 			unqualifiedWeightInputHandle(value, index, clean) {
-			    console.log(value, typeof value ,'value')
-				if(!value){
-					value =  0;
-				}
-				let x = new BigNumber(clean)
-				let y = new BigNumber(value)
-				let z = new BigNumber(this.showWeigh[index].cinderWeight)
-				console.log(value, index, clean,'涓嶅悎鏍奸噸閲忚緭鍏�')
-				this.showWeigh[index].weight = x.minus(y).minus(z).toFixed(2) || ''
+				// 鍒ゆ柇鏄笉鏄湁鍑�閲嶆墠杩涜璁$畻
+				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){
+						this.showWeigh[index].weight = '0';
+						this.$u.toast('褰撳墠鍑�閲嶄笉鍚堟牸锛岃妫�鏌ョ毊閲嶏紝姣涢噸鏄惁鍑嗙‘')
+					}else{
+						this.showWeigh[index].weight = x.minus(y).minus(z).toFixed(2) ;
+					}
+				
+			
 			},
 			// 鍒犻櫎鍥剧墖
 			deletePic(event) {
@@ -643,6 +1013,70 @@
 			//鐐瑰嚮tab 鍒囨崲灞曠ず鏄庣粏
 			tabChange(val){
 				this.current = val;
+			},
+			//涓嬫媺妗嗚仛鐒︽椂闂�
+			onFoucus(val){
+				this.focusSelect = true;
+
+			},
+			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}`
+					})
+				}
 			}
 		},
 	}
@@ -658,6 +1092,11 @@
 
 	/deep/ .u-picker {
 		height: 600rpx;
+	}
+	.addBtn{
+		width: 65%;
+		font-size: 26rpx;
+		background-color: #3c9cff;;
 	}
 
 	.main {
@@ -756,6 +1195,11 @@
 				.num-input {
 					width: 60%;
 					border-bottom: 1px solid rgb(218, 219, 222);
+					position: relative;
+				}
+				.num-radio{
+					width: 60%;
+					font-size: 100rpx;
 				}
 
 				.num-show {

--
Gitblit v1.9.1