riku
2024-11-13 48145f787eda81815f653ad21161a60e89b6a303
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
const ledgerservice = require('../../../service/ledgerservice');
const selfpatrolservice = require('../../../service/selfpatrolservice');
const moment = require('../../../utils/moment.min');
const app = getApp();
 
Page({
  data: {
    stickyProps: {
      zIndex: 2,
    },
    exist: 0,
    loading: true,
  },
 
  onLoad(options) {
  },
 
  onShow() {
    this.fetchSelfPatrolTask();
  },
 
  fetchSelfPatrolTask() {
    const date = moment().format('YYYY-MM-DD');
    selfpatrolservice.getTask(app.globalData.accessToken.userId, date, {
      success: res => {
        let unfinishedNum = 0;
        res.data.forEach(e => {
          if (e.spTaskStatus == 1) unfinishedNum++;
        });
        this.setData({
          unfinishedNum,
          exist: res.data.length != 0,
          loading: false,
        });
      },
    });
  },
});