From 4e517dc54e1e3e5e5b543383c321161de351272e Mon Sep 17 00:00:00 2001
From: yangan <yangan0921@163.com>
Date: 星期一, 11 十一月 2024 16:05:06 +0800
Subject: [PATCH] Merge branch 'feature/jlhg/first' of http://39.96.92.240:10000/r/~fyy/unattended-app into feature/jlhg/first

---
 pages/customer-page/addTo-freightForwarder-driver/addTo-freightForwarder-driver.vue |  255 ++++++++++++++++++++++++++++++--------------------
 1 files changed, 153 insertions(+), 102 deletions(-)

diff --git a/pages/customer-page/addTo-freightForwarder-driver/addTo-freightForwarder-driver.vue b/pages/customer-page/addTo-freightForwarder-driver/addTo-freightForwarder-driver.vue
index 4bf211f..322283c 100644
--- a/pages/customer-page/addTo-freightForwarder-driver/addTo-freightForwarder-driver.vue
+++ b/pages/customer-page/addTo-freightForwarder-driver/addTo-freightForwarder-driver.vue
@@ -1,122 +1,173 @@
 <template>
-	<!-- 娣诲姞璐т唬鎴栧徃鏈� -->
+	<!-- 娣诲姞鎵胯繍鍟嗘垨鍙告満 -->
 	<view class="addTo-freightForwarder-drvier">
 		<view class="addForm">
-			<u--form labelPosition="top" ref="form1">
-				<u-form-item labelWidth="20%" label="濮撳悕" ref="item1"><u--input v-model="name" :customStyle="{ border: '1px solid #dddddd' }"></u--input></u-form-item>
-				<u-form-item labelWidth="25%" label="鎵嬫満鍙�" ref="item1"><u--input v-model="phone" :customStyle="{ border: '1px solid #dddddd' }"></u--input></u-form-item>
-				<u-form-item labelWidth="25%" label="姹借溅杞︾墝鍙�" ref="item1" v-if="role == 2">
-					<u--input v-model="carNo" :customStyle="{ border: '1px solid #dddddd' }"></u--input>
+			<u--form labelPosition="top"
+				ref="form1">
+				<u-form-item labelWidth="20%"
+					:label="role == 1 ?'鎵胯繍鍟�' : '濮撳悕'" 
+					ref="item1"
+					v-if="role == 1"><u--input v-model="name"
+						:customStyle="{ border: '1px solid #dddddd' }"></u--input></u-form-item>
+				<u-form-item labelWidth="25%"
+					label="鎵嬫満鍙�"
+					ref="item1"
+					v-if="role == 1"><u--input v-model="phone"
+						:customStyle="{ border: '1px solid #dddddd' }"></u--input></u-form-item>
+				<u-form-item labelWidth="25%"
+					label="姹借溅杞︾墝鍙�"
+					ref="item1"
+					v-if="role == 2">
+					<xm-cell special label="杞︾墝鍙�" :value="carNo" @show="showKeyboard('xmKeyboard')"></xm-cell>
+					<xm-keyboard-v2 ref="xmKeyboard" @confirm="(v) => carNo = v"></xm-keyboard-v2>
 				</u-form-item>
 			</u--form>
 		</view>
-		<view class="addBtn"><u-button text="閭�璇�" type="primary" @click="addToHuoDaiOrDriver"></u-button></view>
+		<view class="else-invite"
+			@click="elseInvite">
+			+浠庡叾浠栬溅闃熼�夋嫨
+		</view>
+		<view class="addBtn"><u-button text="閭�璇�"
+				type="primary"
+				@click="addToHuoDaiOrDriver"
+				:loading="loading"></u-button></view>
 	</view>
 </template>
 
 <script>
