demo如下:
import React, { Component } from 'react';
import { StyleSheet, Text, TouchableOpacity, View ,TouchableHighlight} from 'react-native';
import GiftedListView from 'react-native-gifted-listview';
import Ionicons from 'react-native-vector-icons/Ionicons';
import { httpGet } from '../../utils/ajax';
import { formatMoney, getDate, getTime } from '../../utils/utils';
import Header from '../normal/header';
import { CommonStyles } from '../styles/common';
class LBill extends Component {
static navigationOptions = ({ navigation }) => {
return {
header: null,
};
};
constructor(props) {
super(props);
this.state = {
pendingCount: 0,
totalCount: 0,
pageSize: 5,
sumMoney: 0,
sumRent: 0,
sumExpense: 0,
};
}
componentDidMount() {
// 获取水电统计信息
httpGet('bill/landlordStatis').then(data => {
this.setState({
sumMoney: data.data.sumMoney,
sumRent: data.data.sumRent,
sumExpense: data.data.sumExpense,
});
});
}
_onFetch(page = 1, callback, options) {
httpGet('bill/listByLandlordID?pageIndex=' + page + '&pageSize=' + this.state.pageSize).then((data) => {
this.setState({ totalCount: data.data.recordCount });
if (page === data.data.pageCount) {
callback(data.data.items, { allLoaded: true });
} else {
callback(data.data.items);
}
});
}
handleEstate=(estate,timeLine)=>{
//alert(estateid);
//alert(timeLine);
navigation.navigate('LbillDetail',{estate:estate,timeLine:timeLine});
}
_renderRowView(item) {
const { navigation } = this.props;
let timeLine={item.timeline}
let estateitems_h=item.items.map((e_item,index)=>{
return
房源名称:{e_item.estatename}
房租:{formatMoney(e_item.totalrent / 100)}元
物业费:{formatMoney(e_item.totalexpense / 100)}元
水电费:{formatMoney(e_item.totalmoney / 100)}元
});
return (
{timeLine}
{estateitems_h}
);
}
_renderPaginationWaitingView(paginateCallback) {
return (
加载更多...
);
}
_renderPaginationAllLoadedView() {
return (
加载完毕~
);
}
_renderEmptyView(refreshCallback) {
return (
~~暂时没有显示内容
);
}
render() {
const { navigation } = this.props;
return (
{formatMoney(this.state.sumRent / 100)}
房租(元)
{formatMoney(this.state.sumExpense / 100)}
物业费(元)
{formatMoney(this.state.sumMoney / 100)}
水电费(元)
{/* 结算记录轴 */}
)
}
}
const styles = StyleSheet.create({
itemContainer: {
paddingLeft: 10,
paddingRight: 10,
height: 60,
paddingTop: 10,
borderStyle: 'solid',
borderBottomColor: '#EAE9E9',
borderBottomWidth: 1,
flexDirection: 'row'
},
item:{
height:40,
flex:1,
minWidth:80
},
item_text: {
fontSize: 12,
flex: 1,
justifyContent: 'center'
},
itemBorder:{
borderRightColor:'#fff',
borderRightWidth:1,
borderStyle:'solid',
},
view_item: {
flex: 1,
width: '100%',
height: 20,
lineHeight: 20,
flexDirection: 'row',
},
billHeaderTitle: {
width: '100%',
paddingLeft: 10,
paddingRight: 10,
height: 40,
backgroundColor: '#EBEBEB',
justifyContent: 'center',
// alignItems:'center'
}
});
export default LBill