Commit 693df5f8f4a4c6ced3d39fd93b8ad98f2c89fb3c

Authored by liuxuqinfhp1220
1 parent 85365c54

no message

  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 })
@@ -2,11 +2,22 @@ @@ -2,11 +2,22 @@
2 cur-year="{{curYear}}" 2 cur-year="{{curYear}}"
3 cur-month="{{curMonth}}" 3 cur-month="{{curMonth}}"
4 day="{{day}}" 4 day="{{day}}"
  5 +selectedDate="{{date}}"
5 header_show='{{header_show}}' 6 header_show='{{header_show}}'
6 -prev='{{prev}}'  
7 -next='{{next}}' 7 +prev='{{nextNum}}'
  8 +next='{{next}}'
  9 +speciallist="{{speciallist}}"
  10 +closelaststyle="{{closelaststyle}}"
  11 +colored="#999999"
  12 +circle_show="{{false}}"
  13 +weekheight="100"
  14 +txt_style="txt_style"
8 calendar-style="calendar-style" 15 calendar-style="calendar-style"
9 weektitle-style="week-style" 16 weektitle-style="week-style"
10 datefont-style="datefont-style" 17 datefont-style="datefont-style"
11 header-style="header-style" 18 header-style="header-style"
12 -active-colort="active-colort"/>  
  19 +active-colort="active-colort"
  20 +active-coloro="active-coloro"
  21 +bindnextMonth="nextMonth"
  22 +bindprevMonth="prevMonth"
  23 +bindselectDate="selectDate"/>
@@ -13,9 +13,26 @@ @@ -13,9 +13,26 @@
13 } 13 }
14 .header-style{ 14 .header-style{
15 color:#353535; 15 color:#353535;
16 - font-size:30rpx; 16 + font-size:30rpx!important;
17 font-weight:bold; 17 font-weight:bold;
18 } 18 }
19 .active-colort{ 19 .active-colort{
20 - 20 + color:#C0A369;
  21 + font-weight:bold;
  22 + font-size:28rpx;
  23 + border:1px solid #C0A369;
  24 +}
  25 +.active-coloro{
  26 + color:#fff!important;
  27 + font-weight:bold;
  28 + font-size:28rpx;
  29 + background: -webkit-linear-gradient(top, #F2D190, #C0A369); /* Safari 5.1 - 6.0 */
  30 + background: -o-linear-gradient(-45deg, #F2D190, #C0A369); /* Opera 11.1 - 12.0 */
  31 + background: -moz-linear-gradient(top, #F2D190, #C0A369); /* Firefox 3.6 - 15 */
  32 + background: linear-gradient(to bottom, #F2D190, #C0A369);
  33 +}
  34 +.txt_style{
  35 + color:#C0A369;
  36 + margin-top:-10px;
  37 + fon-size:20rpx;
21 } 38 }
@@ -276,5 +276,8 @@ export default { @@ -276,5 +276,8 @@ export default {
276 }, 276 },
277 277
278 //获取营业时间段满房接口 278 //获取营业时间段满房接口
279 - 'App.Customer.GetHouseFullDateTimes':null 279 + 'App.Customer.GetHouseFullDateTimes':null,
  280 +
  281 + //根据指定年份月份获取当月满房的日期
  282 + 'App.Customer.GetHouseFullDate':null
280 } 283 }