From eec82b55813387e20087989536cd32810b59cd48 Mon Sep 17 00:00:00 2001
From: qingyiay <2386314947@qq.com>
Date: 星期五, 13 十月 2023 09:42:49 +0800
Subject: [PATCH] 大部分按钮增加loading 放空操作逻辑修改

---
 pages/driver-page/driver-index/bill-of-lading-details/weighingDevice/weighingDevice.vue |   36 +++++++++++------
 pages/login/userPassword.vue                                                            |    8 +++-
 pages/register/register.vue                                                             |    8 +++-
 pages/customer-page/customer-index/customer-index.vue                                   |    9 +++-
 pages/bindBackground/bindBackground.vue                                                 |    9 +++-
 pages/driver-page/driver-index/bill-of-lading-details/bill-of-lading-details.vue        |    9 +++-
 6 files changed, 56 insertions(+), 23 deletions(-)

diff --git a/pages/bindBackground/bindBackground.vue b/pages/bindBackground/bindBackground.vue
index 2d6eec6..1467513 100644
--- a/pages/bindBackground/bindBackground.vue
+++ b/pages/bindBackground/bindBackground.vue
@@ -22,7 +22,8 @@
 		</view>
 		<view class="loginBtn"><u-button type="primary"
 				text="纭"
-				@click="submit()"></u-button></view>
+				@click="submit()"
+				:loading="submitLoading"></u-button></view>
 	</view>
 </template>
 
@@ -33,7 +34,8 @@
 			return {
 				username: '',
 				password: '',
-				code: ''
+				code: '',
+				submitLoading: false
 			};
 		},
 		methods: {
@@ -68,6 +70,7 @@
 				})
 			},
 			setUpWxOpenid(userName, passWord, code) {
+				this.submitLoading = true
 				uni.request({
 					url: `${BaseUrl}/admin/user/setUpWxOpenid`,
 					data: {
@@ -83,8 +86,10 @@
 						console.log(res, '缁戝畾缁撴灉');
 						if (res.data.code === 1) {
 							this.$u.toast(res.data.msg ? res.data.msg : '缁戝畾澶辫触')
+							this.submitLoading = false
 						} else {
 							this.$u.toast('鎿嶄綔鎴愬姛')
+							this.submitLoading = false
 						}
 					}
 				})
diff --git a/pages/customer-page/customer-index/customer-index.vue b/pages/customer-page/customer-index/customer-index.vue
index 36f1c8e..3f52405 100644
--- a/pages/customer-page/customer-index/customer-index.vue
+++ b/pages/customer-page/customer-index/customer-index.vue
@@ -142,7 +142,8 @@
 					<view class="receiverPopup__btn"><u-button text="纭畾"
 							type="primary"
 							@click="popupDetermineClick"
-							:disabled="canClick"></u-button></view>
+							:disabled="canClick"
+							:loading="popupDetermineClickLoading"></u-button></view>
 				</view>
 			</u-popup>
 		</view>
@@ -203,7 +204,8 @@
 				carNum: "",
 				// 鍓╀綑鐨勬彁鐓ゅ崟鏁伴噺
 				carNumSurplus: '',
-				canClick: false
+				canClick: false,
+				popupDetermineClickLoading: false
 			};
 		},
 		onLoad() {
@@ -260,11 +262,13 @@
 			},
 			popupDetermineClick() {
 				if (this.receiveNum > 0) {
+					this.popupDetermineClickLoading = true;
 					this.getOrderNum.num = this.receiveNum;
 					uni.showLoading({ title: '鍔犺浇涓�...' });
 					this.$reqPost('customerGet', this.getOrderNum, 'params').then(res => {
 						uni.hideLoading();
 						if (res.code == 0) {
+							this.popupDetermineClickLoading = false;
 							this.getOrderNum.num = '';
 							this.GetOrderPlan();
 							this.show = false;
@@ -274,6 +278,7 @@
 								duration: 1000
 							});
 						} else {
+							this.popupDetermineClickLoading = false;
 							this.$u.toast(res.msg ? res.msg : '棰嗗彇澶辫触');
 						}
 					});
diff --git a/pages/driver-page/driver-index/bill-of-lading-details/bill-of-lading-details.vue b/pages/driver-page/driver-index/bill-of-lading-details/bill-of-lading-details.vue
index a8cb7d7..b8dd578 100644
--- a/pages/driver-page/driver-index/bill-of-lading-details/bill-of-lading-details.vue
+++ b/pages/driver-page/driver-index/bill-of-lading-details/bill-of-lading-details.vue
@@ -141,7 +141,8 @@
 						<u-button text="鎻愪氦"
 							type="primary"
 							@click.stop="submitOriginInfo"
