Selaa lähdekoodia

房态入住人bug修复

17755135699 8 kuukautta sitten
vanhempi
commit
c808c6ba29
3 muutettua tiedostoa jossa 35 lisäystä ja 8 poistoa
  1. 5 3
      pages/house/createOrder.vue
  2. 3 3
      pages/house/index.vue
  3. 27 2
      pages/house/stayCheck.vue

+ 5 - 3
pages/house/createOrder.vue

@@ -288,9 +288,10 @@
 		},
 		},
 		watch: {
 		watch: {
 		},
 		},
+		onUnload() {
+			uni.$off('toSendData');
+		},
 		methods: {
 		methods: {
-
-
 			compoutPrice(e) {
 			compoutPrice(e) {
 				this.dealTotalMoney();
 				this.dealTotalMoney();
 			},
 			},
@@ -361,10 +362,12 @@
 				uni.$once('toSendData', () => {
 				uni.$once('toSendData', () => {
 					uni.$emit('sendData', this.dataForm)
 					uni.$emit('sendData', this.dataForm)
 				})
 				})
+				console.log(this.dataForm)
 				uni.navigateTo({
 				uni.navigateTo({
 					url: '/pages/house/stayCheck',
 					url: '/pages/house/stayCheck',
 					events: {
 					events: {
 						addSuccess: data => {
 						addSuccess: data => {
+							console.log(data.data)
 							this.dataForm.detailFormList[0].checkInPersonList = data.data || [];
 							this.dataForm.detailFormList[0].checkInPersonList = data.data || [];
 						}
 						}
 					},
 					},
@@ -528,7 +531,6 @@
 					}
 					}
 				});
 				});
 				newDataForm.detailFormList[0].checkInPersonList = checkInPersonList;
 				newDataForm.detailFormList[0].checkInPersonList = checkInPersonList;
-				console.log(newDataForm)
 				//return
 				//return
 				this.$api.post(url, newDataForm).then(res => {
 				this.$api.post(url, newDataForm).then(res => {
 					if (res.data.code == 0) {
 					if (res.data.code == 0) {

+ 3 - 3
pages/house/index.vue

@@ -488,7 +488,7 @@
 
 
 	.head,
 	.head,
 	.roomType {
 	.roomType {
-		padding: 0 30rpx;
+		padding: 0 30rpx 0 0;
 		display: flex;
 		display: flex;
 		width: 400rpx;
 		width: 400rpx;
 		// justify-content: space-between;
 		// justify-content: space-between;
@@ -528,7 +528,7 @@
 		color: #333;
 		color: #333;
 		font-size: 24rpx;
 		font-size: 24rpx;
 		position: relative;
 		position: relative;
-		padding-left: 44rpx;
+		padding-left: 34rpx;
 		margin: 20rpx 0 16rpx;
 		margin: 20rpx 0 16rpx;
 
 
 		&::after {
 		&::after {
@@ -537,7 +537,7 @@
 			height: 24rpx;
 			height: 24rpx;
 			width: 5rpx;
 			width: 5rpx;
 			background-color: #1372FF;
 			background-color: #1372FF;
-			left: 30rpx;
+			left: 20rpx;
 			top: 4rpx;
 			top: 4rpx;
 			z-index: 1;
 			z-index: 1;
 		}
 		}

+ 27 - 2
pages/house/stayCheck.vue

@@ -120,8 +120,7 @@
 			that = this;
 			that = this;
 			uni.$once('sendData', info => {
 			uni.$once('sendData', info => {
 				that.orderInfo = info;
 				that.orderInfo = info;
-				console.log(that.orderInfo)
-				that.checkInPersonList = that.orderInfo.detailFormList[0].checkInPersonList;
+				that.checkInPersonList = that.deepClone(that.orderInfo.detailFormList[0].checkInPersonList)
 				if (!that.checkInPersonList || that.checkInPersonList.length == 0) {
 				if (!that.checkInPersonList || that.checkInPersonList.length == 0) {
 					that.checkInPersonList.push({
 					that.checkInPersonList.push({
 						cardType: 0,
 						cardType: 0,
@@ -134,6 +133,32 @@
 			uni.$emit('toSendData');
 			uni.$emit('toSendData');
 		},
 		},
 		methods: {
 		methods: {
+			deepClone(obj, cache = new WeakMap()) {
+				if (obj === null || typeof obj !== 'object') return obj;
+				if (cache.has(obj)) return cache.get(obj);
+				let clone;
+				if (obj instanceof Date) {
+					clone = new Date(obj.getTime());
+				} else if (obj instanceof RegExp) {
+					clone = new RegExp(obj);
+				} else if (obj instanceof Map) {
+					clone = new Map(Array.from(obj, ([key, value]) => [key, this.deepClone(value, cache)]));
+				} else if (obj instanceof Set) {
+					clone = new Set(Array.from(obj, value => this.deepClone(value, cache)));
+				} else if (Array.isArray(obj)) {
+					clone = obj.map(value => this.deepClone(value, cache));
+				} else if (Object.prototype.toString.call(obj) === '[object Object]') {
+					clone = Object.create(Object.getPrototypeOf(obj));
+					cache.set(obj, clone);
+					for (const [key, value] of Object.entries(obj)) {
+						clone[key] = this.deepClone(value, cache);
+					}
+				} else {
+					clone = Object.assign({}, obj);
+				}
+				cache.set(obj, clone);
+				return clone;
+			},
 			passengerConfirm(e, index) {
 			passengerConfirm(e, index) {
 				this.checkInPersonList[index].cardType = e.value[0].value;
 				this.checkInPersonList[index].cardType = e.value[0].value;
 				this.show = false;
 				this.show = false;