-import { customerId } from '@/utils/status.js';
-import { mapMutations } from 'vuex';
-export default {
-	onLoad(params) {
-		this.role = params.role;
-		if (params.fleetId) {
-			this.fleetId = params.fleetId;
-		}
-	},
-	data() {
-		return {
-			role: null, // 鍐冲畾娣诲姞璐т唬鍙告満锛岃繕鏄溅闃熷徃鏈�
-			fleetId: null,
-			name: '',
-			phone: '',
-			carNo: '',
-			customerId
-		};
-	},
-	methods: {
-		...mapMutations(['lengthchange']),
-		init() {},
-		addToHuoDaiOrDriver() {
-			switch (this.role) {
-				case '1':
-					if (this.name == '' || this.phone == '') {
-						uni.showToast({
-							title: '璇疯鑼冭緭鍏ワ紒',
-							icon: 'error',
-							duration: 2000
-						});
-					} else {
-						this.bindHuoDai();
-					}
-					break;
-				case '2':
-					if (this.name == '' || this.phone == '' || this.carNo == '') {
-						uni.showToast({
-							title: '璇疯鑼冭緭鍏ワ紒',
-							icon: 'error',
-							duration: 2000
-						});
-					} else {
-						this.bindUserFleet();
-					}
-				default:
-					break;
+	import { customerId } from '@/utils/status.js';
+	export default {
+		onLoad(params) {
+			console.log(params,'params')
+			this.role = params.role;
+			if (params.fleetId) {
+				this.fleetId = params.fleetId;
 			}
 		},
-		// 閭�璇疯揣浠�
-		bindHuoDai() {
-			// this.$reqPost('bindHuoDai', { customerId: this.customerId, name: this.name, phone: this.phone }, 'params').then(res => {
-			this.$reqPost('bindHuoDai', { name: this.name, phone: this.phone }, 'params').then(res => {
-				if (res.code == 0) {
-					this.$u.toast('娣诲姞鎴愬姛');
-					setTimeout(() => {
-						uni.navigateBack({
-							delta: 1
-						});
-					}, 1000);
-				} else {
-					this.$u.toast(res.msg ? res.msg : '鏈垚鍔熸坊鍔�');
-				}
-			});
+		data() {
+			return {
+				role: null, // 鍐冲畾娣诲姞鎵胯繍鍟嗗徃鏈猴紝杩樻槸杞﹂槦鍙告満
+				fleetId: null,
+				name: '',
+				phone: '',
+				carNo: '',
+				customerId,
+				loading: false
+			};
 		},
-		// 閭�璇峰徃鏈�
-		bindUserFleet() {
-			this.$reqPost('bindUserFleet', { fleetId: this.fleetId, name: this.name, phone: this.phone, carNo: this.carNo }, 'params').then(res => {
-				console.log('閭�璇峰徃鏈�', res);
-				if (res.code == 0) {
-					this.$u.toast(res.msg ? res.msg : '鎿嶄綔鎴愬姛');
-					this.$reqGet('GetUserFleet', { fleetId: this.fleetId }).then(response => {
-						this.lengthchange(response.data.length);
-					});
-					uni.navigateBack({
-						delta: 1
-					});
-				} else {
-					uni.showToast({
-						title: res.msg ? res.msg : '鎿嶄綔澶辫触',
-						icon: 'null',
-						duration: 2000
-					});
+		methods: {
+			showKeyboard(ref){
+				this.$refs[ref].toShow(this.carNo)
+			},
+			init() {},
+			addToHuoDaiOrDriver() {
+				switch (this.role) {
+					case '1':
+						if (this.name == '' || this.phone == '') {
+							uni.showToast({
+								title: '璇疯鑼冭緭鍏ワ紒',
+								icon: 'error',
+								duration: 2000
+							});
+						} else {
+							this.bindHuoDai();
+						}
+						break;
+					case '2':
+						if (this.carNo == '') {
+							uni.showToast({
+								title: '璇疯鑼冭緭鍏ワ紒',
+								icon: 'error',
+								duration: 2000
+							});
+						} else {
+							this.bindUserFleet();
+						}
+					default:
+						break;
 				}
-			});
+			},
+			// 閭�璇锋壙杩愬晢
+			bindHuoDai() {
+				this.loading = true
+				this.$reqPost('bindHuoDai', { name: this.name, phone: this.phone }, 'params').then(res => {
+					this.loading = false
+					if (res.code == 0) {
+						this.$u.toast('娣诲姞鎴愬姛');
+						setTimeout(() => {
+							uni.navigateBack()
+							uni.$emit('needRefresh')
+							// uni.switchTab({
+							// 	url: '/pages/tabbar-page/myPage-tabbar/myPage-tabbar'
+							// });
+						}, 1000);
+					} else {
+						this.$u.toast(res.msg ? res.msg : '鏈垚鍔熸坊鍔�');
+					}
+				}).catch(e => {
+					this.loading = false
+				})
+			},
+			// 閭�璇峰徃鏈�
+			bindUserFleet() {
+				this.loading = true
+				this.$reqPost('bindUserFleet', {
+					fleetId: this.fleetId,
+					carNo: this
+						.carNo
+				}, 'params').then(res => {
+					console.log('閭�璇峰徃鏈�', res);
+					this.loading = false
+					if (res.code == 0) {
+						this.$u.toast(res.msg ? res.msg : '鎿嶄綔鎴愬姛');
+						setTimeout(() => {
+							uni.navigateBack()
+							uni.$emit('needRefresh')
+							// uni.switchTab({
+							// 	url: '/pages/tabbar-page/myPage-tabbar/myPage-tabbar'
+							// });
+						}, 1000)
+					} else {
+						uni.showToast({
+							title: res.msg ? res.msg : '鎿嶄綔澶辫触',
+							duration: 2000
+						});
+					}
+				}).catch(e => {
+					this.loading = false
+				})
+			},
+			elseInvite() {
+				uni.navigateTo({
+					url: `/pages/public-page/selectFleet/selectFleet?fleetId=${this.fleetId}`
+				})
+			}
 		}
-	}
-};
+	};
 </script>
 
-<style lang="scss" scoped>
-::v-deep.addTo-freightForwarder-drvier {
-	width: 90%;
-	margin: 0 auto;
-	.addForm {
-		margin: 0 auto;
-	}
-	.addBtn {
+<style lang="scss"
+	scoped>
+	::v-deep.addTo-freightForwarder-drvier {
 		width: 90%;
-		position: fixed;
-		bottom: vww(48);
 		margin: 0 auto;
+
+		.addForm {
+			margin: 0 auto;
+		}
+
+		.else-invite {
+			width: vww(150);
+			margin: 0 auto;
+			color: #3c9cff;
+			margin-top: vww(40);
+		}
+
+		.addBtn {
+			width: 90%;
+			position: fixed;
+			bottom: vww(48);
+			margin: 0 auto;
+		}
 	}
-}
-</style>
+</style>
\ No newline at end of file

--
Gitblit v1.9.1