-							:disabled="isModifyoriginInfo"></u-button>
+							:disabled="isModifyoriginInfo"
+							:loading="submitOriginInfoLoading"></u-button>
 					</view>
 				</view>
 			</view>
@@ -395,7 +396,8 @@
 				timeout: '0',
 				wsgShow: false,
 				timeLineStatus: null,
-				originInfoNotice: '濉啓鍘熷彂淇℃伅鍚庡彲涓婄璁¢噺'
+				originInfoNotice: '濉啓鍘熷彂淇℃伅鍚庡彲涓婄璁¢噺',
+				submitOriginInfoLoading: false
 			};
 		},
 		watch: {
@@ -882,10 +884,13 @@
 				if (this.originInfoForm.coalContactSkin && this.originInfoForm.coalContactHair && this
 					.originInfoForm
 					.contactPicture) {
+					this.submitOriginInfoLoading = true
 					this.$reqPost('appSaveContact', form, 'json').then(res => {
 						if (res.code === 0) {
 							this.$u.toast('鎻愪氦鎴愬姛')
+							this.submitOriginInfoLoading = false
 						} else {
+							this.submitOriginInfoLoading = false
 							this.isModifyoriginInfo = true
 							this.$u.toast(res.msg ? res.msg : '鎻愪氦澶辫触')
 
diff --git a/pages/driver-page/driver-index/bill-of-lading-details/weighingDevice/weighingDevice.vue b/pages/driver-page/driver-index/bill-of-lading-details/weighingDevice/weighingDevice.vue
index a846053..72ae6c0 100644
--- a/pages/driver-page/driver-index/bill-of-lading-details/weighingDevice/weighingDevice.vue
+++ b/pages/driver-page/driver-index/bill-of-lading-details/weighingDevice/weighingDevice.vue
@@ -189,6 +189,7 @@
 				plain
 				@click="evacuation"
 				throttleTime="500"
+				:loading="TwoEvacuationLoading"
 				v-if='weighList.skin||weighList.hair'></u-button>
 			<!-- 澶栭攢璁㈠崟绉扮毊鏃讹紝杩斿洖鍔犲噺鍚ㄦ寜閽疆鐏般�傜О姣涙椂鍙敤.澶栬喘璁㈠崟锛屼笉鍑虹幇杩斿洖鍔犲噺鍚ㄧ殑鎸夐挳 -->
 			<u-button type="primary"
@@ -203,7 +204,8 @@
 				:disabled="addAndSubtractCoalDisabled"
 				@click="addAndSubtractCoal"
 				class="jiajian"
-				v-if="outBuy||!isSkinWeigh"></u-button>
+				v-if="outBuy||!isSkinWeigh"
+				:loading="addAndSubtractCoalLoading"></u-button>
 		</view>
 		<view v-show="isExceedOrigin"
 			style="color: #ff6363;width: auto;margin: 0 auto;">
@@ -389,7 +391,9 @@
 				refreshLoading: false,
 				timer: null,
 				afterEvacuationStatus: null, //鏀剧┖鍚庢彁鐓ゅ崟鐘舵�佺姸鎬佷负21鏃舵彁绀衡�樼瓑寰呯鎴跨‘璁も��
-				afterEvacuationText: ''
+				afterEvacuationText: '',
+				TwoEvacuationLoading: false,
+				addAndSubtractCoalLoading: false
 			};
 		},
 		watch: {
@@ -582,6 +586,7 @@
 			},
 			// 鍔犲噺鐓�
 			addAndSubtractCoal() {
+				this.addAndSubtractCoalLoading = true
 				this.$reqPost('addAndSubtractCoal', {
 					deptId: this.weighData.deptId,
 					sceneId: this.weighData.sceneId,
@@ -592,6 +597,7 @@
 					weigh: this.weighData.weigh
 				}, 'json').then(res => {
 					if (res.code == 0) {
+						this.addAndSubtractCoalLoading = false
 						this.$u.toast('鎿嶄綔鎴愬姛锛屽嵆灏嗚繑鍥炰笂涓�椤�');
 						setTimeout(() => {
 							uni.navigateBack({
@@ -599,7 +605,8 @@
 							});
 							this.isConfirmWeighLoading = false;
 						}, 1000);
-						console.log(res, '鍔犲噺鐓�');
+					} else {
+						this.$u.toast(res.msg ? res.msg : '鎿嶄綔澶辫触');
 					}
 				});
 			},
@@ -609,22 +616,24 @@
 			},
 			// 鏀剧┖寮圭獥纭
 			evacuationConfirm() {
+				this.TwoEvacuationLoading = true;
 				this.$reqPost('getTwoEvacuation', this.weighData, 'json').then(res => {
 					console.log(res, '绗簩娆℃斁绌�');
-					if (res.code == 0) {
-						this.$u.toast('鎿嶄綔鎴愬姛');
-						// setTimeout(() => {
-						// 	uni.navigateBack({
-						// 		delta: 1
-						// 	});
-						// }, 1000);
+					if (res.msg.length > 4) { //澶т簬4鏄瓑寰呭悗鍙扮‘璁�
+						this.TwoEvacuationLoading = true;
 						this.evacuationModalShow = false;
 						this.afterEvacuationStatus = res.data.status === 21 || res.data.status === 22
 						this.afterEvacuationText = res.msg
 
-					} else {
-						this.$u.toast(res.msg ? res.msg : '鎿嶄綔澶辫触');
-						this.evacuationModalShow = true;
+					} else { //灏忎簬4鎴愬姛
+						this.TwoEvacuationLoading = false;
+						this.evacuationModalShow = false;
+						this.$u.toast('鎿嶄綔鎴愬姛,鍗冲皢杩斿洖涓婁竴椤�');
+						setTimeout(() => {
+							uni.navigateBack({
+								delta: 1
+							});
+						}, 1000);
 					}
 				});
 			},
@@ -700,6 +709,7 @@
 			confirmWeighConfirm() {
 				this.changeconfirmWeighVisiable(false)
 				this.isConfirmWeighLoading = false
+				this.TwoEvacuationLoading = false;
 				setTimeout(() => {
 					this.$u.toast('鍗冲皢杩斿洖涓婁竴椤�'),
 						uni.navigateBack({
diff --git a/pages/login/userPassword.vue b/pages/login/userPassword.vue
index 73b5cfc..fff267a 100644
--- a/pages/login/userPassword.vue
+++ b/pages/login/userPassword.vue
@@ -22,7 +22,8 @@
 		</view>
 		<view class="loginBtn"><u-button type="primary"
 				:text="btnText == 1 ? '缁戝畾' : '鐧诲綍'"
-				@click="submit()"></u-button></view>
+				@click="submit()"
+				:loading="submitLoading"></u-button></view>
 	</view>
 </template>
 
@@ -46,7 +47,8 @@
 				// username: '13333333332',// 鍙告満
 				password: '',
 				remember: true,
-				baseUrl: ''
+				baseUrl: '',
+				submitLoading: false
 			};
 		},
 		methods: {
@@ -67,6 +69,7 @@
 				}
 				let grant_type = 'password';
 				//鐧诲綍鎺ュ彛
+				this.submitLoading = true
 				await apiLoginPassword({
 						username: this.username,
 						password: this.password,
@@ -77,6 +80,7 @@
 						setToken(res.access_token);
 						setRefreshToken(res.refresh_token);
 						if (this.btnText == 0) {
+							this.submitLoading = false
 							if (res.code != 1) {
 								// 鐧婚檰鎴愬姛锛屽瓨鍌ㄧ浉鍏充俊鎭�
 								setToken(res.access_token);
diff --git a/pages/register/register.vue b/pages/register/register.vue
index 3be71e8..3bb222e 100644
--- a/pages/register/register.vue
+++ b/pages/register/register.vue
@@ -144,7 +144,8 @@
 		</view>
 		<view class="registerBtn"><u-button text="娉ㄥ唽"
 				type="primary"
-				@click="registerClick"></u-button></view>
+				@click="registerClick"
+				:loading="registerClickloading"></u-button></view>
 		<!-- 鍥剧墖棰勮寮瑰嚭妗� -->
 		<!-- <view class="previewImage-container">
 			<u-popup :show="previewImageShow" mode="center" @close="previewImageClose" @open="previewImageOpen">
@@ -315,7 +316,8 @@
 				title: '鎻愮ず',
 				content: '褰撳墠濉叆淇℃伅锛屽垏鎹㈣鑹插悗锛屽嵆娓呴櫎锛屾槸鍚﹀垏鎹紵',
 				wxcode: '',
-				openid: ''
+				openid: '',
+				registerClickloading: false
 			};
 		},
 		watch: {
@@ -349,9 +351,11 @@
 						.validate()
 						.then(res => {
 							console.log(this.registerFormModel);
+							this.registerClickloading = true;
 							this.registerFormModel.username = this.registerFormModel.phone;
 							apiRegister(this.registerFormModel)
 								.then(res => {
+									this.registerClickloading = false;
 									if (res.data.code == 0) {
 										uni.showToast({
 											title: '娉ㄥ唽鎴愬姛,鍗冲皢杩斿洖鐧诲綍椤�',

--
Gitblit v1.9.1