Authored by 孙凯

add 返回刷新 review by hongmo

... ... @@ -137,7 +137,8 @@ export default keyMirror({
SET_LACK_NUM: null,
SET_EXPRESS_NUM: null,
SET_EXPRESS_VALUE: null,
RETSET_DATA: null,
SWITCH_SHOP: null,
LOGOUT: null,
});
... ...
... ... @@ -52,6 +52,7 @@ class TransferShipmentContainer extends Component {
this._goToStatsPage = this._goToStatsPage.bind(this);
this._checkUp = this._checkUp.bind(this);
this._setPurchaseNum = this._setPurchaseNum.bind(this);
this._resetData = this._resetData.bind(this);
}
... ... @@ -63,6 +64,11 @@ class TransferShipmentContainer extends Component {
}
_resetData(){
this.props.actions.resetData();
this.props.actions.getPurchaseList();
}
_goToStatsPage(type,params) {
this.props.actions.goToStatsPage(type,params);
}
... ...
... ... @@ -9,6 +9,10 @@
import {Actions} from 'react-native-router-flux';
import DeliverGoodsService from '../../services/DeliverGoodsService';
import {Alert, Linking} from 'react-native';
import {
resetData,
getPurchaseList,
} from '../transferShipment/transferShipmentActions';
const {
... ... @@ -71,8 +75,9 @@ export function deliveryGoodsFailure(error) {
export function deliveryGoods() {
return (dispatch,getState) => {
let {deliverGoods,home} = getState();
let deliverData = deliverGoods.get('deliverData')?deliverGoods.get('deliverData'):[];
let expressValue = deliverGoods.get('expressValue')?deliverGoods.get('expressValue'):null;
let deliverData = deliverGoods&&deliverGoods.get('deliverData')?deliverGoods.get('deliverData'):null;
let expressValue = deliverGoods&&deliverGoods.get('expressValue')?deliverGoods.get('expressValue'):null;
let expressId = expressValue?expressValue.get('id'):0;
let expressNumber = deliverGoods.get('expressNum');
let shopId = home.shopId;
... ... @@ -94,6 +99,8 @@ export function deliveryGoods() {
'提交成功!',
'',
[{text: 'OK', onPress: () => {
dispatch(resetData());
dispatch(getPurchaseList());
Actions.pop();
}}]
);
... ... @@ -104,6 +111,7 @@ export function deliveryGoods() {
'提交失败!',
error.message,
[{text: 'OK', onPress: () => {
Actions.pop();
}}]
);
dispatch(deliveryGoodsFailure(error))
... ...
... ... @@ -9,6 +9,10 @@
import {Actions} from 'react-native-router-flux';
import OutOfStockService from '../../services/OutOfStockService';
import {Alert, Linking} from 'react-native';
import {
resetData,
getPurchaseList,
} from '../transferShipment/transferShipmentActions';
const {
... ... @@ -58,6 +62,8 @@ export function stockOut() {
'提交成功!',
'',
[{text: 'OK', onPress: () => {
dispatch(resetData());
dispatch(getPurchaseList());
Actions.pop();
}}]
);
... ...
... ... @@ -22,6 +22,9 @@ const {
CHECKUP_REQUEST,
SET_PURCHASE_NUM,
RETSET_DATA,
} = require('../../constants/actionTypes').default;
export function goToStatsPage(type,params) {
... ... @@ -51,6 +54,12 @@ export function goToStatsPage(type,params) {
}
}
export function resetData() {
return {
type: RETSET_DATA,
};
}
export function goDeliverGoods() {
return (dispatch,getState) => {
let {transferShipment,home} = getState();
... ...
... ... @@ -20,6 +20,8 @@ const {
CHECKUP_REQUEST,
SET_PURCHASE_NUM,
RETSET_DATA,
} = require('../../constants/actionTypes').default;
const initialState = new InitialState;
... ... @@ -74,6 +76,15 @@ export default function userReducer(state = initialState, action) {
case SET_PURCHASE_NUM:{
return state.setIn(['purchaseList', 'records'], Immutable.fromJS(action.payload));
}
case RETSET_DATA: {
return state.setIn(['purchaseList', 'isFetching'], false)
.setIn(['purchaseList', 'error'], null)
.setIn(['purchaseList', 'records'], null)
.setIn(['purchaseList', 'pageNo'], 0)
.setIn(['purchaseList', 'totalPage'], 0)
.setIn(['purchaseList', 'totalCount'], 0)
.setIn(['purchaseList', 'endReached'], false);
}
return state;
}
... ...