Commit 49882ac220e0be63bcd7702728d2ba31cf8af82c

Authored by liuxuqinfhp1220
1 parent 1a190b6b

no message

... ... @@ -121,6 +121,10 @@
"bmCalendar": {
"version": "1.2.1",
"provider": "wx23a9cef3522e4f7c"
},
"myPlugin": {
"version": "2.1.0",
"provider": "wx6b6cb15df2836ebe"
}
},
"permission": {
... ...
... ... @@ -117,6 +117,9 @@
.black-font{
color:#353535;
}
.gray-font{
color:#999999;
}
.white-font{
color:#fff;
}
... ...
... ... @@ -7,168 +7,249 @@ Component({
date:{
type:String,
value:util.unixtoTime(new Date()/1000,'YYYY-MM-DD'),
},
hidecalendar:{
type:Boolean,
value:true
}
},
data: {
curYear: new Date().getFullYear(), // 年份
curMonth: new Date().getMonth() + 1,// 月份 1-12
day:new Date().getDate(),
header_show: true, // 主标题是否显示
next: true, // 下一个月按钮是否显示
closelaststyle:true,
speciallist: [],
nextNum:0,
showprev:false
},
observers: {
'seller,date': function(seller,newdate) {
if(seller && newdate!=''){
let showYearMonth=this.getshowmonth();
if(this.data.showYearMonth){ //周历点击
if(showYearMonth.showyear==this.data.showYearMonth.showyear && showYearMonth.showmonth==this.data.showYearMonth.showmonth){
this.changedatestyle(newdate);
}else{
this.setData({
showYearMonth:showYearMonth,
showprev:this.isShowPrev(showYearMonth)
})
this.getdayslist(showYearMonth.showyear,showYearMonth.showmonth);
// this.gethousefulldate(seller);
}
}else{
//初始化---默认
this.setData({
showYearMonth:showYearMonth,
showprev:this.isShowPrev(showYearMonth)
})
this.getdayslist(showYearMonth.showyear,showYearMonth.showmonth);
// this.gethousefulldate(seller);
}
}
}
},
attached(){
//默认标记特殊日期
this.getspeciallist();
this.gethousefulldate(this.data.curYear,this.data.curMonth,'defalut');
this.getweeklist();
},
ready(){
},
detached(){
console.log('在组件实例被从页面节点树移除时执行')
},
//测试
pageLifetimes: {
show(){
//日期改变重新标记
if(this.data.speciallist.date!=util.unixtoTime(new Date()/1000, 'YYYY-MM-DD')){
this.getspeciallist();
this.setData({
curYear: new Date().getFullYear(), // 年份
curMonth: new Date().getMonth() + 1,// 月份 1-12
day:new Date().getDate(),
})
methods:{
//获取当前选中日期
getshowmonth(){
let datearr=this.data.date.split('-');
return{
showyear:Number(datearr[0]),
showmonth:Number(datearr[1]),
}
console.log(this.data.date,new Date());
},
hide(){
console.log(this.data.date);
}
},
methods:{
//默认标记特殊日期
getspeciallist(){
let speciallist = [
{date: util.unixtoTime(new Date()/1000, 'YYYY-MM-DD'), background: '', text: '今'},
{date: util.unixtoTime(new Date()/1000 + 86400, 'YYYY-MM-DD'), background: '', text: '明'}
];
//获得周列表
getweeklist(){
let week=['日','一','二','三','四','五','六'];
let weeklist=[];
for(let i=0;i<week.length;i++){
weeklist.push({
weekfont:week[i],
weeknum:i
})
}
this.setData({
speciallist:speciallist
weeklist:weeklist,
})
},
//根据指定年份月份获取当月满房的日期
gethousefulldate(year,month,action){
let parmdata={
sid:this.data.seller.id,
date:year+'-'+month
//获取显示月份天数
getMonthdays(year,month){
var d = new Date(year,month,0);
return d.getDate();
},
//获取某一天是星期几
getdayweek:function(year,month,day){
var tmpdate=new Date(year,month,day);
return tmpdate.getDay()
},
//获取当月日期
getdayslist(year,month){
this.today={
curdate:util.unixtoTime(new Date()/1000,'YYYY-MM-DD'),
curtimestamp:new Date()/1000
}
App.Customer.GetHouseFullDate(parmdata).then((json)=>{
console.log(json)
let obj={
date:this.data.date,
action:'defalut',
overdate:0,
}
if(json.ret==200){
this.houseFullDate=json.data;
//默认
if(action=='defalut'){
if(this.houseFullDate.indexOf(this.data.date)==-1){
obj.houseFullStatus=0;
}else{ //满房
obj.houseFullStatus=1;
}
this.triggerEvent('selectdate',obj)
//当前显示月份天数
let monthdays=this.getMonthdays(year,month);
//当前月1号星期几
let dayweek=this.getdayweek(year,month,1);
let daylist=[];
//多少行
let singlelen=Math.ceil((monthdays+dayweek)/7);
for(let i=0;i<singlelen;i++){
daylist.push({
list:[]
})
}
//本月日期
for(let i=0;i<singlelen*7;i++){
let thisdayobj={};
if(i>=dayweek && i<monthdays+dayweek){
let thisday=i-dayweek+1;
let thisdate=year+'-'+(month<10 ? '0'+month : month)+'-'+(thisday<10 ? '0'+thisday : thisday);
let thistimestamp=Number(util.timetouUnix(thisdate,'-'));
thisdayobj={
year:year,
month:month,
day:thisday,
week:i%7,
date:thisdate,
istoday:false,
overdate:thistimestamp<(new Date()/1000)-86400 ? true : false, //日期是否过期,
}
if(json.data.length>0){
this.changespeciallist(json.data)
if(thisdate==this.today.curdate){
thisdayobj.istoday=true;
thisdayobj.mark='今'
}
}else{
//不可预订
if(json.ret==401){
if(action=='defalut'){
this.houseFullDate=null
this.triggerEvent('selectdate',obj);
obj.action=401;
this.triggerEvent('selectdate',obj);
}
if(util.unixtoTime(this.today.curtimestamp+86400,'YYYY-MM-DD')==thisdate){
thisdayobj.mark='明'
}
thisdayobj.isselected=this.data.date==thisdate ? true : false;
}
daylist[Math.floor(i/7)].list.push(thisdayobj)
}
this.setData({
daylist:daylist
})
console.log(daylist)
},
//修改标记特殊日期
changespeciallist(houseFullDate){
let speciallist=this.data.speciallist;
let newspeciallist=[];
houseFullDate.forEach((v,i)=>{
newspeciallist.push({
date:v,
background:'',
text:'满'
//选择日期
selectdate(e){
let _target=e.currentTarget.dataset;
this.changedatestyle(_target.date);
this.triggerEvent('tellselectdate',{date:_target.date,action:'click'});
},
//修改日期列表
changedatestyle(selecteddate){
let daylist=this.data.daylist;
let prevsingle,previndex,cursingle,curindex;
daylist.forEach((v,i)=>{
v.list.forEach((r,n)=>{
if(r.isselected){
prevsingle=i;
previndex=n;
let prevkey='daylist['+prevsingle+'].list['+previndex+'].isselected';
this.setData({
[prevkey]:false,
})
}
if(r.date==selecteddate){
cursingle=i;
curindex=n;
}
})
})
speciallist.forEach((v,i)=>{
if(houseFullDate.indexOf(v.date)==-1){
newspeciallist.push(v)
}
})
console.log(newspeciallist)
let currentkey='daylist['+cursingle+'].list['+curindex+'].isselected';
this.setData({
speciallist:newspeciallist
[currentkey]:true
})
},
//下一月
nextMonth(e){
console.log(e)
this.gethousefulldate(e.detail.currentYear,e.detail.currentMonth,'click');
this.setData({
nextNum:this.data.nextNum+1
})
//计算是否显示prev
isShowPrev(showYearMonth){
let curyear=new Date().getFullYear();
let curmonth=new Date().getMonth() + 1;
let curtitle=''+curyear+(curmonth<10 ? '0'+curmonth : curmonth);
let showtitle=''+showYearMonth.showyear+(showYearMonth.showmonth< 10 ? '0'+showYearMonth.showmonth : showYearMonth.showmonth)
return Number(showtitle)>Number(curtitle);
},
//上一月
prevMonth(e){
this.gethousefulldate(e.detail.currentYear,e.detail.currentMonth,'click');
//回退月份
prevmonth(){
var showyear=this.data.showYearMonth.showyear;
var showmonth=this.data.showYearMonth.showmonth;
if(showmonth==1){
showmonth=12;
showyear=showyear-1;
}else{
showmonth-=1;
}
let showYearMonth={
showyear:showyear,
showmonth:showmonth
}
this.setData({
nextNum:this.data.nextNum-1
showYearMonth:showYearMonth,
showprev:this.isShowPrev(showYearMonth)
})
this.getdayslist(showYearMonth.showyear,showYearMonth.showmonth);
this.gethousefulldate(this.data.seller);
},
//点击日期
selectDate(e){
//推前月份
nextmonth(){
var showyear=this.data.showYearMonth.showyear;
var showmonth=this.data.showYearMonth.showmonth;
if(showmonth==12){
showmonth=1;
showyear=showyear+1;
}else{
showmonth+=1;
}
let showYearMonth={
showyear:showyear,
showmonth:showmonth
}
this.setData({
date:e.detail.date
showYearMonth:showYearMonth,
showprev:this.isShowPrev(showYearMonth)
})
let obj={
date:this.data.date,
action:'click',
this.getdayslist(showYearMonth.showyear,showYearMonth.showmonth);
this.gethousefulldate(this.data.seller);
},
//根据指定年份月份获取当月满房的日期
gethousefulldate(seller){
let showYearMonth=this.data.showYearMonth;
let parmdata={
sid:seller.id,
type:'month',
date:showYearMonth.showyear+'-'+(showYearMonth.showmonth<10 ? '0'+showYearMonth.showmonth : showYearMonth.showmonth)
}
if(Number(util.timetouUnix(this.data.date,'-'))-new Date()/1000>=-24*60*60){ //今天以及之后日期
obj.overdate=0;
//可预订
if(this.houseFullDate){
if(this.houseFullDate.indexOf(this.data.date)==-1){
obj.houseFullStatus=0;
}else{ //满房
obj.houseFullStatus=1;
App.Customer.GetHouseFullDate(parmdata).then((json)=>{
console.log(json)
if(json.ret==200){
if(json.data && json.data.length>0){
this.markFullHouse(json.data);
}
this.triggerEvent('selectdate',obj)
}else{
//不可预订
obj.houseFullStatus=1;
this.triggerEvent('selectdate',obj);
obj.action=401
this.triggerEvent('selectdate',obj);
}
}else{ //overdate为1过期日期
obj.overdate=1;
obj.houseFullStatus=1;
this.triggerEvent('selectdate',obj)
}
}
})
},
//标记满房
markFullHouse(fullHouseDate){
let daylist=this.data.daylist;
daylist.forEach((v,i)=>{
v.list.forEach((r,n)=>{
fullHouseDate.forEach((r1,n1)=>{
if(r1==r.date){
r.mark='满'
}
})
})
})
this.setData({
daylist:daylist
})
},
}
})
\ No newline at end of file
... ...
{
"component": true,
"usingComponents": {
"calendar": "plugin://bmCalendar/calendar"
}
}
\ No newline at end of file
... ...
<calendar
cur-year="{{curYear}}"
cur-month="{{curMonth}}"
day="{{day}}"
header_show='{{header_show}}'
prev='{{nextNum}}'
next='{{next}}'
speciallist="{{speciallist}}"
closelaststyle="{{closelaststyle}}"
colored="#e0e0e0"
circle_show="{{false}}"
weekheight="100"
txt_style="txt_style"
calendar-style="calendar-style"
weektitle-style="week-style"
datefont-style="datefont-style"
header-style="header-style"
active-colort="active-colort"
active-coloro="active-coloro"
bindnextMonth="nextMonth"
bindprevMonth="prevMonth"
bindselectDate="selectDate"/>
\ No newline at end of file
<view class="calendar" hidden="{{hidecalendar}}">
<view class="calendar-title flex-lr">
<view class="black-font font30r Semibold calendar-title-date">{{showYearMonth.showyear}}-{{showYearMonth.showmonth<10 ? '0'+showYearMonth.showmonth : showYearMonth.showmonth}}</view>
<view class="calendar-title-tab-list flex-rr">
<block wx:if="{{showprev}}">
<view class="calendar-title-tab-cover calendar-title-prev-cover" bindtap="prevmonth">
<view class="calendar-title-prev calendar-title-tab"></view>
</view>
</block>
<view class="calendar-title-tab-cover calendar-title-next-cover" bindtap="nextmonth">
<view class="calendar-title-next calendar-title-tab"></view>
</view>
</view>
</view>
<view class="calendar-week flex-lr">
<block wx:for="{{weeklist}}" wx:key="{{index}}">
<view class="week-single gray-font font30r Semibold flex-cc">{{item.weekfont}}</view>
</block>
</view>
<view class="calendar-content">
<block wx:for="{{daylist}}" wx:for-item="itemlist" wx:for-index="indexlist" wx:key="{{indexlist}}">
<view class="calendar-week-day flex-lr">
<block wx:for="{{itemlist.list}}" wx:key="{{index}}">
<view class="{{item.overdate ? 'gray-font' : 'font-font'}} calendar-day flex-cc font30r Semibold {{item.istoday ? 'today' : ''}} {{item.isselected ? 'bg-yellow white-font' : ''}}" data-date="{{item.date}}" catchtap="{{item.overdate ? '' : 'selectdate'}}">{{item.mark ? item.mark : item.day}}</view>
</block>
</view>
</block>
</view>
</view>
\ No newline at end of file
... ...
.calendar-style{
@import "../../../app.wxss";
.calendar{
width:100%;
background: #FFFBF2;
border-top-left-radius:20rpx;
border-top-right-radius:20rpx;
overflow: hidden;
padding:30rpx 0;
}
.week-style{
color:#999;
font-size:28rpx;
font-weight:bold;
}
.datefont-style{
color:#353535;
font-size:30rpx;
font-weight:bold;
}
.header-style{
color:#353535;
font-size:30rpx!important;
font-weight:bold;
}
.header-style text:before{
font-size:30rpx!important;
color:#666666!important;
padding:0 30rpx;
}
.active-colort{
color:#C0A369;
font-weight:bold;
font-size:28rpx;
border:1px solid #C0A369;
}
.active-coloro{
color:#fff!important;
font-weight:bold;
font-size:28rpx;
.calendar-title{
width:100%;
padding:0 40rpx;
box-sizing: border-box;
}
.calendar-title-date{
padding:30rpx 0 30rpx 20rpx;
}
.calendar-title-tab-cover{
padding:20rpx;
margin-left:40rpx;
}
.calendar-title-prev-cover{
padding-left:8rpx;
}
.calendar-title-next-cover{
padding-right:8rpx;
}
.calendar-week, .calendar-content{
width:100%;
padding:0 38rpx;
box-sizing: border-box;
}
.week-single{
width:80rpx;
padding-bottom: 12rpx;
}
.calendar-week-day{
width:100%;
height:80rpx;
}
.calendar-title-tab{
width:0;
height:0;
border:12rpx solid transparent;
}
.calendar-title-next{
border-left:12rpx solid #999;
}
.calendar-title-prev{
border-right:12rpx solid #999;
}
.calendar-week-day{
margin-bottom: 14rpx;
}
.calendar-day{
width:80rpx;
height:80rpx;
border-radius:50%;
box-sizing: border-box;
}
.calendar-day.today{
border:2rpx solid #C0A369;
}
.calendar-day.bg-yellow{
background: -webkit-linear-gradient(top, #F2D190, #C0A369); /* Safari 5.1 - 6.0 */
background: -o-linear-gradient(-45deg, #F2D190, #C0A369); /* Opera 11.1 - 12.0 */
background: -moz-linear-gradient(top, #F2D190, #C0A369); /* Firefox 3.6 - 15 */
background: linear-gradient(to bottom, #F2D190, #C0A369);
border-width:0;
}
.txt_style{
color:#C0A369;
margin-top:-10px;
fon-size:20rpx;
}
\ No newline at end of file
... ...
Component({
})
\ No newline at end of file
... ...
{
"component": true,
"usingComponents": {
}
}
\ No newline at end of file
... ...
import util from '../../../utils/util';
import App from '../../../utils/api';
Component({
properties:{
seller:Object,
//选中日期
date:{
type:String,
value:util.unixtoTime(new Date()/1000,'YYYY-MM-DD'),
}
},
attached(){
console.log('xxxxx',this.data.seller);
},
observers: {
'date'(newdate){
if(newdate!=''){
//今天日期
let today=util.unixtoTime(new Date()/1000,'YYYY-MM-DD');
this.getsectionlist();
if(today==newdate){
this.markoversection();
}else{
this.changesectionstyle(this.data.sectionlist[0].section);
let obj={
section:this.data.sectionlist[0].section,
action:'defalut',
time:this.data.sectionlist[0].sectiondur.split('-')[0]
}
this.triggerEvent('selectsection',obj)
}
}
}
},
ready(){
},
methods:{
getsectionlist(){
let section={'morning':'早餐','noon':'午餐','night':'晚餐','midnight':'夜宵'};
let sectionlist=[];
for(let key in this.data.seller.daily){
if(this.data.seller.daily[key]!=""){
sectionlist.push({
section:key,
sectiondur:this.data.seller.daily[key],
showmark:section[key],
overdate:false,
isselected:false
})
}
}
this.setData({
sectionlist:sectionlist
})
console.log(sectionlist)
},
markoversection(){
let sectionlist=this.data.sectionlist;
//今天日期
let today=util.unixtoTime(new Date()/1000,'YYYY-MM-DD');
let curtimestamp=new Date()/1000;
let interval=[];
sectionlist.forEach((v,i)=>{
let sectionarr=v.sectiondur.split('-');
if(curtimestamp>=new Date(today+' '+sectionarr[1]+':00')/1000){
v.overdate=true
}
if(!v.overdate){
let intervaldur=curtimestamp-new Date(today+' '+sectionarr[0]+':00')/1000;
interval.push({
intervaldur:intervaldur,
index:i
})
}
})
console.log(interval)
if(interval.length>0){
sectionlist[interval[0].index].isselected=true;
this.tellsection(sectionlist[interval[0].index].section,'defalut',interval[0].index)
}
this.setData({
sectionlist:sectionlist
})
console.log(sectionlist)
},
//点击时段
selectsection(e){
let _target=e.currentTarget.dataset;
this.changesectionstyle(_target.section);
this.tellsection(_target.section,'click',_target.index);
},
//通知时段
tellsection(selectsection,action,index){
let today=util.unixtoTime(new Date()/1000,'YYYY-MM-DD');
let curtimestamp=new Date()/1000;
let sectionarr=this.data.sectionlist[index].sectiondur.split('-');
let starttimestamp=new Date(today+' '+sectionarr[0]+':00')/1000;
let endtimestamp=new Date(today+' '+sectionarr[1]+':00')/1000;
let obj={
section:selectsection,
action:action
}
if(curtimestamp>=starttimestamp && curtimestamp<endtimestamp){
obj.time=sectionarr[1]
}else{
if(curtimestamp>=endtimestamp){
obj.time=sectionarr[1]
}else{
obj.time=sectionarr[0]
}
}
this.triggerEvent('selectsection',obj)
},
changesectionstyle(selectsection){
let sectionlist=this.data.sectionlist;
let previndex,curindex;
sectionlist.forEach((v,i)=>{
if(v.isselected){
previndex=i;
let prevkey='sectionlist['+previndex+'].isselected';
this.setData({
[prevkey]:false
})
}
if(selectsection==v.section){
curindex=i;
}
})
let curkey='sectionlist['+curindex+'].isselected';
this.setData({
[curkey]:true
})
}
}
})
\ No newline at end of file
... ...
{
"component": true,
"usingComponents": {
}
}
\ No newline at end of file
... ...
<view class="section flex-ll">
<block wx:for="{{sectionlist}}" wx:key="{{index}}">
<view class="flex-vc section-single {{item.isselected ? 'bg-yellow' : ''}}" style="width:{{690/sectionlist.length}}rpx;" data-section="{{item.section}}" data-index="{{index}}" catchtap="{{item.overdate ? '' : 'selectsection'}}">
<view class="{{item.overdate ? 'gray-font' : (item.isselected ? 'white-font' : '')}} font30r Semibold">{{item.showmark}}</view>
<view class="{{item.overdate ? 'gray-font' : (item.isselected ? 'white-font' : '')}} font24r" style="line-height:34rpx;">{{item.sectiondur}}</view>
</view>
</block>
</view>
\ No newline at end of file
... ...
@import "../../../app.wxss";
.section{
width:690rpx;
height:90rpx;
border-radius:10rpx;
box-shadow: 0 0 8rpx rgba(166,166,166,.5);
overflow: hidden;
margin:0 auto;
}
.section-single{
height:100%;
}
.section-single.bg-yellow{
background: -webkit-linear-gradient(top, #F2D190, #C0A369); /* Safari 5.1 - 6.0 */
background: -o-linear-gradient(-45deg, #F2D190, #C0A369); /* Opera 11.1 - 12.0 */
background: -moz-linear-gradient(top, #F2D190, #C0A369); /* Firefox 3.6 - 15 */
background: linear-gradient(to bottom, #F2D190, #C0A369);
border-width:0;
}
\ No newline at end of file
... ...
import App from '../../../utils/api';
import util from '../../../utils/util';
Component({
properties:{
seller:Object,
date:{
type:String,
value:util.unixtoTime(new Date()/1000,'YYYY-MM-DD')
},
section:String,
seletroom:{
type:Array,
value:[]
}
},
data:{
}
})
\ No newline at end of file
... ...
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file
... ...
<view>ddddddddd</view>
\ No newline at end of file
... ...
import util from '../../../utils/util';
import App from '../../../utils/api';
Component({
properties:{
seller:Object,
//选中日期
date:{
type:String,
value:util.unixtoTime(new Date()/1000,'YYYY-MM-DD'),
}
},
data:{
hidecalendar:true
},
attached(){
this.setData({
showYearMonth:this.getshowmonth(this.data.date)
})
this.triggerEvent('selectdate',{date:this.data.date,action:'defalut'})
this.getweeklist();
this.getdaylist();
this.getFullDate();
},
ready(){
},
methods:{
//获取当前选中日期年月
getshowmonth(selecteddate){
let datearr=selecteddate.split('-');
return{
showyear:Number(datearr[0]),
showmonth:Number(datearr[1]),
}
},
//获得周列表
getweeklist(){
let week=['日','一','二','三','四','五','六'];
let weeklist=[];
for(let i=0;i<week.length;i++){
weeklist.push({
weekfont:week[i],
weeknum:i
})
}
this.setData({
weeklist:weeklist,
})
},
//获取日期列表
getdaylist(){
//选中时间时间戳
let selectedtime=Number(util.timetouUnix(this.data.date,'-'));
//选中日期星期几
let selectedweek=new Date(selectedtime*1000).getDay();
//今天日期
let today=util.unixtoTime(new Date()/1000,'YYYY-MM-DD');
console.log('selectedweek',selectedweek)
let daylist=[{list:[]},{list:[]}];
//用于月历点击的时候判断是否改变周历列表
this.datelist={};
for(let i=0;i<14;i++){
let thistimestamp=selectedtime+(i-selectedweek)*86400;
let thisdate=new Date(thistimestamp*1000);
let thisdayobj={
year:thisdate.getFullYear(),
month:thisdate.getMonth()+1,
day:thisdate.getDate(),
week:thisdate.getDay(),
date:util.unixtoTime(thistimestamp,'YYYY-MM-DD'),
overdate:thistimestamp<(new Date()/1000)-86400 ? true : false, //日期是否过期
istoday:false
}
//是否是今天
if(today==thisdayobj.date){
thisdayobj.istoday=true;
thisdayobj.mark='今'
}
if(util.unixtoTime(new Date()/1000+86400,'YYYY-MM-DD')==thisdayobj.date){
thisdayobj.mark='明'
}
thisdayobj.isselected=this.data.date==thisdayobj.date ? true : false;
//日期是否选中
daylist[Math.floor(i/7)].list.push(thisdayobj);
this.datelist[thisdayobj.date]=Math.floor(i/7)+'-'+(i-Math.floor(i/7)*7)
}
this.setData({
daylist:daylist
})
console.log(daylist,this.datelist)
},
//获取满房日期
getFullDate(){
let parmdata={
sid:this.data.seller.id,
type:'week',
date:this.data.daylist[0].list[0].date
}
App.Customer.GetHouseFullDate(parmdata).then((json)=>{
console.log(json)
if(json.ret==200){
if(json.data && json.data.length>0){
this.markFullHouse(json.data);
}
}
})
},
//标记满房
markFullHouse(fullHouseDate){
let daylist=this.data.daylist;
daylist.forEach((v,i)=>{
v.list.forEach((r,n)=>{
fullHouseDate.forEach((r1,n1)=>{
if(r1==r.date){
r.mark='满'
}
})
})
})
this.setData({
daylist:daylist
})
},
//选择日期
selectdate(e){
let _target=e.currentTarget.dataset;
this.changedatestyle(_target.date);
this.triggerEvent('selectdate',{date:_target.date,action:'click'});
this.setData({
date:_target.date,
showYearMonth:this.getshowmonth(_target.date)
})
},
//日历组件---通知事件
tellselectdate(e){
console.log(e)
let _target=e.detail;
this.triggerEvent('selectdate',{date:_target.date,action:'click'});
this.setData({
date:_target.date,
showYearMonth:this.getshowmonth(_target.date)
})
if(_target.date in this.datelist){
this.changedatestyle(_target.date)
}else{
this.getdaylist();
this.getFullDate();
}
},
//修改日期列表
changedatestyle(selecteddate){
let daylist=this.data.daylist;
let prevsingle,previndex,cursingle,curindex;
daylist.forEach((v,i)=>{
v.list.forEach((r,n)=>{
if(r.isselected){
prevsingle=i;
previndex=n;
let prevkey='daylist['+prevsingle+'].list['+previndex+'].isselected';
this.setData({
[prevkey]:false,
})
}
if(r.date==selecteddate){
cursingle=i;
curindex=n;
}
})
})
let currentkey='daylist['+cursingle+'].list['+curindex+'].isselected';
this.setData({
[currentkey]:true
})
},
clickmore(){
this.setData({
hidecalendar:false
})
},
closecalendar(){
this.setData({
hidecalendar:true
})
}
}
})
\ No newline at end of file
... ...
{
"component": true,
"usingComponents": {
"calendar":"../calendar/calendar"
}
}
\ No newline at end of file
... ...
<view class="week-calendar">
<view class="week-calendar-header flex-lr">
<view class="week-calendar-header-title week-calendar-header-item black-font font30r Semibold">{{showYearMonth.showyear}}-{{showYearMonth.showmonth<10 ? '0'+showYearMonth.showmonth : showYearMonth.showmonth}}</view>
<view class="week-calendar-header-more week-calendar-header-item flex-rr" catchtap="clickmore">
<view class="black-font font24r">更多</view>
<image class="click-icon" src="/pages/image/click-icon.png"></image>
</view>
</view>
<view class="week-calendar-week flex-lr">
<block wx:for="{{weeklist}}" wx:key="{{index}}">
<view class="gray-font font30r Semibold">{{item.weekfont}}</view>
</block>
</view>
<view class="week-calendar-content">
<block wx:for="{{daylist}}" wx:for-item="itemlist" wx:for-index="indexlist" wx:key="{{indexlist}}">
<view class="week-calendar-day-list flex-lr">
<block wx:for="{{itemlist.list}}" wx:key="{{index}}">
<view class="{{item.overdate ? 'gray-font' : 'font-font'}} font30r Semibold week-calendar-day flex-cc {{item.istoday ? 'today' : ''}} {{item.isselected ? 'bg-yellow white-font' : ''}}" data-date="{{item.date}}" catchtap="{{item.overdate ? '' : 'selectdate'}}">{{item.mark ? item.mark : item.day}}</view>
</block>
</view>
</block>
</view>
</view>
<view class="calendar-mask" hidden="{{hidecalendar}}" catchtap="closecalendar"></view>
<calendar seller="{{seller}}" date="{{date}}" hidecalendar="{{hidecalendar}}" bind:tellselectdate="tellselectdate"></calendar>
\ No newline at end of file
... ...
@import "../../../app.wxss";
.week-calendar{
width:100%;
height:336rpx;
background:#FFFBF2;
padding:0 40rpx;
box-sizing: border-box;
}
.week-calendar-header, .week-calendar-week{
width:100%;
padding:0 20rpx;
box-sizing: border-box;
}
.week-calendar-header-item{
padding:30rpx 0;
}
.week-calendar-content{
width:100%;
padding-top:16rpx;
}
.week-calendar-day-list{
width:100%;
margin-bottom:30rpx;
}
.week-calendar-day{
width:70rpx;
height:70rpx;
box-sizing: border-box;
border-radius:50%;
}
.week-calendar-day.today{
border:2rpx solid #C0A369;
}
.week-calendar-day.bg-yellow{
background: -webkit-linear-gradient(top, #F2D190, #C0A369); /* Safari 5.1 - 6.0 */
background: -o-linear-gradient(-45deg, #F2D190, #C0A369); /* Opera 11.1 - 12.0 */
background: -moz-linear-gradient(top, #F2D190, #C0A369); /* Firefox 3.6 - 15 */
background: linear-gradient(to bottom, #F2D190, #C0A369);
border-width:0;
}
.click-icon{
width:12rpx;
height:20rpx;
padding-left:10rpx;
}
.calendar-mask{
position: fixed;
left:0;
right:0;
top:0;
bottom:0;
z-index:10;
background:rgba(21,20,20,.5);
}
\ No newline at end of file
... ...
... ... @@ -273,6 +273,15 @@ Page({
}
},
//时段改变
selectsection(e){
console.log(e);
this.setData({
reserveSection:e.detail.section
})
this.reserve.section=e.detail.section;
this.reserve.time=e.detail.time;
},
selecttime(e){//时间改变
console.log(e);
if(!e.detail.time){//满房
... ...
... ... @@ -14,6 +14,8 @@
"share":"/components/reserve/share/share",
"people":"/components/reserve/people/people",
"dur":"/components/reserve/dur/dur",
"calendar":"/components/reserve/calendar/calendar"
"calendar":"/components/reserve/week-calendar/week-calendar",
"section":"/components/reserve/section/section",
"select-room":"/components/reserve/select-room/select-room"
}
}
\ No newline at end of file
... ...
... ... @@ -212,10 +212,9 @@
<view hidden="{{activeTab!='reserve'}}" wx:if="{{seller.id}}">
<view class="olreserve bg_white">
<calendar seller="{{seller}}" bindselectdate="selectdate"></calendar>
<people seller="{{seller}}" bindselectpeople="selectpeople" wx:if="{{!hasFullHouse}}"></people>
<view class="reserve-time Semibold">可订时间</view>
<dur seller="{{seller}}" wx:if="{{!hasFullHouse}}"
date="{{reserveDate}}" bindselecttime="selecttime"></dur>
<view class="reserve-time Semibold">预订时段</view>
<section seller="{{seller}}" date="{{reserveDate}}" bindselectsection="selectsection"></section>
<select-room seller="{{seller}}" date="{{reserveDate}}" section="{{reserveSection}}"></select-room>
<view class="hasFullHouse Semibold flex-vc" wx:if="{{hasFullHouse}}">{{fullHouseMsg}}</view>
</view>
</view>
... ...
... ... @@ -511,7 +511,7 @@
padding-bottom: 0rpx;
}
.reserve-time{
padding: 60rpx 0 38rpx 30rpx;
padding: 40rpx 0 30rpx 30rpx;
font-size: 32rpx;
}
.hasFullHouse{
... ...
... ... @@ -45,7 +45,7 @@
"list": []
},
"miniprogram": {
"current": 54,
"current": 56,
"list": [
{
"id": 0,
... ...