Commit 171a41af authored by 罗超's avatar 罗超

实现VIP功能,优化日历

parent 7c304602
<template>
<view class="content">
<scroll-view :scroll-y="true" style="height: 100%; flex: 1; box-sizing: border-box">
<scroll-view :scroll-y="true" class="sign-scroll" scroll-with-animation="true" style="height: 100%; flex: 1; box-sizing: border-box" :scroll-top="scrollTop">
<view class="header">
<!-- <view class="bar"></view>
<view class="set text-gray">
<text @click="close" style="font-size:40upx;">返回</text>
<text @click="reset" style="font-size:35upx;color:#DDDDDD">清空</text>
</view> -->
<!-- <view class="in-and-out">
<view class="item" v-if="start.length > 0">
<view style="font-size:30upx;color:#C0C0C0">入住日期</view>
<view style="font-weight: bold;margin-top:10upx;font-size:36upx">{{ startDay }}</view>
<view style="font-size:24upx;margin-top:10upx">{{ startWeek }}</view>
</view>
<view class="item text" v-if="start.length == 0">
<view>入住日期</view>
</view>
<view class="item">
<view class="count-border" :class="day == 0 ? 'gray' : 'orange'">
<view class="count" style="font-size:26upx;line-height:26upx;">{{ day }}</view>
</view>
</view>
<view class="item text" v-if="end.length == 0">
<view>离店日期</view>
</view>
<view class="item" v-if="end.length > 0">
<view style="font-size:30upx;color:#C0C0C0">离店日期</view>
<view style="font-weight: bold;margin-top:10upx;font-size:36upx">{{ endDay }}</view>
<view style="font-size:24upx;margin-top:10upx">{{ endWeek }}</view>
</view>
</view> -->
<view style="
font-size: 32rpx;
color: #111;
......@@ -150,27 +123,7 @@
computed: {
//房间是否能预订
isSub() {
// if (this.priceStauts.length > 0) {
// for (var i = this.start[0]; i <= this.end[0]; i++) {
// if (i == this.start[0]) {
// for (var j = this.start[1]; j < this.date[i].length; j++) {
// if (this.priceStauts[i][j] == -1) return false
// }
// } else if (this.end[0] == this.start[0]) {
// for (var j = this.start[1]; j < this.end[1]; j++) {
// if (this.priceStauts[i][j] == -1) return false
// }
// } else if (i == this.end[0]) {
// for (var j = 0; j < this.end[1]; j++) {
// if (this.priceStauts[i][j] == -1) return false
// }
// } else {
// for (var j = 0; j < this.priceStauts[i].length; j++) {
// if (this.priceStauts[i][j] == -1) return false
// }
// }
// }
// }
return this.start.length == 2;
},
//计算日历里的节假日
......@@ -218,6 +171,8 @@
priceStauts: [], //价格状态
lastNot: [0, 10], //前置的无房操作
userDefaultDate: "",
scrollTop:0,
scrollHeight:0
};
},
mounted() {
......@@ -236,21 +191,23 @@
this.start = this.setDefaultDate(this.userDefaultDate);
}
this.priceStauts = this.initPrice();
// #ifdef MP-ALIPAY
uni.setNavigationBarTitle({
title: "",
});
// #endif
setTimeout(()=>{
const that =this
const query = uni.createSelectorQuery().in(this);
query.selectAll('.sign-scroll').boundingClientRect((rects) => {
that.scrollHeight = rects[0].height
that.calcDefautlOffset()
}).exec();
},200)
},
watch: {
defaultDate(newVal) {
this.userDefaultDate = newVal;
if (this.userDefaultDate != "") {
this.start = this.setDefaultDate(this.userDefaultDate);
}
this.priceStauts = this.initPrice();
console.log(this.priceStauts)
},
//入住日期
start(newVal) {
......@@ -269,13 +226,11 @@
}
if (this.priceStauts.length > 0) {
console.log(this.lastNot);
for (var i = newVal[0]; i < this.priceStauts.length; i++) {
if (i == newVal[0]) {
for (var j = newVal[1]; j < this.priceStauts[i].length; j++) {
if (this.priceStauts[i][j] == -1) {
this.lastNot = [i, j];
console.log(this.lastNot);
return;
}
}
......@@ -283,7 +238,6 @@
for (var j = 0; j < this.priceStauts[i].length; j++) {
if (this.priceStauts[i][j] == -1) {
this.lastNot = [i, j];
console.log(this.lastNot);
return;
}
}
......@@ -295,13 +249,21 @@
},
},
methods: {
calcDefautlOffset(){
const that =this
const query = uni.createSelectorQuery().in(this);
query.selectAll('.select-style').boundingClientRect((rects) => {
const top = rects[0].top-(that.scrollHeight) - 20
that.scrollTop = top>0?top:0
}).exec();
},
initPrice() {
//年份
var year = new Date().getFullYear();
let data = [];
//月份
var month = new Date().getMonth();
console.log('执行。。。。')
for (let i = 0; i < this.count; i++) {
var days = [];
var week = 0;
......@@ -562,7 +524,6 @@
//月份
var month = new Date().getMonth();
console.log("执行了...");
for (let i = 0; i < this.count; i++) {
var day = [];
var week = 0;
......@@ -618,7 +579,6 @@
};
let tempPrice = {};
this.priceList.forEach((x, i) => {
console.log(x.startDate, obj.start);
if (obj.start == x.startDate) {
obj.priceObj = i;
}
......
......@@ -958,7 +958,7 @@
</view> -->
<u-popup v-model="showDateChosen" mode="bottom" border-radius="20" length="90%" :safe-area-inset-bottom="true">
<canlendar @finish="chosenDateResult" :defaultDate="currentPrice.startDate" :priceList="dataList.priceList"></canlendar>
<canlendar @finish="chosenDateResult" v-if="showDateChosen" :defaultDate="currentPrice.startDate" :priceList="dataList.priceList"></canlendar>
</u-popup>
<u-popup v-model="showOrderPreviwe" mode="bottom" border-radius="20" length="90%" :safe-area-inset-bottom="true">
<view style="
......@@ -968,7 +968,7 @@
flex-direction: column;
">
<view style="flex: 1; width: 100%; height: 1rpx">
<canlendar @finish="chosenDateResult" :immediately="true" :defaultDate="currentPrice.startDate" :priceList="dataList.priceList"
<canlendar @finish="chosenDateResult" v-if="showOrderPreviwe" :immediately="true" :defaultDate="currentPrice.startDate" :priceList="dataList.priceList"
title="确定日期和人数"></canlendar>
</view>
<view style="background: #ecf1f4; padding: 20rpx 0">
......@@ -1168,9 +1168,6 @@
<script>
import hParse from "@/components/u-parse/parse.vue";
import canlendar from "./components/sign/index.vue";
// #ifdef MP-ALIPAY
import parseHtml from "../../plugin/htmlparse.js";
// #endif
import auth from "@/components/auth/index.vue";
import vip from "../../components/vip/vip.vue";
export default {
......
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