Authored by 盖剑秋

Add account settlement request serveceto home service. Reviewer:Yu Liang.

... ... @@ -28,7 +28,7 @@ export default class AccountSettlement extends Component {
}
renderRow(Data,sectionId) {
console.log(Data);
switch (sectionId) {
case 'SECTION_HEADER':
... ... @@ -82,8 +82,9 @@ export default class AccountSettlement extends Component {
<ListView
dataSource={this.dataSource.cloneWithRowsAndSections(this.props.dataBlob)}
renderRow={this.renderRow}
onEndReachedThreshold={-150}
onEndReachedThreshold={-50}
onEndReached={this.props.fetchNextPage}
enableEmptySections={true}
/>
</View>
);
... ...
... ... @@ -62,7 +62,7 @@ export default class AccountSettlementContainer extends Component {
'SECTION_HEADER':[{title:'累计结算金额(元)',content:'12567.00'}],
'SECTION_SEPORATOR':[{}],
'SECTION_TITLE':[{}],
'SECTION_CONTENT':this.props.actStmt.jsonData,
'SECTION_CONTENT':this.props.actStmt.jsonData.toJS(),
};
return (
... ...
'use strict';
import Request from '../../services/Request';
import HomeService from '../../services/HomeService';
const {
ACCOUNT_LIST_REQUEST,
... ... @@ -43,100 +44,14 @@ export function nextPageOfDataRequest() {
return dispatch => {
dispatch(requestNextPage());
let api = new Request();
api.get({
url:'/operations/api/v6/category/getCategory'
})
.then(data => {
console.log(data);
dispatch(nextPageOfDataSuccess(testData));
return new HomeService().accountSettlementData()
.then(json => {
dispatch(nextPageOfDataSuccess(json));
})
.catch(error => {
dispatch(nextPageOfDataFailure(error));
});
})
};
}
let testData = [
{
brand:'vans',
date: '2016-01-23',
status: '已出账单',
bill:'923.00'
},
{
brand:'vans',
date: '2016-01-23',
status: '已出账单',
bill:'923.00'
},
{
brand:'vans',
date: '2016-01-23',
status: '已出账单',
bill:'923.00'
},
{
brand:'vans',
date: '2016-01-23',
status: '已出账单',
bill:'923.00'
},
{
brand:'vans',
date: '2016-01-23',
status: '已出账单',
bill:'923.00'
},
{
brand:'vans',
date: '2016-01-23',
status: '已出账单',
bill:'923.00'
},
{
brand:'vans',
date: '2016-01-23',
status: '已出账单',
bill:'923.00'
},
{
brand:'vans',
date: '2016-01-23',
status: '已出账单',
bill:'923.00'
},
{
brand:'vans',
date: '2016-01-23',
status: '已出账单',
bill:'923.00'
},
{
brand:'vans',
date: '2016-01-23',
status: '已出账单',
bill:'923.00'
},
{
brand:'vans',
date: '2016-01-23',
status: '已出账单',
bill:'923.00'
},
{
brand:'vans',
date: '2016-01-23',
status: '已出账单',
bill:'923.00'
},
{
brand:'vans',
date: '2016-01-23',
status: '已出账单',
bill:'923.00'
},
];
}
... ...
... ... @@ -7,7 +7,7 @@ let InitialState = Record({
isFetching: false,
pageCount: 0,
sum:'0.00',
jsonData:List(),
jsonData:List([]),
});
export default InitialState;
... ...
'use strict';
import AccountSettlementInitialState from './accountSettlementInitialState'
import Immutable, {List, Record} from 'immutable';
const {
ACCOUNT_LIST_REQUEST,
... ... @@ -23,10 +24,9 @@ export default function messageReducer(state = initialState, action) {
break;
case ACCOUNT_LIST_SUCCESS:{
const {jsonData} = state;
let data = [...jsonData, ...action.payload];
let nextState = state.set('isFetching',false).set('jsonData',data);
let origin = jsonData.toJS();
let data = [...origin, ...action.payload];
let nextState = state.set('isFetching',false).set('jsonData', List(data));
return nextState;
}
break;
... ...
... ... @@ -26,4 +26,100 @@ export default class UserService {
throw(error);
});
}
async accountSettlementData() {
return await this.api.get({
url:'/operations/api/v6/category/getCategory'
})
.then((json) => {
return testData;
})
.catch((error) => {
throw(error);
})
}
}
let testData = [
{
brand:'vans',
date: '2016-01-23',
status: '已出账单',
bill:'923.00'
},
{
brand:'vans',
date: '2016-01-23',
status: '已出账单',
bill:'923.00'
},
{
brand:'vans',
date: '2016-01-23',
status: '已出账单',
bill:'923.00'
},
{
brand:'vans',
date: '2016-01-23',
status: '已出账单',
bill:'923.00'
},
{
brand:'vans',
date: '2016-01-23',
status: '已出账单',
bill:'923.00'
},
{
brand:'vans',
date: '2016-01-23',
status: '已出账单',
bill:'923.00'
},
{
brand:'vans',
date: '2016-01-23',
status: '已出账单',
bill:'923.00'
},
{
brand:'vans',
date: '2016-01-23',
status: '已出账单',
bill:'923.00'
},
{
brand:'vans',
date: '2016-01-23',
status: '已出账单',
bill:'923.00'
},
{
brand:'vans',
date: '2016-01-23',
status: '已出账单',
bill:'923.00'
},
{
brand:'vans',
date: '2016-01-23',
status: '已出账单',
bill:'923.00'
},
{
brand:'vans',
date: '2016-01-23',
status: '已出账单',
bill:'923.00'
},
{
brand:'vans',
date: '2016-01-23',
status: '已出账单',
bill:'923.00'
},
];
... ...