|
|
@@ -1,6 +1,7 @@
|
|
|
import React, { Component } from 'react';
|
|
|
import { List } from 'antd-mobile';
|
|
|
import {collectByDate} from '../../untils/date'
|
|
|
+//import {setSessionStorage} from '../../untils/session_help'
|
|
|
const Item = List.Item;
|
|
|
|
|
|
|
|
|
@@ -20,7 +21,6 @@ export default class IconList extends Component{
|
|
|
}
|
|
|
}
|
|
|
componentWillReceiveProps(props){
|
|
|
-
|
|
|
let {bills,week}=props
|
|
|
this.getDayCollect(bills)
|
|
|
this.getWeekCollect(bills,week)
|
|
|
@@ -30,14 +30,14 @@ export default class IconList extends Component{
|
|
|
|
|
|
|
|
|
getDayCollect(bills=[]){
|
|
|
-
|
|
|
let day=new Date().toDateString()
|
|
|
-
|
|
|
- console.log(day)
|
|
|
-
|
|
|
bills.forEach((item)=>{
|
|
|
let itemDay=new Date(item.time).toDateString()
|
|
|
if(itemDay===day){
|
|
|
+
|
|
|
+ console.log('todayBill',[item])
|
|
|
+ //setSessionStorage('todayBill',[item])
|
|
|
+
|
|
|
if(item.class==='pay'){
|
|
|
this.setState({
|
|
|
dayPay:item.money
|
|
|
@@ -50,6 +50,7 @@ export default class IconList extends Component{
|
|
|
return 0
|
|
|
}
|
|
|
})
|
|
|
+
|
|
|
|
|
|
}
|
|
|
|
|
|
@@ -60,6 +61,8 @@ export default class IconList extends Component{
|
|
|
// console.log(bottom,top)
|
|
|
let weeks=collectByDate(bills,bottom,top)
|
|
|
//console.log('weeks',weeks)
|
|
|
+ console.log('weekBill',weeks.arr)
|
|
|
+ //setSessionStorage('weekBill',weeks.arr)
|
|
|
this.setState({
|
|
|
weekPay:weeks.Pay,
|
|
|
weekIncome:weeks.Income
|
|
|
@@ -71,8 +74,10 @@ export default class IconList extends Component{
|
|
|
const year=new Date().getFullYear()
|
|
|
let bottom=new Date(year+'/'+month+'/1').getTime(),
|
|
|
top=new Date(year+'/'+month+'/31').getTime();
|
|
|
- let collect=collectByDate(bills,bottom,top)
|
|
|
- this.setState({monthPay:collect.Pay,monthIncome:collect.Income})
|
|
|
+ let months=collectByDate(bills,bottom,top)
|
|
|
+ console.log('monthBill',months.arr)
|
|
|
+ //setSessionStorage('monthBill',months.arr)
|
|
|
+ this.setState({monthPay:months.Pay,monthIncome:months.Income})
|
|
|
}
|
|
|
|
|
|
getAllCollect(bills=[]){
|
|
|
@@ -84,12 +89,11 @@ export default class IconList extends Component{
|
|
|
allIncome+=item.money
|
|
|
}
|
|
|
})
|
|
|
-
|
|
|
+ console.log('allBill',bills)
|
|
|
+ //setSessionStorage('allBill',bills)
|
|
|
this.setState({allPay,allIncome})
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-
|
|
|
render(){
|
|
|
return (
|
|
|
<div className="listWrap">
|
|
|
@@ -97,7 +101,10 @@ export default class IconList extends Component{
|
|
|
<Item
|
|
|
thumb="https://wly-1254337200.cos.ap-guangzhou.myqcloud.com/today.svg"
|
|
|
arrow="horizontal"
|
|
|
- onClick={() => {}}
|
|
|
+ onClick={() => {
|
|
|
+ this.props.setDetail('day')
|
|
|
+ this.props.changePage('detail')
|
|
|
+ }}
|
|
|
>
|
|
|
<div className="itemWrap">
|
|
|
<div>今日</div>
|
|
|
@@ -111,7 +118,10 @@ export default class IconList extends Component{
|
|
|
<List>
|
|
|
<Item
|
|
|
thumb="https://wly-1254337200.cos.ap-guangzhou.myqcloud.com/week.svg"
|
|
|
- onClick={() => {}}
|
|
|
+ onClick={() => {
|
|
|
+ this.props.setDetail('week')
|
|
|
+ this.props.changePage('detail')
|
|
|
+ }}
|
|
|
arrow="horizontal"
|
|
|
>
|
|
|
<div className="itemWrap">
|
|
|
@@ -126,7 +136,10 @@ export default class IconList extends Component{
|
|
|
<List>
|
|
|
<Item
|
|
|
thumb="https://wly-1254337200.cos.ap-guangzhou.myqcloud.com/month.svg"
|
|
|
- onClick={() => {}}
|
|
|
+ onClick={() => {
|
|
|
+ this.props.setDetail('month')
|
|
|
+ this.props.changePage('detail')
|
|
|
+ }}
|
|
|
arrow="horizontal"
|
|
|
>
|
|
|
<div className="itemWrap">
|
|
|
@@ -141,7 +154,10 @@ export default class IconList extends Component{
|
|
|
<List>
|
|
|
<Item
|
|
|
thumb="https://wly-1254337200.cos.ap-guangzhou.myqcloud.com/all.svg"
|
|
|
- onClick={() => {}}
|
|
|
+ onClick={() => {
|
|
|
+ this.props.setDetail('all')
|
|
|
+ this.props.changePage('detail')
|
|
|
+ }}
|
|
|
arrow="horizontal"
|
|
|
>
|
|
|
<div className="itemWrap">
|