From 82af85eae92790fc125ca42d1a800046fe0bd916 Mon Sep 17 00:00:00 2001
From: qingyiay <2386314947@qq.com>
Date: 星期三, 29 三月 2023 14:00:08 +0800
Subject: [PATCH] 登录页修改

---
 pages/public-page/forward/forward.vue |   48 +++++++++++++++++++++++++++++++++++++++---------
 1 files changed, 39 insertions(+), 9 deletions(-)

diff --git a/pages/public-page/forward/forward.vue b/pages/public-page/forward/forward.vue
index e10f843..e57f01f 100644
--- a/pages/public-page/forward/forward.vue
+++ b/pages/public-page/forward/forward.vue
@@ -1,7 +1,8 @@
 <template>
 	<!-- 杞彂 -->
 	<view class="forward">
-		<view><u-notice-bar :text="text" :fontSize="30" mode="link"></u-notice-bar></view>
+		<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">
 			<u--form labelPosition="top" :model="forwardForm" ref="form1">
 				<u-form-item label="杞彂瀵硅薄" labelWidth="20%" ref="item1" @click="forwardObjectClick(index)">
@@ -53,8 +54,12 @@
 
 export default {
 	onLoad(params) {
+		// 瀹㈡埛
 		this.cars2 = Number(params.cars2);
 		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;
@@ -64,7 +69,7 @@
 		}
 		this.orderPlanId = params.orderPlanId;
 		this.$reqGet('forwardList', { OrderPlanId: params.orderPlanId }).then(res => {
-			if (res.data) {
+			if (res.data.length !== 0 && this.roleType == 1) {
 				this.jhOrderPlanForwardList = res.data.map(item => {
 					return {
 						id: item.id,
@@ -76,7 +81,18 @@
 						checkboxValue1: ''
 					};
 				});
-				console.log(this.jhOrderPlanForwardList, '鍒楄〃');
+			} 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,
+						checkboxValue1: ''
+					};
+				});
 			} else {
 				this.jhOrderPlanForwardList = this.jhOrderPlanForwardList.map(v => {
 					if (!v.orderPlanId) {
@@ -122,6 +138,8 @@
 			tabHuoDai: false,
 			carNumSurplus1: '',
 			cars2: '',
+			carNum: '',
+			carNumSurplusHuodai: '',
 			formNum: 1
 		};
 	},
@@ -138,6 +156,9 @@
 		},
 		text() {
 			return `宸查鍙�${this.cars2}寮犳棩璁″垝鍗�,鍓╀綑${this.carNumSurplus1}寮犳棩璁″垝鍗昤;
+		},
+		text1() {
+			return `宸叉嫢鏈�${this.carNum}寮犳棩璁″垝鍗�,鍓╀綑${this.carNumSurplusHuodai}寮犳棩璁″垝鍗昤;
 		}
 	},
 	methods: {
@@ -217,15 +238,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('鍒犻櫎鎴愬姛');
 			}
 		},
 		// 鎻愪氦
@@ -236,22 +261,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