Pārlūkot izejas kodu

opt:查询酒店时会传当前小程序的appId到后端,只查询与当前appId有关联的酒店

Shu 1 mēnesi atpakaļ
vecāks
revīzija
52aa3fa35f
1 mainītis faili ar 14 papildinājumiem un 3 dzēšanām
  1. 14 3
      subpkg/chooseHotel/chooseHotel.vue

+ 14 - 3
subpkg/chooseHotel/chooseHotel.vue

@@ -63,6 +63,7 @@
 				notFound: false,
 				displayScanner: true,
 				source: "",
+				appId: ""
 			}
 		},
 		methods: {
@@ -70,9 +71,15 @@
 			async inputChanged() {
 				this.notFound = false
 
-				let res = await uni.$http.get(`/hotel/hotelName/${this.hotelName}`)
+				let res = await uni.$http.post('/hotel/available', {
+					appId: this.appId,
+					hotelName: this.hotelName
+				})
+				
+				
 				if (res.data.data.length === 0) {
 					this.notFound = true
+					console.log("sous", res);
 					return
 				}
 				this.hotelList = res.data.data
@@ -108,7 +115,9 @@
 				// #endif
 			},
 			async getHotels() {
-				let res = await uni.$http.get('/hotel')
+				let res = await uni.$http.post('/hotel/available', {
+					appId: this.appId
+				})
 				this.hotelList = res.data.data
 			},
 			async queryHotelByHotelId(hotelId) {
@@ -145,6 +154,8 @@
 			// #endif
 
 			// 首次载入页面渲染全部酒店,后可根据搜索来搜索其他酒店
+			const {miniProgram: {appId}} = uni.getAccountInfoSync();
+			this.appId = appId
 			await this.getHotels()
 		},
 	}
@@ -228,7 +239,7 @@
 				background-color: #ffffff;
 				width: 100%;
 				position: absolute;
-				top: 120rpx;
+				top: 350rpx;
 				left: 0;
 				bottom: 0;
 				padding-top: 20rpx;