From 837c21ced9ed0aafe17a7c0c16975a1b6731eb9d Mon Sep 17 00:00:00 2001
From: qingyiay <2386314947@qq.com>
Date: 星期五, 07 七月 2023 11:30:37 +0800
Subject: [PATCH] 验质功能修改,websocket优化

---
 pages/driver-page/driver-index/bill-of-lading-details/weighDetail/weighDetail.vue |  118 +++++++++++++++++++++++++++++++++++++++-------------------
 1 files changed, 79 insertions(+), 39 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 09c87ff..dcb00fb 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
@@ -42,42 +42,52 @@
 						<u--input placeholder="璇疯緭鍏ユ墸娓�"
 							border="bottom"
 							clearable
-							v-model="item.discount"
+							v-model="item.cinderWeight"
 							@input='v=>discountInputHandle(v,i,item.clean)'></u--input>
 					</view>
 					<view v-else-if='flag'
-						class="count">{{ item.discount }}%
+						class="count">{{ item.cinderWeight }}
 					</view>
 				</view>
 				<view class="weigh">
 					<view class="label-text">
 						鎵f福鍚庡噣閲�
 					</view>
-					<view class="count">{{ item.discountWeight }}</view>
+					<view class="count">{{ item.weight }}</view>
 				</view>
-			</view>
-			<view class="level">
-				<view class=""
-					style="width: 70rpx;">
-					<u--text text="钃濇湰"
-						size='32'></u--text>
-				</view>
-				<u-tag :text="MaterialList[i].breed+MaterialList[i].spec||'鏆傛棤'"
-					plain
-					@click="productNamePopoverShow(i)"
-					v-if='MaterialList[i].breed&&MaterialList[i].spec||roleType===4'></u-tag>
 			</view>
 			<view class="level"
-				v-if='modifyMaterialList[i].modifyProductName'>
-				<view style="width: 70rpx;">
-					<u--text text="淇"
+				v-if='!flag'>
+				<view class=""
+					style="width: 140rpx;">
+					<u--text text="鐗╄祫鏄庣粏"
 						size='32'></u--text>
 				</view>
-				<view>
-					<u-tag :text="modifyMaterialList[i].modifyProductName"
-						plain></u-tag>
+				<u-tag :text="item.breed+item.spec||item.modifygoodsName||'鏆傛棤'"
+					plain
+					@click="goodsPopoverShow(i)"
+					v-if='item.breed&&item.spec||roleType===4'></u-tag>
+			</view>
+			<view class="level"
+				v-if='item.modifygoodsName||flag'>
+				<view style="width: 140rpx;">
+					<u--text text="浜у搧鍚嶇О"
+						size='32'></u--text>
+				</view>
+				<view v-if="showWeighCopy[i].modifyProductName||item.breed&&item.spec">
+					<u-tag :text="!flag?showWeighCopy[i].modifyProductName:item.breed+item.spec"
+						plain
+						@click="productNamePopoverShow(i)"></u-tag>
 				</view>
 			</view>
+			<!-- 鐗╄祫鏄庣粏 -->
+			<u-action-sheet :actions="goodsList"
+				:show="goodsShow"
+				cancelText='鍙栨秷'
+				:closeOnClickOverlay='true'
+				@close='goodsNameClose'
+				@select="goodsselectClick"></u-action-sheet>
+			<!-- 浜у搧鍒楄〃 -->
 			<view class="">
 				<u-action-sheet :actions="actionsList"
 					:show="actionShow"
@@ -107,10 +117,15 @@
 				orderPlanId: "",
 				coalDetailsData: {},
 				showWeigh: [],
+				showWeighCopy: [],
 				discountrate: "",
 				loading: false,
 				show: false,
 				selectIndex: null,
+				// 鐗╄祫鏄庣粏
+				goodsList: [],
+				goodsShow: false,
+				goodsIndex: null,
 				// 浜у搧鍒楄〃
 				actionsList: [],
 				actionShow: false,
@@ -119,11 +134,7 @@
 				havedInput: false,
 				flag: false,
 				orderCode: null,
