From b62578f8b43f15be89b3d14f463f11aed03e6fb9 Mon Sep 17 00:00:00 2001
From: jiangping <jp@doumee.com>
Date: 星期四, 09 五月 2024 18:57:25 +0800
Subject: [PATCH] 最新版本

---
 h5/pages/visitorApplication/visitorApplication.vue |  247 +++++++++++++++++++++++++++++++++++++++++--------
 1 files changed, 207 insertions(+), 40 deletions(-)

diff --git a/h5/pages/visitorApplication/visitorApplication.vue b/h5/pages/visitorApplication/visitorApplication.vue
index fdca622..9c96377 100644
--- a/h5/pages/visitorApplication/visitorApplication.vue
+++ b/h5/pages/visitorApplication/visitorApplication.vue
@@ -2,13 +2,13 @@
 	<view class="visit">
 		<view class="head">鎷滆淇℃伅</view>
 		<view class="list">
-			<view class="list_item">
+			<!-- <view class="list_item">
 				<view class="list_item_label">
 					<text>琚浜烘墜鏈�</text>
 					<text>*</text>
 				</view>
 				<view class="list_item_content">
-					<input type="number" maxlength="11" v-model="form1.phone1" placeholder="璇疯緭鍏ユ墜鏈哄彿" @blur="getUser" placeholder-style="color: #999999;" />
+					<input type="number" maxlength="11" v-model="form1.phone1" :placeholder="verify == '0' ? '杈撳叆鎵嬫満鍙峰悗鑷姩鑾峰彇' : '璇疯緭鍏ユ墜鏈哄彿'" @blur="getUser" placeholder-style="color: #999999;" />
 				</view>
 			</view>
 			<view class="list_item">
@@ -18,6 +18,16 @@
 				</view>
 				<view class="list_item_content">
 					<input type="text" placeholder="璇疯緭鍏ュ鍚�" v-model="form1.receptMemberName" @blur="getUser" placeholder-style="color: #999999;" />
+				</view>
+			</view> -->
+			<view class="list_item">
+				<view class="list_item_label">
+					<text>琚浜�</text>
+					<text>*</text>
+				</view>
+				<view class="list_item_content" @click="showName = true">
+					<text :style="{color: form1.name ? '#000000' : ''}">{{form1.name ? form1.name : '璇烽�夋嫨'}}</text>
+					<u-icon name="arrow-right" color="#CCCCCC" size="20"></u-icon>
 				</view>
 			</view>
 			<view class="list_item">
@@ -35,7 +45,7 @@
 					<text>绂诲巶鏃堕棿</text>
 					<text>*</text>
 				</view>
-				<view class="list_item_content" @click="show5 = true">
+				<view class="list_item_content" @click="openLC">
 					<text :style="{color: form1.endtime ? '#000000' : ''}">{{form1.endtime ? form1.endtime : '璇烽�夋嫨'}}</text>
 					<u-icon name="arrow-right" color="#CCCCCC" size="20"></u-icon>
 				</view>
@@ -45,22 +55,52 @@
 					<text>璁块棶闂ㄧ</text>
 					<text>*</text>
 				</view>
+				 <!-- @click="show6 = true" -->
 				<view class="list_item_content">
 					<text :style="{color: form1.doorSelectName ? '#000000' : ''}">{{form1.doorSelectName ? form1.doorSelectName : '璇烽�夋嫨'}}</text>
 					<u-icon name="arrow-right" color="#CCCCCC" size="20"></u-icon>
 				</view>
 			</view>
+			<div class="empty"></div>
 			<view class="list_item">
 				<view class="list_item_label">
 					<text>鎷滆浜嬬敱</text>
-					<text></text>
+					<text>*</text>
 				</view>
 				<view class="list_item_content">
