Authored by 张丽霞

分期还款模块,review by 陈林

... ... @@ -13,6 +13,7 @@ import ReactNative, {
import Immutable, {Map} from 'immutable';
import Prompt from '../../../coupon/components/coupon/Prompt';
import LoadingIndicator from '../../../common/components/LoadingIndicator';
export default class RepayList extends React.Component {
constructor(props) {
... ... @@ -20,7 +21,7 @@ export default class RepayList extends React.Component {
}
render() {
let {repayList,tipMessage} = this.props.dataSource;
let {repayList,tipMessage,isFetching} = this.props.dataSource;
repayList = repayList.toJS();
let curRepayInfo = repayList[0];
if (!curRepayInfo) {
... ... @@ -79,7 +80,9 @@ export default class RepayList extends React.Component {
duration={800}
onPromptHidden={this.props.clearTipMessage}
/> : null}
<LoadingIndicator
isVisible={isFetching}
/>
</View>
);
}
... ...
... ... @@ -48,11 +48,11 @@ class RepayRecordListContainer extends Component {
}
componentDidMount() {
this.props.actions.getRepayRecordList();
this.props.actions.getRepayRecordList(1);
}
_reloadPage() {
this.props.actions.getRepayRecordList();
this.props.actions.getRepayRecordList(1);
}
_onEndReached() {
... ...
... ... @@ -134,11 +134,15 @@ export function getRepayList() {
}
//还款记录
export function getRepayRecordList() {
export function getRepayRecordList(page) {
return (dispatch, getState) => {
let {app, repayDetail} = getState();
let {currentPage,repayList,pageTotal} = repayDetail;
currentPage++;
if (page) {
currentPage = page
} else {
currentPage++;
}
if (pageTotal > 0 && currentPage > pageTotal) {
return;
}
... ...
... ... @@ -24,7 +24,8 @@ export default function appReducer(state = initialState, action) {
case SET_TIP_MESSAGE:
return state.set('tipMessage', action.payload);
case QUERY_REPAY_RECORD_LIST_REQUEST:
return state.set('isFetching', true);
return state.set('isFetching', true)
.set('error', null);
case QUERY_REPAY_RECORD_LIST_SUCCESS:
return state.set('repayList', Immutable.fromJS(action.payload.detailInfoList))
.set('currentPage', action.payload.currentPage)
... ...