-				// 鐗╄祫鏄庣粏list
-				MaterialList: [],
-				// 淇敼涔嬪悗鐨勭墿璧勬槑缁唋ist
-				modifyMaterialList: [],
-				// 淇敼涔嬪悗鐨勪骇鍝佸悕绉�
+
 				modifyProductName: null,
 				// 鏄惁淇敼
 				isModify: false
@@ -156,6 +167,15 @@
 						this.orderCode = res.data.orderCode
 						this.showWeigh = this.coalDetailsData.tmTaskCoalItems ? this.coalDetailsData
 							.tmTaskCoalItems : [];
+						this.showWeigh = this.showWeigh.map(v => {
+							return {
+								...v,
+								modifyProductName: '',
+								modifygoodsName: ''
+
+							}
+						})
+						this.showWeighCopy = JSON.parse(JSON.stringify(this.showWeigh))
 						uni.hideLoading()
 					} else {
 						this.$u.toast('鍔犺浇澶辫触')
@@ -163,8 +183,12 @@
 					}
 				}).then(() => {
 					this.$reqGet('getMaterialDetailByOrderCode', { orderCode: this.orderCode }).then(r => {
-						this.MaterialList = r.data
-						this.modifyMaterialList = JSON.parse(JSON.stringify(this.MaterialList))
+						this.goodsList = r.data.map(v => {
+							return {
+								...v,
+								name: v.breed + v.spec
+							}
+						})
 						uni.hideLoading()
 					})
 				})
@@ -202,14 +226,8 @@
 				this.showWeigh = this.showWeigh.map((v, i) => {
 					return {
 						...v,
-						itemId: this.MaterialList[i].itemId,
-						Num: this.MaterialList[i].Num,
-						NumUnit: this.MaterialList[i].NumUnit,
-						Remark: this.MaterialList[i].Remark,
-						spec: this.modifyMaterialList[i].modifyProductName ? this.actionsList[i].spec : this
-							.MaterialList[i].spec,
-						breed: this.modifyMaterialList[i].modifyProductName ? this.actionsList[i]
-							.secondCategoryName : this.MaterialList[i].breed
+						breed: this.showWeighCopy[i].modifyProductName ? this.showWeighCopy[i].breed : v.breed,
+						spec: this.showWeighCopy[i].modifyProductName ? this.showWeighCopy[i].spec : v.spec
 					}
 				})
 				this.$reqPost('updateTmTaskCoalItem', this.showWeigh, 'json').then(
@@ -228,20 +246,42 @@
 						}
 					})
 			},
+			// 鐗╄祫鏄庣粏
+			goodsPopoverShow(index) {
+				this.goodsShow = true
+				this.goodsIndex = index
+			},
+			goodsNameClose() {
+				this.goodsShow = false
+			},
+			goodsselectClick(val) {
+				this.showWeigh[this.goodsIndex].modifygoodsName = val.name
+				this.showWeigh[this.goodsIndex].itemId = val.itemId
+				this.showWeigh[this.goodsIndex].num = val.num
+				this.showWeigh[this.goodsIndex].numUnit = val.numUnit
+				this.showWeigh[this.goodsIndex].remark = val.remark
+				this.showWeigh[this.goodsIndex].breed = val.breed
+				this.showWeigh[this.goodsIndex].spec = val.spec
+			},
+			// 浜у搧鍒楄〃
 			productNamePopoverShow(index) {
-				this.actionShow = true
-				this.actionIndex = index
+				if (this.roleType === 4 && !this.flag) {
+					this.actionShow = true
+					this.actionIndex = index
+				}
 			},
 			productNameClose() {
 				this.actionShow = false
 			},
 			selectClick(val) {
-				this.modifyMaterialList[this.actionIndex].modifyProductName = val.name
+				this.showWeighCopy[this.actionIndex].modifyProductName = val.name
+				this.showWeighCopy[this.actionIndex].breed = val.secondCategoryName
+				this.showWeighCopy[this.actionIndex].spec = val.spec
 			},
 			// 鎶樻墸鐜囪緭鍏�
 			discountInputHandle(value, index, clean) {
 				this.showWeigh[index].cinderWeight = Number(value)
-				this.showWeigh[index].discountWeight = (clean - (Number(value)).toFixed(2));
+				this.showWeigh[index].weight = (clean - (Number(value)).toFixed(2));
 			}
 		},
 	}

--
Gitblit v1.9.1