-					<input type="text" v-model="form1.reason" placeholder="璇疯緭鍏ユ潵璁夸簨鐢憋紝鎮ㄦ潵鍋氫粈涔堢殑" placeholder-style="color: #999999;" />
+					<input type="text" v-model="form1.reason" placeholder="璇疯緭鍏ユ潵璁夸簨鐢�" placeholder-style="color: #999999;" />
+				</view>
+			</view>
+			<view class="list_item">
+				<view class="list_item_label">
+					<text>鏄惁鏂藉伐浣滀笟</text>
+					<text>*</text>
+				</view>
+				<view class="list_item_content">
+					<switch color="#4e99a9" style="transform:scale(0.8)" @change="constructionChange" />
+				</view>
+			</view>
+			<view class="list_item">
+				<view class="list_item_label">
+					<text>鏂藉伐鍐呭</text>
+					<text>*</text>
+				</view>
+				<view class="list_item_content">
+					<input type="text" v-model="form1.ss" placeholder="璇疯緭鍏ユ柦宸ュ唴瀹�" placeholder-style="color: #999999;" />
+				</view>
+			</view>
+			<view class="list_item">
+				<view class="list_item_label">
+					<text>闅忚杞﹁締</text>
+					<text></text>
+				</view>
+				<view class="list_item_content" @click="openInput(1)">
+					<text :style="{color: form1.carNos ? '#000000' : ''}">{{form1.carNos ? form1.carNos : '璇疯緭鍏ヨ溅鐗屽彿鐮�'}}</text>
+					<!-- <input type="text" placeholder="璇疯緭鍏ヨ溅鐗屽彿" v-model="form1.carNos" maxlength="8" placeholder-style="color: #999999;" /> -->
 				</view>
 			</view>
 		</view>
-		<view class="cate">
+		<!-- <view class="cate">
 			<view class="cate_head">杞﹁締淇℃伅</view>
 			<view class="cate_list">
 				<view class="cate_list_item" v-for="(item, index) in cars" :key="index">
@@ -69,7 +109,7 @@
 				</view>
 			</view>
 			<view class="cate_add" @click="show2 = true">+娣诲姞杞﹁締</view>
-		</view>
+		</view> -->
 		<view class="cate">
 			<view class="cate_head">闅忚浜哄憳淇℃伅</view>
 			<view class="cate_list">
@@ -94,14 +134,15 @@
 		></u-datetime-picker>
 		<!-- 绂诲満鏃堕棿 -->
 		<u-datetime-picker
+			v-if="form1.starttime"
 			:show="show5"
-			:minDate="new Date().getTime()"
+			:minDate="formatTimeStamp(form1.starttime)"
 			mode="datetime"
 			@cancel="show5 = false"
 			@confirm="setoutDate"
 		></u-datetime-picker>
 		<!-- 闂ㄧ -->
-		<u-popup :show="show" :round="10" :safeAreaInsetBottom="true" :closeable="true" mode="bottom" @close="show = false">
+		<u-popup :show="show" :round="10" :safeAreaInsetBottom="true" :closeable="true" mode="bottom" @close="closeMJ">
 			<view class="menjin">
 				<view class="respondent-title">
 					閫夋嫨闂ㄧ
@@ -109,12 +150,12 @@
 				<scroll-view scroll-y class="list">
 					<view class="list_item" v-for="(item, index) in columns" :key="index" @click="seleMJ(index)">
 						<text>{{item.name}}</text>
-						<image src="@/static/video@2x.png" mode="widthFix" v-show="!item.active"></image>
-						<image src="@/static/video_sel@2x.png" mode="widthFix" v-show="item.active"></image>
+						<image src="@/static/checkbox@2x.png" mode="widthFix" v-show="!item.active"></image>
+						<image src="@/static/checkbo1x_sel@2x.png" mode="widthFix" v-show="item.active"></image>
 					</view>
 				</scroll-view>
 				<view class="menjin_footer">
-					<view class="menjin_footer_item" @click="show = false">鍙栨秷</view>
+					<view class="menjin_footer_item" @click="closeMJ">鍙栨秷</view>
 					<view class="menjin_footer_item" @click="submitMJ">纭</view>
 				</view>
 			</view>
@@ -211,13 +252,13 @@
 							<text>*</text>
 						</view>
 						<view class="adduser_list_item_ipt">
-							<input type="text" v-model="withUserList.idcardNo" placeholder-style="color: #999999;font-size: 28rpx;" placeholder="璇疯緭鍏ヨ瘉浠跺彿鐮�" />
+							<input type="text" v-model="withUserList.idcardNo" maxlength="18" placeholder-style="color: #999999;font-size: 28rpx;" placeholder="璇疯緭鍏ヨ瘉浠跺彿鐮�" />
 						</view>
 					</view>
 					<view class="adduser_list_item">
 						<view class="adduser_list_item_label">
 							<text>鍏徃</text>
-							<text></text>
+							<text>*</text>
 						</view>
 						<view class="adduser_list_item_ipt">
 							<input type="text" v-model="withUserList.companyName" placeholder-style="color: #999999;font-size: 28rpx;" placeholder="璇疯緭鍏ュ叕鍙稿悕绉�" />
@@ -228,15 +269,16 @@
 							<text>闅忚杞﹁締</text>
 							<text></text>
 						</view>
