You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
129 lines
3.6 KiB
129 lines
3.6 KiB
10 months ago
|
import {event12345Rates} from "../../../../utils/statisticsApi";
|
||
|
import {formatTime} from "../../../../utils/util";
|
||
|
const formatDay2 = date => {
|
||
|
const year = date.getFullYear()
|
||
|
const month = date.getMonth() + 1
|
||
|
const day = date.getDay()
|
||
|
return [year, month, day].map(formatNumber).join('-')
|
||
|
}
|
||
|
const formatDay = date => {
|
||
|
const year = date.getFullYear()
|
||
|
const month = date.getMonth()
|
||
|
const day = date.getDay()
|
||
|
return [year, month, day].map(formatNumber).join('-')
|
||
|
}
|
||
|
const formatNumber = n => {
|
||
|
n = n.toString()
|
||
|
return n[1] ? n : '0' + n
|
||
|
}
|
||
|
Component({
|
||
|
properties: {
|
||
|
curVal: {
|
||
|
type: String,
|
||
|
value: '1',
|
||
|
observer: function () {
|
||
|
this.getList();
|
||
|
}
|
||
|
}
|
||
|
},
|
||
|
data: {
|
||
|
list: [],
|
||
|
day: '',
|
||
|
day2: '',
|
||
|
showitem: 3,
|
||
|
},
|
||
|
ready() {
|
||
|
this.setData({
|
||
|
day: formatDay(new Date()),
|
||
|
})
|
||
|
this.setData({
|
||
|
day2: formatDay2(new Date())
|
||
|
})
|
||
|
|
||
|
this.getList()
|
||
|
},
|
||
|
methods: {
|
||
|
onChange(e) {
|
||
|
this.setData({
|
||
|
day: e.detail.value
|
||
|
})
|
||
|
},
|
||
|
onChange2(e) {
|
||
|
this.setData({
|
||
|
day2: e.detail.value
|
||
|
})
|
||
|
},
|
||
|
onSearch(){
|
||
|
if(this.data.day>this.data.day2){
|
||
|
wx.showToast({
|
||
|
title: '起止日期错误',
|
||
|
icon: 'error',
|
||
|
duration: 2000
|
||
|
})
|
||
|
return false
|
||
|
}
|
||
|
this.getList()
|
||
|
},
|
||
|
showall(){
|
||
|
if(this.data.showitem==99999){
|
||
|
this.setData({
|
||
|
showitem: 3
|
||
|
})
|
||
|
}else{
|
||
|
this.setData({
|
||
|
showitem: 99999
|
||
|
})
|
||
|
}
|
||
|
},
|
||
|
getList() {
|
||
|
if (this.data.curVal == '1') {
|
||
|
this.getEventList(false)
|
||
|
} else {
|
||
|
this.getEventList(false)
|
||
|
}
|
||
|
},
|
||
|
getEventList(deptFlag) {
|
||
|
|
||
|
|
||
|
event12345Rates({
|
||
|
startDate: this.data.day.toString() + ' ' + '00:00:00',
|
||
|
endDate: this.data.day2.toString() + ' ' + '23:59:59',
|
||
|
usableFlag: true,
|
||
|
// deptFlag: deptFlag,
|
||
|
recountFlag:1
|
||
|
}).then(res => {
|
||
|
console.log('++++++++++++',res.data)
|
||
|
// res.data.list.forEach(item => {
|
||
|
// item.reportTime = this.formatTime(item.reportTime)
|
||
|
// })
|
||
|
this.setData({
|
||
|
list: res.data
|
||
|
})
|
||
|
})
|
||
|
},
|
||
|
formatTime(date) {
|
||
|
if (date) {
|
||
|
let _date = new Date(date)
|
||
|
let M = _date.getMonth() - 0 + 1 > 10 ? _date.getMonth() - 0 + 1 : '0' + (_date.getMonth() - 0 + 1)
|
||
|
let D = _date.getDate() > 10 ? _date.getDate() : '0' + _date.getDate()
|
||
|
return M + '-' +D
|
||
|
}
|
||
|
return ''
|
||
|
|
||
|
},
|
||
|
|
||
|
gotopage(e) {
|
||
|
if (this.data.stayVal === '1') {
|
||
|
wx.navigateTo({
|
||
|
url: '/subpages/statistics/pages/event/detail/detail?id=' + e.currentTarget.dataset.id+'&is12345=2',
|
||
|
})
|
||
|
} else {
|
||
|
wx.navigateTo({
|
||
|
url: '/subpages/statistics/pages/demand/detail/detail?id=' + e.currentTarget.dataset.id+'&type=1',
|
||
|
})
|
||
|
}
|
||
|
|
||
|
}
|
||
|
}
|
||
|
});
|