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, }); }, }); }, });