소스 검색

完善任务提醒

yangyongyong 4 년 전
부모
커밋
d0a52e2521
2개의 변경된 파일35개의 추가작업 그리고 24개의 파일을 삭제
  1. 2 2
      client/pages/customer/taskreminder/taskreminder.axml
  2. 33 22
      client/pages/customer/taskreminder/taskreminder.js

+ 2 - 2
client/pages/customer/taskreminder/taskreminder.axml

@@ -20,14 +20,14 @@
     <view class="tasks-line">
       <view class="common-page-padding tasks-tik">
         <view class="tik-title">
-          <label>今天</label>
+          <label>{{nowselectTime}}</label>
           <view class="tik-right" onTap="showtime">
             <image mode="scaleToFill" src="/image/icon-calendar.png"/>
             <label>查看其它日期</label>
           </view>
         </view>
         <view class="tik-week" a:for="{{datelist}}" key="{{index}}">
-          <view class="tik-week-item {{item.cssName}}" onTap="changeWeekTime"  data-id="{{id}}">
+          <view class="tik-week-item {{item.cssName}}" onTap="changeWeekTime"  data-value="{{item.date}}" data-id="{{item.id}}">
             <view>{{item.title}}</view>
             <view>{{item.day}}
             <text a:if={{item.cssName}}>\n▪</text>

+ 33 - 22
client/pages/customer/taskreminder/taskreminder.js

@@ -19,9 +19,13 @@ Page({
   },
   onLoad() {
     //加载选中的时间
-    console.log(this.data.nowselectTime);
     let that=this;
-    that.getWeekStartDate(this.data.nowselectTime);
+    that.getWeekStartDate(this.data.nowselectTime); 
+    that.setnowweek();
+    this.selectDayTaskItem()
+    this.selectDayTaskCost()
+  },
+  setnowweek(){
     let data = this.data.datelist;
     for(let i=0;i<7;i++){
       if(this.data.weekdateday[i]==this.data.nowDay){
@@ -32,6 +36,7 @@ Page({
       else{
         data[i].date=this.data.weekdate[i];
         data[i].day=this.data.weekdateday[i];
+        data[i].cssName=''
       }
     }
     this.setData({
@@ -40,10 +45,6 @@ Page({
       weekday: app.globalData.relationInfo.servantTaskPeriod.workDay,
       servantTypeValue: app.globalData.relationInfo.servantType
     });
-    //处理时间完成
-
-    this.selectDayTaskItem()
-    this.selectDayTaskCost()
   },
   showcancel(){
     this.setData({
@@ -97,8 +98,22 @@ Page({
 
   },
   changeWeekTime(e){
-    console.log(e.target.id);
-    let changetime=e.target;
+    //切换选中的样式
+    let weeklist=this.data.datelist;
+    let selectedtabid=e.target.dataset.id;
+    for(let i=0;i<weeklist.length;i++){
+      if(weeklist[i].id==selectedtabid){
+        weeklist[i].cssName="tik-week-item-select";
+      }else{
+        weeklist[i].cssName="";
+      }
+    }
+    //设置当前选中的时间
+    this.setData({
+      nowselectTime:e.target.dataset.value,
+      datelist:weeklist
+    });
+    this.selectDayTaskItem();
   },
   
   showtime(){
@@ -108,7 +123,14 @@ Page({
   },
   //日历选中
   handleSelect(e) {
-      console.log(e[0]);
+      this.setData({
+        nowselectTime:util.formatDate(e[0]),
+        showchangetime:false,
+        nowDay:new Date(util.formatDate(e[0])).getDay()
+      });
+      this.selectDayTaskItem();
+      this.getWeekStartDate(util.formatDate(e[0]));
+      this.setnowweek();
   },
 
 // 查询保姆每日任务
@@ -118,7 +140,6 @@ Page({
       "date": this.data.nowselectTime
     }
     request.httpServiceGet(apiUrl1.selectDayTaskItemPath, params).then(data => {
-      console.log("今日任务=" + data);
       // 未设置任务
       if (data.length == 0) {
         this.setData({
@@ -128,6 +149,7 @@ Page({
         // 今天有任务
         this.setData({
           taskList: data,
+          isreminds: true
         });
       }
     }
@@ -144,18 +166,7 @@ Page({
       "date": this.data.nowselectTime
     }
     request.httpServiceGet(apiUrl.getEmployerCost, params).then(data => {
-      console.log("今日任务花费=" + data);
-      // 未设置任务
-      if (data.length == 0) {
-        this.setData({
-          isreminds: false,
-        });
-      } else {
-        // 今天有任务
-        this.setData({
-          taskList: data,
-        });
-      }
+      
     }
 
     ).catch(e => {