From 04f3f15c930c2b02187d0ce11d68978b65361d54 Mon Sep 17 00:00:00 2001
From: qingyiay <2386314947@qq.com>
Date: 星期五, 31 三月 2023 09:26:29 +0800
Subject: [PATCH] 修复多数bug

---
 pages/public-page/forward/forward.vue |   49 ++++++++++++++++++++++++++++++++-----------------
 1 files changed, 32 insertions(+), 17 deletions(-)

diff --git a/pages/public-page/forward/forward.vue b/pages/public-page/forward/forward.vue
index e98e380..5878218 100644
--- a/pages/public-page/forward/forward.vue
+++ b/pages/public-page/forward/forward.vue
@@ -3,10 +3,10 @@
 	<view class="forward">
 		<view v-if="roleType == 1"><u-notice-bar :text="text" :fontSize="30" mode="link"></u-notice-bar></view>
 		<view v-else-if="roleType == 2"><u-notice-bar :text="text1" :fontSize="30" mode="link"></u-notice-bar></view>
-		<view class="forward-card" v-for="(val, index) in jhOrderPlanForwardList">
+		<view class="forward-card" v-for="(val, index) in jhOrderPlanForwardList" :key="index">
 			<u--form labelPosition="top" :model="forwardForm" ref="form1">
 				<u-form-item label="杞彂瀵硅薄" labelWidth="20%" ref="item1" @click="forwardObjectClick(index)">
-					<u--input v-model="val.name" placeholder="鐐瑰嚮閫夋嫨杞彂瀵硅薄"></u--input>
+					<u--input v-model="val.name" placeholder="鐐瑰嚮閫夋嫨杞彂瀵硅薄" :readonly="true"></u--input>
 				</u-form-item>
 				<u-form-item label="杈撳叆鏁伴噺" labelWidth="20%" ref="item1">
 					<view class="forward-card-amount">
@@ -59,22 +59,27 @@
 		this.carNumSurplus1 = Number(params.carNumSurplus1);
 		// 璐т唬
 		this.carNum = Number(params.carNum);
-		this.carNumSurplusHuodai = Number(params.carNumSurplusHuodai);
-		if (params.carNumSurplus1 || params.carNumSurplusHuodai) {
-			if (params.carNumSurplus1 != 0) {
-				this.forwardSurplus = params.carNumSurplus1;
-			} else if (params.carNumSurplusHuodai != 0) {
-				this.forwardSurplus = params.carNumSurplusHuodai;
-			}
-		}
+		this.carNumSurplusHuodai = this.forwardSurplus = Number(params.carNumSurplusHuodai);
 		this.orderPlanId = params.orderPlanId;
 		this.$reqGet('forwardList', { OrderPlanId: params.orderPlanId }).then(res => {
-			if (res.data.length !== 0) {
+			if (res.data.length !== 0 && this.roleType == 1) {
 				this.jhOrderPlanForwardList = res.data.map(item => {
 					return {
 						id: item.id,
 						orderPlanId: item.orderPlanId,
 						name: item.xsUserName === null ? item.fleetName : item.xsUserName,
+						carNum: item.carNum,
+						xsUserId: item.xsUserId === null ? 0 : item.xsUserId,
+						fleetId: item.fleetId === null ? 0 : item.fleetId,
+						checkboxValue1: ''
+					};
+				});
+			} else if (res.data.length !== 0 && this.roleType == 2) {
+				this.jhOrderPlanForwardList = res.data.map(item => {
+					return {
+						id: item.id,
+						orderPlanId: item.orderPlanId,
+						name: item.fleetName,
 						carNum: item.carNum,
 						xsUserId: item.xsUserId === null ? 0 : item.xsUserId,
 						fleetId: item.fleetId === null ? 0 : item.fleetId,
@@ -167,6 +172,7 @@
 		checkboxChange(value, index) {
 			console.log('澶嶉�夋鍙樺寲', value, index);
 			if (value.length != 0) {
+				console.log(this.forwardSurplus, '璐т唬杞彂鍏ㄩ儴鏁伴噺');
 				this.jhOrderPlanForwardList[index].carNum = this.forwardSurplus;
 			} else {
 				this.jhOrderPlanForwardList[index].carNum = null;
@@ -226,15 +232,19 @@
 		},
 		// 鍒犻櫎涓�缁勮〃鍗�
 		deleteGroup(index, v) {
-			if (v.id) {
+			let tempcarNum = v.carNum;
+			if (v.id && this.jhOrderPlanForwardList[index].carNum !== tempcarNum) {
 				this.$reqPost('deleteForward', { id: v.id }, 'params').then(res => {
 					if (res.code === 0) {
 						this.jhOrderPlanForwardList.splice(index, 1);
 						this.$u.toast('鍒犻櫎鎴愬姛');
+					} else if (res.code === 1) {
+						this.$u.toast(res.msg);
 					}
 				});
 			} else {
 				this.jhOrderPlanForwardList.splice(index, 1);
+				this.$u.toast('鍒犻櫎鎴愬姛');
 			}
 		},
 		// 鎻愪氦
@@ -245,22 +255,27 @@
 					this.$u.toast('璇疯緭鍏ュ悎娉曟暟瀛�');
 					isPass = false;
 					return isPass;
-				} else if (Number(v.carNum) > Number(this.forwardSurplus)) {
-					this.$u.toast('瓒呰繃鏈�澶ц鍗曞墿浣欓噺');
-					isPass = false;
-					return isPass;
-				} else {
+				}
+				// else if (Number(v.carNum) > Number(this.forwardSurplus)) {
+				// 	this.$u.toast('瓒呰繃鏈�澶ц鍗曞墿浣欓噺');
+				// 	isPass = false;
+				// 	return isPass;
+				// }
+				else {
 					isPass = true;
 					return isPass;
 				}
 			});
 			if (isPass) {
 				this.$reqPost('forward', this.jhOrderPlanForwardList, 'json').then(res => {
+					console.log(res, 'zh');
 					if (res.code == 0) {
 						this.$u.toast('鎻愪氦鎴愬姛');
 						setTimeout(() => {
 							uni.navigateBack({ delta: 1 });
 						}, 1000);
+					} else {
+						this.$u.toast(res.msg);
 					}
 				});
 			}

--
Gitblit v1.9.1