| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169 |
- // pages/clock/clock-tongji/list.js
- import {
- getCenterInfo,
- weekSettlement,
- monthSettlement
- } from '../../../services/index.js'
- import {
- imgServerUrl
- } from '../../../config/config.js'
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- avatar: wx.getStorageSync('userInfo').avatarUrl,
- name: wx.getStorageSync('userInfo').nickName,
- imgServerUrl,
- mouthNext: `${imgServerUrl}/images/clock/clock-arrow-righr-disabled.png`,
- mouthLast: `${imgServerUrl}/images/clock/clock-arrow-left.png`,
- weekNext: `${imgServerUrl}/images/clock/clock-arrow-righr-disabled.png`,
- weekLast: `${imgServerUrl}/images/clock/clock-arrow-left.png`,
- mouthData: {},
- weekData: {},
- mouth: '',
- defaultmouth: '',
- week: '本周'
- },
- getMouth(month_type) {
- monthSettlement({ month_type }).then(data => {
- this.setData({
- mouthData: data.data.currentSettlement
- })
- })
- },
- getWeek(week_type) {
- weekSettlement({ week_type }).then(data => {
- this.setData({
- weekData: data.data.currentSettlement
- })
- })
- },
- mouthNext() {
- if (this.data.mouth < this.data.defaultmouth) {
- this.setData({
- mouth: new Date().getMonth() + 1,
- mouthNext: `${imgServerUrl}/images/clock/clock-arrow-righr-disabled.png`,
- mouthLast: `${imgServerUrl}/images/clock/clock-arrow-left.png`,
- }, _ => {
- this.getMouth(1)
- })
- }
- },
- mouthLast() {
- if (this.data.mouth === this.data.defaultmouth) {
- if (new Date().getMonth() - 1 < 0) {
- this.setData({
- mouth: 12,
- year: this.data.year - 1
- }, _ => {
- this.getMouth(2)
- })
- } else {
- this.setData({
- mouth: new Date().getMonth()
- }, _ => {
- this.getMouth(2)
- })
- }
- this.setData({
- mouthNext: `${imgServerUrl}/images/clock/clock-arrow-righr.png`,
- mouthLast: `${imgServerUrl}/images/clock/clock-arrow-left-disabled.png`,
- })
- }
- },
- weekLast() {
- if (this.data.week === '本周') {
- this.setData({
- week: '上周',
- weekNext: `${imgServerUrl}/images/clock/clock-arrow-righr.png`,
- weekLast: `${imgServerUrl}/images/clock/clock-arrow-left-disabled.png`,
- })
- this.getWeek(2)
- }
- },
- weekNext() {
- if (this.data.week === '上周') {
- this.setData({
- week: '本周',
- weekLast: `${imgServerUrl}/images/clock/clock-arrow-left.png`,
- weekNext: `${imgServerUrl}/images/clock/clock-arrow-right-disabled.png`,
- })
- this.getWeek(1)
- }
- },
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad: function (options) {
-
- },
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady: function () {
- },
- /**
- * 生命周期函数--监听页面显示
- */
- onShow: function () {
- getCenterInfo().then(data => {
- let {
- approveStatus
- } = data.data
- this.setData({
- approveStatus, // 认证状态(0:未认证 1:等待认证 2:未通过 3:已认证) ,
- })
- })
- this.getMouth(1)
- this.getWeek(1)
- const date = new Date()
- let month = date.getMonth() + 1
- let year = date.getFullYear()
- this.setData({
- defaultmouth: month,
- mouth: month,
- year
- })
- },
- /**
- * 生命周期函数--监听页面隐藏
- */
- onHide: function () {
- },
- /**
- * 生命周期函数--监听页面卸载
- */
- onUnload: function () {
- },
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh: function () {
- },
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom: function () {
- },
- /**
- * 用户点击右上角分享
- */
- onShareAppMessage: function () {
- }
- })
|