Commit 80a55cf9 authored by youjie's avatar youjie

优化

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