calendar.js
2.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
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'),
},
setroom:{
type:Object,
value:{}
}
},
data:{
marklist:[]
},
attached(){
this.marklist=[];
this.setData({
date:util.unixtoTime(new Date()/1000,'YYYY-MM-DD')
})
this.showYearMonth=this.getshowmonth();
this.gethousefulldate(this.data.seller,this.showYearMonth);
this.triggerEvent('tellselectdate',{date:util.unixtoTime(new Date()/1000,'YYYY-MM-DD'),action:'defalut'});
},
observers: {
'setroom'(newsetroom){
console.log('calendar-room',newsetroom)
if(newsetroom && newsetroom.id){
this.marklist=[];
this.gethousefulldate(this.data.seller,this.showYearMonth);
}
}
},
methods:{
//获取当前选中日期
getshowmonth(){
let datearr=this.data.date.split('-');
return{
showyear:Number(datearr[0]),
showmonth:Number(datearr[1]),
}
},
//切换月份
getmonth(e){
console.log('tellmonth',e)
this.showYearMonth=e.detail;
if(e.detail.action='click'){
this.gethousefulldate(this.data.seller,this.showYearMonth);
}
},
//根据指定年份月份获取当月满房的日期
gethousefulldate(seller,showYearMonth){
let parmdata={
sid:seller.id,
type:'month',
date:showYearMonth.showyear+'-'+(showYearMonth.showmonth<10 ? '0'+showYearMonth.showmonth : showYearMonth.showmonth)
}
App.Customer.GetHouseFullDate(parmdata).then((json)=>{
console.log(json)
if(json.ret==200){
let marklist=[];
console.log(marklist)
if(json.data && json.data.length>0){
json.data.forEach((v,i)=>{
marklist.push({
date:v,
mark:'满'
})
})
this.marklist=marklist;
}
this.getFillDate(seller,showYearMonth);
}
})
},
getFillDate(seller,showYearMonth){
let parmdata={
sid:seller.id,
type:'month',
date:showYearMonth.showyear+'-'+(showYearMonth.showmonth<10 ? '0'+showYearMonth.showmonth : showYearMonth.showmonth)
}
App.Customer.GetTableFillUpDate(parmdata).then((json)=>{
if(json.ret==200){
let marklist=this.marklist;
let templist=[];
marklist.forEach((v,i)=>{
templist.push(v.date)
})
json.data.forEach((v,i)=>{
if(templist.length>0){
if(templist.indexOf(v)==-1){
marklist.push({
date:v,
mark:'置'
})
}
}else{
marklist.push({
date:v,
mark:'置'
})
}
})
this.marklist=marklist;
this.setData({
marklist:this.marklist
})
}
})
},
tellselectdate(e){
this.triggerEvent('tellselectdate',e.detail);
}
}
})