Commit 80a55cf9 authored by youjie's avatar youjie

优化

parent 7fb8b2b0
......@@ -750,13 +750,6 @@
}
}, {
"path": "orderdetails"//酒店订单详情
// ,"style": {
// "navigationStyle": "custom",
// "mp-alipay": {
// "transparentTitle": "always",
// "titlePenetrate": "YES"
// }
// }
}
]
},
......
......@@ -53,7 +53,7 @@
<script>
export default {
props: ['item', 'isMap', 'dayObj', 'searchObj'],
props: ['item', 'isMap', 'searchObj'],
data() {
return {
StarImgs: [
......@@ -67,21 +67,20 @@
},
created() {},
watch: {
dayObj: {
searchObj: {
handler(val, oldval) {
if (val) {
this.myDayObj = val
}
},
deep: true,
immediate: true
immediate: false
}
},
methods: {
goHotelDetail(id) {
let myDayObj = JSON.stringify(this.myDayObj);
uni.navigateTo({
url: "/pages/hotel/detail?id=" + id + '&dayObj=' + myDayObj + '&searchObj=' + JSON.stringify(
url: "/pages/hotel/detail?id=" + id +'&searchObj=' + JSON.stringify(
this.searchObj)
});
}
......
......@@ -149,7 +149,7 @@
<script>
import orderService from "@/components/serviceStaff/orderService";
export default {
props: ['roomMsg', 'dataList', 'search', 'rooms', 'day', 'qRoomType', 'qMealType','createById'],
props: ['roomMsg', 'dataList', 'search', 'rooms', 'qRoomType', 'qMealType','createById'],
components: {
orderService,
},
......@@ -223,14 +223,6 @@
},
deep: true,
},
day: {
handler(val, oldval) {
if (val) {
this.dayObj = val
}
},
deep: true,
},
roomMsg: {
handler(val, oldval) {
if (val) {
......@@ -256,6 +248,15 @@
this.b2bUser = uni.getStorageSync("b2b_user");
this.getSale()
},
mounted() {
uni.getStorage({
key: "Time",
success: (res) => {
let obj = JSON.parse(res.data);
this.dayObj = obj
},
});
},
methods: {
goReserce(item){
this.msg.SaleName = item.SaleName
......@@ -418,7 +419,7 @@
console.log("hotelRoom", pHotel);
console.log("searchroomGroup", this.searchObj.searchroomGroup);
uni.navigateTo({
url: `/pages/hotel/order?searchObj=${JSON.stringify(this.searchObj)}&dayObj=${JSON.stringify(this.dayObj)}&HotelInfo=${JSON.stringify(pHotel)}&RoomInfo=${JSON.stringify(subItem)}&CreateBy=${createBy}`,
url: `/pages/hotel/order?searchObj=${JSON.stringify(this.searchObj)}&HotelInfo=${JSON.stringify(pHotel)}&RoomInfo=${JSON.stringify(subItem)}&CreateBy=${createBy}`,
});
},
openPicture(item) {
......
......@@ -302,16 +302,6 @@
},
deep: true,
},
daysObj: {
handler(val, oldval) {
this.startDay = val.startDay;
this.endDay = val.endDay;
this.day = val.day;
this.dayObj = val
},
deep: true,
immediate: true,
},
MapType: {
handler(val, oldval) {
if (val) {
......@@ -322,6 +312,18 @@
},
onLoad(options) {
},
mounted() {
uni.getStorage({
key: "Time",
success: (res) => {
let obj = JSON.parse(res.data);
this.startDay = obj.startDay;
this.endDay = obj.endDay;
this.day = obj.day;
this.dayObj = obj
},
});
},
created() {
uni.setNavigationBarTitle({
......@@ -632,7 +634,7 @@
goMapHotel() {
this.closeDropdown()
uni.navigateTo({
url: `/pages/hotel/mapList?msg=${encodeURIComponent(JSON.stringify(this.parameters))}&dayObj=${encodeURIComponent(JSON.stringify(this.dayObj))}&MapType=1`
url: `/pages/hotel/mapList?msg=${encodeURIComponent(JSON.stringify(this.parameters))}&MapType=1`
});
}
},
......
......@@ -236,7 +236,7 @@ export default {
},
});
this.setDate();
this.nowDay = new Date().getDate();
this.nowDay = new Date().getDate()+7;
/*默认入住离店日期,今日入住明日离店,此处应在setDefaultDate函数内传入vuex里保存的日期进行默认操作
*不推荐使用本地缓存,下边只是使用缓存的示例
*/
......
......@@ -524,52 +524,25 @@
},
});
this.mainColor = this.$uiConfig.mainColor;
if (options.dayObj) {
var tempDay = JSON.parse(options.dayObj);
this.roomMsg.StartDate = tempDay.start;
this.roomMsg.EndDate = tempDay.end;
this.startDay = tempDay.startDay;
this.endDay = tempDay.endDay;
this.day = tempDay.day;
this.dayObj = tempDay;
} else {
let d1 = new Date();
let d = new Date();
let d2 = new Date(d.setDate(d.getDate() + 1));
let startWeek = "周" + "日一二三四五六".charAt(new Date().getDay());
let endWeek = "周" + "日一二三四五六".charAt(new Date().getDay() + 1);
let month1 = d1.getMonth() + 1;
let day1 = d1.getDate();
let Month1 = month1 > 9 ? month1 : '0' + month1;
let Day1 = day1 > 9 ? day1 : '0' + day1;
let month2 = d2.getMonth() + 1;
let day2 = d2.getDate();
let Month2 = month2 > 9 ? month2 : '0' + month2;
let Day2 = day2 > 9 ? day2 : '0' + day2;
var obj = {
start: `${d1.getFullYear()}-${Month1}-${Day1}`,
end: `${d2.getFullYear()}-${Month2}-${Day2}`,
startDay: `${Month1}-${Day1}`,
endDay: `${Month2}-${Day2}`,
day: 1,
startWeek: startWeek,
endWeek: endWeek,
};
this.roomMsg.StartDate = obj.start;
this.roomMsg.EndDate = obj.end;
this.startDay = obj.startDay;
this.endDay = obj.endDay;
this.day = obj.day;
this.dayObj = obj;
}
if (this.id > 0) {
this.getHotelDetail(this.id);
}
if (options.searchObj) {
this.searchObj = JSON.parse(options.searchObj);
}
this.getHotelPrices()
uni.getStorage({
key: "Time",
success: (res) => {
let obj = JSON.parse(res.data);
this.roomMsg.StartDate = obj.start;
this.roomMsg.EndDate = obj.end;
this.startDay = obj.startDay;
this.endDay = obj.endDay;
this.day = obj.day;
this.dayObj = obj;
this.getHotelPrices()
},
});
this.getdidaMealType()
},
onShow() {
......
......@@ -4,7 +4,6 @@
<hotelHeaders :title="pageTitle"></hotelHeaders>
<hotelSearch
:msg="searchObj"
:daysObj="dayObj"
:isMap="1"
@change="change" @getItem="getItem">
</hotelSearch>
......@@ -20,7 +19,7 @@
:scroll-top="scrollTop" @scroll="scroll" v-if="HotelList.length > 0" class="hotelScroll">
<view style="padding: 0 31rpx;">
<view v-for="(item,index) in HotelList" :key="index">
<hotel-good :item="item" :dayObj="dayObj" :searchObj="searchObj"></hotel-good>
<hotel-good :item="item" :searchObj="searchObj"></hotel-good>
</view>
</view>
<u-loadmore v-if="showLoading" :status="status" :load-text="loadText" :font-size="24"
......@@ -38,6 +37,9 @@
import Address from "./components/address/smh-address-indexed.vue";
import hotelHeaders from "@/components/header/header";
import hotelSearch from "./components/search.vue";
import {
GetDateFewFaysLater
} from '@/plugin/utils.js'
export default {
data() {
return {
......@@ -87,30 +89,18 @@
uni.setNavigationBarTitle({
title: "酒店",
});
let d1 = new Date();
let d = new Date();
let d2 = new Date(d.setDate(d.getDate() + 1));
let startWeek = "周" + "日一二三四五六".charAt(new Date().getDay());
let endWeek = "周" + "日一二三四五六".charAt(new Date().getDay() + 1);
let month1 = d1.getMonth() + 1;
let day1 = d1.getDate();
let Month1 = month1 > 9 ? month1 : '0' + month1;
let Day1 = day1 > 9 ? day1 : '0' + day1;
let month2 = d2.getMonth() + 1;
let day2 = d2.getDate();
let Month2 = month2 > 9 ? month2 : '0' + month2;
let Day2 = day2 > 9 ? day2 : '0' + day2;
let d1 = this.$utils.GetDateFewFaysLater(7);
let d2 = this.$utils.GetDateFewFaysLater(8);
var obj = {
start: `${d1.getFullYear()}-${Month1}-${Day1}`,
end: `${d1.getFullYear()}-${Month2}-${Day2}`,
startDay: `${Month1}-${Day1}`,
endDay: `${Month2}-${Day2}`,
start: `${d1.year}-${d1.month}-${d1.day}`,
end: `${d2.year}-${d2.month}-${d2.day}`,
startDay: `${d1.month}-${d1.day}`,
endDay: `${d2.month}-${d2.day}`,
day: 1,
startWeek: startWeek,
endWeek: endWeek,
startTime: `${d1.getFullYear()}-${Month1}-${Day1}`,
endTime: `${d1.getFullYear()}-${Month2}-${Day2}`
startWeek: this.getWeek(d1.date),
endWeek: this.getWeek(d2.date),
startTime: `${d1.year}-${d1.month}-${d1.day}`,
endTime: `${d2.year}-${d2.month}-${d2.day}`
};
this.dayObj = obj;
uni.setStorage({
......@@ -120,6 +110,11 @@
this.getSearchCondition();
},
methods: {
getWeek(date) {
var weekArray = new Array("日", "一", "二", "三", "四", "五", "六");
var week = weekArray[new Date(date).getDay()]; //注意此处必须是先new一个Date
return "周" + week;
},
getItem(parameters, obj) {
this.searchObj = {
...this.searchObj,
......@@ -130,6 +125,10 @@
startTime: `${obj.year}-${obj.startDay}`,
endTime: `${obj.year}-${obj.endDay}`
}
uni.setStorage({
key: "Time",
data: JSON.stringify(this.dayObj),
});
},
scroll(e) {
this.old.scrollTop = e.detail.scrollTop;
......
......@@ -4,7 +4,6 @@
<hotelHeaders :title="pageTitle"></hotelHeaders>
<hotelSearch
:msg="searchObj"
:daysObj="dayObj"
:MapType="MapType"
@change="change"
@getItem="getItem"></hotelSearch>
......@@ -47,7 +46,7 @@
current==index?'active':'',
nextCurrent==index?'activeNext':'',]">
<view class="hotelMapList">
<hotel-good :item="item" :dayObj="dayObj" :searchObj="searchObj" :isMap="1"></hotel-good>
<hotel-good :item="item" :searchObj="searchObj" :isMap="1"></hotel-good>
</view>
</swiper-item>
</swiper>
......@@ -182,14 +181,18 @@
this.searchObj = JSON.parse(decodeURIComponent(options.msg))
this.pageTitle = this.searchObj.CityName
}
if(options && options.dayObj){
this.dayObj = JSON.parse(decodeURIComponent(options.dayObj))
this.searchObj.QStartDate = this.dayObj.start;
this.searchObj.QEndDate = this.dayObj.end;
this.startDay = this.dayObj.startDay;
this.endDay = this.dayObj.endDay;
this.day = this.dayObj.day;
}
uni.getStorage({
key: "Time",
success: (res) => {
let obj = JSON.parse(res.data);
this.startDay = obj.startDay;
this.endDay = obj.endDay;
this.day = obj.day;
this.dayObj = obj
this.searchObj.QStartDate = obj.start;
this.searchObj.QEndDate = obj.end;
},
});
this.MapType = options.MapType?options.MapType:0;
},
created() {
......@@ -205,6 +208,10 @@
startTime: `${obj.year}-${obj.startDay}`,
endTime: `${obj.year}-${obj.endDay}`
}
uni.setStorage({
key: "Time",
data: JSON.stringify(this.dayObj),
});
},
handleCalloutClick(marker) {
console.log('点击了标记:', marker.detail);
......
......@@ -7,11 +7,9 @@
<view class="o-timer">
<view class="row-sb-n">
<view class="row items-center">
<view class="time-item">{{getDate(dayObj.start)?getDate(dayObj.start):''}}
<text>{{ getWeek(dayObj.start) }}</text>
</view>
<view class="time-item">{{getDate(dayObj.start)}}<text>{{ getWeek(dayObj.start) }}</text></view>
<view class="time-itemZhi"><text>-</text></view>
<view class="time-item">{{getDate(dayObj.end)}}</view>
<view class="time-item">{{getDate(dayObj.end)}}<text>{{ getWeek(dayObj.end) }}</text></view>
<view class="timeline"></view>
<view class="time-split">
<view>{{dayObj.day?dayObj.day:''}}</view>
......@@ -384,10 +382,6 @@
price: 0,
}
},
created() {
this.mainColor = this.$uiConfig.mainColor;
this.activeStyle = `background:${this.mainColor};`;
},
onLoad(options) {
uni.setNavigationBarTitle({
title: "订单支付预览",
......@@ -407,39 +401,52 @@
if (options.RoomInfo) {
this.RoomInfo = JSON.parse(options.RoomInfo)
}
if (options.dayObj) {
this.dayObj = JSON.parse(options.dayObj)
}
if (options.CreateBy) {
this.CreateBy = options.CreateBy
}
this.orderMsg.ProductId = this.RoomInfo.RoomTypeID;
this.orderMsg.RatePlanID = this.RoomInfo.RatePlanID
this.orderMsg.CheckInDate = this.dayObj.start;
this.orderMsg.CheckOutDate = this.dayObj.end;
this.orderMsg.RoomCount = this.searchObj.rooms
this.getGroupData()
this.params = {
sort: 1,
displayFrom: 1,
CheckInDate: this.orderMsg.CheckInDate,
CheckOutDate: this.orderMsg.CheckOutDate,
searchroomGroup: this.searchObj.searchroomGroup,
ratePlanID: this.orderMsg.RatePlanID,
imgUrl: "",
RoomCount: this.orderMsg.RoomCount,
ChildCount: this.searchObj.childrenNumberZC,
AdultCount: this.searchObj.adultsNumber,
OccupancyDetails: [],
hotelId: this.orderMsg.hotelId
}
this.price = this.RoomInfo.Currency + this.RoomInfo.RatePlanPrice
this.getUserCouponList()
this.CalTotalPrice();
this.GetCountryInfo()
this.initHotel()
},
created() {
this.mainColor = this.$uiConfig.mainColor;
this.activeStyle = `background:${this.mainColor};`;
},
mounted() {
uni.getStorage({
key: "Time",
success: (res) => {
let obj = JSON.parse(res.data);
this.dayObj = obj
this.orderMsg.CheckInDate = this.dayObj.start;
this.orderMsg.CheckOutDate = this.dayObj.end;
this.params = {
sort: 1,
displayFrom: 1,
CheckInDate: this.orderMsg.CheckInDate,
CheckOutDate: this.orderMsg.CheckOutDate,
searchroomGroup: this.searchObj.searchroomGroup,
ratePlanID: this.orderMsg.RatePlanID,
imgUrl: "",
RoomCount: this.orderMsg.RoomCount,
ChildCount: this.searchObj.childrenNumberZC,
AdultCount: this.searchObj.adultsNumber,
OccupancyDetails: [],
hotelId: this.orderMsg.hotelId
}
this.initHotel()
},
});
},
methods: {
getGroupData(){
......
......@@ -182,6 +182,24 @@ function setAttatchParameter(vm){
}
}
//获取几天后的日期
function GetDateFewFaysLater(Days){
let today = new Date()
let date2 = new Date(today);
const date = new Date(date2.setDate(today.getDate() + Days));
// 获取日期信息
const year = date.getFullYear();
const month = date.getMonth() + 1; // 月份是从0开始的
const day = date.getDate();
return {
year: year,
month: month>9?month:'0'+month,
day: day>9?day:'0'+day,
date: `${year}-${month>9?month:'0'+month}-${day>9?day:'0'+day}`
}
}
export default {
calcContentHeight,
......@@ -193,5 +211,6 @@ export default {
// #endif
VersionUpdate,
formatDates,
setAttatchParameter
setAttatchParameter,
GetDateFewFaysLater
}
\ No newline at end of file
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