Forráskód Böngészése

雇主端-月报页面

una 4 éve
szülő
commit
ba04d26d33

+ 3 - 1
client/app.js

@@ -16,7 +16,9 @@ App({
   globalData:{
     userInfo:{},  //用户信息
     employRelationNo:'',//进入工作台的雇佣关系编号
-    relationInfo:'',//雇佣关系详情,编辑服务者用
+    relationInfo:'',//雇佣关系详情,编辑服务者用,
+    reportList:'',//月报列表
+    reportInfo:'',//月报信息
     servantInfo:''//保姆编辑使用
   }
   

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

@@ -91,11 +91,11 @@
       </view>
    </view>
    <!-- 月报 -->
-    <view class="common-card module-card">
+    <view class="common-card module-card" onTap="switchReportList">
        <view class="module-text">
       <view class="module-title">
       保姆月报
-      <text class="report-tips">服务时间较短,暂未生成~</text>
+      <text class="report-tips" a:if="{{noReportShow}}">服务时间较短,暂未生成~</text>
       </view>
       <view class="module-detail">服务回顾 发现问题</view>
       </view>

+ 39 - 1
client/pages/customer/customerCenter/customerCenter.js

@@ -20,6 +20,7 @@ Page({
     unSetTaskModal:false,//未设置任务提醒
     finishSetModal:false,//完成设置指引
     noSetSerStan:false,//未设置服务标准
+    noReportShow:false,//没有月报
  
     unSetBtn: [
       { text: '现在设置', extClass: 'buttonBold' },
@@ -62,6 +63,7 @@ Page({
     console.log(query);
       this.initCustomerInfo();
       this.getEmployerNotice();
+      this.selectMonthlyReport();
   },
     // 获取雇佣关系详情
   initCustomerInfo(){
@@ -337,6 +339,10 @@ Page({
  // 点击开启体验按钮
   onFinishButtonClick(e){
     console.log(e.target);
+    // if(this.data.finishTitle==this.data.finishModalCase3[0]){
+    //     // 复制关联码
+    //     this.copyCode();
+    // }
     if(e.target.dataset.index==0){
        this.setData({
       finishSetModal: false,
@@ -487,9 +493,41 @@ Page({
          console.log(e);
        }
 
-  }
+  },
 
+  // 获取月报
 
+   selectMonthlyReport(){
+  
+let params={
+        "employRelationNo":app.globalData.employRelationNo,
+        "reportType": '1',
+    }
+     request.httpServicePost(apiUrl.selectMonthlyReportPath,params).then(data=>{
+        console.log('月报信息response');
+      console.log(data);
+      let noReport=(data.length==0)
+          this.setData({
+      noReportShow: noReport,
+    });
+        if(!noReport){
+          app.globalData.reportList=data;
+        }
+
+          }).catch(e=>{
+           console.log(e);
+           
+        })
+
+  },
+
+switchReportList(){
+  if(!this.data.noReportShow){
+        my.navigateTo({
+      url: '../reportList/reportList'
+    });
+  }
+}
 
 
 

+ 12 - 18
client/pages/customer/monthReport/monthReport.js

@@ -6,6 +6,9 @@ const PieLabel = require('@antv/f2/lib/plugin/pie-label'); // 引入 PieLabel 
 
 // 方式一:全局注册
 F2.Chart.plugins.register(PieLabel);
+import request from '../../../util/http'
+import apiUrl from '../../../util/apiUrl'
+var app = getApp();
 Page({
   data: {
     reportDate: '2020年11月',
@@ -14,9 +17,14 @@ Page({
     percentTop: '88%',
     expendTotal: '1888',
     taskNum: '60',
+    reportInfo:'',
   },
   onLoad() {
-
+    let reportInfo=app.globalData.reportInfo;
+    console.log(reportInfo);
+    this.setData({
+      reportInfo:reportInfo,
+    })
   },
   onInitChart(F2, config) {
     //  饼状图
@@ -391,22 +399,8 @@ chart.render();
 
     //任务无法完成原因
     const chart = new F2.Chart(config);
-    const data = [{
-      year: '2014 年',
-      sales: 145
-    }, {
-      year: '2015 年',
-      sales: 121
-    }, {
-      year: '2016 年',
-      sales: 100
-    }, {
-      year: '2017 年',
-      sales: 97
-    }, {
-      year: '2018 年',
-      sales: 85
-    }];
+    // const data = [{"number":"20","typeName":"任务太多"},{"number":"0","typeName":"我不会"},{"number":"10","typeName":"任务不详细"}];
+    const data=JSON.parse(this.data.reportInfo.unfinishd);
     chart.source(data, {
       sales: {
         tickCount: 5
@@ -422,7 +416,7 @@ chart.render();
     //   }
     // });
     chart.interval()
-      .position('year*sales')
+      .position('typeName*number')
       .color('l(90) 0:#FBEC9F 1:#F3D34D'); // 定义柱状图渐变色
     chart.render();
     // 注意:需要把chart return 出来

+ 3 - 8
client/pages/customer/reportList/reportList.axml

@@ -1,16 +1,11 @@
 <view class="common-page-padding servantlistpage">
 <!---服务列表-->
-  <view class="servantlistitem">
-     <view class="servantlistitem-left">1月月报</view>
-     <view class="servantlistitem-right">
-      <image mode="scaleToFill" src="/image/icon-right.png"/>
-     </view>
-  </view>
-  <view class="servantlistitem">
-     <view class="servantlistitem-left">2月月报</view>
+  <view class="servantlistitem"  a:for="{{reportList}}" onTap="switchMonthReport" data-reportIndex="{{index}}" key="{{index}}">
+     <view class="servantlistitem-left">{{item.reportTime+'月报'}}</view>
      <view class="servantlistitem-right">
       <image mode="scaleToFill" src="/image/icon-right.png"/>
      </view>
   </view>
   
+  
 </view>

+ 21 - 2
client/pages/customer/reportList/reportList.js

@@ -1,4 +1,23 @@
+import request from '../../../util/http'
+import apiUrl from '../../../util/apiUrl'
+var app = getApp();
 Page({
-  data: {},
-  onLoad() {},
+  data: {
+    reportList:[],
+  },
+  onLoad() {
+     console.log(app.globalData);
+     this.setData({
+       reportList:app.globalData.reportList
+     });
+
+  },
+  switchMonthReport(e){
+    let reportIndex=e.target.dataset.reportIndex;
+    app.globalData.reportInfo=this.data.reportList[reportIndex];
+    console.log(app.globalData.reportInfo);
+    my.navigateTo({
+      url: '../monthReport/monthReport'
+    });
+  }
 });