Authored by 盖剑秋

My order list data. reviewed by redding.

@@ -33,6 +33,10 @@ import { @@ -33,6 +33,10 @@ import {
33 setProductSKN, 33 setProductSKN,
34 } from './reducers/detail/detailActions'; 34 } from './reducers/detail/detailActions';
35 35
  36 +import {
  37 + setFirstShowIndex
  38 +} from './reducers/list/listActions';
  39 +
36 function getInitialState() { 40 function getInitialState() {
37 const _initState = { 41 const _initState = {
38 app: (new appInitialState()), 42 app: (new appInitialState()),
@@ -55,6 +59,7 @@ export default function native(platform) { @@ -55,6 +59,7 @@ export default function native(platform) {
55 59
56 let type = this.props.type; 60 let type = this.props.type;
57 if (type == 'list') { 61 if (type == 'list') {
  62 + store.dispatch(setFirstShowIndex(this.props.firstShowIndex));
58 return ( 63 return (
59 <Provider store={store}> 64 <Provider store={store}>
60 <ListContainer /> 65 <ListContainer />
@@ -3,9 +3,9 @@ @@ -3,9 +3,9 @@
3 import React, {Component} from 'react'; 3 import React, {Component} from 'react';
4 import Immutable, {Map} from 'immutable'; 4 import Immutable, {Map} from 'immutable';
5 import LoadingIndicator from '../../../common/components/LoadingIndicator'; 5 import LoadingIndicator from '../../../common/components/LoadingIndicator';
6 -import LoadMoreIndicator from '../../../common/components/LoadMoreIndicator';  
7 -import ListCell from './ListCell';  
8 -import ListBannerSwiper from './ListBannerSwiper'; 6 +import ListContent from './ListContent';
  7 +import ScrollableTabView from 'react-native-scrollable-tab-view';
  8 +import {DefaultTabBar} from 'react-native-scrollable-tab-view';
9 9
10 import ReactNative, { 10 import ReactNative, {
11 View, 11 View,
@@ -24,74 +24,41 @@ export default class List extends Component { @@ -24,74 +24,41 @@ export default class List extends Component {
24 24
25 constructor(props) { 25 constructor(props) {
26 super(props); 26 super(props);
27 - this.renderRow = this.renderRow.bind(this);  
28 - this.dataSource = new ListView.DataSource({  
29 - rowHasChanged: (r1, r2) => !Immutable.is(r1, r2),  
30 - sectionHeaderHasChanged: (s1, s2) => !Immutable.is(s1, s2),  
31 - });  
32 - }  
33 -  
34 - renderRow(rowData,sectionID,rowID,highlightRow) {  
35 - switch (sectionID) {  
36 - case 'banner': {  
37 - return <ListBannerSwiper resource={rowData} onPressBanner={this.props.onPressBanner}/>  
38 - }  
39 - break;  
40 - case 'list': {  
41 - return <ListCell resource={rowData} onPressDetail={this.props.onPressDetail}/>;  
42 - }  
43 - break;  
44 - }  
45 - return null;  
46 } 27 }
47 28
48 render() { 29 render() {
49 - let {products, banner} = this.props.resource;  
50 - let isProductListFetching = products.isFetching;  
51 - let isFetching = (isProductListFetching && products.page == 0) || banner.isFetching;  
52 -  
53 - let list = products.list && products.list.toJS();  
54 - let bannerData = [];  
55 - if (banner.data && banner.data.toJS()) {  
56 - let bannerDataArray = banner.data.toJS();  
57 - if (bannerDataArray.length > 0) {  
58 - bannerData = bannerDataArray[0].data;  
59 - }  
60 - }  
61 - let dataBlob = {  
62 - 'banner': bannerData.length ? [bannerData] : [],  
63 - 'list': list ? list : [],  
64 - };  
65 -  
66 return ( 30 return (
67 <View style={styles.container}> 31 <View style={styles.container}>
68 - {!isFetching?  
69 - <ListView  
70 - contentContainerStyle={styles.contentContainer}  
71 - enableEmptySections={true}  
72 - showsVerticalScrollIndicator={false}  
73 - dataSource={this.dataSource.cloneWithRowsAndSections(dataBlob)}  
74 - renderRow={this.renderRow}  
75 -  
76 - onEndReached={() => {  
77 - if (list && list.length) {  
78 - this.props.onEndReached && this.props.onEndReached(); 32 + <ScrollableTabView
  33 + initialPage={2}
  34 + renderTabBar={() => <DefaultTabBar
  35 + underlineHeight={0}
  36 + activeTextColor={'black'}
  37 + inactiveTextColor={'gray'}
  38 + style={{height: 30}}/>
79 } 39 }
80 - }}  
81 - renderFooter={()=>{  
82 - if (list && list.length && isProductListFetching) {  
83 - return <LoadMoreIndicator  
84 - isVisible={true}  
85 - animating={true}  
86 - />;  
87 - } else {  
88 - return null;  
89 - }  
90 - }} 40 + >
  41 + <ListContent style={{backgroundColor: 'red'}}
  42 + tabLabel={'全部'}
  43 + type={'all'}
  44 + getOrderListByType={this.props.getOrderListByType}
  45 + />
  46 + <ListContent style={{ backgroundColor: 'green'}}
  47 + tabLabel={'待付款'}
  48 + type={'onPay'}
  49 + getOrderListByType={this.props.getOrderListByType}
91 /> 50 />
92 - :<LoadingIndicator  
93 - isVisible={isFetching}  
94 - />} 51 + <ListContent style={{backgroundColor: 'orange'}}
  52 + tabLabel={'待发货'}
  53 + type={'onDelivery'}
  54 + getOrderListByType={this.props.getOrderListByType}
  55 + />
  56 + <ListContent style={{backgroundColor: 'blue'}}
  57 + tabLabel={'待收货'}
  58 + type={'onReceive'}
  59 + getOrderListByType={this.props.getOrderListByType}
  60 + />
  61 + </ScrollableTabView>
95 </View> 62 </View>
96 ); 63 );
97 } 64 }
@@ -99,11 +66,6 @@ export default class List extends Component { @@ -99,11 +66,6 @@ export default class List extends Component {
99 66
100 let {width, height} = Dimensions.get('window'); 67 let {width, height} = Dimensions.get('window');
101 68
102 -let rowWidth = Math.ceil(137.5 * width / 320);  
103 -let rowHeight = Math.ceil(254 * width / 320);  
104 -let rowMarginTop = Math.ceil(10 * width / 320);  
105 -let rowMarginHorizontal = (width - rowWidth * 2) / 3;  
106 -  
107 let styles = StyleSheet.create({ 69 let styles = StyleSheet.create({
108 container: { 70 container: {
109 flex: 1, 71 flex: 1,
1 -'use strict';  
2 -  
3 -import React from 'react';  
4 -import ReactNative from 'react-native';  
5 -import Swiper from 'react-native-swiper';  
6 -import ImmutablePropTypes from 'react-immutable-proptypes';  
7 -import SlicedImage from '../../../common/components/SlicedImage';  
8 -import Immutable, {Map} from 'immutable';  
9 -  
10 -const {  
11 - View,  
12 - Image,  
13 - TouchableOpacity,  
14 - StyleSheet,  
15 - Dimensions,  
16 - Platform,  
17 -} = ReactNative;  
18 -  
19 -export default class ListBannerSwiper extends React.Component {  
20 -  
21 - constructor(props) {  
22 - super (props);  
23 -  
24 - this.dot = <View  
25 - style={{  
26 - backgroundColor:'rgba(0,0,0,.2)',  
27 - width: 6,  
28 - height: 6,  
29 - borderRadius: 3,  
30 - marginLeft: 3,  
31 - marginRight: 3,  
32 - marginTop: (Platform.OS === 'ios')?3:23,  
33 - marginBottom: 0,  
34 - }}  
35 - />;  
36 - this.activeDot = <View  
37 - style={{  
38 - backgroundColor:'white',  
39 - width: 6,  
40 - height: 6,  
41 - borderRadius: 3,  
42 - marginLeft: 3,  
43 - marginRight: 3,  
44 - marginTop: 3,  
45 - marginBottom: 0,  
46 - }}  
47 - />;  
48 - }  
49 -  
50 - render() {  
51 - let {resource} = this.props;  
52 -  
53 - return (  
54 - <View style={styles.container}>  
55 - <Swiper  
56 - style={styles.banner}  
57 - showsButtons={false}  
58 - loop={true}  
59 - autoplay={true}  
60 - autoplayTimeout={2}  
61 - paginationStyle={{bottom: 8}}  
62 - dot={this.dot}  
63 - activeDot={(Platform.OS === 'ios')?this.activeDot:null}  
64 - width={width}  
65 - height={height}  
66 - >  
67 - {resource.map((item, i) => {  
68 - return (  
69 - <TouchableOpacity  
70 - key={i}  
71 - activeOpacity={1}  
72 - onPress={() => {  
73 - this.props.onPressBanner && this.props.onPressBanner(item.url);  
74 - }}  
75 - >  
76 - <SlicedImage source={{uri: item.src}} style={{width, height}}/>  
77 - </TouchableOpacity>  
78 - );  
79 - })}  
80 - </Swiper>  
81 - </View>  
82 - );  
83 - }  
84 -}  
85 -  
86 -let {width} = Dimensions.get('window');  
87 -let height = Math.ceil((310 / 640) * width) + 40;  
88 -  
89 -let styles = StyleSheet.create({  
90 -  
91 - container: {  
92 - width: width,  
93 - height: height,  
94 - backgroundColor:'#f0f0f0',  
95 - },  
96 - banner: {  
97 -  
98 - },  
99 -  
100 -});  
@@ -17,36 +17,22 @@ import ReactNative, { @@ -17,36 +17,22 @@ import ReactNative, {
17 17
18 18
19 19
20 -export default class ListCell extends Component { 20 +export default class ListContent extends Component {
21 21
22 constructor(props) { 22 constructor(props) {
23 super(props); 23 super(props);
24 } 24 }
25 25
  26 + componentDidMount() {
  27 + console.log(this.props.tabLabel);
  28 + this.props.getOrderListByType(this.props.type);
  29 + }
26 30
27 render() { 31 render() {
28 - let data = this.props.resource;  
29 - if (!data) {  
30 - return null;  
31 - }  
32 - let {  
33 - default_images,  
34 - product_skn,  
35 - phrase,  
36 - product_name,  
37 - } = data;  
38 - default_images = default_images.replace('{width}', 240).replace('{height}', 320).replace('{mode}',2);  
39 return ( 32 return (
40 - <TouchableOpacity style={styles.container} onPress={() => {this.props.onPressDetail && this.props.onPressDetail(product_skn)}}>  
41 - <View style={styles.container}>  
42 - <Image style={styles.image} source={{uri:default_images}}/> 33 + <View style={[styles.container, this.props.style]}>
43 34
44 - <View style={styles.rightPannel}>  
45 - <Text numberOfLines={2} style={styles.title}>{product_name}</Text>  
46 - <Text numberOfLines={4} style={styles.phrase}>{phrase}</Text>  
47 - </View>  
48 </View> 35 </View>
49 - </TouchableOpacity>  
50 ); 36 );
51 } 37 }
52 } 38 }
@@ -55,43 +41,7 @@ let {width, height} = Dimensions.get('window'); @@ -55,43 +41,7 @@ let {width, height} = Dimensions.get('window');
55 41
56 let styles = StyleSheet.create({ 42 let styles = StyleSheet.create({
57 container: { 43 container: {
  44 + flex: 1,
58 width: width, 45 width: width,
59 - flexDirection: 'row',  
60 - height: 180,  
61 - },  
62 -  
63 - image: {  
64 - marginTop: 10,  
65 - marginLeft: 15,  
66 - marginRight: 15,  
67 - width: 120,  
68 - height: 160,  
69 - backgroundColor: '#e0e0e0',  
70 - },  
71 -  
72 - rightPannel: {  
73 - width: width - 150,  
74 - height: 180,  
75 - flexDirection: 'column',  
76 - borderColor: '#ededed',  
77 - borderBottomWidth: 1,  
78 - },  
79 -  
80 - title: {  
81 - fontSize: 15,  
82 - width: width - 150 - 15,  
83 - marginTop: 20,  
84 - marginBottom: 0,  
85 - color: '#444444',  
86 - // backgroundColor: 'red',  
87 - },  
88 -  
89 - phrase: {  
90 - marginTop: 6,  
91 - width: width - 150 - 15,  
92 - fontSize: 13,  
93 - color: '#b0b0b0',  
94 - lineHeight: 20,  
95 - // backgroundColor: 'red',  
96 }, 46 },
97 }); 47 });
@@ -7,7 +7,7 @@ export default keyMirror({ @@ -7,7 +7,7 @@ export default keyMirror({
7 SET_SERVICE_HOST: null, 7 SET_SERVICE_HOST: null,
8 SET_CHANNEL: null, 8 SET_CHANNEL: null,
9 SET_SINGLE_HOST: null, 9 SET_SINGLE_HOST: null,
10 - 10 + SET_FIRST_SHOW_INDEX: null,
11 SET_PRODUCT_SKN: null, 11 SET_PRODUCT_SKN: null,
12 GET_DETAIL_REQUEST: null, 12 GET_DETAIL_REQUEST: null,
13 GET_DETAIL_SUCCESS: null, 13 GET_DETAIL_SUCCESS: null,
@@ -19,9 +19,9 @@ export default keyMirror({ @@ -19,9 +19,9 @@ export default keyMirror({
19 SET_FAVORITE_STATUS: null, 19 SET_FAVORITE_STATUS: null,
20 20
21 // 列表 21 // 列表
22 - GET_PRODUCT_LIST_REQUEST: null,  
23 - GET_PRODUCT_LIST_SUCCESS: null,  
24 - GET_PRODUCT_LIST_FAILURE: null, 22 + GET_ORDER_LIST_REQUEST: null,
  23 + GET_ORDER_LIST_SUCCESS: null,
  24 + GET_ORDER_LIST_FAILURE: null,
25 25
26 // 列表资源位 26 // 列表资源位
27 FETCH_BANNER_REQUEST: null, 27 FETCH_BANNER_REQUEST: null,
@@ -46,48 +46,35 @@ function mapDispatchToProps(dispatch) { @@ -46,48 +46,35 @@ function mapDispatchToProps(dispatch) {
46 class ListContainer extends Component { 46 class ListContainer extends Component {
47 constructor(props) { 47 constructor(props) {
48 super(props); 48 super(props);
49 - this._onPressDetail = this._onPressDetail.bind(this);  
50 - this._onPressBanner = this._onPressBanner.bind(this);  
51 this._onEndReached = this._onEndReached.bind(this); 49 this._onEndReached = this._onEndReached.bind(this);
  50 + this._getOrderListByType = this._getOrderListByType.bind(this);
52 } 51 }
53 52
54 componentDidMount() { 53 componentDidMount() {
55 - this.props.actions.fetchBanner();  
56 - this.props.actions.getProductList();  
57 - }  
58 -  
59 - componentWillUnmount() {  
60 54
61 } 55 }
62 56
63 - _onPressDetail(product_skn) {  
64 - if (!product_skn) {  
65 - return;  
66 - }  
67 - ReactNative.NativeModules.YH_CommonHelper.pushGoodGoodsRecommendDetailWithProductSKN(product_skn + '');  
68 - } 57 + componentWillUnmount() {
69 58
70 - _onPressBanner(url) {  
71 - if (!url) {  
72 - return;  
73 - }  
74 - ReactNative.NativeModules.YH_CommonHelper.jumpWithUrl(url);  
75 } 59 }
76 60
77 - _onEndReached() { 61 + _onEndReached(type) {
78 InteractionManager.runAfterInteractions(() => { 62 InteractionManager.runAfterInteractions(() => {
79 - this.props.actions.getProductList(); 63 + this.props.actions.getOrderListByType(type);
80 }); 64 });
81 } 65 }
82 66
  67 + _getOrderListByType(type) {
  68 + this.props.actions.getOrderListByType(type);
  69 + }
  70 +
83 render() { 71 render() {
84 let {list} = this.props; 72 let {list} = this.props;
85 return ( 73 return (
86 <List 74 <List
87 resource={list} 75 resource={list}
88 - onPressDetail={this._onPressDetail}  
89 onEndReached={this._onEndReached} 76 onEndReached={this._onEndReached}
90 - onPressBanner={this._onPressBanner} 77 + getOrderListByType={this._getOrderListByType}
91 /> 78 />
92 ); 79 );
93 } 80 }
@@ -6,27 +6,38 @@ import ListService from '../../services/ListService'; @@ -6,27 +6,38 @@ import ListService from '../../services/ListService';
6 import helper from '../../../common/utils/helper'; 6 import helper from '../../../common/utils/helper';
7 7
8 const { 8 const {
9 - GET_PRODUCT_LIST_REQUEST,  
10 - GET_PRODUCT_LIST_SUCCESS,  
11 - GET_PRODUCT_LIST_FAILURE,  
12 - FETCH_BANNER_REQUEST,  
13 - FETCH_BANNER_SUCCESS,  
14 - FETCH_BANNER_FAILURE, 9 + GET_ORDER_LIST_REQUEST,
  10 + GET_ORDER_LIST_SUCCESS,
  11 + GET_ORDER_LIST_FAILURE,
  12 +
  13 + SET_FIRST_SHOW_INDEX,
15 } = require('../../constants/actionTypes').default; 14 } = require('../../constants/actionTypes').default;
16 15
17 -export function getProductList() { 16 +export function setFirstShowIndex(firstShowIndex) {
  17 + return {
  18 + type: SET_FIRST_SHOW_INDEX,
  19 + payload: firstShowIndex,
  20 + }
  21 +}
  22 +
  23 +export function getOrderListByType(type) {
18 return (dispatch, getState) => { 24 return (dispatch, getState) => {
19 let {app, list} = getState(); 25 let {app, list} = getState();
20 - let {products} = list;  
21 26
22 - if (products.isFetching || products.endReached || products.error) { 27 + let currentList = list.get(type);
  28 + let typeMap = list.get('typeMap');
  29 + let currentType = typeMap.get(type);
  30 + let page = currentList.currentPage + 1;
  31 + let pageSize = currentList.pageSize;
  32 +
  33 + if (currentList.isFetching || currentList.endReached || currentList.error) {
23 return; 34 return;
24 } 35 }
25 36
26 - let fetchList = (channel, gender, uid, page, pageSize) => {  
27 dispatch(getProductListRequest()); 37 dispatch(getProductListRequest());
28 - return new ListService(app.serviceHost).getProductListData(channel, gender, uid, page, pageSize) 38 + return new ListService(app.host).getOrderListByType(currentType, page, pageSize)
29 .then(json => { 39 .then(json => {
  40 + console.log(json);
30 let payload = parseProductList(json); 41 let payload = parseProductList(json);
31 payload.endReached = payload.currentPage == payload.pageCount; 42 payload.endReached = payload.currentPage == payload.pageCount;
32 43
@@ -40,24 +51,7 @@ export function getProductList() { @@ -40,24 +51,7 @@ export function getProductList() {
40 .catch(error => { 51 .catch(error => {
41 dispatch(getProductListFailure(error)); 52 dispatch(getProductListFailure(error));
42 }); 53 });
43 - };  
44 54
45 - let channel = app.channel;  
46 - let gender = '';  
47 - let uid = 0;  
48 - let page = products.currentPage + 1;  
49 - let pageSize = products.pageSize;  
50 -  
51 - Promise.all([  
52 - ReactNative.NativeModules.YH_CommonHelper.currentGender(),  
53 - ReactNative.NativeModules.RNNativeConfig.uid(),  
54 - ]).then(result => {  
55 - gender = result[0];  
56 - uid = result[1];  
57 - fetchList(channel, gender, uid, page, pageSize);  
58 - }).catch(error => {  
59 -  
60 - });  
61 }; 55 };
62 } 56 }
63 57
@@ -77,59 +71,20 @@ function parseProductList(json) { @@ -77,59 +71,20 @@ function parseProductList(json) {
77 71
78 export function getProductListRequest() { 72 export function getProductListRequest() {
79 return { 73 return {
80 - type: GET_PRODUCT_LIST_REQUEST, 74 + type: GET_ORDER_LIST_REQUEST,
81 }; 75 };
82 } 76 }
83 77
84 export function getProductListSuccess(json) { 78 export function getProductListSuccess(json) {
85 return { 79 return {
86 - type: GET_PRODUCT_LIST_SUCCESS, 80 + type: GET_ORDER_LIST_SUCCESS,
87 payload: json 81 payload: json
88 }; 82 };
89 } 83 }
90 84
91 export function getProductListFailure(error) { 85 export function getProductListFailure(error) {
92 return { 86 return {
93 - type: GET_PRODUCT_LIST_FAILURE,  
94 - payload: error  
95 - };  
96 -}  
97 -  
98 -export function fetchBanner() {  
99 - return (dispatch, getState) => {  
100 - let {app, list} = getState();  
101 - let {banner} = list;  
102 -  
103 - if (banner.isFetching || banner.error) {  
104 - return;  
105 - }  
106 - dispatch(fetchBannerRequest());  
107 - return new ListService(app.serviceHost).fetchBannerData()  
108 - .then(json => {  
109 - dispatch(fetchBannerSuccess(json));  
110 - })  
111 - .catch(error => {  
112 - dispatch(fetchBannerFailure(error));  
113 - });  
114 - }  
115 -}  
116 -  
117 -export function fetchBannerRequest() {  
118 - return {  
119 - type: FETCH_BANNER_REQUEST  
120 - };  
121 -}  
122 -  
123 -export function fetchBannerSuccess(json) {  
124 - return {  
125 - type: FETCH_BANNER_SUCCESS,  
126 - payload: json  
127 - };  
128 -}  
129 -  
130 -export function fetchBannerFailure(error) {  
131 - return {  
132 - type: FETCH_BANNER_FAILURE, 87 + type: GET_ORDER_LIST_FAILURE,
133 payload: error 88 payload: error
134 }; 89 };
135 } 90 }
@@ -2,22 +2,32 @@ @@ -2,22 +2,32 @@
2 2
3 import {Record, List, Map} from 'immutable'; 3 import {Record, List, Map} from 'immutable';
4 4
5 -let InitialState = Record({  
6 - banner: new (Record({  
7 - isFetching: false,  
8 - error: null,  
9 - data: null,  
10 - })),  
11 - products: new (Record({ 5 +let templet = new(Record({
  6 + firstLoad: true,
12 isFetching: false, 7 isFetching: false,
13 error: null, 8 error: null,
14 list: null, 9 list: null,
15 currentPage: 0, 10 currentPage: 0,
16 pageCount: 0, 11 pageCount: 0,
17 - pageSize: 20, 12 + pageSize: 60,//60,
18 total: 0, 13 total: 0,
19 endReached: false, 14 endReached: false,
20 - })), 15 +}));
  16 +
  17 +let typeMap = new(Record({
  18 + all: '1',
  19 + onPay: '2',
  20 + onDelivery: '3',
  21 + onReceive: '4',
  22 +}));
  23 +
  24 +let InitialState = Record({
  25 + firstShowIndex: 0,
  26 + all: templet,
  27 + onPay: templet,
  28 + onDelivery: templet,
  29 + onReceive: templet,
  30 + typeMap,
21 }); 31 });
22 32
23 export default InitialState; 33 export default InitialState;
@@ -4,22 +4,24 @@ import InitialState from './listInitialState'; @@ -4,22 +4,24 @@ import InitialState from './listInitialState';
4 import Immutable, {Map} from 'immutable'; 4 import Immutable, {Map} from 'immutable';
5 5
6 const { 6 const {
7 - GET_PRODUCT_LIST_REQUEST,  
8 - GET_PRODUCT_LIST_SUCCESS,  
9 - GET_PRODUCT_LIST_FAILURE,  
10 - FETCH_BANNER_REQUEST,  
11 - FETCH_BANNER_SUCCESS,  
12 - FETCH_BANNER_FAILURE, 7 + GET_ORDER_LIST_REQUEST,
  8 + GET_ORDER_LIST_SUCCESS,
  9 + GET_ORDER_LIST_FAILURE,
  10 +
  11 + SET_FIRST_SHOW_INDEX,
13 } = require('../../constants/actionTypes').default; 12 } = require('../../constants/actionTypes').default;
14 13
15 const initialState = new InitialState; 14 const initialState = new InitialState;
16 15
17 export default function listReducer(state=initialState, action) { 16 export default function listReducer(state=initialState, action) {
18 switch(action.type) { 17 switch(action.type) {
19 - case GET_PRODUCT_LIST_REQUEST: {  
20 - return state.setIn(['products', 'isFetching'], true); 18 + case SET_FIRST_SHOW_INDEX: {
  19 + return state.set('firstShowIndex', action.payload);
  20 + }
  21 + case GET_ORDER_LIST_REQUEST: {
  22 + return state;
21 } 23 }
22 - case GET_PRODUCT_LIST_SUCCESS: { 24 + case GET_ORDER_LIST_SUCCESS: {
23 let { 25 let {
24 list, 26 list,
25 currentPage, 27 currentPage,
@@ -28,30 +30,12 @@ export default function listReducer(state=initialState, action) { @@ -28,30 +30,12 @@ export default function listReducer(state=initialState, action) {
28 endReached, 30 endReached,
29 } = action.payload; 31 } = action.payload;
30 32
31 - let newState = state.setIn(['products', 'isFetching'], false)  
32 - .setIn(['products', 'error'], null)  
33 - .setIn(['products', 'list'], Immutable.fromJS(list))  
34 - .setIn(['products', 'currentPage'], currentPage)  
35 - .setIn(['products', 'pageCount'], pageCount)  
36 - .setIn(['products', 'total'], total)  
37 - .setIn(['products', 'endReached'], endReached); 33 + let newState = state
38 34
39 return newState; 35 return newState;
40 } 36 }
41 - case GET_PRODUCT_LIST_FAILURE: {  
42 - return state.setIn(['products', 'isFetching'], false)  
43 - .setIn(['products', 'error'], action.payload);  
44 - }  
45 - case FETCH_BANNER_REQUEST: {  
46 - return state.setIn(['banner', 'isFetching'], true);  
47 - }  
48 - case FETCH_BANNER_SUCCESS: {  
49 - return state.setIn(['banner', 'isFetching'], false)  
50 - .setIn(['banner', 'data'], Immutable.fromJS(action.payload));  
51 - }  
52 - case FETCH_BANNER_FAILURE: {  
53 - return state.setIn(['banner', 'isFetching'], false)  
54 - .setIn(['banner', 'error'], action.payload); 37 + case GET_ORDER_LIST_FAILURE: {
  38 + return state;
55 } 39 }
56 } 40 }
57 41
@@ -12,41 +12,15 @@ export default class ListService { @@ -12,41 +12,15 @@ export default class ListService {
12 this.api = new Request(baseURL); 12 this.api = new Request(baseURL);
13 } 13 }
14 14
15 - async getProductListData(channel, gender, uid, page, pageSize) {  
16 - // this.api = new Request('http://dev-api.yohops.com:9999'); 15 + async getOrderListByType(type = '1', page, pageSize) {
17 16
18 return await this.api.get({ 17 return await this.api.get({
19 url: '', 18 url: '',
20 body: { 19 body: {
21 - method: 'app.search.good',  
22 - // debug: 'XYZ',  
23 - uid: uid, 20 + method: 'app.SpaceOrders.get',
24 limit: pageSize, 21 limit: pageSize,
25 page: page, 22 page: page,
26 - yh_channel: channel,  
27 - gender: gender,  
28 - app_type: '0'  
29 - }  
30 - })  
31 - .then((json) => {  
32 - return json;  
33 - })  
34 - .catch((error) => {  
35 - throw(error);  
36 - });  
37 - }  
38 -  
39 - async fetchBannerData() {  
40 - // this.api = new Request('http://service-test3.yohops.com:9999');  
41 -  
42 - let content_code = 'efe8847a09c501c363ed94f87e32c0d7';  
43 - let fromPage = '';  
44 -  
45 - return await this.api.get({  
46 - url: '/operations/api/v5/resource/get',  
47 - body: {  
48 - fromPage,  
49 - content_code 23 + type,
50 } 24 }
51 }) 25 })
52 .then((json) => { 26 .then((json) => {