Browse Source

bug修复

xiaoxin 2 years ago
parent
commit
9482bbd2db

+ 15 - 6
pages/affirmOrder/affirmOrder.vue

@@ -1,5 +1,5 @@
 <template>
-	<view class="container">
+	<view class="container" v-if="totalMoney">
 		<!-- 导航栏图片区域 -->
 		<view class="header">
 			<img src="https://chtech.ncjti.edu.cn/hotelReservation/image/18.png" />
@@ -45,6 +45,7 @@
 						<img class="img2" src="../../static/index/minus.png" @click="handleMinus" />
 					</view>
 				</view>
+
 				<view class="msg_box">
 					<view class="box_key">住客姓名</view>
 					<view class="box_value">
@@ -54,6 +55,7 @@
 						<img class="img2" src="../../static/index/people.png" />
 					</view>
 				</view>
+
 				<view class="msg_box">
 					<view class="box_key">联系电话</view>
 					<view class="box_value">
@@ -180,7 +182,9 @@ export default {
 			couponNum: 0,
 			chooseObj: {},
 			dayList: [],
-			totalMoney: 0
+			totalMoney: 0,
+			// 房间数量的最大数
+			maxRooms: 0
 		}
 	},
 	created() {
@@ -197,6 +201,7 @@ export default {
 	},
 	onLoad(options) {
 		this.info = JSON.parse(options.info)
+		this.maxRooms = this.info.item.remainRooms
 		this.hotelName = this.info.hotelName
 		this.getDayList()
 		uni.$on('change', this.change)
@@ -206,9 +211,6 @@ export default {
 	computed: {
 		// 总费用
 		totalPrice() {
-			// if (this.info.item) {
-			// 	return (this.roomCount * this.info.item.price * this.info.nightNum - (this.chooseObj.discountAmount * 1 || 0)).toFixed(2)
-			// }
 			if (this.info.item) {
 				let tem = this.roomCount * this.totalMoney - (this.chooseObj.discountAmount * 1 || 0)
 				let res = tem > 0 ? tem.toFixed(2) : 0
@@ -294,7 +296,14 @@ export default {
 			this.$refs.datetimePicker.open()
 		},
 		handleAdd() {
-			this.roomCount++
+			if (this.roomCount < this.maxRooms) {
+				this.roomCount++
+			} else {
+				uni.showToast({
+					title: `当前房型只有${this.roomCount}间`,
+					icon: 'none'
+				})
+			}
 		},
 		handleMinus() {
 			if (this.roomCount > 1) {

+ 107 - 60
pages/detail/detail.vue

@@ -301,28 +301,27 @@
 				</span>
 			</view>
 			<!-- 周边列表区域 -->
-			<view class="rim_body">
+			<view class="rim_body" v-if="rimList.length">
 				<!-- 每一个盒子区域 -->
-				<view class="rim_box" v-for="item in rimList" :key="item.id" @click="GoRimDetail">
-					<img mode="aspectFill" :src="item.url" />
+				<view class="rim_box" v-for="item in rimList" :key="item.id" @click="GoRimDetail(item)">
+					<img mode="aspectFill" :src="item.first_img" />
 					<view class="box_info">
-						<view class="info_top">{{ item.name }}</view>
-						<view class="info_center">{{ item.leave }}</view>
-						<view class="info_bottom">
-							<view class="bottom_rate">{{ item.rate }}分</view>
+						<view class="info_top">{{ item.rname }}</view>
+						<view class="info_center" v-if="item.distance">距您{{ item.distance }}km</view>
+						<!-- <view class="info_bottom">
+							<view class="bottom_rate">4.8分</view>
 							<view class="bottom_num">{{ item.num }}条评论</view>
 							<view class="bottom_price">
-								¥{{ item.price }}
+								¥220
 								<text>起</text>
 							</view>
-						</view>
+						</view> -->
 					</view>
 				</view>
 			</view>
-			<!-- 查看全部 -->
-			<view class="rim_more" @click="test">
-				查看全部
-				<img src="../../static/index/right.png" />
+			<view class="noData" v-else>
+				<img src="../../static/images/noData.png" />
+				暂无数据
 			</view>
 		</view>
 	</view>
@@ -387,48 +386,21 @@ export default {
 			// 是否是全屏状态
 			isFullScreen: false,
 			// 周边列表数组
-			rimList: [
-				{
-					id: 1726150980,
-					url: 'https://chtech.ncjti.edu.cn/hotelReservation/fileload/download/16311442750812_8.jpg',
-					name: '九岭山房民宿',
-					leave: '金宿',
-					rate: 4.8,
-					num: 109,
-					price: 180
-				},
-				{
-					id: 1102488098,
-					url: 'https://chtech.ncjti.edu.cn/hotelReservation/fileload/download/1933617026前台.jpg',
-					name: '云上九岭',
-					leave: '白金',
-					rate: 4.5,
-					num: 21,
-					price: 880
-				},
-				{
-					id: 1147515780,
-					url: 'https://chtech.ncjti.edu.cn/hotelReservation/fileload/download/1922593201民宿图片2.jpg',
-					name: '靖安三闲居民宿',
-					leave: '白金',
-					rate: 4.6,
-					num: 89,
-					price: 680
-				},
-				{
-					id: 1851521611,
-					url: 'https://chtech.ncjti.edu.cn/hotelReservation/fileload/download/14323863982h0k15000000ym7ji8285_W_1080_808_R5_D.jpg',
-					name: '野塘隐夏民宿',
-					leave: '白金',
-					rate: 4.7,
-					num: 81,
-					price: 650
-				}
-			],
+			rimList: [],
 			// 周边分段器当前索引
 			rimActiveIndex: 0,
 			// 周边分段器数组
-			rimHeaderList: ['民宿', '美食', '景点', '洗浴', '健身', 'KTV', '电影院', '酒店']
+			rimHeaderList: ['民宿', '美食', '景点', '洗浴', '健身', 'KTV', '电影院', '停车场', '酒吧', '加油站', '其他'],
+			// 周边列表当前页
+			page: 1,
+			// 周边列表每页多少条
+			rows: 10,
+			// 周边列表总条数
+			rimTotal: null,
+			// 用户定位经度
+			myLng: 0,
+			// 用户定位纬度
+			myLat: 0
 		}
 	},
 	mounted() {
@@ -449,6 +421,21 @@ export default {
 				this.getEvaData()
 			}
 		})
+		uni.getLocation({
+			type: 'gcj02',
+			success: (res) => {
+				this.myLat = res.latitude
+				this.myLng = res.longitude
+				// this.rimList.forEach((ele) => {
+				// 	let lat = ele.jingwei.split(',')[1]
+				// 	let lng = ele.jingwei.split(',')[0]
+				// 	ele.distance = this.calculateDistance(lat, lng)
+				// })
+			},
+			complete: () => {
+				this.getRimList()
+			}
+		})
 	},
 	onPageScroll(e) {
 		if (!this.queryDom) {
@@ -474,17 +461,44 @@ export default {
 			this.activeIndex = 0
 		}
 	},
-	methods: {
-		test() {
+	onReachBottom() {
+		if (this.rimList < this.rimTotal) {
+			this.page++
+			this.getRimList()
+		} else {
 			uni.showToast({
-				title: '功能开发中',
-				icon: 'none',
-				mask: true
+				title: '没有更多数据了',
+				icon: 'none'
 			})
+		}
+	},
+	methods: {
+		async getRimList() {
+			const res = await this.$myRequest({
+				url: '/mhotel/applistAround.action',
+				data: {
+					page: this.page,
+					rows: this.rows,
+					rtype: this.rimHeaderList[this.rimActiveIndex]
+				}
+			})
+			// console.log(res)
+			if (res.code === 200) {
+				this.rimList = [...this.rimList, ...res.rows]
+				this.rimTotal = res.total
+				if (this.distance && this.rimList.length) {
+					this.rimList.forEach((ele) => {
+						let lat = ele.jingwei.split(',')[1]
+						let lng = ele.jingwei.split(',')[0]
+						ele.distance = this.calculateDistance(lat, lng)
+					})
+				}
+			}
 		},
-		GoRimDetail() {
+		GoRimDetail(item) {
+			let info = encodeURIComponent(JSON.stringify(item))
 			uni.navigateTo({
-				url: '/pages/rimDetail/rimDetail'
+				url: `/pages/rimDetail/rimDetail?info=${info}`
 			})
 		},
 		// 进入全屏和退出全屏时触发的回调
@@ -597,6 +611,9 @@ export default {
 		},
 		onClickItemRim(index) {
 			this.rimActiveIndex = index
+			this.pgae = 1
+			this.rimList = []
+			this.getRimList()
 		},
 		monthSwitch(e) {
 			let time = e.year + '-' + e.month.toString().padStart(2, 0) + '-01'
@@ -760,6 +777,7 @@ export default {
 			let today = new Date()
 			// 明天
 			let tomorrow = new Date(today.getTime() + 24 * 60 * 60 * 1000)
+
 			let late = new Date(today.getTime() + 24 * 60 * 60 * 1000 * 14)
 
 			this.startTime = `${today.getFullYear()}-${(today.getMonth() + 1).toString().padStart(2, 0)}-${today.getDate().toString().padStart(2, 0)}`
@@ -804,6 +822,21 @@ export default {
 				urls: temList,
 				current
 			})
+		},
+		// 计算两个点之间的距离
+		calculateDistance(lat, lng) {
+			let centerLat = lat
+			let centerLng = lng
+
+			let red1 = (this.myLat * Math.PI) / 180.0
+			let red2 = (centerLat * Math.PI) / 180.0
+			let a = red1 - red2
+			let b = (this.myLng * Math.PI) / 180.0 - (centerLng * Math.PI) / 180.0
+			let R = 6378137
+			let distance = R * 2 * Math.asin(Math.sqrt(Math.pow(Math.sin(a / 2), 2) + Math.cos(red1) * Math.cos(red2) * Math.pow(Math.sin(b / 2), 2)))
+			let res = (distance / 1000).toFixed(2) * 1
+
+			return res
 		}
 	}
 }
@@ -1603,6 +1636,20 @@ export default {
 			}
 		}
 
+		.noData {
+			display: flex;
+			flex-direction: column;
+			justify-content: center;
+			align-items: center;
+			padding-bottom: 60rpx;
+
+			img {
+				margin-top: 160rpx;
+				width: 500rpx;
+				height: 500rpx;
+			}
+		}
+
 		.rim_more {
 			display: flex;
 			justify-content: center;
@@ -1710,4 +1757,4 @@ export default {
 		}
 	}
 }
-</style>
+</style>

+ 5 - 5
pages/home3/home3.vue

@@ -96,7 +96,7 @@
 
 			<view class="body">
 				<!-- 精选攻略区域 -->
-				<view class="body_top">
+				<view class="body_top" v-if="bestNewsInfo">
 					<view class="circle"></view>
 					<view class="circle color"></view>
 					<view class="top_title">精选攻略 .</view>
@@ -106,7 +106,7 @@
 						<img src="https://chtech.ncjti.edu.cn/hotelReservation/image/13.png" />
 					</view>
 				</view>
-				<view class="body_strategy" @click="handleGoDetail(bestNewsInfo)">
+				<view v-if="bestNewsInfo" class="body_strategy" @click="handleGoDetail(bestNewsInfo)">
 					<img v-if="bestNewsInfo.image" class="strategy_cover" mode="aspectfill" :src="bestNewsInfo.image" />
 					<video
 						v-if="bestNewsInfo.video"
@@ -168,7 +168,7 @@
 						<view class="descrition">
 							<text class="title">{{ item.hotel_name }}</text>
 							<text class="type">{{ item.hTypeName }}</text>
-							<text class="distance">距您直线{{ item.distance }}公里</text>
+							<text class="distance" v-if="showdDistance">距您直线{{ item.distance }}公里</text>
 							<view class="detail">
 								<img class="img" src="../../static/index/hotel.png" />
 								<view class="price">
@@ -276,7 +276,7 @@ export default {
 			// 招商资讯列表
 			newsList: [],
 			// 精选攻略数据
-			bestNewsInfo: {}
+			bestNewsInfo: null
 		}
 	},
 	created() {
@@ -1209,4 +1209,4 @@ export default {
 		}
 	}
 }
-</style>
+</style>

+ 79 - 42
pages/rimDetail/rimDetail.vue

@@ -1,43 +1,38 @@
 <template>
-	<view class="container" :style="'overflow:' + (showPage ? 'hidden' : 'visible')">
+	<view class="container" :style="'overflow:' + (showPage ? 'hidden' : 'visible')" v-if="info">
 		<!-- 顶部轮播图区域 -->
-		<swiper class="swiper" indicator-dots indicator-color="rgba(255, 255, 255, 0.5)" indicator-active-color="#fff" autoplay :interval="3000">
-			<swiper-item>
+		<swiper v-if="info.detail_img" class="swiper" indicator-dots indicator-color="rgba(255, 255, 255, 0.5)" indicator-active-color="#fff" autoplay :interval="3000">
+			<swiper-item v-for="(item, index) in info.detail_img.split(',')" :key="index" @click="handleLookImgs(info.detail_img.split(','), index)">
 				<view class="swiper-item">
-					<img class="img" mode="aspectFill" src="https://chtech.ncjti.edu.cn/hotelReservation/fileload/download/1933617026前台.jpg" />
-				</view>
-			</swiper-item>
-			<swiper-item>
-				<view class="swiper-item">
-					<img class="img" mode="aspectFill" src="https://chtech.ncjti.edu.cn/hotelReservation/fileload/download/1933617026前台.jpg" />
+					<img class="img" mode="aspectFill" :src="item" />
 				</view>
 			</swiper-item>
 		</swiper>
 
 		<!-- 周边信息区域 -->
 		<view class="info">
-			<view class="info_name">周边名称周边名称周边名称</view>
+			<view class="info_name">{{ info.rname }}</view>
 			<view class="info_score">
-				<view class="score_left">5.0</view>
-				<view class="score_right">超棒</view>
+				<!-- <view class="score_left">5.0</view>
+				<view class="score_right">超棒</view> -->
 				<view class="score_msg" @click="goPageInfo">简介</view>
 				<img class="score_icon" src="../../static/index/right.png" @click="goPageInfo" />
 			</view>
 			<view class="info_address">
 				<img class="address_icon" src="../../static/index/address.png" />
-				江西省南昌市西湖区九州大街南昌动物园西门
+				<text @click="handleLookAddress">{{ info.radress }}</text>
 			</view>
 		</view>
 
 		<!-- 周边产品区域 -->
-		<view class="goods">
+		<view class="goods" v-if="goodList.length">
 			<view class="goods_title">周边产品</view>
 			<!-- 列表区域 -->
 			<view class="goods_list">
 				<!-- 每一个产品区域 -->
-				<view class="item_box" v-for="item in goodList" :key="item.id" @click="handleLookDetail">
+				<view class="item_box" v-for="item in goodList" :key="item.id" @click="handleLookDetail(item)">
 					<view class="box_left">
-						<view class="left_name">{{ item.name }}</view>
+						<view class="left_name">{{ item.product_name }}</view>
 						<view class="left_info">产品简介 ></view>
 						<view class="left_price">¥{{ item.price }}</view>
 					</view>
@@ -49,7 +44,7 @@
 		</view>
 
 		<!-- 查看更多区域 -->
-		<view class="more">
+		<view class="more" v-if="showMore" @click="handleShowMore">
 			查看更多
 			<img class="more_icon" src="../../static/index/down.png" />
 		</view>
@@ -57,11 +52,15 @@
 		<!-- 弹窗区域 -->
 		<uv-popup ref="popup" bgColor="none" :safeAreaInsetBottom="false">
 			<view class="body_pop">
-				<img class="pop_img" mode="aspectFill" src="https://chtech.ncjti.edu.cn/hotelReservation/fileload/download/1933617026前台.jpg" />
+				<img class="pop_img" mode="aspectFill" :src="info.first_img" />
 				<!-- 弹窗关闭图标区域 -->
 				<img class="pop_icon" src="../../static/index/close.png" @click="handleClosePop" />
-				<view class="pop_name">门票+观光车+竹筏</view>
-				<view class="pop_title">
+				<view class="pop_name">{{ popInfo.product_name }}</view>
+
+				<view class="pop_desc">
+					<mp-html :content="popInfo.product_desc" />
+				</view>
+				<!-- <view class="pop_title">
 					<img class="title_img" src="../../static/index/notice.png" />
 					购票须知
 				</view>
@@ -79,8 +78,7 @@
 					<img class="title_img" src="../../static/index/phone3.png" />
 					联系电话
 				</view>
-
-				<view class="pop_phone">13677988964</view>
+				<view class="pop_phone">13677988964</view> -->
 			</view>
 		</uv-popup>
 	</view>
@@ -92,32 +90,45 @@ export default {
 		return {
 			// 滚动穿透控制
 			showPage: false,
-			goodList: [
-				{
-					id: 1,
-					name: '门票+观光车+竹筏',
-					price: 120
-				},
-				{
-					id: 2,
-					name: '门票',
-					price: 20
-				},
-				{
-					id: 3,
-					name: '观光车+竹筏',
-					price: 80
-				}
-			]
+			goodList: [],
+			page: 1,
+			rows: 3,
+			total: null,
+			info: null,
+			showMore: true,
+			popInfo: null
 		}
 	},
+	onLoad(options) {
+		this.info = JSON.parse(decodeURIComponent(options.info))
+		this.getData()
+	},
 	methods: {
+		async getData() {
+			const res = await this.$myRequest({
+				url: '/mhotel/applistAround_pd.action',
+				data: {
+					aid: this.info.id,
+					page: this.page,
+					rows: this.rows
+				}
+			})
+			// console.log(res)
+			if (res.code === 200) {
+				this.goodList = [...this.goodList, ...res.rows]
+				this.total = res.total
+				if (this.goodList.length >= this.total) {
+					this.showMore = false
+				}
+			}
+		},
 		goPageInfo() {
 			uni.navigateTo({
-				url: '/pages/rimInfo/rimInfo'
+				url: `/pages/rimInfo/rimInfo?desc=${this.info.detail}`
 			})
 		},
-		handleLookDetail() {
+		handleLookDetail(item) {
+			this.popInfo = item
 			this.showPage = true
 			this.$refs.popup.open('bottom')
 		},
@@ -125,6 +136,28 @@ export default {
 		handleClosePop() {
 			this.showPage = false
 			this.$refs.popup.close()
+		},
+		handleLookImgs(urls, current) {
+			uni.previewImage({
+				urls,
+				current
+			})
+		},
+		handleLookAddress() {
+			let latitude = this.info.jingwei.split(',')[1] * 1
+			let longitude = this.info.jingwei.split(',')[0] * 1
+
+			uni.openLocation({
+				latitude,
+				longitude,
+				name: this.info.rname,
+				address: this.info.radress,
+				success: () => {}
+			})
+		},
+		handleShowMore() {
+			this.page++
+			this.getData()
 		}
 	}
 }
@@ -184,7 +217,7 @@ export default {
 				background-color: #dff2f2;
 			}
 			.score_msg {
-				margin-left: 42rpx;
+				// margin-left: 42rpx;
 				color: #096562;
 			}
 
@@ -326,6 +359,10 @@ export default {
 			font-weight: bold;
 		}
 
+		.pop_desc {
+			padding: 0 20rpx;
+		}
+
 		.pop_title {
 			display: flex;
 			align-items: center;

+ 10 - 3
pages/rimInfo/rimInfo.vue

@@ -1,6 +1,8 @@
 <template>
 	<view class="container">
-		<view class="title">
+		<mp-html :content="desc" />
+
+		<!-- <view class="title">
 			<img class="title_img" src="../../static/index/notice.png" />
 			购票须知
 		</view>
@@ -15,14 +17,19 @@
 			景点介绍
 		</view>
 
-		<view class="content">此处内容为景点介绍内容</view>
+		<view class="content">此处内容为景点介绍内容</view> -->
 	</view>
 </template>
 
 <script>
 export default {
 	data() {
-		return {}
+		return {
+			desc: ''
+		}
+	},
+	onLoad(options) {
+		this.desc = options.desc
 	}
 }
 </script>

+ 2 - 1
util/api.js

@@ -40,7 +40,8 @@ export const myRequest = (options) => {
 
 						} else {
 							uni.showToast({
-								title: res.data.message,
+								title: res.data.message ? res.data.message :
+									'报错',
 								icon: "none",
 								mask: true
 							})