From 2e60df573ae7648e5df412b50a924cb52820b135 Mon Sep 17 00:00:00 2001 From: yangan <yangan0921@163.com> Date: 星期四, 18 一月 2024 15:49:45 +0800 Subject: [PATCH] feat:小程序验质拆分净重提煤单增加不合格明细 --- pages/driver-page/driver-index/bill-of-lading-details/weighDetail/weighDetail.vue | 184 +++++++++++++++++++++++++++++++++++---------- 1 files changed, 142 insertions(+), 42 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 f10a4d5..a6f4ad4 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 @@ -55,12 +55,22 @@ class="count">{{ item.cinderWeight }} </view> </view> - <view class="weigh"> - <view class="label-text"> - 鎵f福鍚庡噣閲� + <!-- 鍑�閲峝iv --> + <view class="weight-box"> + <view class="weigh-qualified"> + <view> + 鍚堟牸鍑�閲嶏細 </view> - <view class="count">{{ item.weight }}</view> + <view class="count"> {{ cleanWeight(item) }}</view> </view> + <view class="weigh-qualified" v-for="el,index in unqualifiedArr(i)"> + <view> + 涓嶅悎鏍煎噣閲嶏細 + </view> + <view class="count"> {{el.unqualifiedWeight || ''}}</view> + </view> + </view> + </view> </view> <!-- 鍒ゆ柇鏄惁妫�楠岃川閲� --> @@ -97,7 +107,7 @@ </view> </view> <view class="level" - v-if='item.modifygoodsName||globalShowWeigh[i].modifyProductName'> + v-if='item.modifygoodsName ||globalShowWeigh[i].modifyProductName'> <view style="width: 180rpx;"> <u--text text="鍝佸悕涓庤鏍�" size='32'></u--text> @@ -108,6 +118,7 @@ {{!flag?(globalShowWeigh[i].modifyProductName?globalShowWeigh[i].modifyProductName:item.modifygoodsName):(item.breed+'/'+item.spec)}} </text> </view> + </view> <!-- <view class="unqualifiedBreed"> <view style="width: 180rpx;"> @@ -227,8 +238,28 @@ {{item.penaltyAmount}} </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" + v-if='roleType===4&&!flag' + > + <u--input placeholder="璇疯緭鍏ュ崟浠�" + border="bottom" + clearable + v-model="item.unitPrice"></u--input> + </view> + <view class="num-show" + v-else-if="flag"> + {{item.unitPrice}} + </view> + </view> <!--涓嶅悎鏍煎垽瀹氱绫� --> - <!-- <view class="notice-num" v-if="item.penaltyType == '鍏朵粬鎵g綒'" > + <view class="notice-num"> <view class="num-text" style="margin-left: 10rpx;"> <u--text text="涓嶅悎鏍煎垽瀹�" @@ -239,17 +270,17 @@ @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-group size='32' v-model="item.penaltyType"> + <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> + <text> {{item.penaltyType == 1 ? '瓒呭昂鎵g綒' : item.penaltyType == 2 ? '鍘氬害鎵g綒' :item.penaltyType == 3 ? '瀵嗛棴鍣�' : null }} </text> </view> - </view> --> + </view> </view> <u-empty v-if=" isYanz() && !isShow(item) " icon-size="200" text="''" > <text>鏆傛湭楠岃川</text> @@ -321,7 +352,7 @@ <view> <view class="notice-num"> <view class="num-text"> - <u--text text="涓嶅悎鏍肩綒娆�" + <u--text text="涓嶅悎鏍奸噸閲�" size='32'></u--text> </view> <view class="num-input" @@ -342,9 +373,26 @@ </view> </view> - <view class="notice-num"> + <!-- <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'> + <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 class="notice-num"> + <view class="num-text"> + <u--text text="鍗曚环" size='32'></u--text> </view> <view class="num-input" @@ -355,13 +403,13 @@ 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 class="num-show" +> {{el.penaltyUnitPrice || ''}} </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 : '' }} + {{el.penaltyUnitPrice || ''}} </view> </view> @@ -669,6 +717,7 @@ let arr = []; let temp = []; let noPin = []; + let noPrice = []; const item = this.globalShowWeigh[index]; console.log(this.globalShowWeigh[index],'index') if(item){ @@ -681,12 +730,15 @@ noPin = item.unqualifiedType.toString().split(','); } + if(item.penaltyUnitPrice){ + noPrice = item.penaltyUnitPrice.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],unqualifiedType:noPin[index]} + let obj = {unqualifiedBreed:el,unqualifiedWeight:temp[index],unqualifiedType:noPin[index],penaltyUnitPrice:noPrice[index]} return obj }) console.log(result,temp,'arr') @@ -699,12 +751,27 @@ } + }, + cleanWeight(){ + return function(item){ + console.log(item,'itemsssss') + if(!item.weight){ + return '' + }else if(item.weight && !item.unqualifiedWeight){ + return item.weight + }else if(item.weight && item.unqualifiedWeight){ + return (item.weight - (item.unqualifiedWeight - 0)).toFixed(2) + }else{ + return '' + } + } } + }, onShow(params){ console.log(params,'paramss') - // this.numAll(this.globalShowWeigh[this.indexFlag].unqualifiedWeights.split(","),this.indexFlag,this.showWeigh[this.indexFlag].clean) + this.numAll(this.globalShowWeigh[this.indexFlag].unqualifiedWeights.split(","),this.indexFlag,this.showWeigh[this.indexFlag].clean) }, mounted() { this.roleType === 1 ? this.GetOrderPlan() : this.getTakeCoal(); @@ -851,17 +918,22 @@ }, // 鐐瑰嚮纭 confirmInput() { + let flag = true; let params = {},unqualifiedWeightAll; params.qualityInstructions = this.qualityInstructions; params.remarks = this.remarks; this.showWeigh = this.showWeigh.map((v, i) => { - if(!v.penaltyType) { - v.unqualifiedType = ''; + v.unqualifiedType = ''; + if(!v.unitPrice){ + flag = false; } + + + if(this.globalShowWeigh[i].unqualifiedWeights){ unqualifiedWeightAll = this.globalShowWeigh[i].unqualifiedWeights.split(",").reduce((p,n)=>{return (p - 0) + (n - 0)},0).toFixed(2) || '' }else{ - unqualifiedWeightAll ='' + unqualifiedWeightAll = 0; } return { ...v, @@ -869,14 +941,15 @@ 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 :unqualifiedWeightAll, - penaltyType:this.globalShowWeigh[i].unqualifiedType, - tempArr:this.globalShowWeigh[i].tempArr ? JSON.stringify(this.globalShowWeigh[i].tempArr) : '' + unqualifiedWeights :this.globalShowWeigh[i].unqualifiedWeights ? this.globalShowWeigh[i].unqualifiedWeights : 0, + unqualifiedWeight :unqualifiedWeightAll , + // penaltyType:this.globalShowWeigh[i].unqualifiedType, + tempArr:this.globalShowWeigh[i].tempArr ? JSON.stringify(this.globalShowWeigh[i].tempArr) : '', + penaltyUnitPrice:this.globalShowWeigh[i].penaltyUnitPrice, } }); - console.log(this.globalShowWeigh,this.showWeigh,'this.gloa') + if(flag){ this.loading = true; params.tmTaskCoalItems = this.showWeigh; this.$reqPost('updateTmTaskCoalItem', params, 'json').then( @@ -894,6 +967,11 @@ this.$u.toast(res.msg ? res.msg : '鎿嶄綔澶辫触') } }) + }else{ + this.$u.toast('璇疯緭鍏ュ崟浠�') + return + } + }, // 鏍¢獙鏁版嵁鏄惁鍚堟牸 checkValue(data,target){ @@ -937,7 +1015,7 @@ // this.actionShow = true // this.actionIndex = index uni.navigateTo({ - url: `/pages/public-page/selectSpecifications/selectSpecifications?index=${index}&takeCoalId=${this.orderPlanId}&productName=${this.willProductName}` + url: `/pages/public-page/selectSpecifications/selectSpecifications?index=${index}&takeCoalId=${this.orderPlanId}&productName=${this.willProductName}&pageFlag=${false}` }) } }, @@ -952,11 +1030,11 @@ // 鎶樻墸鐜囪緭鍏� discountInputHandle(value, index, clean) { let znums; - // if(this.globalShowWeigh[index].unqualifiedWeights){ - // znums = this.globalShowWeigh[index].unqualifiedWeights.split(',') - // }else{ - // znums = [] - // } + if(this.globalShowWeigh[index].unqualifiedWeights){ + znums = this.globalShowWeigh[index].unqualifiedWeights.split(',') + }else{ + znums = [] + } console.log('璁$畻鍑�閲�',value, index, clean) this.indexFlag = index; // 璁板綍鏍囪瘑浣� if ( @@ -978,15 +1056,15 @@ 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)) + let z = new BigNumber(znums.reduce((p,n)=>{ + return (p - 0) + (n - 0) + },0)) console.log(clean,value,'鎵f福'); if(x.minus(y).toFixed(2) <= 0){ this.showWeigh[index].weight = '0'; this.$u.toast('褰撳墠鍑�閲嶄笉鍚堟牸锛岃妫�鏌ョ毊閲嶏紝姣涢噸鏄惁鍑嗙‘') }else{ - this.showWeigh[index].weight = x.minus(y); + this.showWeigh[index].weight = x.minus(y).minus(z); } }else{ this.$u.toast('褰撳墠鏃犲噣閲�') @@ -1097,7 +1175,7 @@ } }, deleteItem(i,index){ - let {unqualifiedBreed,unqualifiedWeights,unqualifiedType} = this.globalShowWeigh[i]; + let {unqualifiedBreed,unqualifiedWeights,unqualifiedType,penaltyUnitPrice} = this.globalShowWeigh[i]; this.indexFlag = i; // 璁板綍鏍囪瘑浣� console.log(this.globalShowWeigh[i],'index') if (this.roleType === 4 && !this.flag) { @@ -1120,22 +1198,30 @@ unqualifiedWeights = ''; } - if(unqualifiedType.split(",").length > 1){ - let strArr = unqualifiedType.split(','); + // if(unqualifiedType.split(",").length > 1){ + // let strArr = unqualifiedType.split(','); + // strArr.splice(index ,1) + // unqualifiedType = strArr.join(",") + // }else{ + // unqualifiedType = ''; + // } + if(penaltyUnitPrice.split(",").length > 1){ + let strArr = penaltyUnitPrice.split(','); strArr.splice(index ,1) - unqualifiedType = strArr.join(",") + penaltyUnitPrice = strArr.join(",") }else{ - unqualifiedType = ''; + penaltyUnitPrice = ''; } this.globalShowWeigh[i].unqualifiedBreed = unqualifiedBreed; this.globalShowWeigh[i].unqualifiedWeights = unqualifiedWeights; - this.globalShowWeigh[i].unqualifiedType = unqualifiedType; + // this.globalShowWeigh[i].unqualifiedType = unqualifiedType; + this.globalShowWeigh[i].penaltyUnitPrice = penaltyUnitPrice; 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) + this.numAll(this.globalShowWeigh[this.indexFlag].unqualifiedWeights.split(","),this.indexFlag,this.showWeigh[this.indexFlag].clean) console.log(this.globalShowWeigh[i],'deleteItem'); } @@ -1161,6 +1247,20 @@ justify-content: space-between; align-items: center; } + .weigh-qualified{ + display: flex; + flex-direction: row; + justify-content: space-around; + height: 160rpx; + + } + .weight-box{ + display: flex; + height: 160rpx; + margin-bottom: 20rpx; + flex-direction: column; + overflow-y: scroll; + } /deep/ .u-picker { height: 600rpx; -- Gitblit v1.9.1