add 返回刷新 review by hongmo
Showing
6 changed files
with
43 additions
and
2 deletions
@@ -137,6 +137,7 @@ export default keyMirror({ | @@ -137,6 +137,7 @@ export default keyMirror({ | ||
137 | SET_LACK_NUM: null, | 137 | SET_LACK_NUM: null, |
138 | SET_EXPRESS_NUM: null, | 138 | SET_EXPRESS_NUM: null, |
139 | SET_EXPRESS_VALUE: null, | 139 | SET_EXPRESS_VALUE: null, |
140 | + RETSET_DATA: null, | ||
140 | 141 | ||
141 | SWITCH_SHOP: null, | 142 | SWITCH_SHOP: null, |
142 | LOGOUT: null, | 143 | LOGOUT: null, |
@@ -52,6 +52,7 @@ class TransferShipmentContainer extends Component { | @@ -52,6 +52,7 @@ class TransferShipmentContainer extends Component { | ||
52 | this._goToStatsPage = this._goToStatsPage.bind(this); | 52 | this._goToStatsPage = this._goToStatsPage.bind(this); |
53 | this._checkUp = this._checkUp.bind(this); | 53 | this._checkUp = this._checkUp.bind(this); |
54 | this._setPurchaseNum = this._setPurchaseNum.bind(this); | 54 | this._setPurchaseNum = this._setPurchaseNum.bind(this); |
55 | + this._resetData = this._resetData.bind(this); | ||
55 | 56 | ||
56 | } | 57 | } |
57 | 58 | ||
@@ -63,6 +64,11 @@ class TransferShipmentContainer extends Component { | @@ -63,6 +64,11 @@ class TransferShipmentContainer extends Component { | ||
63 | 64 | ||
64 | } | 65 | } |
65 | 66 | ||
67 | + _resetData(){ | ||
68 | + this.props.actions.resetData(); | ||
69 | + this.props.actions.getPurchaseList(); | ||
70 | + } | ||
71 | + | ||
66 | _goToStatsPage(type,params) { | 72 | _goToStatsPage(type,params) { |
67 | this.props.actions.goToStatsPage(type,params); | 73 | this.props.actions.goToStatsPage(type,params); |
68 | } | 74 | } |
@@ -9,6 +9,10 @@ | @@ -9,6 +9,10 @@ | ||
9 | import {Actions} from 'react-native-router-flux'; | 9 | import {Actions} from 'react-native-router-flux'; |
10 | import DeliverGoodsService from '../../services/DeliverGoodsService'; | 10 | import DeliverGoodsService from '../../services/DeliverGoodsService'; |
11 | import {Alert, Linking} from 'react-native'; | 11 | import {Alert, Linking} from 'react-native'; |
12 | +import { | ||
13 | + resetData, | ||
14 | + getPurchaseList, | ||
15 | +} from '../transferShipment/transferShipmentActions'; | ||
12 | 16 | ||
13 | const { | 17 | const { |
14 | 18 | ||
@@ -71,8 +75,9 @@ export function deliveryGoodsFailure(error) { | @@ -71,8 +75,9 @@ export function deliveryGoodsFailure(error) { | ||
71 | export function deliveryGoods() { | 75 | export function deliveryGoods() { |
72 | return (dispatch,getState) => { | 76 | return (dispatch,getState) => { |
73 | let {deliverGoods,home} = getState(); | 77 | let {deliverGoods,home} = getState(); |
74 | - let deliverData = deliverGoods.get('deliverData')?deliverGoods.get('deliverData'):[]; | ||
75 | - let expressValue = deliverGoods.get('expressValue')?deliverGoods.get('expressValue'):null; | 78 | + let deliverData = deliverGoods&&deliverGoods.get('deliverData')?deliverGoods.get('deliverData'):null; |
79 | + | ||
80 | + let expressValue = deliverGoods&&deliverGoods.get('expressValue')?deliverGoods.get('expressValue'):null; | ||
76 | let expressId = expressValue?expressValue.get('id'):0; | 81 | let expressId = expressValue?expressValue.get('id'):0; |
77 | let expressNumber = deliverGoods.get('expressNum'); | 82 | let expressNumber = deliverGoods.get('expressNum'); |
78 | let shopId = home.shopId; | 83 | let shopId = home.shopId; |
@@ -94,6 +99,8 @@ export function deliveryGoods() { | @@ -94,6 +99,8 @@ export function deliveryGoods() { | ||
94 | '提交成功!', | 99 | '提交成功!', |
95 | '', | 100 | '', |
96 | [{text: 'OK', onPress: () => { | 101 | [{text: 'OK', onPress: () => { |
102 | + dispatch(resetData()); | ||
103 | + dispatch(getPurchaseList()); | ||
97 | Actions.pop(); | 104 | Actions.pop(); |
98 | }}] | 105 | }}] |
99 | ); | 106 | ); |
@@ -104,6 +111,7 @@ export function deliveryGoods() { | @@ -104,6 +111,7 @@ export function deliveryGoods() { | ||
104 | '提交失败!', | 111 | '提交失败!', |
105 | error.message, | 112 | error.message, |
106 | [{text: 'OK', onPress: () => { | 113 | [{text: 'OK', onPress: () => { |
114 | + Actions.pop(); | ||
107 | }}] | 115 | }}] |
108 | ); | 116 | ); |
109 | dispatch(deliveryGoodsFailure(error)) | 117 | dispatch(deliveryGoodsFailure(error)) |
@@ -9,6 +9,10 @@ | @@ -9,6 +9,10 @@ | ||
9 | import {Actions} from 'react-native-router-flux'; | 9 | import {Actions} from 'react-native-router-flux'; |
10 | import OutOfStockService from '../../services/OutOfStockService'; | 10 | import OutOfStockService from '../../services/OutOfStockService'; |
11 | import {Alert, Linking} from 'react-native'; | 11 | import {Alert, Linking} from 'react-native'; |
12 | +import { | ||
13 | + resetData, | ||
14 | + getPurchaseList, | ||
15 | +} from '../transferShipment/transferShipmentActions'; | ||
12 | 16 | ||
13 | const { | 17 | const { |
14 | 18 | ||
@@ -58,6 +62,8 @@ export function stockOut() { | @@ -58,6 +62,8 @@ export function stockOut() { | ||
58 | '提交成功!', | 62 | '提交成功!', |
59 | '', | 63 | '', |
60 | [{text: 'OK', onPress: () => { | 64 | [{text: 'OK', onPress: () => { |
65 | + dispatch(resetData()); | ||
66 | + dispatch(getPurchaseList()); | ||
61 | Actions.pop(); | 67 | Actions.pop(); |
62 | }}] | 68 | }}] |
63 | ); | 69 | ); |
@@ -22,6 +22,9 @@ const { | @@ -22,6 +22,9 @@ const { | ||
22 | 22 | ||
23 | CHECKUP_REQUEST, | 23 | CHECKUP_REQUEST, |
24 | SET_PURCHASE_NUM, | 24 | SET_PURCHASE_NUM, |
25 | + | ||
26 | + RETSET_DATA, | ||
27 | + | ||
25 | } = require('../../constants/actionTypes').default; | 28 | } = require('../../constants/actionTypes').default; |
26 | 29 | ||
27 | export function goToStatsPage(type,params) { | 30 | export function goToStatsPage(type,params) { |
@@ -51,6 +54,12 @@ export function goToStatsPage(type,params) { | @@ -51,6 +54,12 @@ export function goToStatsPage(type,params) { | ||
51 | } | 54 | } |
52 | } | 55 | } |
53 | 56 | ||
57 | +export function resetData() { | ||
58 | + return { | ||
59 | + type: RETSET_DATA, | ||
60 | + }; | ||
61 | +} | ||
62 | + | ||
54 | export function goDeliverGoods() { | 63 | export function goDeliverGoods() { |
55 | return (dispatch,getState) => { | 64 | return (dispatch,getState) => { |
56 | let {transferShipment,home} = getState(); | 65 | let {transferShipment,home} = getState(); |
@@ -20,6 +20,8 @@ const { | @@ -20,6 +20,8 @@ const { | ||
20 | 20 | ||
21 | CHECKUP_REQUEST, | 21 | CHECKUP_REQUEST, |
22 | SET_PURCHASE_NUM, | 22 | SET_PURCHASE_NUM, |
23 | + | ||
24 | + RETSET_DATA, | ||
23 | } = require('../../constants/actionTypes').default; | 25 | } = require('../../constants/actionTypes').default; |
24 | 26 | ||
25 | const initialState = new InitialState; | 27 | const initialState = new InitialState; |
@@ -74,6 +76,15 @@ export default function userReducer(state = initialState, action) { | @@ -74,6 +76,15 @@ export default function userReducer(state = initialState, action) { | ||
74 | case SET_PURCHASE_NUM:{ | 76 | case SET_PURCHASE_NUM:{ |
75 | return state.setIn(['purchaseList', 'records'], Immutable.fromJS(action.payload)); | 77 | return state.setIn(['purchaseList', 'records'], Immutable.fromJS(action.payload)); |
76 | } | 78 | } |
79 | + case RETSET_DATA: { | ||
80 | + return state.setIn(['purchaseList', 'isFetching'], false) | ||
81 | + .setIn(['purchaseList', 'error'], null) | ||
82 | + .setIn(['purchaseList', 'records'], null) | ||
83 | + .setIn(['purchaseList', 'pageNo'], 0) | ||
84 | + .setIn(['purchaseList', 'totalPage'], 0) | ||
85 | + .setIn(['purchaseList', 'totalCount'], 0) | ||
86 | + .setIn(['purchaseList', 'endReached'], false); | ||
87 | + } | ||
77 | return state; | 88 | return state; |
78 | } | 89 | } |
79 | 90 |
-
Please register or login to post a comment