Commit 3ed0e1b5 authored by zhengke's avatar zhengke

修改

parent f37d7f22
......@@ -46,6 +46,10 @@
dayObj:{
type: Object,
default: null
},
searchObj:{
type:Object,
default:null
}
},
data() {
......@@ -60,7 +64,7 @@
goHotelDetail(id){
let myDayObj = JSON.stringify(this.dayObj);
uni.navigateTo({
url: "/pages/hotel/detail?id=" + id + '&dayObj=' + myDayObj
url: "/pages/hotel/detail?id=" + id + '&dayObj=' + myDayObj+'&searchObj='+JSON.stringify(this.searchObj)
});
}
}
......
<template>
<view class="hotel-list-item">
<view class="img-box">
<image src="http://imgfile.oytour.com/Upload/DMC/202105251114114560000000058.png" mode="aspectFill"></image>
</view>
<view class="hotel-info">
<view class="hotel-name">乐山禅驿·嘉定院子酒店</view>
<view class="hotel-start">
<!-- TODO:判定是否为星级酒店,如果是显示星级,不是,显示另外一种方式 -->
<view class="rate" v-if="hotelType==0">
<u-rate active-color="#FEB969" inactive-color="#FFF" current="4" active-icon="star" inactive-icon="star" disabled></u-rate>
<text style="margin-left: 20rpx;vertical-align: top;">四星</text>
<view>
<view class="hotel-list-item" v-for="(item,index) in HotelArr" :key="index" @click="goHotelDetail(item.HotelId)">
<view class="img-box">
<image :src="item.CoverImg" mode="aspectFill"></image>
</view>
<view class="hotel-info">
<view class="hotel-name">{{item.HotelName}}</view>
<view class="hotel-start">
<!-- TODO:判定是否为星级酒店,如果是显示星级,不是,显示另外一种方式 -->
<view class="rate" v-if="item.Star>=1&&item.Star<=5">
<u-rate active-color="#FEB969" inactive-color="#FFF" :current="item.Star" active-icon="star" inactive-icon="star" disabled></u-rate>
<text style="margin-left: 20rpx;vertical-align: top;">{{item.StarName}}</text>
</view>
<view class="other-rate" v-if="item.Star==9">
<text>温泉酒店</text>
<span class="line"></span>
</view>
<view class="other-rate" v-if="item.Star==8">
<text>精选民宿</text>
<span class="line"></span>
</view>
</view>
<view class="other-rate" v-if="hotelType==1">
<text>温泉酒店</text>
<span class="line"></span>
<view class="localtion">{{item.Address}}</view>
<view>
<u-tag text="亲子设施" bg-color="#FFF" border-color="#DFBE6E" color="#DFBE6E" size="mini"></u-tag>
</view>
<view class="other-rate" v-if="hotelType==2">
<text>精选民宿</text>
<span class="line"></span>
<view class="price">
<text></text>
<text class="money">{{item.B2BPrice}}</text>
<text></text>
</view>
</view>
<view class="localtion">距该酒店直线4.1公里·近九寨千古情景区·沟口</view>
<view>
<u-tag text="亲子设施" bg-color="#FFF" border-color="#DFBE6E" color="#DFBE6E" size="mini"></u-tag>
</view>
<view class="price">
<text></text>
<text class="money">599</text>
<text></text>
</view>
</view>
</view>
</template>
......@@ -36,9 +38,17 @@
<script>
export default {
props:{
hotelType:{
type:Number,
default:0
HotelArr:{
type:Array,
default:null
},
dayObj:{
type:Object,
default:null
},
searchObj:{
type:Object,
default:null
}
},
data() {
......@@ -46,6 +56,18 @@
key: value
}
},
mounted(){
console.log(this.dayObj,'dayObj');
console.log(this.searchObj,'searchObj');
},
methods:{
goHotelDetail(id){
let myDayObj = JSON.stringify(this.dayObj);
uni.navigateTo({
url: "/pages/hotel/detail?id=" + id +'&dayObj=' + myDayObj+'&searchObj='+JSON.stringify(this.searchObj)
});
}
}
}
</script>
......
......@@ -174,12 +174,12 @@
<text>精选推荐</text>
</view>
<view class="flex" style="margin-left: 64rpx;">
<view class="nearby-type active">附近满足条件酒店(2)</view>
<view class="nearby-type active">附近满足条件酒店({{HotelArr.length}})</view>
</view>
</view>
<view>
<recommed-hotel></recommed-hotel>
<recommed-hotel :hotelType="1"></recommed-hotel>
<recommed-hotel :HotelArr="HotelArr" :dayObj="dayObj" :searchObj="searchObj"></recommed-hotel>
<!-- <recommed-hotel :hotelType="1"></recommed-hotel> -->
</view>
</view>
</view>
......@@ -257,6 +257,9 @@
RoomList: [], //可过滤房间
dataList: {}, //数据
isShowAll: false, //显示全部
HotelArr:[] ,//推荐酒店
searchObj:{},
dayObj:{}
}
},
components: {
......@@ -270,7 +273,8 @@
},
onLoad(options) {
this.id = options.id
this.id = options.id;
this.roomMsg.HotelId = options.id;
let that = this
uni.getSystemInfo({
success(res) {
......@@ -287,14 +291,40 @@
}
if (options.dayObj) {
var tempDay = JSON.parse(options.dayObj);
this.dayObj = tempDay;
this.roomMsg.StartDate = tempDay.StartDate;
this.roomMsg.EndDate = tempDay.EndDate;
this.day = tempDay.day;
this.startWeek = tempDay.startWeek;
this.endWeek = tempDay.endWeek;
}
if(options.searchObj){
this.searchObj = JSON.parse(options.searchObj);
}
this.getRecomHotel();
},
methods: {
//获取推荐酒店
getRecomHotel(){
this.searchObj.HotelId = this.id
this.request2({
url: '/api/Hotel/AppGetHotelPage',
data: this.searchObj
},
res => {
if (res.resultCode == 1) {
console.log(res,'推荐酒店');
this.HotelArr=[];
let tempHotel = res.data.pageData;
tempHotel.forEach(x=>{
if(this.HotelArr.length<2){
this.HotelArr.push(x);
}
})
}
}
);
},
goMap(name, lon, lat) {
wx.openLocation({
latitude: lat,
......@@ -322,20 +352,29 @@
url: "/pages/hotel/description?hotelObj="+encodeURIComponent(hotelObj)
})
},
//返回周几
getWeek(date) {
console.log(date, 'date');
var weekArray = new Array("日", "一", "二", "三", "四", "五", "六");
var week = weekArray[new Date(date).getDay()]; //注意此处必须是先new一个Date
return '周' + week;
},
chosenDateResult(obj) {
console.log(obj, 'objjjj');
obj.startDay = this.formatMonthDay(obj.startDay)
obj.endDay = this.formatMonthDay(obj.endDay)
this.searchObj.date = obj
this.roomMsg.StartDate = obj.start;
this.roomMsg.EndDate = obj.end;
this.startWeek = obj.startWeek;
this.endWeek = obj.endWeek;
this.day = obj.day;
this.getRoomType();
this.showTimePopup = false
},
//切换日期获取房型
getRoomType(){
this.request2({
url: '/api/Hotel/GetHotelRoom',
data: this.roomMsg
},
res => {
if (res.resultCode == 1) {
console.log(res, '房间数据');
this.RoomList = res.data.RoomList;
}
}
);
},
formatMonthDay(str) {
let temp = str.split('-')
temp[0] = temp[0] > 9 ? temp[0] : "0" + temp[0]
......@@ -351,6 +390,7 @@
return d > 9 ? d : "0" + d
},
getWeek(date) {
console.log(date,'date');
let day = date.getDay();
if (day === 1) {
var week = "一";
......@@ -422,6 +462,9 @@
} else {
this.isShowAll = false;
}
if(num==0){
this.RoomList = this.dataList.RoomList;
}
},
changeLike() {
this.islike = !this.islike
......
......@@ -55,7 +55,7 @@
</view>
<scroll-view :scroll-y="true" @scrolltolower="lower" :enable-back-to-top="true" :enable-flex="true" :scroll-top="scrollTop"
@scroll="scroll" style="height: calc(100% - 224rpx); padding-bottom: 0px;">
<hotel-good :HotelList="HotelList" :dayObj="dayObj"></hotel-good>
<hotel-good :HotelList="HotelList" :dayObj="dayObj" :searchObj="searchObj"></hotel-good>
<u-loadmore v-if="showLoading" :status="status" :load-text="loadText" :font-size="24" :margin-top="20"
:margin-bottom="20" bg-color="#F5F5F5" color="#111" />
</scroll-view>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment