|
|
|
1
|
+import util from '../../../utils/util';
|
|
|
|
2
|
+import App from '../../../utils/api';
|
|
|
|
3
|
+let date=new Date();
|
|
1
|
Component({
|
4
|
Component({
|
|
|
|
5
|
+ properties:{
|
|
|
|
6
|
+ seller:Object,
|
|
|
|
7
|
+ //选中日期
|
|
|
|
8
|
+ date:{
|
|
|
|
9
|
+ type:String,
|
|
|
|
10
|
+ value:date.getFullYear()+'-'+(date.getMonth()+1<10 ? '0'+(date.getMonth()+1) : date.getMonth()+1),
|
|
|
|
11
|
+ }
|
|
|
|
12
|
+ },
|
|
2
|
data: {
|
13
|
data: {
|
|
3
|
- curYear: new Date().getFullYear(), // 年份
|
|
|
|
4
|
- curMonth: new Date().getMonth() + 1,// 月份 1-12
|
|
|
|
5
|
- day: new Date().getDate(), // 日期 1-31 若日期超过该月天数,月份自动增加
|
|
|
|
6
|
- header_show: true, // 主标题是否显示
|
|
|
|
7
|
- prev: true, // 上一个月按钮是否显示
|
|
|
|
8
|
- next: true, // 下一个月按钮是否显示
|
14
|
+ curYear: date.getFullYear(), // 年份
|
|
|
|
15
|
+ curMonth: date.getMonth() + 1,// 月份 1-12
|
|
|
|
16
|
+ day:date.getDate(),
|
|
|
|
17
|
+ header_show: true, // 主标题是否显示
|
|
|
|
18
|
+ next: true, // 下一个月按钮是否显示
|
|
|
|
19
|
+ closelaststyle:true,
|
|
|
|
20
|
+ speciallist: [],
|
|
|
|
21
|
+ nextNum:0,
|
|
9
|
},
|
22
|
},
|
|
|
|
23
|
+ attached(){
|
|
|
|
24
|
+ //默认标记特殊日期
|
|
|
|
25
|
+ this.getspeciallist();
|
|
|
|
26
|
+ this.gethousefulldate();
|
|
|
|
27
|
+ },
|
|
|
|
28
|
+ ready(){
|
|
|
|
29
|
+ this.triggerEvent('selectdate',{date:this.data.date,action:'defalut'})
|
|
|
|
30
|
+ },
|
|
|
|
31
|
+ methods:{
|
|
|
|
32
|
+ //默认标记特殊日期
|
|
|
|
33
|
+ getspeciallist(){
|
|
|
|
34
|
+ let speciallist = [
|
|
|
|
35
|
+ {date: util.unixtoTime(date, 'YYYY-MM-DD'), background: '', text: '今'},
|
|
|
|
36
|
+ {date: util.unixtoTime(date + 86400, 'YYYY-MM-DD'), background: '', text: '明'}
|
|
|
|
37
|
+ ];
|
|
|
|
38
|
+ this.setData({
|
|
|
|
39
|
+ speciallist:speciallist
|
|
|
|
40
|
+ })
|
|
|
|
41
|
+ },
|
|
|
|
42
|
+ //根据指定年份月份获取当月满房的日期
|
|
|
|
43
|
+ gethousefulldate(){
|
|
|
|
44
|
+ let parmdata={
|
|
|
|
45
|
+ sid:this.data.seller.id,
|
|
|
|
46
|
+ date:this.data.date
|
|
|
|
47
|
+ }
|
|
|
|
48
|
+ App.Customer.GetHouseFullDate(parmdata).then((json)=>{
|
|
|
|
49
|
+ console.log(json)
|
|
|
|
50
|
+ if(json.ret==200){
|
|
|
|
51
|
+ if(json.data.length>0){
|
|
|
|
52
|
+ this.changespeciallist(json.data)
|
|
|
|
53
|
+ }
|
|
|
|
54
|
+
|
|
|
|
55
|
+ }
|
|
|
|
56
|
+ })
|
|
|
|
57
|
+ },
|
|
|
|
58
|
+ //修改标记特殊日期
|
|
|
|
59
|
+ changespeciallist(houseFullDate){
|
|
|
|
60
|
+ let speciallist=this.data.speciallist;
|
|
|
|
61
|
+ let newspeciallist=[];
|
|
|
|
62
|
+ houseFullDate.forEach((v,i)=>{
|
|
|
|
63
|
+ newspeciallist.push({
|
|
|
|
64
|
+ date:v,
|
|
|
|
65
|
+ background:'',
|
|
|
|
66
|
+ text:'满'
|
|
|
|
67
|
+ })
|
|
|
|
68
|
+ })
|
|
|
|
69
|
+ speciallist.forEach((v,i)=>{
|
|
|
|
70
|
+ if(houseFullDate.indexOf(v.date)==-1){
|
|
|
|
71
|
+ newspeciallist.push(v)
|
|
|
|
72
|
+ }
|
|
|
|
73
|
+ })
|
|
|
|
74
|
+ this.setData({
|
|
|
|
75
|
+ speciallist:newspeciallist
|
|
|
|
76
|
+ })
|
|
|
|
77
|
+ },
|
|
|
|
78
|
+ //下一月
|
|
|
|
79
|
+ nextMonth(e){
|
|
|
|
80
|
+ this.setData({
|
|
|
|
81
|
+ nextNum:this.data.nextNum+1
|
|
|
|
82
|
+ })
|
|
|
|
83
|
+ },
|
|
|
|
84
|
+ //上一月
|
|
|
|
85
|
+ prevMonth(e){
|
|
|
|
86
|
+ this.setData({
|
|
|
|
87
|
+ nextNum:this.data.nextNum-1
|
|
|
|
88
|
+ })
|
|
|
|
89
|
+ },
|
|
|
|
90
|
+ //点击日期
|
|
|
|
91
|
+ selectDate(e){
|
|
|
|
92
|
+ this.setData({
|
|
|
|
93
|
+ date:e.detail.date
|
|
|
|
94
|
+ })
|
|
|
|
95
|
+ this.triggerEvent('selectdate',{date:this.data.date,action:'click'})
|
|
|
|
96
|
+ }
|
|
|
|
97
|
+ }
|
|
|
|
98
|
+
|
|
10
|
}) |
99
|
}) |