Commit 693df5f8f4a4c6ced3d39fd93b8ad98f2c89fb3c

Authored by liuxuqinfhp1220
1 parent 85365c54

no message

import util from '../../../utils/util';
import App from '../../../utils/api';
let date=new Date();
Component({
properties:{
seller:Object,
//选中日期
date:{
type:String,
value:date.getFullYear()+'-'+(date.getMonth()+1<10 ? '0'+(date.getMonth()+1) : date.getMonth()+1),
}
},
data: {
curYear: new Date().getFullYear(), // 年份
curMonth: new Date().getMonth() + 1,// 月份 1-12
day: new Date().getDate(), // 日期 1-31 若日期超过该月天数,月份自动增加
header_show: true, // 主标题是否显示
prev: true, // 上一个月按钮是否显示
next: true, // 下一个月按钮是否显示
curYear: date.getFullYear(), // 年份
curMonth: date.getMonth() + 1,// 月份 1-12
day:date.getDate(),
header_show: true, // 主标题是否显示
next: true, // 下一个月按钮是否显示
closelaststyle:true,
speciallist: [],
nextNum:0,
},
attached(){
//默认标记特殊日期
this.getspeciallist();
this.gethousefulldate();
},
ready(){
this.triggerEvent('selectdate',{date:this.data.date,action:'defalut'})
},
methods:{
//默认标记特殊日期
getspeciallist(){
let speciallist = [
{date: util.unixtoTime(date, 'YYYY-MM-DD'), background: '', text: '今'},
{date: util.unixtoTime(date + 86400, 'YYYY-MM-DD'), background: '', text: '明'}
];
this.setData({
speciallist:speciallist
})
},
//根据指定年份月份获取当月满房的日期
gethousefulldate(){
let parmdata={
sid:this.data.seller.id,
date:this.data.date
}
App.Customer.GetHouseFullDate(parmdata).then((json)=>{
console.log(json)
if(json.ret==200){
if(json.data.length>0){
this.changespeciallist(json.data)
}
}
})
},
//修改标记特殊日期
changespeciallist(houseFullDate){
let speciallist=this.data.speciallist;
let newspeciallist=[];
houseFullDate.forEach((v,i)=>{
newspeciallist.push({
date:v,
background:'',
text:'满'
})
})
speciallist.forEach((v,i)=>{
if(houseFullDate.indexOf(v.date)==-1){
newspeciallist.push(v)
}
})
this.setData({
speciallist:newspeciallist
})
},
//下一月
nextMonth(e){
this.setData({
nextNum:this.data.nextNum+1
})
},
//上一月
prevMonth(e){
this.setData({
nextNum:this.data.nextNum-1
})
},
//点击日期
selectDate(e){
this.setData({
date:e.detail.date
})
this.triggerEvent('selectdate',{date:this.data.date,action:'click'})
}
}
})
\ No newline at end of file
... ...
... ... @@ -2,11 +2,22 @@
cur-year="{{curYear}}"
cur-month="{{curMonth}}"
day="{{day}}"
selectedDate="{{date}}"
header_show='{{header_show}}'
prev='{{prev}}'
next='{{next}}'
prev='{{nextNum}}'
next='{{next}}'
speciallist="{{speciallist}}"
closelaststyle="{{closelaststyle}}"
colored="#999999"
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"/>
\ No newline at end of file
active-colort="active-colort"
active-coloro="active-coloro"
bindnextMonth="nextMonth"
bindprevMonth="prevMonth"
bindselectDate="selectDate"/>
\ No newline at end of file
... ...
... ... @@ -13,9 +13,26 @@
}
.header-style{
color:#353535;
font-size:30rpx;
font-size:30rpx!important;
font-weight:bold;
}
.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;
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);
}
.txt_style{
color:#C0A369;
margin-top:-10px;
fon-size:20rpx;
}
\ No newline at end of file
... ...
... ... @@ -276,5 +276,8 @@ export default {
},
//获取营业时间段满房接口
'App.Customer.GetHouseFullDateTimes':null
'App.Customer.GetHouseFullDateTimes':null,
//根据指定年份月份获取当月满房的日期
'App.Customer.GetHouseFullDate':null
}
\ No newline at end of file
... ...