Showing
17 changed files
with
489 additions
and
13 deletions
@@ -62,6 +62,9 @@ export default class DeliverGoods extends Component { | @@ -62,6 +62,9 @@ export default class DeliverGoods extends Component { | ||
62 | } | 62 | } |
63 | 63 | ||
64 | render() { | 64 | render() { |
65 | + let {expressList,storehouse} = this.props.resource; | ||
66 | + console.log(expressList?expressList.toJS():'s'); | ||
67 | + console.log(storehouse?storehouse.toJS():'s'); | ||
65 | 68 | ||
66 | return ( | 69 | return ( |
67 | <View style={styles.container}> | 70 | <View style={styles.container}> |
@@ -35,7 +35,8 @@ export default class TransferShipment extends Component { | @@ -35,7 +35,8 @@ export default class TransferShipment extends Component { | ||
35 | } | 35 | } |
36 | 36 | ||
37 | render() { | 37 | render() { |
38 | - | 38 | + let {resource} = this.props; |
39 | + console.log(resource?resource.toJS():''); | ||
39 | return ( | 40 | return ( |
40 | <View style={styles.container}> | 41 | <View style={styles.container}> |
41 | <ListView | 42 | <ListView |
@@ -110,6 +110,26 @@ export default keyMirror({ | @@ -110,6 +110,26 @@ export default keyMirror({ | ||
110 | REFOUND_STATS_FAILURE: null, | 110 | REFOUND_STATS_FAILURE: null, |
111 | REFOUND_STATS_CLEAN: null, | 111 | REFOUND_STATS_CLEAN: null, |
112 | 112 | ||
113 | + GET_PURCHASE_LIST_REQUEST: null, | ||
114 | + GET_PURCHASE_LIST_SUCCESS: null, | ||
115 | + GET_PURCHASE_LIST_FAILURE: null, | ||
116 | + | ||
117 | + DELIVERY_GOODS_REQUEST: null, | ||
118 | + DELIVERY_GOODS_SUCCESS: null, | ||
119 | + DELIVERY_GOODS_FAILURE: null, | ||
120 | + | ||
121 | + GET_EXPRESS_LIST_REQUEST: null, | ||
122 | + GET_EXPRESS_LIST_SUCCESS: null, | ||
123 | + GET_EXPRESS_LIST_FAILURE: null, | ||
124 | + | ||
125 | + QUERYBYSUPPLIER_REQUEST: null, | ||
126 | + QUERYBYSUPPLIER_SUCCESS: null, | ||
127 | + QUERYBYSUPPLIER_FAILURE: null, | ||
128 | + | ||
129 | + STOCKOUT_REQUEST: null, | ||
130 | + STOCKOUT_SUCCESS: null, | ||
131 | + STOCKOUT_FAILURE: null, | ||
132 | + | ||
113 | SWITCH_SHOP: null, | 133 | SWITCH_SHOP: null, |
114 | LOGOUT: null, | 134 | LOGOUT: null, |
115 | }); | 135 | }); |
@@ -52,7 +52,8 @@ class DeliverGoodsContainer extends Component { | @@ -52,7 +52,8 @@ class DeliverGoodsContainer extends Component { | ||
52 | } | 52 | } |
53 | 53 | ||
54 | componentDidMount() { | 54 | componentDidMount() { |
55 | - | 55 | + this.props.actions.getExpressList(); |
56 | + this.props.actions.queryBySupplierId(); | ||
56 | } | 57 | } |
57 | 58 | ||
58 | componentWillUnmount() { | 59 | componentWillUnmount() { |
@@ -60,9 +61,11 @@ class DeliverGoodsContainer extends Component { | @@ -60,9 +61,11 @@ class DeliverGoodsContainer extends Component { | ||
60 | } | 61 | } |
61 | 62 | ||
62 | render() { | 63 | render() { |
64 | + let {deliverGoods} = this.props; | ||
65 | + | ||
63 | return ( | 66 | return ( |
64 | <View style={styles.container}> | 67 | <View style={styles.container}> |
65 | - <DeliverGoods /> | 68 | + <DeliverGoods resource={deliverGoods}/> |
66 | </View> | 69 | </View> |
67 | ); | 70 | ); |
68 | } | 71 | } |
@@ -60,6 +60,8 @@ class OutOfStockContainer extends Component { | @@ -60,6 +60,8 @@ class OutOfStockContainer extends Component { | ||
60 | } | 60 | } |
61 | 61 | ||
62 | render() { | 62 | render() { |
63 | + let {outOfStock} = this.props; | ||
64 | + | ||
63 | return ( | 65 | return ( |
64 | <View style={styles.container}> | 66 | <View style={styles.container}> |
65 | <OutOfStock /> | 67 | <OutOfStock /> |
@@ -53,7 +53,7 @@ class TransferShipmentContainer extends Component { | @@ -53,7 +53,7 @@ class TransferShipmentContainer extends Component { | ||
53 | } | 53 | } |
54 | 54 | ||
55 | componentDidMount() { | 55 | componentDidMount() { |
56 | - | 56 | + this.props.actions.getPurchaseList(); |
57 | } | 57 | } |
58 | 58 | ||
59 | componentWillUnmount() { | 59 | componentWillUnmount() { |
@@ -65,9 +65,11 @@ class TransferShipmentContainer extends Component { | @@ -65,9 +65,11 @@ class TransferShipmentContainer extends Component { | ||
65 | } | 65 | } |
66 | 66 | ||
67 | render() { | 67 | render() { |
68 | + let {transferShipment} = this.props; | ||
69 | + let {purchaseList} = transferShipment; | ||
68 | return ( | 70 | return ( |
69 | <View style={styles.container}> | 71 | <View style={styles.container}> |
70 | - <TransferShipment goToStatsPage={this._goToStatsPage}/> | 72 | + <TransferShipment resource={purchaseList} goToStatsPage={this._goToStatsPage}/> |
71 | </View> | 73 | </View> |
72 | ); | 74 | ); |
73 | } | 75 | } |
@@ -13,5 +13,143 @@ import {Alert, Linking} from 'react-native'; | @@ -13,5 +13,143 @@ import {Alert, Linking} from 'react-native'; | ||
13 | const { | 13 | const { |
14 | 14 | ||
15 | LOGOUT, | 15 | LOGOUT, |
16 | + DELIVERY_GOODS_REQUEST, | ||
17 | + DELIVERY_GOODS_SUCCESS, | ||
18 | + DELIVERY_GOODS_FAILURE, | ||
19 | + | ||
20 | + GET_EXPRESS_LIST_REQUEST, | ||
21 | + GET_EXPRESS_LIST_SUCCESS, | ||
22 | + GET_EXPRESS_LIST_FAILURE, | ||
23 | + | ||
24 | + QUERYBYSUPPLIER_REQUEST, | ||
25 | + QUERYBYSUPPLIER_SUCCESS, | ||
26 | + QUERYBYSUPPLIER_FAILURE, | ||
16 | 27 | ||
17 | } = require('../../constants/actionTypes').default; | 28 | } = require('../../constants/actionTypes').default; |
29 | + | ||
30 | +export function deliveryGoodsRequest() { | ||
31 | + return { | ||
32 | + type: DELIVERY_GOODS_REQUEST, | ||
33 | + }; | ||
34 | +} | ||
35 | + | ||
36 | +export function deliveryGoodsSuccess(json) { | ||
37 | + return { | ||
38 | + type: DELIVERY_GOODS_SUCCESS, | ||
39 | + payload: json, | ||
40 | + }; | ||
41 | +} | ||
42 | + | ||
43 | +export function deliveryGoodsFailure(error) { | ||
44 | + return { | ||
45 | + type: DELIVERY_GOODS_FAILURE, | ||
46 | + payload: error, | ||
47 | + }; | ||
48 | +} | ||
49 | + | ||
50 | +export function deliveryGoods() { | ||
51 | + return (dispatch,getState) => { | ||
52 | + let {home} = getState(); | ||
53 | + | ||
54 | + dispatch(deliveryGoodsRequest()) | ||
55 | + return new DeliverGoodsService().deliveryGoods() | ||
56 | + .then((json) => { | ||
57 | + dispatch(deliveryGoodsSuccess(json)) | ||
58 | + }) | ||
59 | + .catch((error) => { | ||
60 | + dispatch(deliveryGoodsFailure(error)) | ||
61 | + }); | ||
62 | + }; | ||
63 | +} | ||
64 | + | ||
65 | + | ||
66 | +export function getExpressListRequest() { | ||
67 | + return { | ||
68 | + type: GET_EXPRESS_LIST_REQUEST, | ||
69 | + }; | ||
70 | +} | ||
71 | + | ||
72 | +export function getExpressListSuccess(json) { | ||
73 | + return { | ||
74 | + type: GET_EXPRESS_LIST_SUCCESS, | ||
75 | + payload: json, | ||
76 | + }; | ||
77 | +} | ||
78 | + | ||
79 | +export function getExpressListFailure(error) { | ||
80 | + return { | ||
81 | + type: GET_EXPRESS_LIST_FAILURE, | ||
82 | + payload: error, | ||
83 | + }; | ||
84 | +} | ||
85 | + | ||
86 | +export function getExpressList() { | ||
87 | + return (dispatch,getState) => { | ||
88 | + let {home} = getState(); | ||
89 | + | ||
90 | + dispatch(getExpressListRequest()) | ||
91 | + return new DeliverGoodsService().getExpressList() | ||
92 | + .then((json) => { | ||
93 | + dispatch(getExpressListSuccess(json)) | ||
94 | + }) | ||
95 | + .catch((error) => { | ||
96 | + dispatch(getExpressListFailure(error)) | ||
97 | + }); | ||
98 | + }; | ||
99 | +} | ||
100 | + | ||
101 | + | ||
102 | +export function queryBySupplierIdRequest() { | ||
103 | + return { | ||
104 | + type: QUERYBYSUPPLIER_REQUEST, | ||
105 | + }; | ||
106 | +} | ||
107 | + | ||
108 | +export function queryBySupplierIdSuccess(json) { | ||
109 | + return { | ||
110 | + type: QUERYBYSUPPLIER_SUCCESS, | ||
111 | + payload: json, | ||
112 | + }; | ||
113 | +} | ||
114 | + | ||
115 | +export function queryBySupplierIdFailure(error) { | ||
116 | + return { | ||
117 | + type: QUERYBYSUPPLIER_FAILURE, | ||
118 | + payload: error, | ||
119 | + }; | ||
120 | +} | ||
121 | + | ||
122 | +export function queryBySupplierId() { | ||
123 | + return (dispatch,getState) => { | ||
124 | + let {home} = getState(); | ||
125 | + let supplierId = 1; | ||
126 | + | ||
127 | + dispatch(queryBySupplierIdRequest()) | ||
128 | + return new DeliverGoodsService().queryBySupplierId(supplierId) | ||
129 | + .then((json) => { | ||
130 | + let res = exposePruductListData(json); | ||
131 | + dispatch(queryBySupplierIdSuccess(res)) | ||
132 | + }) | ||
133 | + .catch((error) => { | ||
134 | + dispatch(queryBySupplierIdFailure(error)) | ||
135 | + }); | ||
136 | + }; | ||
137 | +} | ||
138 | +function exposePruductListData(json) { | ||
139 | + | ||
140 | + let adminName=json?json.adminName:''; | ||
141 | + let address=json?json.address:''; | ||
142 | + let phone=json?json.phone:''; | ||
143 | + let storehouseName=json?json.storehouseName:''; | ||
144 | + let id=json?json.id:''; | ||
145 | + let status=json?json.status:''; | ||
146 | + | ||
147 | + return { | ||
148 | + adminName, | ||
149 | + address, | ||
150 | + phone, | ||
151 | + storehouseName, | ||
152 | + id, | ||
153 | + status, | ||
154 | + }; | ||
155 | +} |
@@ -7,7 +7,21 @@ import {List, Record} from 'immutable'; | @@ -7,7 +7,21 @@ import {List, Record} from 'immutable'; | ||
7 | 7 | ||
8 | 8 | ||
9 | let InitialState = Record({ | 9 | let InitialState = Record({ |
10 | - | 10 | + expressList: new (Record({ |
11 | + isFetching: false, | ||
12 | + error: null, | ||
13 | + list: List(), | ||
14 | + })), | ||
15 | + storehouse: new (Record({ | ||
16 | + isFetching: false, | ||
17 | + error: null, | ||
18 | + adminName: '', | ||
19 | + address: '', | ||
20 | + phone: '', | ||
21 | + storehouseName: '', | ||
22 | + id: '', | ||
23 | + status: '', | ||
24 | + })), | ||
11 | }); | 25 | }); |
12 | 26 | ||
13 | export default InitialState; | 27 | export default InitialState; |
@@ -12,6 +12,17 @@ import Immutable, {List, Record} from 'immutable'; | @@ -12,6 +12,17 @@ import Immutable, {List, Record} from 'immutable'; | ||
12 | const { | 12 | const { |
13 | 13 | ||
14 | LOGOUT, | 14 | LOGOUT, |
15 | + DELIVERY_GOODS_REQUEST, | ||
16 | + DELIVERY_GOODS_SUCCESS, | ||
17 | + DELIVERY_GOODS_FAILURE, | ||
18 | + | ||
19 | + GET_EXPRESS_LIST_REQUEST, | ||
20 | + GET_EXPRESS_LIST_SUCCESS, | ||
21 | + GET_EXPRESS_LIST_FAILURE, | ||
22 | + | ||
23 | + QUERYBYSUPPLIER_REQUEST, | ||
24 | + QUERYBYSUPPLIER_SUCCESS, | ||
25 | + QUERYBYSUPPLIER_FAILURE, | ||
15 | 26 | ||
16 | } = require('../../constants/actionTypes').default; | 27 | } = require('../../constants/actionTypes').default; |
17 | 28 | ||
@@ -26,9 +37,46 @@ export default function userReducer(state = initialState, action) { | @@ -26,9 +37,46 @@ export default function userReducer(state = initialState, action) { | ||
26 | if (!(state instanceof InitialState)) return initialState.merge(state); | 37 | if (!(state instanceof InitialState)) return initialState.merge(state); |
27 | 38 | ||
28 | switch (action.type) { | 39 | switch (action.type) { |
29 | - case LOGOUT:{ | 40 | + case DELIVERY_GOODS_REQUEST:{ |
41 | + return state; | ||
42 | + } | ||
43 | + case DELIVERY_GOODS_SUCCESS:{ | ||
44 | + return state; | ||
45 | + } | ||
46 | + case DELIVERY_GOODS_FAILURE:{ | ||
30 | return state; | 47 | return state; |
31 | } | 48 | } |
49 | + case GET_EXPRESS_LIST_REQUEST:{ | ||
50 | + return state.setIn(['expressList', 'isFetching'], true) | ||
51 | + .setIn(['expressList', 'error'], null); | ||
52 | + } | ||
53 | + case GET_EXPRESS_LIST_SUCCESS:{ | ||
54 | + return state.setIn(['expressList', 'isFetching'], false) | ||
55 | + .setIn(['expressList', 'error'], null) | ||
56 | + .setIn(['expressList', 'list'], Immutable.fromJS(action.payload)); | ||
57 | + } | ||
58 | + case GET_EXPRESS_LIST_FAILURE:{ | ||
59 | + return state.setIn(['expressList', 'isFetching'], false) | ||
60 | + .setIn(['expressList', 'error'], action.payload); | ||
61 | + } | ||
62 | + case QUERYBYSUPPLIER_REQUEST:{ | ||
63 | + return state.setIn(['storehouse', 'isFetching'], true) | ||
64 | + .setIn(['storehouse', 'error'], null); | ||
65 | + } | ||
66 | + case QUERYBYSUPPLIER_FAILURE:{ | ||
67 | + return state.setIn(['storehouse', 'isFetching'], false) | ||
68 | + .setIn(['storehouse', 'adminName'], action.payload.adminName) | ||
69 | + .setIn(['storehouse', 'address'], action.payload.address) | ||
70 | + .setIn(['storehouse', 'phone'], action.payload.phone) | ||
71 | + .setIn(['storehouse', 'storehouseName'], action.payload.storehouseName) | ||
72 | + .setIn(['storehouse', 'id'], action.payload.id) | ||
73 | + .setIn(['storehouse', 'status'], action.payload.status) | ||
74 | + .setIn(['storehouse', 'error'], null) | ||
75 | + } | ||
76 | + case GET_EXPRESS_LIST_FAILURE:{ | ||
77 | + return state.setIn(['storehouse', 'isFetching'], false) | ||
78 | + .setIn(['storehouse', 'error'], action.payload); | ||
79 | + } | ||
32 | return state; | 80 | return state; |
33 | } | 81 | } |
34 | 82 |
@@ -7,11 +7,49 @@ | @@ -7,11 +7,49 @@ | ||
7 | 'use strict'; | 7 | 'use strict'; |
8 | 8 | ||
9 | import {Actions} from 'react-native-router-flux'; | 9 | import {Actions} from 'react-native-router-flux'; |
10 | -import TransferShipmentService from '../../services/OutOfStockService'; | 10 | +import OutOfStockService from '../../services/OutOfStockService'; |
11 | import {Alert, Linking} from 'react-native'; | 11 | import {Alert, Linking} from 'react-native'; |
12 | 12 | ||
13 | const { | 13 | const { |
14 | 14 | ||
15 | - LOGOUT, | ||
16 | - | 15 | + STOCKOUT_REQUEST, |
16 | + STOCKOUT_SUCCESS, | ||
17 | + STOCKOUT_FAILURE, | ||
17 | } = require('../../constants/actionTypes').default; | 18 | } = require('../../constants/actionTypes').default; |
19 | + | ||
20 | +export function stockOutRequest() { | ||
21 | + return { | ||
22 | + type: STOCKOUT_REQUEST, | ||
23 | + }; | ||
24 | +} | ||
25 | + | ||
26 | +export function stockOutSuccess(json) { | ||
27 | + return { | ||
28 | + type: STOCKOUT_SUCCESS, | ||
29 | + payload: json, | ||
30 | + }; | ||
31 | +} | ||
32 | + | ||
33 | +export function stockOutFailure(error) { | ||
34 | + return { | ||
35 | + type: STOCKOUT_FAILURE, | ||
36 | + payload: error, | ||
37 | + }; | ||
38 | +} | ||
39 | + | ||
40 | +export function stockOut() { | ||
41 | + return (dispatch,getState) => { | ||
42 | + let {home} = getState(); | ||
43 | + let proReqFormId=1; | ||
44 | + let productSku=1; | ||
45 | + let num=1; | ||
46 | + dispatch(stockOutRequest()) | ||
47 | + return new OutOfStockService().stockOut(proReqFormId,productSku,num) | ||
48 | + .then((json) => { | ||
49 | + dispatch(stockOutSuccess(json)) | ||
50 | + }) | ||
51 | + .catch((error) => { | ||
52 | + dispatch(stockOutFailure(error)) | ||
53 | + }); | ||
54 | + }; | ||
55 | +} |
@@ -11,7 +11,9 @@ import Immutable, {List, Record} from 'immutable'; | @@ -11,7 +11,9 @@ import Immutable, {List, Record} from 'immutable'; | ||
11 | 11 | ||
12 | const { | 12 | const { |
13 | 13 | ||
14 | - LOGOUT, | 14 | + STOCKOUT_REQUEST, |
15 | + STOCKOUT_SUCCESS, | ||
16 | + STOCKOUT_FAILURE, | ||
15 | 17 | ||
16 | } = require('../../constants/actionTypes').default; | 18 | } = require('../../constants/actionTypes').default; |
17 | 19 | ||
@@ -26,7 +28,13 @@ export default function userReducer(state = initialState, action) { | @@ -26,7 +28,13 @@ export default function userReducer(state = initialState, action) { | ||
26 | if (!(state instanceof InitialState)) return initialState.merge(state); | 28 | if (!(state instanceof InitialState)) return initialState.merge(state); |
27 | 29 | ||
28 | switch (action.type) { | 30 | switch (action.type) { |
29 | - case LOGOUT:{ | 31 | + case STOCKOUT_REQUEST:{ |
32 | + return state; | ||
33 | + } | ||
34 | + case STOCKOUT_SUCCESS:{ | ||
35 | + return state; | ||
36 | + } | ||
37 | + case STOCKOUT_FAILURE:{ | ||
30 | return state; | 38 | return state; |
31 | } | 39 | } |
32 | return state; | 40 | return state; |
@@ -15,6 +15,9 @@ const { | @@ -15,6 +15,9 @@ const { | ||
15 | 15 | ||
16 | GO_TO_OUT_STOCK, | 16 | GO_TO_OUT_STOCK, |
17 | 17 | ||
18 | + GET_PURCHASE_LIST_REQUEST, | ||
19 | + GET_PURCHASE_LIST_SUCCESS, | ||
20 | + GET_PURCHASE_LIST_FAILURE, | ||
18 | } = require('../../constants/actionTypes').default; | 21 | } = require('../../constants/actionTypes').default; |
19 | 22 | ||
20 | export function goToStatsPage(type) { | 23 | export function goToStatsPage(type) { |
@@ -27,3 +30,55 @@ export function goToStatsPage(type) { | @@ -27,3 +30,55 @@ export function goToStatsPage(type) { | ||
27 | }; | 30 | }; |
28 | } | 31 | } |
29 | } | 32 | } |
33 | + | ||
34 | +export function getPurchaseListRequest() { | ||
35 | + return { | ||
36 | + type: GET_PURCHASE_LIST_REQUEST, | ||
37 | + }; | ||
38 | +} | ||
39 | + | ||
40 | +export function getPurchaseListSuccess(json) { | ||
41 | + return { | ||
42 | + type: GET_PURCHASE_LIST_SUCCESS, | ||
43 | + payload: json, | ||
44 | + }; | ||
45 | +} | ||
46 | + | ||
47 | +export function getPurchaseListFailure(error) { | ||
48 | + return { | ||
49 | + type: GET_PURCHASE_LIST_FAILURE, | ||
50 | + payload: error, | ||
51 | + }; | ||
52 | +} | ||
53 | + | ||
54 | +export function getPurchaseList() { | ||
55 | + return (dispatch,getState) => { | ||
56 | + let {transferShipment,home} = getState(); | ||
57 | + let {purchaseList} = transferShipment; | ||
58 | + | ||
59 | + if (purchaseList.isFetching || purchaseList.endReached) { | ||
60 | + return; | ||
61 | + } | ||
62 | + | ||
63 | + let shopId = home.shopId; | ||
64 | + let pageSize = purchaseList.pageSize; | ||
65 | + let pageNo = purchaseList.pageNo + 1; | ||
66 | + | ||
67 | + dispatch(getPurchaseListRequest()) | ||
68 | + return new TransferShipmentService().getPurchaseList(shopId,pageSize,pageNo) | ||
69 | + .then((json) => { | ||
70 | + | ||
71 | + json.endReached = json.pageNo == json.totalPage || json.records.length < pageSize; | ||
72 | + if (json.pageNo > 1) { | ||
73 | + let oldList = purchaseList.records.toJS(); | ||
74 | + let list = [...oldList, ...json.records]; | ||
75 | + json.records = list; | ||
76 | + } | ||
77 | + | ||
78 | + dispatch(getPurchaseListSuccess(json)) | ||
79 | + }) | ||
80 | + .catch((error) => { | ||
81 | + dispatch(getPurchaseListFailure(error)) | ||
82 | + }); | ||
83 | + }; | ||
84 | +} |
@@ -7,7 +7,16 @@ import {List, Record} from 'immutable'; | @@ -7,7 +7,16 @@ import {List, Record} from 'immutable'; | ||
7 | 7 | ||
8 | 8 | ||
9 | let InitialState = Record({ | 9 | let InitialState = Record({ |
10 | - | 10 | + purchaseList: new (Record({ |
11 | + isFetching: false, | ||
12 | + error: null, | ||
13 | + records: List(), | ||
14 | + pageNo: 0, | ||
15 | + totalPage: 0, | ||
16 | + pageSize: 10, | ||
17 | + totalCount: 0, | ||
18 | + endReached: false, | ||
19 | + })), | ||
11 | }); | 20 | }); |
12 | 21 | ||
13 | export default InitialState; | 22 | export default InitialState; |
@@ -12,6 +12,9 @@ import Immutable, {List, Record} from 'immutable'; | @@ -12,6 +12,9 @@ import Immutable, {List, Record} from 'immutable'; | ||
12 | const { | 12 | const { |
13 | 13 | ||
14 | GO_TO_OUT_STOCK, | 14 | GO_TO_OUT_STOCK, |
15 | + GET_PURCHASE_LIST_REQUEST, | ||
16 | + GET_PURCHASE_LIST_SUCCESS, | ||
17 | + GET_PURCHASE_LIST_FAILURE, | ||
15 | 18 | ||
16 | } = require('../../constants/actionTypes').default; | 19 | } = require('../../constants/actionTypes').default; |
17 | 20 | ||
@@ -29,6 +32,36 @@ export default function userReducer(state = initialState, action) { | @@ -29,6 +32,36 @@ export default function userReducer(state = initialState, action) { | ||
29 | case GO_TO_OUT_STOCK:{ | 32 | case GO_TO_OUT_STOCK:{ |
30 | return state; | 33 | return state; |
31 | } | 34 | } |
35 | + case GET_PURCHASE_LIST_REQUEST:{ | ||
36 | + return state.setIn(['purchaseList', 'isFetching'], true) | ||
37 | + .setIn(['purchaseList', 'error'], null) | ||
38 | + .setIn(['purchaseList', 'pageNo'], 0) | ||
39 | + .setIn(['purchaseList', 'totalPage'], 0) | ||
40 | + .setIn(['purchaseList', 'totalCount'], 0) | ||
41 | + .setIn(['purchaseList', 'endReached'], false); | ||
42 | + } | ||
43 | + case GET_PURCHASE_LIST_SUCCESS:{ | ||
44 | + let { | ||
45 | + records, | ||
46 | + pageNo, | ||
47 | + totalPage, | ||
48 | + totalCount, | ||
49 | + endReached, | ||
50 | + } = action.payload; | ||
51 | + | ||
52 | + return state.setIn(['purchaseList', 'isFetching'], false) | ||
53 | + .setIn(['purchaseList', 'error'], null) | ||
54 | + .setIn(['purchaseList', 'records'], Immutable.fromJS(records)) | ||
55 | + .setIn(['purchaseList', 'pageNo'], pageNo) | ||
56 | + .setIn(['purchaseList', 'totalPage'], totalPage) | ||
57 | + .setIn(['purchaseList', 'totalCount'], totalCount) | ||
58 | + .setIn(['purchaseList', 'endReached'], endReached); | ||
59 | + } | ||
60 | + case GET_PURCHASE_LIST_FAILURE:{ | ||
61 | + return state.setIn(['purchaseList', 'isFetching'], false) | ||
62 | + .setIn(['purchaseList', 'error'], action.payload) | ||
63 | + } | ||
64 | + | ||
32 | return state; | 65 | return state; |
33 | } | 66 | } |
34 | 67 |
@@ -9,4 +9,63 @@ export default class DeliverGoodsService { | @@ -9,4 +9,63 @@ export default class DeliverGoodsService { | ||
9 | constructor () { | 9 | constructor () { |
10 | this.api = new Request(); | 10 | this.api = new Request(); |
11 | } | 11 | } |
12 | + | ||
13 | + async deliveryGoods(expressId,expressNumber,shopId,expressGoodsMap) { | ||
14 | + return this.api.get({ | ||
15 | + url: '/purchase/delivery', | ||
16 | + body: { | ||
17 | + expressId: expressId, | ||
18 | + expressNumber: expressNumber, | ||
19 | + shopId: shopId, | ||
20 | + expressGoodsMap: expressGoodsMap, | ||
21 | + } | ||
22 | + }) | ||
23 | + .then(data => { | ||
24 | + console.log(data); | ||
25 | + console.log('deliveryGoods'); | ||
26 | + return data; | ||
27 | + }) | ||
28 | + .catch(error => { | ||
29 | + console.log(error); | ||
30 | + console.log('deliveryGoods error'); | ||
31 | + throw error; | ||
32 | + }); | ||
33 | + } | ||
34 | + | ||
35 | + async getExpressList() { | ||
36 | + return this.api.get({ | ||
37 | + url: '/express/getExpressList', | ||
38 | + body: {} | ||
39 | + }) | ||
40 | + .then(data => { | ||
41 | + console.log(data); | ||
42 | + console.log('getExpressList'); | ||
43 | + return data; | ||
44 | + }) | ||
45 | + .catch(error => { | ||
46 | + console.log(error); | ||
47 | + console.log('getExpressList error'); | ||
48 | + throw error; | ||
49 | + }); | ||
50 | + } | ||
51 | + | ||
52 | + async queryBySupplierId(supplierId) { | ||
53 | + return this.api.get({ | ||
54 | + url: '/purchase/queryBySupplierId', | ||
55 | + body: { | ||
56 | + supplierId, | ||
57 | + } | ||
58 | + }) | ||
59 | + .then(data => { | ||
60 | + console.log(data); | ||
61 | + console.log('queryBySupplierId'); | ||
62 | + return data; | ||
63 | + }) | ||
64 | + .catch(error => { | ||
65 | + console.log(error); | ||
66 | + console.log('queryBySupplierId error'); | ||
67 | + throw error; | ||
68 | + }); | ||
69 | + } | ||
70 | + | ||
12 | } | 71 | } |
@@ -9,4 +9,26 @@ export default class OutOfStockService { | @@ -9,4 +9,26 @@ export default class OutOfStockService { | ||
9 | constructor () { | 9 | constructor () { |
10 | this.api = new Request(); | 10 | this.api = new Request(); |
11 | } | 11 | } |
12 | + | ||
13 | + async stockOut(proReqFormId,productSku,num) { | ||
14 | + return this.api.get({ | ||
15 | + url: '/purchase/stockOut', | ||
16 | + body: { | ||
17 | + proReqFormId: proReqFormId, | ||
18 | + productSku: productSku, | ||
19 | + num: num, | ||
20 | + } | ||
21 | + }) | ||
22 | + .then(data => { | ||
23 | + console.log(data); | ||
24 | + console.log('stockOut data'); | ||
25 | + return data; | ||
26 | + }) | ||
27 | + .catch(error => { | ||
28 | + console.log(error); | ||
29 | + console.log('stockOut error'); | ||
30 | + throw error; | ||
31 | + }); | ||
32 | + } | ||
33 | + | ||
12 | } | 34 | } |
@@ -8,4 +8,25 @@ export default class TransferShipmentService { | @@ -8,4 +8,25 @@ export default class TransferShipmentService { | ||
8 | constructor () { | 8 | constructor () { |
9 | this.api = new Request(); | 9 | this.api = new Request(); |
10 | } | 10 | } |
11 | + | ||
12 | + async getPurchaseList(shopId,pageSize,pageNo) { | ||
13 | + return this.api.get({ | ||
14 | + url: '/purchase/list', | ||
15 | + body: { | ||
16 | + shopId: shopId, | ||
17 | + pageSize: pageSize, | ||
18 | + pageNo: pageNo, | ||
19 | + } | ||
20 | + }) | ||
21 | + .then(data => { | ||
22 | + console.log(data); | ||
23 | + console.log('data'); | ||
24 | + return data; | ||
25 | + }) | ||
26 | + .catch(error => { | ||
27 | + console.log(error); | ||
28 | + console.log('error'); | ||
29 | + throw error; | ||
30 | + }); | ||
31 | + } | ||
11 | } | 32 | } |
-
Please register or login to post a comment