-						<view class="adduser_list_item_ipt">
-							<input type="text" v-model="withUserList.carNos" placeholder-style="color: #999999;font-size: 28rpx;" placeholder="璇疯緭鍏ヨ溅鐗屽彿" />
+						<view class="adduser_list_item_ipt" @click="openInput(2)">
+							<text :style="{color: withUserList.carNos ? '#000000' : ''}">{{withUserList.carNos ? withUserList.carNos : '璇疯緭鍏ヨ溅鐗屽彿鐮�'}}</text>
+							<!-- <input type="text" v-model="withUserList.carNos" disabled placeholder-style="color: #999999;font-size: 28rpx;" placeholder="璇疯緭鍏ヨ溅鐗屽彿" /> -->
 						</view>
 					</view>
 					<view class="adduser_list_item">
 						<view class="adduser_list_item_label1">
 							<text class="cc">浜鸿劯鐓х墖<b>*</b></text>
-							<text class="aa">1銆佽鎻愪緵浜斿畼娓呮櫚锛屼汉鑴稿眳涓殑姝i潰浜鸿劯鍏�</text>
-							<text class="aa">2銆佺収鐗囨棤閫嗗厜銆佹棤PS銆佹棤杩囧害缇庨澶勭悊</text>
+							<text class="aa">1銆佽鎻愪緵浜斿畼娓呮櫚锛屼汉鑴稿眳涓殑姝i潰浜鸿劯鍏嶅啝鐓х墖锛�</text>
+							<text class="aa">2銆佺収鐗囨棤閫嗗厜銆佹棤PS銆佹棤杩囧害缇庨澶勭悊锛�</text>
 						</view>
 						<view class="adduser_list_item_ipt">
 							<view class="adduser_list_item_ipt1_upload" @click="upload('faceImg')" v-if="!withUserList.faceImgUrl">
@@ -269,13 +311,25 @@
 			</view>
 		</u-popup>
 		<u-picker keyName="name" :show="show6" :columns="columns1" @confirm="seleIdcard" @cancel="show6 = false"></u-picker>
+		<u-picker keyName="name" :show="showName" :columns="columnsNames" @confirm="selectedName" @cancel="showName = false"></u-picker>
+		<!-- <tly-picture-cut ref="tlyPictureCut" :pictureSrc="photoSrc" @createImg="uploadImg"></tly-picture-cut> -->
+		<keyboardInput ref="keyboard" @export="setPlate" @close="closeInput" />
+		<qf-image-cropper ref="cropper" :width="280" :height="280" :radius="30" @crop="uploadImg"></qf-image-cropper>
 	</view>
 </template>
 
 <script>
