settlement.js 2.7 KB
import * as types from '../constants/ActionTypes';

const initialState = {
    generateList: [],
    generateListCount: 0,
    confirmingList: [],
    confirmingListCount: 0,
    payingList: [],
    payingListCount: 0,
    completedList: [],
    completedListCount: 0,
    verifyingList: [],
    verifyingListCount: 0,
    detailList: [],
    detailListCount: 0,
    backToFirstPage:false,
    settleRecordsDetail:{},
    positionSettlementDetail:{
      price_proto:'',
      price_policy:''
    },
    needLoad:false
};

export default function environment(state = initialState, action) {
    switch (action.type) {
        case types.GET_GENERATE_LIST:
            return Object.assign({}, state, {
                generateList: action.generateList,
                generateListCount: action.generateListCount
            });
            break;
        case types.GET_CONFIRMING_LIST:
            return Object.assign({}, state, {
                confirmingList: action.confirmingList,
                confirmingListCount: action.confirmingListCount
            });
            break;
        case types.GET_SUPPLEMENT_PAYING_LIST:
            return Object.assign({}, state, {
                payingList: action.payingList,
                payingListCount: action.payingListCount
            });
            break;
        case types.GET_SUPPLEMENT_COMPLETED_LIST:
            return Object.assign({}, state, {
                completedList: action.completedList,
                completedListCount: action.completedListCount
            });
            break;
        case types.GET_VERIFYING_LIST:
            return Object.assign({}, state, {
                verifyingList: action.verifyingList,
                verifyingListCount: action.verifyingListCount
            });
            break;
        case types.SETTLEMENT_DETAIL_LIST:
            return Object.assign({}, state, {
                detailList: action.detailList,
                detailListCount: action.detailListCount
            });
            break;
        case types.CHANGE_PAGE_NUM:
            return Object.assign({}, state, {
              backToFirstPage: action.backToFirstPage,
              });
            break;
        case types.SETTLE_RECORD_DETAIL:
            return Object.assign({}, state, {
              settleRecordsDetail: action.settleRecordsDetail,
              });
            break;
        case types.POSITION_SETTLEMENT_DETAIL:
            return Object.assign({}, state, {
              positionSettlementDetail: action.positionSettlementDetail,
              });
            break;
        case types.CHANGE_SETTLEMENT_NEED_LOAD:
            return Object.assign({}, state, {
              needLoad: action.needLoad,
              });
            break;
        default:
            return state;
    }
}