From 8e095c1fd6164fafc7d5cfd144528a0d67afef7c Mon Sep 17 00:00:00 2001
From: qingyiay <2386314947@qq.com>
Date: 星期三, 22 三月 2023 17:31:15 +0800
Subject: [PATCH] 转发页面修改

---
 pages/public-page/forward/forward.vue                 |  160 ++++++++++++++++++++++++++++++---------
 pages/login/userPassword.vue                          |   31 ++++---
 api/globalApi.js                                      |   39 ++++++---
 pages/customer-page/customer-index/customer-index.vue |    2 
 4 files changed, 164 insertions(+), 68 deletions(-)

diff --git a/api/globalApi.js b/api/globalApi.js
index bc0f77a..ab1cbff 100644
--- a/api/globalApi.js
+++ b/api/globalApi.js
@@ -1,10 +1,10 @@
 export const globalApi = {
 	// 缁戝畾寰俊
-	wxBind:{
-		url:'/wrzs/social/bind',
-		method:"POST"
+	wxBind: {
+		url: '/wrzs/social/bind',
+		method: "POST"
 	},
-	
+
 	//	鎻愮叅鍗�
 	//	鑾峰彇鍙戣繍璁″垝鍒楄〃
 	GetOrderPlan: {
@@ -39,10 +39,23 @@
 	 * @杞彂淇敼
 	 */
 	forward: {
-		url: "/wrzs/userOperation/forward",
+		url: "/wrzs/userOperation/forwardList",
 		method: "POST"
 	},
-
+	/**
+	 * @description 杞彂淇敼鍥炴樉
+	 */
+	forwardList: {
+		url: "/wrzs/userOperation/forwardListData",
+		method: "GET"
+	},
+	/**
+	 * @description 鍒犻櫎涓�缁勮浆鍙�
+	 */
+	deleteForward: {
+		url: "/wrzs/userOperation/deleteForward",
+		method: "POST"
+	},
 	// 璐т唬棣栭〉鍒楄〃
 	// huoDaiList: {
 	// 	url: "/wrzs/wx/huoDaiList",
@@ -52,7 +65,7 @@
 	 * @璐т唬棣栭〉鍒楄〃淇敼
 	 */
 	huoDaiList: {
-		url: "/wrzs/userOperation/huoDaiList",
+		url: "/wrzs/userOperation/huoDaiList	",
 		method: "GET"
 	},
 
@@ -235,14 +248,14 @@
 		method: 'GET'
 	},
 	// 鍔犲噺鐓�
-	addAndSubtractCoal:{
-		url:'/wrzs/jcgatestate/repeatCheck',
-		method:'POST'
+	addAndSubtractCoal: {
+		url: '/wrzs/jcgatestate/repeatCheck',
+		method: 'POST'
 	},
 	// 鑾峰彇鎵�鍦ㄧ鎴�
-	getWeighHouse:{
-		url:"/wrzs/jccoalweighhouse/getWeighHouse",
-		method:'GET'
+	getWeighHouse: {
+		url: "/wrzs/jccoalweighhouse/getWeighHouse",
+		method: 'GET'
 	},
 
 	// 鎻愮叅鍗曟棩蹇楁煡璇�
diff --git a/pages/customer-page/customer-index/customer-index.vue b/pages/customer-page/customer-index/customer-index.vue
index c70f52a..32fbd19 100644
--- a/pages/customer-page/customer-index/customer-index.vue
+++ b/pages/customer-page/customer-index/customer-index.vue
@@ -147,7 +147,7 @@
 		// 杞彂
 		forwardClick(obj) {
 			uni.navigateTo({
-				url: `/pages/public-page/forward/forward?orderPlanId=${obj.id}&carNumSurplus1=${obj.carNumSurplus1}`
+				url: `/pages/public-page/forward/forward?orderPlanId=${obj.id}&carNumSurplus1=${obj.carNumSurplus1}&carNum=${obj.carNum}&cars2=${obj.cars2}`
 			});
 		}
 	}
diff --git a/pages/login/userPassword.vue b/pages/login/userPassword.vue
index 4b8b3fd..605b5a5 100644
--- a/pages/login/userPassword.vue
+++ b/pages/login/userPassword.vue
@@ -43,9 +43,8 @@
 	},
 	data() {
 		return {
-			// username: '12222222222',// 瀹㈡埛
+			username: 'appuser', // 瀹㈡埛
 			// username: '18805080506',// 鐜嬫锛堝徃鏈猴級
-			username: '13333333332',// driver
 			password: '123456',
 			remember: true,
 			baseUrl: ''
@@ -85,20 +84,22 @@
 							setRefreshToken(res.refresh_token);
 							setUsernameKey(res.username);
 							//鏌ヨ鐢ㄦ埛璇︾粏淇℃伅骞跺偍瀛�
-							this.$reqGet('getUserEntity').then(res => {
-								this.$u.toast('鎭枩鎮紝鐧诲綍鎴愬姛锛�');
-								this.setUserTabbar(res.data.type);
-								uni.setStorageSync('roleType', res.data.type);
-								setCustomerId(res.data.customerid);
-								uni.hideLoading();
-								//璺宠浆椤甸潰
-								this.$nextTick(() => {
-									redirectHome();
+							this.$reqGet('getUserEntity')
+								.then(res => {
+									this.$u.toast('鎭枩鎮紝鐧诲綍鎴愬姛锛�');
+									this.setUserTabbar(res.data.type);
+									uni.setStorageSync('roleType', res.data.type);
+									setCustomerId(res.data.customerid);
+									uni.hideLoading();
+									//璺宠浆椤甸潰
+									this.$nextTick(() => {
+										redirectHome();
+									});
+								})
+								.catch(err => {
+									this.$u.toast('鐧诲綍寮傚父锛�');
+									console.log(err);
 								});
-							}).catch(err=>{
-								this.$u.toast('鐧诲綍寮傚父锛�');
-								console.log(err);
-							});
 						} else {
 							uni.hideLoading();
 							this.$u.toast(res.msg);
diff --git a/pages/public-page/forward/forward.vue b/pages/public-page/forward/forward.vue
index a8f43a6..e10f843 100644
--- a/pages/public-page/forward/forward.vue
+++ b/pages/public-page/forward/forward.vue
@@ -1,21 +1,27 @@
 <template>
 	<!-- 杞彂 -->
 	<view class="forward">
-		<view class="forward-card">
+		<view><u-notice-bar :text="text" :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"><u--input v-model="name" placeholder="鐐瑰嚮閫夋嫨杞彂瀵硅薄"></u--input></u-form-item>
+				<u-form-item label="杞彂瀵硅薄" labelWidth="20%" ref="item1" @click="forwardObjectClick(index)">
+					<u--input v-model="val.name" placeholder="鐐瑰嚮閫夋嫨杞彂瀵硅薄"></u--input>
+				</u-form-item>
 				<u-form-item label="杈撳叆鏁伴噺" labelWidth="20%" ref="item1">
 					<view class="forward-card-amount">
-						<view class="forward-card-amount-input"><u--input v-model="forwardForm.nums" placeholder="璇疯緭鍏ヨ浆鍙戞暟閲�"></u--input></view>
-						<u-checkbox-group v-model="checkboxValue1" placement="column" @change="checkboxChange">
+						<view class="forward-card-amount-input"><u--input v-model="val.carNum" placeholder="璇疯緭鍏ヨ浆鍙戞暟閲�"></u--input></view>
+						<u-checkbox-group v-model="val.checkboxValue1" placement="column" @change="v => checkboxChange(v, index)">
 							<u-checkbox :customStyle="{ marginBottom: '8px' }" size="30" labelSize="30" label="鍏ㄩ儴杞彂" name="鍏ㄩ儴杞彂"></u-checkbox>
 						</u-checkbox-group>
 					</view>
 				</u-form-item>
+				<u-form-item><u-button text="鍒犻櫎鏈粍" :hairline="false" type="error" @click="deleteGroup(index, val)"></u-button></u-form-item>
 			</u--form>
 		</view>
+		<!-- 澧炲姞鎸夐挳 -->
+		<view class="AdddBtn"><u-button text="娣诲姞" :hairline="false" type="primary" :customStyle="{ marginBottom: '8px' }" @click="addForm"></u-button></view>
 		<!-- 鎸夐挳 -->
-		<view class="forwardBtn"><u-button text="鎻愪氦" :hairline="false" type="primary" @click="submitForm"></u-button></view>
+		<view class="forwardBtn"><u-button text="鎻愪氦" :hairline="false" type="warning" @click="submitForm"></u-button></view>
 
 		<!-- 閫夋嫨璐т唬鎴栬溅闃熷脊鍑烘 -->
 		<view class="selectHuoDaiOrFleet-container">
@@ -47,7 +53,8 @@
 
 export default {
 	onLoad(params) {
-		console.log('杞彂鐨勬彁鐓ゅ崟id', params.orderPlanId, params.carNum);
+		this.cars2 = Number(params.cars2);
+		this.carNumSurplus1 = Number(params.carNumSurplus1);
 		if (params.carNumSurplus1 || params.carNumSurplusHuodai) {
 			if (params.carNumSurplus1 != 0) {
 				this.forwardSurplus = params.carNumSurplus1;
@@ -55,7 +62,32 @@
 				this.forwardSurplus = params.carNumSurplusHuodai;
 			}
 		}
-		this.forwardForm.orderPlanId = params.orderPlanId;
+		this.orderPlanId = params.orderPlanId;
+		this.$reqGet('forwardList', { OrderPlanId: params.orderPlanId }).then(res => {
+			if (res.data) {
+				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: ''
+					};
+				});
+				console.log(this.jhOrderPlanForwardList, '鍒楄〃');
+			} else {
+				this.jhOrderPlanForwardList = this.jhOrderPlanForwardList.map(v => {
+					if (!v.orderPlanId) {
+						return {
+							...v,
+							orderPlanId: params.orderPlanId
+						};
+					}
+				});
+			}
+		});
 	},
 	data() {
 		return {
@@ -63,13 +95,20 @@
 			paramsName: {},
 			huoDaiData: [],
 			fleetData: [],
-			name: '',
-			forwardForm: {
-				orderPlanId: null,
-				nums: null,
-				userId: 0,
-				fleetId: 0
-			},
+			// 鏃ヨ鍒抜d
+			orderPlanId: '',
+			jhOrderPlanForwardList: [
+				{
+					orderPlanId: '',
+					name: '',
+					carNum: null,
+					xsUserId: 0,
+					fleetId: 0,
+					checkboxValue1: ''
+				}
+			],
+			// 绱㈠紩锛屽埄鐢ㄧ储寮曟纭樉绀�
+			index: '',
 			checkboxValue1: '',
 			selectPopupShow: false,
 			list1: [
@@ -80,7 +119,10 @@
 					name: '璐т唬'
 				}
 			],
-			tabHuoDai: false
+			tabHuoDai: false,
+			carNumSurplus1: '',
+			cars2: '',
+			formNum: 1
 		};
 	},
 	onShow() {
@@ -93,6 +135,9 @@
 	computed: {
 		roleType() {
 			return uni.getStorageSync('roleType');
+		},
+		text() {
+			return `宸查鍙�${this.cars2}寮犳棩璁″垝鍗�,鍓╀綑${this.carNumSurplus1}寮犳棩璁″垝鍗昤;
 		}
 	},
 	methods: {
@@ -110,12 +155,12 @@
 					break;
 			}
 		},
-		checkboxChange(value) {
-			console.log('澶嶉�夋鍙樺寲', value);
+		checkboxChange(value, index) {
+			console.log('澶嶉�夋鍙樺寲', value, index);
 			if (value.length != 0) {
-				this.forwardForm.nums = this.forwardSurplus;
+				this.jhOrderPlanForwardList[index].carNum = this.forwardSurplus;
 			} else {
-				this.forwardForm.nums = null;
+				this.jhOrderPlanForwardList[index].carNum = null;
 			}
 		},
 		// 鑾峰彇璐т唬鍒楄〃
@@ -133,9 +178,9 @@
 			});
 		},
 		// 杞彂
-		forwardObjectClick() {
-			console.log('hahah');
+		forwardObjectClick(index) {
 			this.selectPopupShow = true;
+			this.index = index;
 			console.log(this.huoDaiData, this.fleetData, '杞彂');
 		},
 		selectPopupClose() {
@@ -147,27 +192,61 @@
 		// 杞彂閫夋嫨璐т唬
 		forwardHuoDaiObjectSelect(item) {
 			this.selectPopupShow = false;
-			this.forwardForm.userId = item.userId;
-			this.name = item.name;
-			this.forwardForm.fleetId = 0;
-			console.log('璐т唬閫夋嫨', this.forwardForm);
+			this.jhOrderPlanForwardList[this.index].xsUserId = item.userId;
+			this.jhOrderPlanForwardList[this.index].name = item.name;
+			this.jhOrderPlanForwardList[this.index].fleetId = 0;
+			console.log('璐т唬閫夋嫨', this.jhOrderPlanForwardList[this.index]);
 		},
 		// 杞彂閫夋嫨杞﹂槦
 		forwardFleetObjectSelect(item) {
 			this.selectPopupShow = false;
-			this.forwardForm.fleetId = item.id;
-			this.name = item.name;
-			this.forwardForm.userId = 0;
-			console.log('杞﹂槦閫夋嫨', this.forwardForm);
+			this.jhOrderPlanForwardList[this.index].fleetId = item.id;
+			this.jhOrderPlanForwardList[this.index].name = item.name;
+			this.jhOrderPlanForwardList[this.index].xsUserId = 0;
+			console.log('杞﹂槦閫夋嫨', this.jhOrderPlanForwardList[this.index]);
+		},
+		addForm() {
+			this.jhOrderPlanForwardList.push({
+				orderPlanId: this.orderPlanId,
+				name: '',
+				carNum: 0,
+				xsUserId: 0,
+				fleetId: 0,
+				checkboxValue1: ''
+			});
+		},
+		// 鍒犻櫎涓�缁勮〃鍗�
+		deleteGroup(index, v) {
+			if (v.id) {
+				this.$reqPost('deleteForward', { id: v.id }, 'params').then(res => {
+					if (res.code === 0) {
+						this.jhOrderPlanForwardList.splice(index, 1);
+						this.$u.toast('鍒犻櫎鎴愬姛');
+					}
+				});
+			} else {
+				this.jhOrderPlanForwardList.splice(index, 1);
+			}
 		},
 		// 鎻愪氦
 		submitForm() {
-			if (isNaN(Number(this.forwardForm.nums)) || Number(this.forwardForm.nums) <= 0) {
-				this.$u.toast('璇疯緭鍏ュ悎娉曟暟瀛�');
-			} else if (Number(this.forwardForm.nums) > Number(this.forwardSurplus)) {
-				this.$u.toast('瓒呰繃鏈�澶ц鍗曞墿浣欓噺');
-			} else {
-				this.$reqPost('forward', this.forwardForm, 'params').then(res => {
+			let isPass = false;
+			this.jhOrderPlanForwardList.forEach(v => {
+				if (isNaN(Number(v.carNum)) || Number(v.carNum) <= 0) {
+					this.$u.toast('璇疯緭鍏ュ悎娉曟暟瀛�');
+					isPass = false;
+					return isPass;
+				} 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 => {
 					if (res.code == 0) {
 						this.$u.toast('鎻愪氦鎴愬姛');
 						setTimeout(() => {
@@ -196,8 +275,11 @@
 
 	// 鍗$墖
 	.forward-card {
-		margin-top: vww(24);
-
+		margin-top: vww(10);
+		.notice-bar {
+			width: 100%;
+			height: vww(24);
+		}
 		.u-form {
 			.u-form-item {
 				.u-form-item__body {
@@ -227,8 +309,8 @@
 	}
 
 	.forwardBtn {
-		width: 90%;
-		position: fixed;
+		width: 100%;
+		// position: fixed;
 		bottom: vww(50);
 	}
 

--
Gitblit v1.9.1