+	import tlyPictureCut from "@/components/tly-picture-cut/tlyPictureCut.vue";
+	import keyboardInput from "@/components/keyboard-input/keyboard-input.vue";
+	import QfImageCropper from '@/uni_modules/qf-image-cropper/components/qf-image-cropper/qf-image-cropper.vue';
+	import { getDaysAfterDate } from '@/utils/utils.js'
 	export default {
 		data() {
 			return {
+				photoSrc: '',
+				type: '',
+				inputType: '',
+				showName: false,
 				show: false,
 				show1: false,
 				show2: false,
@@ -283,10 +337,18 @@
 				show4: false,
 				show5: false,
 				show6: false,
+				show7: false,
 				fileList: [],
-				columns1: [[{name: '韬唤璇�', id: 0}, {name: '娓境璇佷欢', id: 1},{name: '鎶ょ収', id: 2}]],
+				columns1: [
+					[{name: '韬唤璇�', id: 0}, {name: '娓境璇佷欢', id: 1},{name: '鎶ょ収', id: 2}],
+				],
+				columnsNames: [
+					[{name: '寮犱笁', id: 0},{name: '寮犱笁', id: 1},{name: '寮犱笁', id: 2},]
+				],
 				columns: [],
 				cars: [],
+				day: null,
+				maxTime: '',
 				carName: '',
 				personnel: [],
 				userAnswerId: '',
@@ -319,16 +381,64 @@
 				verify: ''
 			};
 		},
+		components: { tlyPictureCut, keyboardInput, QfImageCropper },
 		onLoad(options) {
-			this.form = JSON.parse(options.data)
-			this.getvisit()
-			this.getVisit1()
-			this.getUserValid()
+			if (options.data) {
+				this.form = JSON.parse(options.data)
+			}
+			// this.getvisit()
+			// this.getVisit1()
+			// this.getUserValid()
 		},
 		methods: {
+			openInput(type) {
+				this.inputType = type
+				this.$refs.keyboard.open()
+			},
+			setPlate(e) {
+				if (this.inputType === 1) {
+					this.form1.carNos = e
+				} else if (this.inputType === 2) {
+					this.withUserList.carNos = e
+				}
+				this.$forceUpdate()
+				this.closeInput()
+			},
+			closeInput() {
+				this.$refs.keyboard.close()
+			},
+			constructionChange(e) {
+				console.log(e.detail.value);
+			},
+			uploadImg(file) {
+				this.$refs.cropper.close()
+				uni.showLoading({ title: '涓婁紶涓�', mask: true });
+				uni.uploadFile({
+					url: `${this.$baseUrl}visitsAdmin/cloudService/web/public/uploadFtp.do`,
+					filePath: file.tempFilePath,
+					name: 'file',
+					formData: {
+						folderCode: 'MEMBER_IMG'
+					},
+					success: (uploadFileRes) => {
+						let res = JSON.parse(uploadFileRes.data)
+						this.withUserList.faceImg = res.data.halfPath
+						this.withUserList.faceImgUrl = res.data.prefixPath + res.data.folder + res.data.halfPath
+					},
+					complete() {
+						uni.hideLoading();
+					}
+				});
+			},
+			closeMJ() {
+				this.show = false
+				this.columns.forEach(item => {
+					item.active = false
+				})
+			},
 			submit() {
 				if (!this.form1.receptMemberId) return uni.showToast({
-					title: '琚浜轰笉鑳戒负绌�',
+					title: '璇峰~鍐欐湁鏁堢殑璁块棶浜�',
 					icon: 'none'
 				})
 				if (!this.form1.starttime) return uni.showToast({
@@ -339,7 +449,7 @@
 					title: '绂诲満鏃堕棿涓嶈兘涓虹┖',
 					icon: 'none'
 				})
-				if (!this.form1.doorSelectName) return uni.showToast({
+				if (!this.form1.doorSelectName && this.accessControl == 1) return uni.showToast({
 					title: '璁块棶闂ㄧ涓嶈兘涓虹┖',
 					icon: 'none'
 				})
@@ -347,14 +457,21 @@
 					title: '鎷滆浜嬬敱涓嶈兘涓虹┖',
 					icon: 'none'
 				})
+				// this.form1.starttime = this.form1.starttime + ':00'
+				// this.form1.endtime = this.form1.endtime + ':00'
+				let data = JSON.parse(JSON.stringify(this.form1))
+				data.starttime = data.starttime + ':00'
+				data.endtime = data.endtime + ':00'
 				this.$u.api.createFk({
 					...this.form,
-					...this.form1,
+					...data,
 					openid: this.$store.state.openId,
 					withUserList: this.personnel
 				}).then(res => {
 					if (res.code === 200) {
-						console.log(res)
+						uni.reLaunch({
+							url: `/pages/appointmentDetails/appointmentDetails?id=${res.data}`
+						})
 					}
 				})
 			},
@@ -371,6 +488,16 @@
 						this.visit = res.data.code
 					}
 				})
