Browse Source

房态入住人问题修复

17755135699 10 months ago
parent
commit
4411d7565d
3 changed files with 31 additions and 30 deletions
  1. 7 14
      pages/house/createOrder.vue
  2. 2 2
      pages/house/orderInfo.vue
  3. 22 14
      pages/house/stayCheck.vue

+ 7 - 14
pages/house/createOrder.vue

@@ -287,17 +287,6 @@
 			this.currentDate = year + '-' + mon + '-' + day;
 		},
 		watch: {
-			// 'dataForm.detailFormList': {
-			// 	handler(newVal, oldVal) {
-			// 		let disp = newVal[0].roomAmount - this.oldVal;
-			// 		console.log(disp)
-			// 		console.log(this.totalMOney)
-			// 		console.log(newVal[0].roomAmount)
-			// 		this.oldval = newVal[0].roomAmount; //上一次价格
-			// 		this.totalMOney += parseFloat(disp);
-			// 	},
-			// 	deep: true
-			// }
 		},
 		methods: {
 
@@ -368,9 +357,12 @@
 			},
 			//添加入住人
 			goStayCheck() {
-				let list = JSON.stringify(this.dataForm);
+				//let list = JSON.stringify(this.dataForm);
+				uni.$once('toSendData', () => {
+					uni.$emit('sendData', this.dataForm)
+				})
 				uni.navigateTo({
-					url: '/pages/house/stayCheck?orderInfo=' + list,
+					url: '/pages/house/stayCheck',
 					events: {
 						addSuccess: data => {
 							this.dataForm.detailFormList[0].checkInPersonList = data.data || [];
@@ -569,7 +561,6 @@
 					.then((res) => {
 						if (res.data.code == 0) {
 							this.laiyuan = [res.data.data];
-							console.log(this.laiyuan)
 						}
 					});
 			},
@@ -580,12 +571,14 @@
 							...this.dataForm,
 							...res.data.data,
 						};
+						
 						//加密备用
 						if (this.dataForm.detailFormList[0].checkInPersonList.length != 0) {
 							this.tempCheckInPersonList = JSON.parse(
 								JSON.stringify(this.dataForm.detailFormList[0].checkInPersonList)
 							);
 						} //入住人集合
+						
 						this.tempGuestName = this.dataForm.guestName;
 						this.tempGuestPhone = this.dataForm.guestPhone;
 						this.compareDate(this.dataForm.arriveDate);

+ 2 - 2
pages/house/orderInfo.vue

@@ -27,7 +27,7 @@
 				<view class="house-person">
 					<text style="font-size: 30rpx; color: #777;">入住成人数量</text>
 					<view class="right">
-						<text style="font-size: 30rpx;font-weight: bold; color: #111; ">{{orderInfo.checkinGuests}}人
+						<text style="font-size: 30rpx;font-weight: bold; color: #111; ">{{orderInfo.checkinGuests||0}}人
 						</text>
 					</view>
 				</view>
@@ -35,7 +35,7 @@
 				<view class="house-person">
 					<text style="font-size: 30rpx; color: #777;">入住儿童数量</text>
 					<view class="right">
-						<text style="font-size: 30rpx;font-weight: bold; color: #111; ">{{orderInfo.childCheckinNums}}人
+						<text style="font-size: 30rpx;font-weight: bold; color: #111; ">{{orderInfo.childCheckinNums||0}}人
 						</text>
 					</view>
 				</view>

+ 22 - 14
pages/house/stayCheck.vue

@@ -2,7 +2,7 @@
 	<view class="page" :style="{'padding-top':mt+'px'}">
 		<c-nav-bar title="添加入住人" :showIcon="true"></c-nav-bar>
 		<u-form :model="form" ref="form">
-			<view class="box" v-for="(item,index) in checkInPersonList">
+			<view class="box" v-for="(item,index) in checkInPersonList" :key="index">
 				<u-form-item label="姓名" prop="checkInName" label-width="172rpx" border-bottom>
 					<u-input border="false" v-model="item.checkInName" placeholder="请输入姓名" />
 				</u-form-item>
@@ -113,19 +113,25 @@
 				}
 			}
 		},
+		onUnload() {
+			uni.$off('sendData');
+		},
 		onLoad(opt) {
 			that = this;
-			this.orderInfo = JSON.parse(opt.orderInfo);
-			console.log(this.orderInfo)
-			this.checkInPersonList = this.orderInfo.detailFormList[0].checkInPersonList;
-			if (!this.checkInPersonList || this.checkInPersonList.length == 0) {
-				this.checkInPersonList.push({
-					cardType: 0,
-					idCard: '',
-					checkInPhone: '',
-					checkInName: '',
-				})
-			}
+			uni.$once('sendData', info => {
+				that.orderInfo = info;
+				console.log(that.orderInfo)
+				that.checkInPersonList = that.orderInfo.detailFormList[0].checkInPersonList;
+				if (!that.checkInPersonList || that.checkInPersonList.length == 0) {
+					that.checkInPersonList.push({
+						cardType: 0,
+						idCard: '',
+						checkInPhone: '',
+						checkInName: '',
+					})
+				}
+			})
+			uni.$emit('toSendData');
 		},
 		methods: {
 			passengerConfirm(e, index) {
@@ -144,7 +150,7 @@
 				this.checkInPersonList.push({
 					checkInPhone: '',
 					idCard: '',
-					cardType:0,
+					cardType: 0,
 					checkInName: '',
 				})
 			},
@@ -185,7 +191,7 @@
 
 <style lang="scss">
 	.page {
-		background: #F3F4F4;
+
 		padding-bottom: 260rpx;
 		box-sizing: border-box;
 		overflow-y: auto;
@@ -200,6 +206,8 @@
 		width: 92%;
 		padding: 0 30rpx;
 		margin-top: 20rpx;
+		border-bottom: 20rpx solid #F3F4F4;
+		;
 	}
 
 	.tit {