From 05b5c1f397bad8fb53a73ffe55209f573d309f4e Mon Sep 17 00:00:00 2001
From: 付延余 <f-yanyu@outlook.com>
Date: 星期四, 22 十二月 2022 00:25:30 +0800
Subject: [PATCH] 日发运计划接口同步后台更新。完善页面细节

---
 utils/jihua.js        |   20 ++
 utils/request.js      |    1 
 pages/login/login.vue |    2 
 pages/jihua/jihua.vue |  296 ++++++++++++++++++++++++++++++-------------------
 api/global.js         |   13 -
 5 files changed, 205 insertions(+), 127 deletions(-)

diff --git a/api/global.js b/api/global.js
index c8be2af..37fcfb2 100644
--- a/api/global.js
+++ b/api/global.js
@@ -1,6 +1,7 @@
 // import request from '@/config/request';
+import { BaseUrl } from '@/utils/request.js'
 
-// let baseUrl = "/";
+// let BaseUrl = "/";
 // const CURRENT_KEY = 'CURRENT_KEY';
 // const PARAM_KEY = 'PARAM_KEY';
 
@@ -27,12 +28,6 @@
 	});
 }
 
-// const baseUrl = 'http://192.168.3.159:9999'
-// const baseUrl = 'https://mx.jzeg.cn:443/app';
-// let baseUrl = 'http://192.168.0.114:9999';
-
-const baseUrl = "https://mx.jzeg.cn:9998"; // 姝e紡鏈嶅姟
-
 // POST璇锋眰
 function apiLogin({
 	username,
@@ -44,7 +39,7 @@
 
 	return new Promise((resolve, reject) => {
 		uni.request({
-			url: baseUrl + "/auth/oauth/token?grant_type=password&scope=server",
+			url: BaseUrl + "/auth/oauth/token?grant_type=password&scope=server",
 			method: "POST",
 			data: {
 				username,
@@ -79,7 +74,7 @@
 
 	return new Promise((resolve, reject) => {
 		uni.request({
-			url: baseUrl + `/auth/mobile/token/social?grant_type=mobile&mobile=MINI@${code}`,
+			url: BaseUrl + `/auth/mobile/token/social?grant_type=mobile&mobile=MINI@${code}`,
 			method: "POST",
 			header: {
 				"TENANT-ID": "5",
diff --git a/pages/jihua/jihua.vue b/pages/jihua/jihua.vue
index 04c277a..1529468 100644
--- a/pages/jihua/jihua.vue
+++ b/pages/jihua/jihua.vue
@@ -11,17 +11,16 @@
 				</u-radio-group>
 			</view>
 			<view class="main-inside">
-				<view v-if="isTomJihua == '鍏ㄩ儴'">
+				<view v-if="isTomJihua == '鍏ㄩ儴'" class="totalListContainer">
 					<u-empty v-if="fyData.length == 0" mode="data" icon="http://cdn.uviewui.com/uview/empty/data.png" class="empty-container"></u-empty>
-					<view id="u-dropdown" class="main-block-box" v-for="(item, index) in fyData" :key="item.id" ref="planViewRef">
+					<view id="u-dropdown" class="main-block-box" v-for="(item, index) in fyData" :key="item.orderId" ref="planViewRef">
 						<view class="jihua-main-line">
-							<!-- <view class="name">瀹㈡埛鍚嶇О锛歿{item.customerName || ''}}</view> -->
-							<view class="name">鏀惰揣鍗曚綅锛歿{ item.customerAddressName || '' }}</view>
+							<view class="name">瀹㈡埛鍚嶇О锛歿{item.customerName || ''}}</view>
 						</view>
 						<view class="jihua-main-line">
 							<view class="main-flex">
-								<view>鐓ょ锛歿{ item.coalName || '' }}</view>
-								<view>鍓╀綑閲忥細{{ item.executiveSurplus || '' }}</view>
+								<view>鐓ょ锛歿{ item.order.coalName || '' }}</view>
+								<view style="margin-right:10px">鍓╀綑閲忥細{{ item.order.executiveSurplus || '' }} 鍚�</view>
 							</view>
 						</view>
 						<view class="jihua-main-line">
@@ -31,10 +30,10 @@
 									<!-- <u--input placeholder="璇疯緭鍏ュ彂杩愯溅鏁�" border="surround" v-model="item.numPlan" @change="inputChange" @focus="faYunPlanCarsFocus(item)"></u--input> -->
 									<view class="planCars" :style="{color:item.numPlan  ? '#111':'#ccc'}" @click="faYunPlanCarsFocus(item)">
 										<text v-model="item.numPlan">{{ item.numPlan || '鐐瑰嚮杈撳叆鏁伴噺' }}</text>
-										<view class="cursor" v-if="isCursor && fayunPlanFocusId == item.id"><image src="@/static/cursor.gif" mode=""><image></view>
+										<view class="cursor" v-if="isCursor && fayunPlanFocusId == item.orderId"><image src="@/static/cursor.gif" mode=""><image></view>
 									</view>
 								</view>
-								<view>瀹為檯鍙戣溅鏁帮細{{ item.numReal || '鏆傛棤' }}</view>
+								<view style="margin-right:10px">瀹為檯鍙戣溅鏁帮細{{ item.numReal || '鏆傛棤' }}</view>
 							</view>
 						</view>
 						<u-keyboard    
@@ -57,14 +56,14 @@
 				</view>
 				<view v-if="isTomJihua == '宸茶缃殑璁″垝'">
 					<u-empty v-if="fyData.length == 0" mode="data" icon="http://cdn.uviewui.com/uview/empty/data.png" class="empty-container"></u-empty>
-					<view class="main-block-box" v-for="(item, index) in fyData" :key="item.id">
+					<view class="main-block-box" v-for="(item, index) in fyData" :key="item.orderId">
 						<view class="jihua-main-line">
 							<view class="name">瀹㈡埛鍚嶇О锛歿{ item.customerName || '' }}</view>
 						</view>
 						<view class="jihua-main-line">
 							<view class="main-flex">
 								<view>鐓ょ锛歿{ item.order.coalName || '' }}</view>
-								<view>鍓╀綑閲忥細{{ item.order.executiveSurplus || '' }}</view>       
+								<view style="margin-right:10px">鍓╀綑閲忥細{{ item.order.executiveSurplus || '' }} 鍚�</view>
 							</view>
 						</view>
 						<view class="jihua-main-line">
@@ -74,12 +73,12 @@
 									<!-- <u--input placeholder="璇疯緭鍏ュ彂杩愯溅鏁�" border="surround" v-model="item.numPlan" @change="inputTotalChange(item)" @focus="faYunPlanCarsFocus(item)"></u--input> -->
 									<view class="planCars" :style="{color:item.numPlan  ? '#111':'#ccc'}" @click="faYunPlanCarsFocus(item)">
 										<text v-model="item.numPlan">{{ item.numPlan || '鐐瑰嚮杈撳叆鏁伴噺' }}</text>
-										<view class="cursor" v-if="isCursor && fayunPlanFocusId == item.id">
+										<view class="cursor" v-if="isCursor && fayunPlanFocusId == item.orderId">
 											<image src="@/static/cursor.gif" mode="" />
 										</view>
 									</view>
 								</view>
-								<view>瀹為檯鍙戣溅鏁帮細{{ item.order.numReal == null ? '鏆傛棤' : item.order.numReal }}</view>
+								<view style="margin-right:10px">瀹為檯鍙戣溅鏁帮細{{ item.numReal == null ? '鏆傛棤' : item.numReal }}</view>
 							</view>
 						</view>
 						<u-keyboard
@@ -97,10 +96,18 @@
 							zIndex="100000"
 						></u-keyboard>
 					</view>
-					<u-button class="xiugai-btn" type="primary" text="淇敼" @click="editPlan"></u-button>
 				</view>
 			</view>
 		</view>
+		
+		<!-- 淇敼寮瑰嚭妗� -->
+		<u-popup :show="editPopupShow" @close="editPopupClose" @open="editPopupOpen" mode="top" round="10">
+			<view class="editPopup">
+				<view class="editPopup__title"><text>璁″垝杞︽暟</text></view>
+				<view class="editPopup__input"><u--input v-model="keyBoardValue" @change="change" placeholder="璇疯緭鍏ュ唴瀹�" type="number" border="surround"></u--input></view>
+				<!-- <view class="editPopup__btn"><u-button text="纭畾" type="primary" @click="popupDetermineClick"></u-button></view> -->
+			</view>
+		</u-popup>
 
 		<view class="back-top-container"><u-back-top :scroll-top="scrollTop" icon="arrow-up" mode="square"></u-back-top></view>
 		<!-- 鑿滃崟鏍� -->
@@ -111,6 +118,7 @@
 <script>
 import popupMenu from '@/components/common/popup-menu/popup-menu.vue';
 import tool from '@/utils/tool.js';
+import { TrackOpTypes } from "vue";
 export default {
 	components: {
 		popupMenu
@@ -133,6 +141,7 @@
 				shippingDate: this.todayDate()
 			},
 			isTomJihua: '鍏ㄩ儴',
+			editPopupShow:false,// 淇敼寮瑰嚭妗�
 			editRow: '', //淇敼琛岀殑琛�
 			menuShow: false,
 			scrollTop: 0, // 杩斿洖椤堕儴鎸夐挳缁戝畾,
@@ -156,7 +165,6 @@
 	},
 	// 鐐瑰嚮瀵艰埅鏍忚彍鍗曞悗
 	onNavigationBarButtonTap(e) {
-		// console.log(e);
 		this.$refs.menuRef.menuClick();
 	},
 	mounted() {
@@ -176,14 +184,10 @@
 		},
 		keyBoardValue: {
 			handler: function(newV, oldV) {
-				console.log('閿洏杈撳叆鍊�', newV, oldV);
 				this.fyData.map(item => {
-					if (item.id == this.fayunPlanFocusId) {
+					if ( this.isTomJihua == '鍏ㄩ儴'&&item.orderId == this.fayunPlanFocusId) {
 						if (item.numPlan && item.numPlan != newV) {
 							item.numPlan = this.keyBoardValue;
-							if (this.isTomJihua == '宸茶缃殑璁″垝') {
-								this.editRow = item;
-							}
 						}
 					}
 				});
@@ -193,7 +197,6 @@
 		},
 		scrollTop: {
 			handler: function(newV, oldV) {
-				// console.log('椤甸潰婊戝姩', newV);
 				if (newV != oldV) {
 					this.keyBoardClose();
 					// this.keyBoardShow = false;
@@ -210,51 +213,7 @@
 		menushow(e) {
 			this.menuShow = e;
 		},
-		//鎻愪氦
-		dataFormSubmit() {
-			console.log('鏃ュ彂杩愯鍒掓洿鏂版暟鎹彁浜�',this.fyData);
-				this.overlayShow = true;
-				this.fyData.forEach(e => {
-					e.shippingDate = this.info.shippingDate;
-					if (e.planId && !e.numPlan) {
-						e.numPlan = -1; // 鍒犻櫎璁剧疆涓虹┖鐨勮鍒�
-					}
-					let orderId = e.id;  // 璁㈠崟id
-					e.orderId = orderId;
-					// e.id = e.planId;
-				});
-				this.$reqPost('addObj', this.fyData).then(res => {
-					console.log('addObj鎺ュ彛杩斿洖',res);
-					this.$u.toast('娣诲姞鎴愬姛');
-					this.fyList();
-				});
-		},
-		// 鍏ㄩ儴鏃ヨ鍒掓彁浜ゆ寜閽槻鎶�
-		submit:tool.throttle(function(){
-				this.dataFormSubmit();
-		}),
-		// 淇敼鏃ヨ鍒掓寜閽�
-		getOrderCarNum() {
-			//淇敼
-			this.$reqPost('setCarNums', this.editRow).then(res => {
-				this.$u.toast('淇敼鎴愬姛');
-				this.xscarshippingdayplan();
-			});
-		},
-		// 淇敼鏃ヨ鍒掗槻鎶栨寜閽�
-		editPlan:tool.throttle(function(){
-			this.getOrderCarNum();
-		}),
-		// 鍒囨崲鍏ㄩ儴鍜屽凡璁剧疆
-		groupChange(n) {
-			console.log(n, 'n================');
-			this.isTomJihua = n;
-			if (n == '宸茶缃殑璁″垝') {
-				this.xscarshippingdayplan();
-			} else {
-				this.fyList();
-			}
-		},
+		// 鍏ㄩ儴璁″垝鍒楄〃
 		fyList() {
 			this.overlayShow = true;
 			//鍒楄〃鏌ヨ
@@ -264,22 +223,22 @@
 			let compId = uni.getStorageSync('userInfo').compId;
 			let params = {
 				current: 1,
-				size: 100,
+				size: 900,
 				status: 2,
 				trainType: 1,
-				compId: compId
+				compId: compId,
+				endDate: this.info.shippingDate
 			};
 			this.$reqGet('fyList', params).then(res => {
 				if (res.code == 0) {
-					console.log('fylist--------',res.data);
-					this.xscarshippingdayplan(res.data);
+					this.fyData = res.data;
+					uni.hideLoading();
+					this.overlayShow = false;
 				}
 			});
 		},
-		xscarshippingdayplan(allList) {
-			uni.showLoading({
-				title: '姝e湪鍔犺浇...'
-			});
+		// 宸茶缃鍒掑垪琛�
+		xscarshippingdayplan() {
 			this.overlayShow = true;
 			//宸茬粡璁剧疆鐨�
 			let params = {
@@ -287,29 +246,13 @@
 				size: 50,
 				shippingDate: this.info.shippingDate
 			};
+			uni.showLoading({
+				title: '姝e湪鍔犺浇...'
+			});
 			this.$reqGet('xscarshippingdayplan', params)
 				.then(res => {
-					console.log('涓嶇煡閬撴槸浠�涔�---------------',res);
 					if (res.code == 0) {
-						if (allList) {
-							let selectFyData = res.data.records;
-							allList.forEach(e => {
-								selectFyData.forEach(ee => {
-									if (e.id == ee.orderId) {
-										e.numPlan = ee.numPlan;
-										e.numReal = ee.numReal;	
-										// e.planId = ee.id;
-										console.log('淇敼planid鎿嶄綔',`planId:${ee.id}`);
-										if (ee.carNums != null) {
-											e.carNums = ee.carNums;
-										}
-									}
-								});
-							});
-							this.fyData = allList;
-						} else {
-							this.fyData = res.data.records;
-						}
+						this.fyData = res.data.records;
 						uni.hideLoading();
 						this.overlayShow = false;
 					}
@@ -319,9 +262,82 @@
 					this.overlayShow = false;
 				});
 		},
+		//鎻愪氦
+		dataFormSubmit() {
+			this.overlayShow = true;
+			this.fyData.forEach(e => {
+				if(!e.shippingDate && e.numPlan){
+					e.shippingDate = this.info.shippingDate
+				}
+			});
+			this.$reqPost('addObj', this.fyData).then(res => {
+				if(res.code == 0){
+					setTimeout(()=>{
+						uni.showToast({
+							title:'鏇存柊鎴愬姛锛�',
+							icon:'none',
+							duration:1000
+						})
+					},0)
+					this.fyList();
+				}
+			});
+		},
+		// 鍏ㄩ儴鏃ヨ鍒掓彁浜ゆ寜閽槻鎶�
+		submit:tool.throttle(function(){
+				this.dataFormSubmit();
+		}),
+		// 淇敼鏃ヨ鍒掓寜閽�
+		getOrderCarNum() {
+			this.overlayShow = true;
+			uni.showLoading({
+				title:'鍔犺浇涓�...'
+			})
+			//淇敼
+			 this.$reqPost('setCarNums', this.editRow).then(res => {
+				uni.hideLoading();
+				if(res.code == 0){
+					// 璁剧疆setTimeout鏄伩鍏島ni.showToast琚玼ni.showLoading瑕嗙洊鎺�
+					setTimeout(()=>{
+						uni.showToast({
+							title:'淇敼鎴愬姛',
+							icon:'none',
+							duration:1000,
+							position:'bottom'
+						})
+					},0)
+				}else{
+					setTimeout(()=>{
+						uni.showToast({
+							title:'淇敼澶辫触',
+							icon:'none',
+							duration:1000
+						})
+					},0)
+				}
+				this.overlayShow = false;
+				this.xscarshippingdayplan();
+			});
+		},
+		// 淇敼寮瑰嚭妗�
+		editPopupClose(){
+			console.log('淇敼寮瑰嚭妗咰lose');
+			// this.editPopupShow = false;
+		},
+		editPopupOpen(){
+			console.log('淇敼寮瑰嚭妗哋pen');
+		},
+		// 鍒囨崲鍏ㄩ儴鍜屽凡璁剧疆
+		groupChange(n) {
+			this.isTomJihua = n;
+			if (n == '宸茶缃殑璁″垝') {
+				this.xscarshippingdayplan();
+			} else {
+				this.fyList();
+			}
+		},
 		//鍒囨崲浠婃棩鍜屾槑鏃�
 		tabClick(item) {
-			console.log(item, 'item==========');
 			if (item.index == 1) {
 				this.info.shippingDate = this.tomorrowDate();
 				if (this.isTomJihua == '宸茶缃殑璁″垝') {
@@ -351,21 +367,28 @@
 			// let boxBottom = document.getElementById('#u-dropdown');
 			// console.log('鍏冪礌',boxBottom);
 			// let bottom = this.$refs.planViewRef.offsetHeight
-			
-			this.fayunPlanFocusId = item.id;
 			this.keyBoardShow = true;
-			this.isCursor = true;
+			this.fayunPlanFocusId = item.orderId;
 			this.keyBoardValue = item.numPlan + '';
+			if(this.isTomJihua == '宸茶缃殑璁″垝'){
+				this.editPopupShow = true;
+			} else{
+				this.isCursor = true;
+			}
 		},
 		// 閿洏
 		valChange(val) {
 			// this.keyBoardValue += val;
 			// 灏嗘瘡娆℃寜閿殑鍊兼嫾鎺ュ埌value鍙橀噺涓紝娉ㄦ剰+=鍐欐硶
 			this.fyData.map(item => {
-				if (item.id == this.fayunPlanFocusId) {
+				if (item.orderId == this.fayunPlanFocusId) {
 					if (item.numPlan) {
-						item.numPlan = this.keyBoardValue += val + '';
-						this.keyBoardValue = item.numPlan;
+						if(this.isTomJihua == '鍏ㄩ儴'){
+							item.numPlan = this.keyBoardValue += val + '';
+							this.keyBoardValue = item.numPlan;
+						}else{
+							this.keyBoardValue = this.keyBoardValue += val + '';
+						}
 					} else {
 						item.numPlan = val;
 						this.keyBoardValue = item.numPlan;
@@ -376,18 +399,28 @@
 		backspace() {
 			this.keyBoardValue = this.keyBoardValue.substr(0, this.keyBoardValue.length - 1);
 		},
-		keyBoardConfirm(val) {
-			console.log('閿洏鐐瑰嚮纭畾鐨勫��', val);
+		// 閿洏鐐瑰嚮纭畾
+		keyBoardConfirm() {
+			if(this.isTomJihua == '宸茶缃殑璁″垝'){
+				this.fyData.map(item => {
+					if (item.orderId == this.fayunPlanFocusId) {
+						item.numPlan = this.keyBoardValue;
+						this.editRow = item;
+					}
+				});
+				this.getOrderCarNum();
+			}
 			this.keyBoardClose();
 		},
 		keyBoardCancel() {
 			this.keyBoardClose();
 		},
+		// 閿洏鍏抽棴浜�
 		keyBoardClose() {
-			console.log('閿洏鍏抽棴浜�');
 			this.fayunPlanFocusId = null;
 			this.keyBoardShow = false;
 			this.isCursor = false;
+			this.editPopupShow = false;
 		},
 		todayDate() {
 			let yes = new Date().getTime();
@@ -398,7 +431,6 @@
 			let d = date.getDate();
 			d = d < 10 ? '0' + d : d;
 			const time = y + '-' + m + '-' + d;
-			console.log('todayDate---------', time);
 			return time;
 		},
 		tomorrowDate() {
@@ -410,7 +442,6 @@
 			let d = date.getDate();
 			d = d < 10 ? '0' + d : d;
 			const time = y + '-' + m + '-' + d;
-			console.log('tomorrowDate---------222', time);
 			return time;
 		}
 	}
@@ -439,15 +470,7 @@
 		width: vww(100);
 		z-index: 1;
 	}
-	.u-button {
-		position: fixed !important;
-		left: 50%;
-		bottom: vww(20);
-		width: vww(200) !important;
-		transform: translateX(-50%);
-		border-radius: vww(20);
-		z-index: 9999;
-	}
+	
 	.u-radio-group--row {
 		height: 100%;
 		width: 100%;
@@ -469,6 +492,19 @@
 	}
 }
 
+::v-deep.totalListContainer{
+	.u-button {
+		position: fixed !important;
+		left: 50%;
+		bottom: vww(20);
+		width: vww(200) !important;
+		transform: translateX(-50%);
+		border-radius: vww(20);
+		z-index: 9999;
+	}
+}
+
+
 .qiehuan-box {
 	position: fixed;
 	top: 0;
@@ -480,7 +516,7 @@
 	background-color: #fff;
 }
 
-.jihua-wrap {
+::v-deep.jihua-wrap {
 	width: 100%;
 	height: 100%;
 	// overflow-y: auto; // 浼氬紩璧烽敭鐩樺脊鍑洪〉闈㈠竷灞�
@@ -495,6 +531,7 @@
 	// 	transform: translateX(-50%);
 	// 	border-radius: vww(20);
 	// }
+	
 }
 
 .jihua-main {
@@ -584,4 +621,33 @@
 		}
 	}
 }
+
+// 淇敼璁″垝杞﹁締寮瑰嚭妗�
+
+
+::v-deep.editPopup {
+		height: vww(110);
+
+		&__title {
+			margin-top: vww(10);
+			text-align: center;
+		}
+
+		&__input {
+			margin: vww(10) auto 0;
+			.u-input {
+				width:80%;
+				margin:0 auto!important;
+				border: 1px solid #dddddd;
+			}
+		}
+
+		// &__btn {
+		// 	margin: vww(80) auto;
+		// 	width: 50%;
+		// 	.u-button {
+		// 		height: vww(40);
+		// 	}
+		// }
+	}
 </style>
\ No newline at end of file
diff --git a/pages/login/login.vue b/pages/login/login.vue
index 2b7adac..da9de09 100644
--- a/pages/login/login.vue
+++ b/pages/login/login.vue
@@ -232,6 +232,8 @@
  				// password: '123456aaa',
 				// username: 'gequan',
 				// password: 'gequan!@#$',
+				// username: 'dongpang',
+				// password: 'dongpang!@#',
 				username: '',
 				password: ''
  			},
diff --git a/utils/jihua.js b/utils/jihua.js
index 1090277..9fdb15c 100644
--- a/utils/jihua.js
+++ b/utils/jihua.js
@@ -5,10 +5,24 @@
 		method: 'GET'
 	},
 	// 鍙戣繍鍒楄〃
-	fyList: {
-		url: '/yunxiao/contractorder/fyList',
-		method: 'GET'
+	
+	/**
+	 * 閫欐槸鏈塨ug鐨勬帴鍙�
+	 */
+	// fyList: {
+	// 	url: '/yunxiao/contractorder/fyList',
+	// 	method: 'GET'
+	// },
+	
+	/**
+	 * 閫欐槸姝g⒑鐨�
+	 */
+	fyList:{
+		url:'/yunxiao/xscarshippingdayplan/fyList',
+		method:'GET'
 	},
+	
+	
 	xscarshippingdayplan: {
 		url: '/yunxiao/xscarshippingdayplan/page',
 		method: 'GET'
diff --git a/utils/request.js b/utils/request.js
index 3f3cdea..eddc284 100644
--- a/utils/request.js
+++ b/utils/request.js
@@ -85,6 +85,7 @@
 // let BaseUrl = 'http://192.168.3.159:9999';
 // const BaseUrl = 'https://mx.jzeg.cn:443/app';
 // let BaseUrl = 'http://192.168.0.114:9999';
+// const BaseUrl = 'http://192.168.0.102:9999'; // 椋炲摜
 
 const BaseUrl = "https://mx.jzeg.cn:9998"; // 姝e紡鏈嶅姟
 

--
Gitblit v1.9.1