Commit bd78b251 authored by youjie's avatar youjie

优化

parent 4686628e
<script>
import {
setAttatchParameter
} from './plugin/utils.js'
export default {
data() {
return {
......
......@@ -43,9 +43,7 @@
:key="index"
class="day-list"
:class="[
line == start[0] && index == start[1]
? 'bg-orange select-style'
: '',
line == start[0] && index == start[1]? 'bg-orange select-style': '',
(line >= start[0] &&
line <= end[0] &&
index > start[1] &&
......@@ -53,9 +51,8 @@
(line >= start[0] && index > start[1] && line < end[0]) ||
(line <= end[0] && index < end[1] && line > start[0]) ||
(line < end[0] && line > start[0])
? 'bg-higlt-orange'
: '',
line == 0 && index + 1 < nowDay ? 'time-out' : '',
? 'bg-higlt-orange': '',
((line==0||line==start[0])&& index + 1 < nowDay)||res.month<nowMonth ? 'time-out' : '',
isNaN(item) ? 'is-festival' : '',
(isNaN(item) && line == start[0] && index == start[1]) ||
(isNaN(item) && line == end[0] && index == end[1])
......@@ -88,9 +85,9 @@
color: line == end[0] && index == end[1] ? '#FFFFFF' : '',
}"
>
<view style="padding-top: 2px; padding-bottom: 2px">{{
item
}}</view>
<view style="padding-top: 2px; padding-bottom: 2px">
{{item}}
</view>
<view
class="select-style"
v-if="line == start[0] && index == start[1]"
......@@ -189,6 +186,7 @@ export default {
type: "-", //日期分隔符
date: [], //日期数组对象
dayWidth: 0, //日期的宽度
nowMonth: 0, //当前时间的月
nowDay: 0, //当前时间的日
start: [], //入住时间
count: 6, //显示月的数量
......@@ -213,7 +211,8 @@ export default {
},
});
this.setDate();
this.nowDay = new Date().getDate()+7;
// this.nowDay = new Date().getDate()
/*默认入住离店日期,今日入住明日离店,此处应在setDefaultDate函数内传入vuex里保存的日期进行默认操作
*不推荐使用本地缓存,下边只是使用缓存的示例
*/
......@@ -224,11 +223,14 @@ export default {
var obj = JSON.parse(res.data);
this.start = this.setDefaultDate(obj.start);
this.end = this.setDefaultDate(obj.end);
this.nowDay = this.$utils.GetDateFewFaysLater(obj.fewDays).dd
this.nowMonth = this.$utils.GetDateFewFaysLater(obj.fewDays).mm
}
},
fail: () => {
this.start = this.setDefaultDate(this.getDefaultDate(0));
this.end = this.setDefaultDate(this.getDefaultDate(1));
console.log(this.start,this.end)
},
});
setTimeout(()=>{
......@@ -448,7 +450,7 @@ export default {
//选择入住离开
selectDay(line, index) {
if (line == 0 && index + 1 < this.nowDay) return;
if (((line==0||line==this.start[0])&& index + 1 < this.nowDay)||this.resDate[line].month<this.nowMonth) return;
//如果有入住情况和价格则需要进行一些列的判断
if (this.priceStauts.length > 0) {
if (
......
......@@ -37,9 +37,6 @@
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 {
......@@ -89,8 +86,9 @@
uni.setNavigationBarTitle({
title: "酒店",
});
let d1 = this.$utils.GetDateFewFaysLater(7);
let d2 = this.$utils.GetDateFewFaysLater(8);
let fewDays = 7
let d1 = this.$utils.GetDateFewFaysLater(fewDays);
let d2 = this.$utils.GetDateFewFaysLater(fewDays+1);
var obj = {
start: `${d1.year}-${d1.month}-${d1.day}`,
end: `${d2.year}-${d2.month}-${d2.day}`,
......@@ -100,7 +98,8 @@
startWeek: this.getWeek(d1.date),
endWeek: this.getWeek(d2.date),
startTime: `${d1.year}-${d1.month}-${d1.day}`,
endTime: `${d2.year}-${d2.month}-${d2.day}`
endTime: `${d2.year}-${d2.month}-${d2.day}`,
fewDays: fewDays
};
this.dayObj = obj;
uni.setStorage({
......
......@@ -196,7 +196,9 @@ function GetDateFewFaysLater(Days){
return {
year: year,
month: month>9?month:'0'+month,
mm:month,
day: day>9?day:'0'+day,
dd:day,
date: `${year}-${month>9?month:'0'+month}-${day>9?day:'0'+day}`
}
}
......
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