|
@@ -8,6 +8,7 @@ import {
|
|
|
import {
|
|
import {
|
|
|
imgServerUrl
|
|
imgServerUrl
|
|
|
} from '../../../config/config.js'
|
|
} from '../../../config/config.js'
|
|
|
|
|
+let selected = ''
|
|
|
Page({
|
|
Page({
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -22,11 +23,12 @@ Page({
|
|
|
text: '',
|
|
text: '',
|
|
|
currentDuration: 0,
|
|
currentDuration: 0,
|
|
|
punckClockList: [],
|
|
punckClockList: [],
|
|
|
- nextMoney: 0
|
|
|
|
|
|
|
+ nextMoney: 0,
|
|
|
|
|
+ defaultDate: ''
|
|
|
},
|
|
},
|
|
|
toList() {
|
|
toList() {
|
|
|
wx.navigateTo({
|
|
wx.navigateTo({
|
|
|
- url: './list',
|
|
|
|
|
|
|
+ url: './list?date=' + this.data.defaultDate,
|
|
|
})
|
|
})
|
|
|
},
|
|
},
|
|
|
getList(month_type) {
|
|
getList(month_type) {
|
|
@@ -38,12 +40,25 @@ Page({
|
|
|
},
|
|
},
|
|
|
getCurrent() {
|
|
getCurrent() {
|
|
|
currentSettlement().then(data => {
|
|
currentSettlement().then(data => {
|
|
|
- const month = Number(data.data.currentSettlement.date.split('-')[1])
|
|
|
|
|
|
|
+ const date = new Date(data.data.currentSettlement.date.replace(/'-'/g, '/'))
|
|
|
|
|
+ // const month = Number(data.data.currentSettlement.date.split('-')[1])
|
|
|
|
|
+ let year = date.getFullYear()
|
|
|
|
|
+ let month = date.getMonth() + 1
|
|
|
|
|
+ let day = date.getDate()
|
|
|
|
|
+ this.selectComponent('.calendar').init(date)
|
|
|
this.setData({
|
|
this.setData({
|
|
|
currentSettlement: data.data.currentSettlement,
|
|
currentSettlement: data.data.currentSettlement,
|
|
|
text: month,
|
|
text: month,
|
|
|
mouth: month,
|
|
mouth: month,
|
|
|
|
|
+ year,
|
|
|
|
|
+ defaultDate: data.data.currentSettlement.date.replace(/'-'/g, '/')
|
|
|
})
|
|
})
|
|
|
|
|
+
|
|
|
|
|
+ const search_date = [year, month, day].map(val => {
|
|
|
|
|
+ const number = val.toString()
|
|
|
|
|
+ return number[1] ? number : '0' + number
|
|
|
|
|
+ }).join('-')
|
|
|
|
|
+ this.getDay(search_date)
|
|
|
})
|
|
})
|
|
|
},
|
|
},
|
|
|
next() {
|
|
next() {
|
|
@@ -54,13 +69,6 @@ Page({
|
|
|
text: this.data.mouth,
|
|
text: this.data.mouth,
|
|
|
next: `${imgServerUrl}/images/clock/clock-arrow-righr-disabled.png`,
|
|
next: `${imgServerUrl}/images/clock/clock-arrow-righr-disabled.png`,
|
|
|
last: `${imgServerUrl}/images/clock/clock-arrow-left.png`,
|
|
last: `${imgServerUrl}/images/clock/clock-arrow-left.png`,
|
|
|
- }, _ => {
|
|
|
|
|
- let { year, text } = this.data
|
|
|
|
|
- const search_date = [year, text, 1].map(val => {
|
|
|
|
|
- const number = val.toString()
|
|
|
|
|
- return number[1] ? number : '0' + number
|
|
|
|
|
- }).join('-')
|
|
|
|
|
- this.getDay(search_date)
|
|
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
@@ -70,26 +78,11 @@ Page({
|
|
|
this.getList(2)
|
|
this.getList(2)
|
|
|
if (this.data.mouth - 1 <= 0) {
|
|
if (this.data.mouth - 1 <= 0) {
|
|
|
this.setData({
|
|
this.setData({
|
|
|
- text: 12
|
|
|
|
|
- }, _ => {
|
|
|
|
|
- let { year, text } = this.data
|
|
|
|
|
- const search_date = [year - 1, text, 1].map(val => {
|
|
|
|
|
- const number = val.toString()
|
|
|
|
|
- return number[1] ? number : '0' + number
|
|
|
|
|
- }).join('-')
|
|
|
|
|
- this.getDay(search_date)
|
|
|
|
|
-
|
|
|
|
|
|
|
+ text: 12,
|
|
|
})
|
|
})
|
|
|
} else {
|
|
} else {
|
|
|
this.setData({
|
|
this.setData({
|
|
|
text: this.data.mouth - 1
|
|
text: this.data.mouth - 1
|
|
|
- }, _ => {
|
|
|
|
|
- let { year, text } = this.data
|
|
|
|
|
- const search_date = [year, text, 1].map(val => {
|
|
|
|
|
- const number = val.toString()
|
|
|
|
|
- return number[1] ? number : '0' + number
|
|
|
|
|
- }).join('-')
|
|
|
|
|
- this.getDay(search_date)
|
|
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
|
this.setData({
|
|
this.setData({
|
|
@@ -133,20 +126,8 @@ Page({
|
|
|
* 生命周期函数--监听页面显示
|
|
* 生命周期函数--监听页面显示
|
|
|
*/
|
|
*/
|
|
|
onShow: function () {
|
|
onShow: function () {
|
|
|
- const date = new Date()
|
|
|
|
|
- let year = date.getFullYear()
|
|
|
|
|
- let month = date.getMonth() + 1
|
|
|
|
|
- let day = date.getDate()
|
|
|
|
|
- const search_date = [year, month, day].map(val => {
|
|
|
|
|
- const number = val.toString()
|
|
|
|
|
- return number[1] ? number : '0' + number
|
|
|
|
|
- }).join('-')
|
|
|
|
|
this.getList(1)
|
|
this.getList(1)
|
|
|
this.getCurrent()
|
|
this.getCurrent()
|
|
|
- this.getDay(search_date)
|
|
|
|
|
- this.setData({
|
|
|
|
|
- year
|
|
|
|
|
- })
|
|
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
/**
|
|
/**
|