|
@@ -1,54 +1,115 @@
|
|
|
import React, { Component } from 'react'
|
|
import React, { Component } from 'react'
|
|
|
|
|
|
|
|
import NavBars from '../common/NavBar'
|
|
import NavBars from '../common/NavBar'
|
|
|
-import Pickers from '../common/Picker'
|
|
|
|
|
|
|
+//import Pickers from '../common/Picker'
|
|
|
|
|
|
|
|
|
|
|
|
|
-//import {setSessionStorage,getSessionStorage} from '../../untils/session_help'
|
|
|
|
|
-import {collectByDate} from '../../untils/date'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+//import {setSessionStorage,getSessionStorage} from '../../untils/session_help'
|
|
|
|
|
+import {getDayCollect,getWeekCollect,getMonthCollect,getAllCollect} from '../../untils/collect'
|
|
|
|
|
+import './BillDetail.css'
|
|
|
|
|
|
|
|
|
|
|
|
|
-const season = [
|
|
|
|
|
- {
|
|
|
|
|
- label: '春',
|
|
|
|
|
- value: '春',
|
|
|
|
|
- },
|
|
|
|
|
- {
|
|
|
|
|
- label: '夏',
|
|
|
|
|
- value: '夏',
|
|
|
|
|
- },
|
|
|
|
|
- ];
|
|
|
|
|
|
|
+// const season = [
|
|
|
|
|
+// {
|
|
|
|
|
+// label: '春',
|
|
|
|
|
+// value: '春',
|
|
|
|
|
+// },
|
|
|
|
|
+// {
|
|
|
|
|
+// label: '夏',
|
|
|
|
|
+// value: '夏',
|
|
|
|
|
+// },
|
|
|
|
|
+// ];
|
|
|
|
|
|
|
|
export default class BillDetail extends Component {
|
|
export default class BillDetail extends Component {
|
|
|
constructor(props){
|
|
constructor(props){
|
|
|
super(props)
|
|
super(props)
|
|
|
this.state={
|
|
this.state={
|
|
|
- bill:[]
|
|
|
|
|
|
|
+ bill:[],
|
|
|
|
|
+ pay:0,
|
|
|
|
|
+ income:0,
|
|
|
|
|
+ billArr:[]
|
|
|
}
|
|
}
|
|
|
- console.log('detailPage',props)
|
|
|
|
|
- }
|
|
|
|
|
|
|
|
|
|
- componentDidMount(props){
|
|
|
|
|
-
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- componentWillUnmount(){
|
|
|
|
|
|
|
+ componentDidMount(props){
|
|
|
|
|
+ console.log('detailPageProps',props)
|
|
|
|
|
+ const detail=this.props.detail
|
|
|
|
|
+ const bills=this.props.bills
|
|
|
|
|
+ if(detail==='day'){
|
|
|
|
|
+ this.getDay(bills)
|
|
|
|
|
+ }else if(detail==='week'){
|
|
|
|
|
+ this.getWeek(bills)
|
|
|
|
|
+ }else if(detail==='month'){
|
|
|
|
|
+ this.getMonth(bills)
|
|
|
|
|
+ }else{
|
|
|
|
|
+ this.getAll(bills)
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- classBill(bill){
|
|
|
|
|
|
|
+ getDay(bills){
|
|
|
|
|
+ let collect=getDayCollect(bills)
|
|
|
|
|
+ this.setState({pay:collect.pay,income:collect.income,billArr:collect.billArr})
|
|
|
|
|
+ }
|
|
|
|
|
+ getWeek(bills){
|
|
|
|
|
+ let collect=getWeekCollect(bills)
|
|
|
|
|
+ this.setState({pay:collect.pay,income:collect.income,billArr:collect.billArr})
|
|
|
|
|
+ }
|
|
|
|
|
+ getMonth(bills){
|
|
|
|
|
+ let collect=getMonthCollect(bills)
|
|
|
|
|
+ this.setState({pay:collect.pay,income:collect.income,billArr:collect.billArr})
|
|
|
|
|
+ }
|
|
|
|
|
+ getAll(bills){
|
|
|
|
|
+ let collect=getAllCollect(bills)
|
|
|
|
|
+ this.setState({pay:collect.pay,income:collect.income,billArr:collect.billArr})
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ renderList(){
|
|
|
|
|
+ let billArr=this.state.billArr||[]
|
|
|
|
|
+ let length=billArr.lemgth
|
|
|
|
|
+ if(length){
|
|
|
|
|
+ return <div>没有流水记录</div>
|
|
|
|
|
+ }else{
|
|
|
|
|
+ return (
|
|
|
|
|
+ billArr.map((item)=>{
|
|
|
|
|
+ return (
|
|
|
|
|
+ <div className={"pay-wrap"} style={{background:"#fff",margin:"5px 0",padding:"13px 5px"}} key={item.id}>
|
|
|
|
|
+ <span>{item.remark}</span>
|
|
|
|
|
+ <span>{item.money}</span>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ )
|
|
|
|
|
+ })
|
|
|
|
|
+ )
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
render() {
|
|
render() {
|
|
|
|
|
+
|
|
|
return (
|
|
return (
|
|
|
<div>
|
|
<div>
|
|
|
- <NavBars changePage={this.props.changePage} page="home"/>
|
|
|
|
|
- <div className="deatilWrap">
|
|
|
|
|
- <Pickers data={season}/>
|
|
|
|
|
|
|
+ <NavBars changePage={this.props.changePage} page="home" navBarText={"账单详情"}/>
|
|
|
|
|
+ <div className={'detail-wrap'}>
|
|
|
|
|
+ <div className="balance">结余:</div>
|
|
|
|
|
+ <div className={"balance-money"}>{this.state.income - this.state.pay}</div>
|
|
|
|
|
+ <div className={"income-wrap"}>
|
|
|
|
|
+ <span>收入</span>
|
|
|
|
|
+ <span>{this.state.income}</span>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <div className={"pay-wrap"}>
|
|
|
|
|
+ <span>支出</span>
|
|
|
|
|
+ <span>{this.state.pay}</span>
|
|
|
|
|
+ </div>
|
|
|
</div>
|
|
</div>
|
|
|
|
|
+ <div style={{height:'20px'}}></div>
|
|
|
|
|
+ {this.renderList()}
|
|
|
|
|
+
|
|
|
|
|
+ {/*<div className="deatilWrap">
|
|
|
|
|
+ <Pickers data={season}/>
|
|
|
|
|
+ </div>*/}
|
|
|
</div>
|
|
</div>
|
|
|
)
|
|
)
|
|
|
}
|
|
}
|