From 9b80c42df73cb99b37d95b5c0a186ceec5e45a27 Mon Sep 17 00:00:00 2001
From: liukangdong <898885815@qq.com>
Date: 星期二, 07 一月 2025 17:23:31 +0800
Subject: [PATCH] ll

---
 h5/pages/driver/reserved.vue |   43 +++++++++++++++++++++++++++++++++----------
 1 files changed, 33 insertions(+), 10 deletions(-)

diff --git a/h5/pages/driver/reserved.vue b/h5/pages/driver/reserved.vue
index 90f4ccd..1ec23fd 100644
--- a/h5/pages/driver/reserved.vue
+++ b/h5/pages/driver/reserved.vue
@@ -48,7 +48,7 @@
 					<text>鎬昏繍杈撻噺</text>
 				</view>
 				<view class="value">
-					<input type="number" placeholder="璇疯緭鍏ユ�昏繍杈撻噺" v-model="param.totalNum" placeholder-style="color: #999999;" />
+					<input type="number" @blur="checkSurplus" placeholder="璇疯緭鍏ユ�昏繍杈撻噺" v-model="param.totalNum" placeholder-style="color: #999999;" />
 					<text class="unit">涓囨敮</text>
 				</view>
 			</view>
@@ -98,9 +98,10 @@
 				</view>
 			</view>
 			<view class="copy" @click="copy">澶嶅埗杞﹀墠鐗岀収鍙�</view>
-			<view class="perch"></view>
-			<view class="handle_sub" @click="onSubmit">
-				鎻愪氦
+			<view class="footer">
+				<view class="handle_sub" @click="onSubmit">
+					鎻愪氦
+				</view>
 			</view>
 		</view>
 		
@@ -122,7 +123,7 @@
 
 <script>
 import keyboardInput from '@/components/keyboard-input/keyboard-input.vue';
-import { uploadUrl, driverCarApply,driverCarApplyEdit, driverReasonList, driverApplyDetail } from '@/api';
+import { uploadUrl, driverCarApply,driverCarApplyEdit, driverReasonList, driverApplyDetail, checkSurplusNum } from '@/api';
 import dayjs from 'dayjs'
 export default {
 	components: {
@@ -150,6 +151,21 @@
 		this.initData()
 	},
 	methods: {
+		checkSurplus() {
+		      const { arriveDate, reasonId, totalNum } = this.param
+		      if(!arriveDate || !reasonId || !totalNum) return
+		      checkSurplusNum({
+		        arriveDate: arriveDate + ':00',
+		        reasonId,
+		        totalNum
+		      }).then(res => {
+		        console.log('res', res);
+		        
+		        if( res.data == 0 ||  res.data < Number(totalNum)){
+		          this.showToast(`褰撴棩鍓╀綑鍙绾︿綔涓氶噺涓嶈冻璇烽�夋嫨鍏朵粬鍒板満鏃ユ湡`)
+		        }
+		      })
+		    },
 		reasonClick() {
 			if(this.param.id){
 				return
@@ -174,7 +190,9 @@
 					setTimeout(() => {
 						this.showToast('棰勭害鐢宠鎴愬姛')
 					})
-					this.$jump('/pages/driver/reservedRecord')
+					uni.redirectTo({
+						url: '/pages/driver/index'
+					})
 				}
 			})
 		},
@@ -196,10 +214,12 @@
 			const index = e.indexs[0]
 			this.$set(this.param, 'inReason', reasonList[index].reason)
 			this.$set(this.param, 'reasonId', reasonList[index].id)
+			this.checkSurplus()
 			this.showReason = false
 		},
 		setinDate(e) {
 			this.$set(this.param, 'arriveDate', dayjs(e.value).format('YYYY-MM-DD HH:mm'))
+			this.checkSurplus()
 			this.showDatetime = false
 		},
 		inTypeClick(e) {
@@ -360,12 +380,14 @@
 	}
 }
 .main_app {
-	// padding-top: 10rpx;
+	padding-top: 10rpx;
+	.footer{
+		background-color: #f7f7f7;
+		padding: 20rpx 30rpx 30rpx;
+		margin: 0 -30rpx;
+	}
 	.handle_sub{
-		position: fixed;
-		bottom: 64rpx;
 		width: 690rpx;
-		left: 30rpx;
 		background-color: #4d99a8;
 		height: 88rpx;
 		line-height: 88rpx;
@@ -383,6 +405,7 @@
 		background-color: #f7f7f7;
 		display: flex;
 		margin: 0 -30rpx;
+		width: 750rpx;
 		justify-content: flex-end;
 		padding: 12rpx 30rpx;
 		font-size: 26rpx;

--
Gitblit v1.9.3