+				// 璧峰鏃堕棿鏃堕暱
+				this.$u.api.getSystemDictData({
+					dictCode: 'VISIT_CONFIG',
+					label: 'VALIDATE_VISIT'
+				}).then(res => {
+					if (res.code === 200) {
+						this.day = Number(res.data.code)
+						// console.log(nextDay('after', true, this.day))
+					}
+				})
 			},
 			submitUser() {
 				if (!this.withUserList.name) return uni.showToast({
@@ -381,12 +508,28 @@
 					title: '鎵嬫満鍙蜂笉鑳戒负绌�',
 					icon: 'none'
 				})
+				const regExp = /^1[3456789]\d{9}$/;
+				if (!regExp.test(this.withUserList.phone)) return uni.showToast({
+					title: '鎵嬫満鍙锋牸寮忛敊璇�',
+					icon: 'none'
+				})
 				if (!String(this.withUserList.idcardType)) return uni.showToast({
 					title: '璇佷欢绫诲瀷涓嶈兘涓虹┖',
 					icon: 'none'
 				})
 				if (!this.withUserList.idcardNo) return uni.showToast({
 					title: '璇佷欢鍙风爜涓嶈兘涓虹┖',
+					icon: 'none'
+				})
+				if (this.withUserList.idcardType === 0) {
+					const regex = /^[1-9]\d{5}(19|20)\d{2}(0[1-9]|1[0-2])(0[1-9]|[1-2]\d|3[0-1])\d{3}[\dxX]$/;
+					if (!regex.test(this.withUserList.idcardNo)) return uni.showToast({
+						title: '璇佷欢鍙风爜鏍煎紡閿欒',
+						icon: 'none'
+					})
+				}
+				if (!this.withUserList.companyName) return uni.showToast({
+					title: '鍏徃涓嶈兘涓虹┖',
 					icon: 'none'
 				})
 				if (!this.withUserList.faceImg) return uni.showToast({
@@ -414,12 +557,17 @@
 				this.withUserList.imgurlUrl = ''
 			},
 			upload(type) {
+				this.type = type
+				if (type === 'faceImg') {
+					this.$refs.cropper.open()
+					return
+				}
 				uni.chooseImage({
 					success: (chooseImageRes) => {
 						uni.showLoading({ title: '涓婁紶涓�', mask: true });
 						for (let i = 0; i < chooseImageRes.tempFilePaths.length; i++) {
 							uni.uploadFile({
-								url: `${this.$baseUrl}public/api/uploadFtp.do`,
+								url: `${this.$baseUrl}visitsAdmin/cloudService/web/public/uploadFtp.do`,
 								filePath: chooseImageRes.tempFilePaths[i],
 								name: 'file',
 								formData: {
@@ -449,6 +597,11 @@
 				this.withUserList.idcardType = e.value[0].id
 				this.withUserList.idcardTypeName = e.value[0].name
 				this.show6 = false
+			},
+			selectedName(e) {
+				this.form1.name = e.value[0].name
+				this.form1.id = e.value[0].id
+				this.showName = false
 			},
 			submitCart() {
 				if (!this.carName) return uni.showToast({
@@ -488,19 +641,29 @@
 					}
 				})
 			},
+			openLC() {
+				if (!this.form1.starttime) return uni.showToast({
+					title: '璇峰厛閫夋嫨鍏ュ巶鏃堕棿',
+					icon: 'none'
+				})
+				this.show5 = true
+			},
 			setinDate(e) {
-				this.form1.starttime = uni.$u.timeFormat(e.value, 'yyyy-mm-dd hh:MM:ss');
+				this.form1.starttime = uni.$u.timeFormat(e.value, 'yyyy-mm-dd hh:MM');
+				// this.maxTime = getDaysAfterDate(uni.$u.timeFormat(e.value, 'yyyy-mm-dd hh:MM'), this.day)
+				this.maxTime = this.form1.starttime
+				console.log(this.form1.starttime);
 				this.show4 = false
 			},
 			setoutDate(e) {
-				this.form1.endtime = uni.$u.timeFormat(e.value, 'yyyy-mm-dd hh:MM:ss');
+				this.form1.endtime = uni.$u.timeFormat(e.value, 'yyyy-mm-dd hh:MM');
 				this.show5 = false
+			},
+			formatTimeStamp(date) {
+			    return Date.parse(new Date(`${date}`)) || Date.parse(new Date(`${date.replace(/-/g,'/')}`))
 			},
 			// 鏌ヨ鐢ㄦ埛
 			getUser() {
-				console.log(this.verify)
-				console.log(this.form1.phone1)
-				console.log(this.form1.receptMemberName)
 				if (this.verify === '0') {
 					if (this.form1.phone1) {
 						this.$u.api.getVisitedMember({
@@ -533,7 +696,6 @@
 					label: 'BEVISITED_USER_VALID'
 				}).then(res => {
 					if (res.code === 200) {
-						console.log(res)
 						this.verify = res.data.code
 					}
 				})
@@ -658,7 +820,7 @@
 					align-items: center;
 					justify-content: space-between;
 					.adduser_list_item_label1 {
-						flex-shrink: 0;
+						flex: 1;
 						display: flex;
 						flex-direction: column;
 						.cc {
@@ -700,7 +862,7 @@
 						}
 					}
 					.adduser_list_item_ipt {
-						flex: 1;
+						flex-shrink: 0;
 						text-align: right;
 						font-size: 28rpx;
 						font-family: PingFangSC, PingFang SC;
@@ -990,10 +1152,17 @@
 			padding: 0 30rpx;
 			box-sizing: border-box;
 			background-color: #ffffff;
-
+			.empty{
+				width: 750rpx;
+				height: 20rpx;
+				background-color: #f7f7f7;
+				margin: 0 -30rpx;
+			}
 			.list_item {
 				width: 100%;
-				height: 98rpx;
+				// min-height: 98rpx;
+				padding: 30rpx 0;
+				box-sizing: border-box;
 				display: flex;
 				align-items: center;
 				justify-content: space-between;
@@ -1051,8 +1220,6 @@
 			padding: 30rpx;
 			box-sizing: border-box;
 			background-color: #ffffff;
-			margin-top: 20rpx;
-
 			.cate_head {
 				font-size: 32rpx;
 				font-family: PingFangSC, PingFang SC;

--
Gitblit v1.9.3