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

实现VIP功能,优化日历

parent 7c304602
<template> <template>
<view class="content"> <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="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=" <view style="
font-size: 32rpx; font-size: 32rpx;
color: #111; color: #111;
...@@ -150,27 +123,7 @@ ...@@ -150,27 +123,7 @@
computed: { computed: {
//房间是否能预订 //房间是否能预订
isSub() { 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; return this.start.length == 2;
}, },
//计算日历里的节假日 //计算日历里的节假日
...@@ -218,6 +171,8 @@ ...@@ -218,6 +171,8 @@
priceStauts: [], //价格状态 priceStauts: [], //价格状态
lastNot: [0, 10], //前置的无房操作 lastNot: [0, 10], //前置的无房操作
userDefaultDate: "", userDefaultDate: "",
scrollTop:0,
scrollHeight:0
}; };
}, },
mounted() { mounted() {
...@@ -236,21 +191,23 @@ ...@@ -236,21 +191,23 @@
this.start = this.setDefaultDate(this.userDefaultDate); this.start = this.setDefaultDate(this.userDefaultDate);
} }
this.priceStauts = this.initPrice(); this.priceStauts = this.initPrice();
// #ifdef MP-ALIPAY setTimeout(()=>{
uni.setNavigationBarTitle({ const that =this
title: "", const query = uni.createSelectorQuery().in(this);
}); query.selectAll('.sign-scroll').boundingClientRect((rects) => {
// #endif that.scrollHeight = rects[0].height
that.calcDefautlOffset()
}).exec();
},200)
}, },
watch: { watch: {
defaultDate(newVal) { defaultDate(newVal) {
this.userDefaultDate = newVal; this.userDefaultDate = newVal;
if (this.userDefaultDate != "") { if (this.userDefaultDate != "") {
this.start = this.setDefaultDate(this.userDefaultDate); this.start = this.setDefaultDate(this.userDefaultDate);
} }
this.priceStauts = this.initPrice(); this.priceStauts = this.initPrice();
console.log(this.priceStauts)
}, },
//入住日期 //入住日期
start(newVal) { start(newVal) {
...@@ -269,13 +226,11 @@ ...@@ -269,13 +226,11 @@
} }
if (this.priceStauts.length > 0) { if (this.priceStauts.length > 0) {
console.log(this.lastNot);
for (var i = newVal[0]; i < this.priceStauts.length; i++) { for (var i = newVal[0]; i < this.priceStauts.length; i++) {
if (i == newVal[0]) { if (i == newVal[0]) {
for (var j = newVal[1]; j < this.priceStauts[i].length; j++) { for (var j = newVal[1]; j < this.priceStauts[i].length; j++) {
if (this.priceStauts[i][j] == -1) { if (this.priceStauts[i][j] == -1) {
this.lastNot = [i, j]; this.lastNot = [i, j];
console.log(this.lastNot);
return; return;
} }
} }
...@@ -283,7 +238,6 @@ ...@@ -283,7 +238,6 @@
for (var j = 0; j < this.priceStauts[i].length; j++) { for (var j = 0; j < this.priceStauts[i].length; j++) {
if (this.priceStauts[i][j] == -1) { if (this.priceStauts[i][j] == -1) {
this.lastNot = [i, j]; this.lastNot = [i, j];
console.log(this.lastNot);
return; return;
} }
} }
...@@ -295,13 +249,21 @@ ...@@ -295,13 +249,21 @@
}, },
}, },
methods: { 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() { initPrice() {
//年份 //年份
var year = new Date().getFullYear(); var year = new Date().getFullYear();
let data = []; let data = [];
//月份 //月份
var month = new Date().getMonth(); var month = new Date().getMonth();
console.log('执行。。。。')
for (let i = 0; i < this.count; i++) { for (let i = 0; i < this.count; i++) {
var days = []; var days = [];
var week = 0; var week = 0;
...@@ -562,7 +524,6 @@ ...@@ -562,7 +524,6 @@
//月份 //月份
var month = new Date().getMonth(); var month = new Date().getMonth();
console.log("执行了...");
for (let i = 0; i < this.count; i++) { for (let i = 0; i < this.count; i++) {
var day = []; var day = [];
var week = 0; var week = 0;
...@@ -618,7 +579,6 @@ ...@@ -618,7 +579,6 @@
}; };
let tempPrice = {}; let tempPrice = {};
this.priceList.forEach((x, i) => { this.priceList.forEach((x, i) => {
console.log(x.startDate, obj.start);
if (obj.start == x.startDate) { if (obj.start == x.startDate) {
obj.priceObj = i; obj.priceObj = i;
} }
......
...@@ -958,7 +958,7 @@ ...@@ -958,7 +958,7 @@
</view> --> </view> -->
<u-popup v-model="showDateChosen" mode="bottom" border-radius="20" length="90%" :safe-area-inset-bottom="true"> <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>
<u-popup v-model="showOrderPreviwe" mode="bottom" border-radius="20" length="90%" :safe-area-inset-bottom="true"> <u-popup v-model="showOrderPreviwe" mode="bottom" border-radius="20" length="90%" :safe-area-inset-bottom="true">
<view style=" <view style="
...@@ -968,7 +968,7 @@ ...@@ -968,7 +968,7 @@
flex-direction: column; flex-direction: column;
"> ">
<view style="flex: 1; width: 100%; height: 1rpx"> <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> title="确定日期和人数"></canlendar>
</view> </view>
<view style="background: #ecf1f4; padding: 20rpx 0"> <view style="background: #ecf1f4; padding: 20rpx 0">
...@@ -1168,9 +1168,6 @@ ...@@ -1168,9 +1168,6 @@
<script> <script>
import hParse from "@/components/u-parse/parse.vue"; import hParse from "@/components/u-parse/parse.vue";
import canlendar from "./components/sign/index.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 auth from "@/components/auth/index.vue";
import vip from "../../components/vip/vip.vue"; import vip from "../../components/vip/vip.vue";
export default { 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