Showing
10 changed files
with
424 additions
and
7 deletions
@@ -25,6 +25,7 @@ import RecommendContainer from './containers/RecommendContainer'; | @@ -25,6 +25,7 @@ import RecommendContainer from './containers/RecommendContainer'; | ||
25 | import TalentRankContainer from './containers/TalentRankContainer'; | 25 | import TalentRankContainer from './containers/TalentRankContainer'; |
26 | import ShareDetailContainer from './containers/ShareDetailContainer'; | 26 | import ShareDetailContainer from './containers/ShareDetailContainer'; |
27 | import InvitedFriendsContainer from './containers/InvitedFriendsContainer'; | 27 | import InvitedFriendsContainer from './containers/InvitedFriendsContainer'; |
28 | +import EstimateDetailContainer from './containers/EstimateDetailContainer'; | ||
28 | 29 | ||
29 | import {setChannel, setHost, setPlatform, setServiceHost, setproductPool, setSkns} from './reducers/app/appActions'; | 30 | import {setChannel, setHost, setPlatform, setServiceHost, setproductPool, setSkns} from './reducers/app/appActions'; |
30 | import {setOrderCode, setActivityId, setSrc, setJumpUrl} from './reducers/alliance/allianceActions'; | 31 | import {setOrderCode, setActivityId, setSrc, setJumpUrl} from './reducers/alliance/allianceActions'; |
@@ -131,6 +132,14 @@ export default function native(platform) { | @@ -131,6 +132,14 @@ export default function native(platform) { | ||
131 | <InvitedFriendsContainer/> | 132 | <InvitedFriendsContainer/> |
132 | </Provider> | 133 | </Provider> |
133 | ); | 134 | ); |
135 | + } else if (type === 'estimateDetails') { | ||
136 | + return ( | ||
137 | + <Provider store={store}> | ||
138 | + <EstimateDetailContainer | ||
139 | + time_type={this.props.time_type} | ||
140 | + tab_type={this.props.tab_type}/> | ||
141 | + </Provider> | ||
142 | + ); | ||
134 | } else { | 143 | } else { |
135 | return ( | 144 | return ( |
136 | <Provider store={store}> | 145 | <Provider store={store}> |
@@ -140,9 +140,9 @@ export default class Data extends Component { | @@ -140,9 +140,9 @@ export default class Data extends Component { | ||
140 | renderTabBar={() => <TabStatistics tabNames={tabTitles}/>} | 140 | renderTabBar={() => <TabStatistics tabNames={tabTitles}/>} |
141 | onChangeTab={(obj) => {this.props.changeTab && this.props.changeTab(obj.i + 1);}} | 141 | onChangeTab={(obj) => {this.props.changeTab && this.props.changeTab(obj.i + 1);}} |
142 | > | 142 | > |
143 | - <Statistics statisticsInfo={statisticsInfo} jumpWithUrl={this.props.jumpWithUrl}/> | ||
144 | - <Statistics statisticsInfo={statisticsInfo} jumpWithUrl={this.props.jumpWithUrl}/> | ||
145 | - <Statistics statisticsInfo={statisticsInfo} jumpWithUrl={this.props.jumpWithUrl}/> | 143 | + <Statistics statisticsInfo={statisticsInfo} currentTab = {1} resourceJumpWithUrl={this.props.resourceJumpWithUrl}/> |
144 | + <Statistics statisticsInfo={statisticsInfo} currentTab = {2} resourceJumpWithUrl={this.props.resourceJumpWithUrl}/> | ||
145 | + <Statistics statisticsInfo={statisticsInfo} currentTab = {3} resourceJumpWithUrl={this.props.resourceJumpWithUrl}/> | ||
146 | </ScrollableTabView> | 146 | </ScrollableTabView> |
147 | 147 | ||
148 | <View style={{height: 10, backgroundColor: '#f0f0f0'}}/> | 148 | <View style={{height: 10, backgroundColor: '#f0f0f0'}}/> |
js/alliance/components/EstimateIncome.js
0 → 100644
1 | +'use strict'; | ||
2 | + | ||
3 | +import React, {Component} from 'react'; | ||
4 | +import {Dimensions, ListView, StyleSheet, Text, TouchableOpacity, View} from 'react-native'; | ||
5 | +import {Immutable} from 'immutable'; | ||
6 | + | ||
7 | + | ||
8 | +export default class EstimateIncome extends Component { | ||
9 | + | ||
10 | + constructor(props) { | ||
11 | + super(props); | ||
12 | + this.state = { | ||
13 | + tabType: this.props.tabType, | ||
14 | + timeType: this.props.timeType, | ||
15 | + }; | ||
16 | + | ||
17 | + this._renderRow = this._renderRow.bind(this); | ||
18 | + this.dataSource = new ListView.DataSource({ | ||
19 | + rowHasChanged: (r1, r2) => !Immutable.is(r1, r2), | ||
20 | + }); | ||
21 | + } | ||
22 | + | ||
23 | + _renderRow(rowData, sectionID, rowID) { | ||
24 | + let status = rowData.get('status') === '10' ? '待结算' : ''; | ||
25 | + return ( | ||
26 | + <View> | ||
27 | + <TouchableOpacity activeOpacity={1} onPress={() => { | ||
28 | + this.props.jumpWithUrl && (this.state.tabType === 1 ? this.props.jumpWithUrl('订单详情', 'orderDetail', rowData.get('orderCode')) : this.props.jumpWithUrl('佣金详情', 'activityOrderDetail', rowData.get('id')) ); | ||
29 | + }}> | ||
30 | + <View style={styles.rowView}> | ||
31 | + <View style={{height: 70, paddingTop: 12, paddingBottom: 12}}> | ||
32 | + { this.state.tabType === 1 ? <Text style={styles.numberText}>订单金额:{rowData.get('lastOrderAmountStr')}</Text> : <Text style={styles.numberText}>活动名称:{rowData.get('activityName')}</Text>} | ||
33 | + <View style={{flexDirection: 'row', marginTop: 6}}> | ||
34 | + <Text style={styles.timeText}>{rowData.get('orderTimeStr')}</Text> | ||
35 | + {rowData.get('isNew') === 1 && this.state.tabType === 1 ? | ||
36 | + <View style={styles.statusTextContainer}> | ||
37 | + <Text style={styles.statusText}>新客订单</Text> | ||
38 | + </View>: null} | ||
39 | + </View> | ||
40 | + </View> | ||
41 | + <View> | ||
42 | + <Text style={styles.priceText}>{rowData.get('amountStr')}</Text> | ||
43 | + <Text style={[styles.timeText, {fontSize:12, textAlign:'right'}]}>{status}</Text> | ||
44 | + </View> | ||
45 | + </View> | ||
46 | + <View style={styles.lineView}/> | ||
47 | + </TouchableOpacity> | ||
48 | + </View> | ||
49 | + ); | ||
50 | + } | ||
51 | + | ||
52 | + render() { | ||
53 | + let {estimateList} = this.props; | ||
54 | + let estimateLists = estimateList.list ? estimateList.list.toArray() : []; | ||
55 | + return ( | ||
56 | + <View style={styles.container}> | ||
57 | + <ListView | ||
58 | + ref={(c) => { | ||
59 | + this.listView = c; | ||
60 | + }} | ||
61 | + // yh_viewVisible={true} | ||
62 | + contentContainerStyle={styles.contentContainer} | ||
63 | + enableEmptySections={true} | ||
64 | + dataSource={this.dataSource.cloneWithRows(estimateLists)} | ||
65 | + renderRow={this._renderRow} | ||
66 | + onEndReached={() => { | ||
67 | + if (estimateLists.size !== 0) { | ||
68 | + this.props.onEndReached && this.props.onEndReached(); | ||
69 | + } | ||
70 | + }}/> | ||
71 | + </View> | ||
72 | + ); | ||
73 | + } | ||
74 | +} | ||
75 | + | ||
76 | +let {width, height} = Dimensions.get('window'); | ||
77 | + | ||
78 | +let styles = StyleSheet.create({ | ||
79 | + container: { | ||
80 | + flex: 1, | ||
81 | + backgroundColor: '#f0f0f0', | ||
82 | + alignItems: 'center' | ||
83 | + }, | ||
84 | + contentContainer: { | ||
85 | + width: width, | ||
86 | + backgroundColor: 'white' | ||
87 | + }, | ||
88 | + rowView: { | ||
89 | + width: width, | ||
90 | + height: 70, | ||
91 | + flexDirection: 'row', | ||
92 | + paddingLeft: 15, | ||
93 | + paddingRight: 15, | ||
94 | + alignItems: 'center', | ||
95 | + justifyContent: 'space-between' | ||
96 | + }, | ||
97 | + underLine: { | ||
98 | + width: 56, | ||
99 | + height: 2, | ||
100 | + backgroundColor: '#444444', | ||
101 | + }, | ||
102 | + lineView: { | ||
103 | + width: width, | ||
104 | + height: 0.5, | ||
105 | + backgroundColor: '#e0e0e0' | ||
106 | + }, | ||
107 | + numberText: { | ||
108 | + fontFamily: 'PingFang-SC-Regular', | ||
109 | + fontSize: 14, | ||
110 | + color: '#444444', | ||
111 | + letterSpacing: -0.19, | ||
112 | + }, | ||
113 | + priceText: { | ||
114 | + fontFamily: 'PingFang-SC-Medium', | ||
115 | + fontSize: 16, | ||
116 | + color: '#444444', | ||
117 | + letterSpacing: -0.21, | ||
118 | + fontWeight: 'bold' | ||
119 | + }, | ||
120 | + timeText: { | ||
121 | + fontFamily: 'PingFang-SC-Regular', | ||
122 | + fontSize: 14, | ||
123 | + color: '#B0B0B0', | ||
124 | + letterSpacing: -0.19, | ||
125 | + }, | ||
126 | + statusTextContainer: { | ||
127 | + width: 48, | ||
128 | + height: 18, | ||
129 | + marginLeft: 10, | ||
130 | + borderWidth: 1, | ||
131 | + borderColor: '#D0021B', | ||
132 | + borderRadius: 2, | ||
133 | + alignItems: 'center', | ||
134 | + justifyContent: 'center', | ||
135 | + }, | ||
136 | + statusText: { | ||
137 | + fontFamily: 'PingFang-SC-Regular', | ||
138 | + fontSize: 10, | ||
139 | + color: '#D0021B', | ||
140 | + letterSpacing: -0.24, | ||
141 | + textAlign: 'center', | ||
142 | + }, | ||
143 | +}); |
@@ -20,23 +20,46 @@ export default class Statistics extends Component { | @@ -20,23 +20,46 @@ export default class Statistics extends Component { | ||
20 | 20 | ||
21 | render() { | 21 | render() { |
22 | let {statisticsInfo} = this.props; | 22 | let {statisticsInfo} = this.props; |
23 | + let currentTab = this.props.currentTab; | ||
23 | return ( | 24 | return ( |
24 | - <TouchableOpacity activeOpacity={1} style={styles.container} onPress={() => { | ||
25 | - this.props.jumpWithUrl && this.props.jumpWithUrl('全部佣金', 'orderIncome'); | ||
26 | - }} > | 25 | + |
27 | <View style={styles.container}> | 26 | <View style={styles.container}> |
28 | <View style={styles.statisticsView}> | 27 | <View style={styles.statisticsView}> |
28 | + | ||
29 | + <TouchableOpacity activeOpacity={1} style={styles.container} onPress={() => { | ||
30 | + let url = `http://m.yohobuy.com?openby:yohobuy={"action":"go.minealliance","params":{"title":"预估佣金","type":"estimateDetails","time_type":${currentTab}, "tab_type":"1"}}`; | ||
31 | + this.props.resourceJumpWithUrl && this.props.resourceJumpWithUrl(url); | ||
32 | + }} > | ||
33 | + | ||
29 | <View style={{width: width / 2, paddingLeft: 30, marginTop: -10}}> | 34 | <View style={{width: width / 2, paddingLeft: 30, marginTop: -10}}> |
30 | <Text style={styles.numberText}>¥{statisticsInfo.orderAmountSum}</Text> | 35 | <Text style={styles.numberText}>¥{statisticsInfo.orderAmountSum}</Text> |
31 | <Text style={styles.tipsText}>预估订单佣金</Text> | 36 | <Text style={styles.tipsText}>预估订单佣金</Text> |
32 | </View> | 37 | </View> |
38 | + | ||
39 | + </TouchableOpacity> | ||
40 | + | ||
33 | <View style={styles.spaceView}/> | 41 | <View style={styles.spaceView}/> |
42 | + | ||
43 | + <TouchableOpacity activeOpacity={1} style={styles.container} onPress={() => { | ||
44 | + let url = `http://m.yohobuy.com?openby:yohobuy={"action":"go.minealliance","params":{"title":"预估佣金","type":"estimateDetails","time_type":${currentTab}, "tab_type":"2"}}`; | ||
45 | + this.props.resourceJumpWithUrl && this.props.resourceJumpWithUrl(url); | ||
46 | + }} > | ||
47 | + | ||
34 | <View style={{width: width / 2, paddingLeft: 30, marginTop: -10}}> | 48 | <View style={{width: width / 2, paddingLeft: 30, marginTop: -10}}> |
35 | <Text style={styles.numberText}>¥{statisticsInfo.extraAmountSum}</Text> | 49 | <Text style={styles.numberText}>¥{statisticsInfo.extraAmountSum}</Text> |
36 | <Text style={styles.tipsText}>预估其他佣金</Text> | 50 | <Text style={styles.tipsText}>预估其他佣金</Text> |
37 | </View> | 51 | </View> |
52 | + | ||
53 | + </TouchableOpacity> | ||
54 | + | ||
38 | </View> | 55 | </View> |
39 | <View style={styles.lineView}/> | 56 | <View style={styles.lineView}/> |
57 | + | ||
58 | + <TouchableOpacity activeOpacity={1} style={styles.container} onPress={() => { | ||
59 | + let url = `http://m.yohobuy.com?openby:yohobuy={"action":"go.minealliance","params":{"title":"全部佣金","type":"orderIncome"}}`; | ||
60 | + this.props.resourceJumpWithUrl && this.props.resourceJumpWithUrl(url); | ||
61 | + }} > | ||
62 | + | ||
40 | <View style={styles.statisticsView}> | 63 | <View style={styles.statisticsView}> |
41 | <View style={{width: width / 2, paddingLeft: 30, marginTop: -10}}> | 64 | <View style={{width: width / 2, paddingLeft: 30, marginTop: -10}}> |
42 | <Text style={styles.numberText}>{statisticsInfo.orderNum}</Text> | 65 | <Text style={styles.numberText}>{statisticsInfo.orderNum}</Text> |
@@ -48,9 +71,12 @@ export default class Statistics extends Component { | @@ -48,9 +71,12 @@ export default class Statistics extends Component { | ||
48 | <Text style={styles.tipsText}>点击数</Text> | 71 | <Text style={styles.tipsText}>点击数</Text> |
49 | </View> | 72 | </View> |
50 | </View> | 73 | </View> |
74 | + | ||
75 | + </TouchableOpacity> | ||
76 | + | ||
77 | + | ||
51 | <View style={styles.lineView}/> | 78 | <View style={styles.lineView}/> |
52 | </View> | 79 | </View> |
53 | - </TouchableOpacity> | ||
54 | ); | 80 | ); |
55 | } | 81 | } |
56 | 82 |
@@ -69,6 +69,10 @@ export default keyMirror({ | @@ -69,6 +69,10 @@ export default keyMirror({ | ||
69 | ORDER_LIST_SUCCESS: null, | 69 | ORDER_LIST_SUCCESS: null, |
70 | ORDER_LIST_FAILURE: null, | 70 | ORDER_LIST_FAILURE: null, |
71 | 71 | ||
72 | + ESTIMATE_LIST_REQUEST: null, | ||
73 | + ESTIMATE_LIST_SUCCESS: null, | ||
74 | + ESTIMATE_LIST_FAILURE: null, | ||
75 | + | ||
72 | TOP_LIST_REQUEST: null, | 76 | TOP_LIST_REQUEST: null, |
73 | TOP_LIST_SUCCESS: null, | 77 | TOP_LIST_SUCCESS: null, |
74 | TOP_LIST_FAILURE: null, | 78 | TOP_LIST_FAILURE: null, |
1 | +'use strict'; | ||
2 | + | ||
3 | +import React, {Component} from 'react'; | ||
4 | +import {StyleSheet, View} from 'react-native'; | ||
5 | +import {bindActionCreators} from 'redux'; | ||
6 | +import {connect} from 'react-redux'; | ||
7 | +import {Map} from 'immutable'; | ||
8 | +import * as allianceActions from '../reducers/alliance/allianceActions'; | ||
9 | +import EstimateIncome from "../components/EstimateIncome"; | ||
10 | +import LoadingIndicator from '../../common/components/LoadingIndicator'; | ||
11 | +import ReactNative from "react-native"; | ||
12 | + | ||
13 | +const actions = [ | ||
14 | + allianceActions, | ||
15 | +]; | ||
16 | + | ||
17 | +function mapStateToProps(state) { | ||
18 | + return { | ||
19 | + ...state | ||
20 | + }; | ||
21 | +} | ||
22 | + | ||
23 | +function mapDispatchToProps(dispatch) { | ||
24 | + | ||
25 | + const creators = Map() | ||
26 | + .merge(...actions) | ||
27 | + .filter(value => typeof value === 'function') | ||
28 | + .toObject(); | ||
29 | + | ||
30 | + return { | ||
31 | + actions: bindActionCreators(creators, dispatch), | ||
32 | + dispatch | ||
33 | + }; | ||
34 | +} | ||
35 | + | ||
36 | +class EstimateDetailContainer extends Component { | ||
37 | + constructor(props) { | ||
38 | + super(props); | ||
39 | + this.state = { | ||
40 | + tabType: this.props.tab_type, //1 订单收入,2活动收入 | ||
41 | + timeType: this.props.time_type, //1 昨日 2 本月 3 上月 | ||
42 | + }; | ||
43 | + | ||
44 | + this._jumpWithUrl = this._jumpWithUrl.bind(this); | ||
45 | + this._onEndReached = this._onEndReached.bind(this); | ||
46 | + } | ||
47 | + | ||
48 | + componentDidMount() { | ||
49 | + this.props.actions.getEstimateList(this.state.tabType, this.state.timeType, true); | ||
50 | + } | ||
51 | + | ||
52 | + componentWillUnmount() { | ||
53 | + | ||
54 | + } | ||
55 | + | ||
56 | + _jumpWithUrl(title='', type='', orderCode='') { | ||
57 | + let url = `http://m.yohobuy.com?openby:yohobuy={"action":"go.minealliance","params":{"title":"${title}","type":"${type}","order_code":"${orderCode}"}}`; | ||
58 | + ReactNative.NativeModules.YH_CommonHelper.jumpWithUrl(url); | ||
59 | + } | ||
60 | + | ||
61 | + _onEndReached() { | ||
62 | + this.props.actions.getEstimateList(this.state.tabType, this.state.timeType, true); | ||
63 | + } | ||
64 | + | ||
65 | + render() { | ||
66 | + let {estimateList} = this.props.alliance; | ||
67 | + let isFetching = estimateList.isFetching; | ||
68 | + return ( | ||
69 | + <View style={styles.container}> | ||
70 | + <EstimateIncome | ||
71 | + estimateList={estimateList} | ||
72 | + jumpWithUrl={this._jumpWithUrl} | ||
73 | + onEndReached={this._onEndReached} | ||
74 | + /> | ||
75 | + <LoadingIndicator isVisible={isFetching}/> | ||
76 | + </View> | ||
77 | + ) | ||
78 | + } | ||
79 | +} | ||
80 | + | ||
81 | +let styles = StyleSheet.create({ | ||
82 | + container: { | ||
83 | + flex: 1, | ||
84 | + }, | ||
85 | +}); | ||
86 | + | ||
87 | +export default connect(mapStateToProps, mapDispatchToProps)(EstimateDetailContainer); |
@@ -67,6 +67,10 @@ const { | @@ -67,6 +67,10 @@ const { | ||
67 | ORDER_LIST_SUCCESS, | 67 | ORDER_LIST_SUCCESS, |
68 | ORDER_LIST_FAILURE, | 68 | ORDER_LIST_FAILURE, |
69 | 69 | ||
70 | + ESTIMATE_LIST_REQUEST, | ||
71 | + ESTIMATE_LIST_SUCCESS, | ||
72 | + ESTIMATE_LIST_FAILURE, | ||
73 | + | ||
70 | TOP_LIST_REQUEST, | 74 | TOP_LIST_REQUEST, |
71 | TOP_LIST_SUCCESS, | 75 | TOP_LIST_SUCCESS, |
72 | TOP_LIST_FAILURE, | 76 | TOP_LIST_FAILURE, |
@@ -394,6 +398,26 @@ export function orderListFailure(error) { | @@ -394,6 +398,26 @@ export function orderListFailure(error) { | ||
394 | }; | 398 | }; |
395 | } | 399 | } |
396 | 400 | ||
401 | +export function estimateListRequest() { | ||
402 | + return { | ||
403 | + type: ESTIMATE_LIST_REQUEST, | ||
404 | + }; | ||
405 | +} | ||
406 | + | ||
407 | +export function estimateListSuccess(json) { | ||
408 | + return { | ||
409 | + type: ESTIMATE_LIST_SUCCESS, | ||
410 | + payload: json | ||
411 | + }; | ||
412 | +} | ||
413 | + | ||
414 | +export function estimateListFailure(error) { | ||
415 | + return { | ||
416 | + type: ESTIMATE_LIST_FAILURE, | ||
417 | + payload: error | ||
418 | + }; | ||
419 | +} | ||
420 | + | ||
397 | export function topListRequest() { | 421 | export function topListRequest() { |
398 | return { | 422 | return { |
399 | type: TOP_LIST_REQUEST, | 423 | type: TOP_LIST_REQUEST, |
@@ -917,6 +941,55 @@ export function getOrderList(orderType, orderStatus, isChanged) { | @@ -917,6 +941,55 @@ export function getOrderList(orderType, orderStatus, isChanged) { | ||
917 | }; | 941 | }; |
918 | } | 942 | } |
919 | 943 | ||
944 | +export function getEstimateList(tabType, timeType, isChanged) { | ||
945 | + return (dispatch, getState) => { | ||
946 | + let {app, alliance} = getState(); | ||
947 | + let list = alliance.estimateList; | ||
948 | + | ||
949 | + /** | ||
950 | + * page: 0, //当前页面 | ||
951 | + * page_size: 20, //每页显示的数量 | ||
952 | + * total: 0, //总共多少条 | ||
953 | + * totalPage: 0, //总共多少页 | ||
954 | + * endReached: false, //到达底部 | ||
955 | + */ | ||
956 | + if (!isChanged && (list.isFetching || list.endReached || list.error || (!list.endReached && list.totalPage === 1))) { | ||
957 | + return; | ||
958 | + } | ||
959 | + | ||
960 | + let page = isChanged ? 1 : list.page + 1; | ||
961 | + let pageSize = list.page_size; | ||
962 | + | ||
963 | + let fetchEstimateList = (uid) => { | ||
964 | + dispatch(estimateListRequest()); | ||
965 | + return new AllianceService(app.host).fetchEstimateList(uid, tabType, timeType, page, pageSize) | ||
966 | + .then(json => { | ||
967 | + let payload = json; | ||
968 | + payload.endReached = (payload.page === payload.totalPage) && (payload.totalPage !== 1); | ||
969 | + if (payload.page > 1) { | ||
970 | + let oldList = list.list.toJS(); | ||
971 | + let newList = [...oldList, ...payload.list]; | ||
972 | + payload.list = newList; | ||
973 | + } | ||
974 | + dispatch(estimateListSuccess(payload)); | ||
975 | + }) | ||
976 | + .catch(error => { | ||
977 | + dispatch(estimateListFailure(error)); | ||
978 | + }); | ||
979 | + }; | ||
980 | + | ||
981 | + let uid = 0; | ||
982 | + ReactNative.NativeModules.YH_CommonHelper.uid() | ||
983 | + .then(uid => { | ||
984 | + fetchEstimateList(uid) | ||
985 | + }) | ||
986 | + .catch(error => { | ||
987 | + fetchEstimateList(uid) | ||
988 | + }); | ||
989 | + | ||
990 | + }; | ||
991 | +} | ||
992 | + | ||
920 | export function getTop100List() { | 993 | export function getTop100List() { |
921 | return (dispatch, getState) => { | 994 | return (dispatch, getState) => { |
922 | let {app, alliance} = getState(); | 995 | let {app, alliance} = getState(); |
@@ -100,6 +100,17 @@ let InitialState = Record({ | @@ -100,6 +100,17 @@ let InitialState = Record({ | ||
100 | list: List(), | 100 | list: List(), |
101 | })), | 101 | })), |
102 | 102 | ||
103 | + estimateList: new (Record({ | ||
104 | + isFetching: false, | ||
105 | + error: null, | ||
106 | + page: 0, //当前页面 | ||
107 | + page_size: 20, //每页显示的数量 | ||
108 | + total: 0, //总共多少条 | ||
109 | + totalPage: 0, //总共多少页 | ||
110 | + endReached: false, //到达底部 | ||
111 | + list: List(), | ||
112 | + })), | ||
113 | + | ||
103 | settlementRecordList: new (Record({ | 114 | settlementRecordList: new (Record({ |
104 | isFetching: false, | 115 | isFetching: false, |
105 | error: null, | 116 | error: null, |
@@ -65,6 +65,10 @@ const { | @@ -65,6 +65,10 @@ const { | ||
65 | ORDER_LIST_SUCCESS, | 65 | ORDER_LIST_SUCCESS, |
66 | ORDER_LIST_FAILURE, | 66 | ORDER_LIST_FAILURE, |
67 | 67 | ||
68 | + ESTIMATE_LIST_REQUEST, | ||
69 | + ESTIMATE_LIST_SUCCESS, | ||
70 | + ESTIMATE_LIST_FAILURE, | ||
71 | + | ||
68 | TOP_LIST_REQUEST, | 72 | TOP_LIST_REQUEST, |
69 | TOP_LIST_SUCCESS, | 73 | TOP_LIST_SUCCESS, |
70 | TOP_LIST_FAILURE, | 74 | TOP_LIST_FAILURE, |
@@ -403,6 +407,32 @@ export default function couponReducer(state = initialState, action) { | @@ -403,6 +407,32 @@ export default function couponReducer(state = initialState, action) { | ||
403 | .setIn(['orderList', 'error'], action.payload); | 407 | .setIn(['orderList', 'error'], action.payload); |
404 | } | 408 | } |
405 | 409 | ||
410 | + case ESTIMATE_LIST_REQUEST: { | ||
411 | + return state.setIn(['estimateList', 'isFetching'], true) | ||
412 | + .setIn(['estimateList', 'error'], null); | ||
413 | + | ||
414 | + } | ||
415 | + | ||
416 | + case ESTIMATE_LIST_SUCCESS: { | ||
417 | + let { | ||
418 | + page, | ||
419 | + totalPage, | ||
420 | + endReached, | ||
421 | + list, | ||
422 | + } = action.payload; | ||
423 | + return state.setIn(['estimateList', 'isFetching'], false) | ||
424 | + .setIn(['estimateList', 'page'], page) | ||
425 | + .setIn(['estimateList', 'totalPage'], totalPage) | ||
426 | + .setIn(['estimateList', 'endReached'], endReached) | ||
427 | + .setIn(['estimateList', 'list'], Immutable.fromJS(list)) | ||
428 | + .setIn(['estimateList', 'error'], null); | ||
429 | + } | ||
430 | + | ||
431 | + case ESTIMATE_LIST_FAILURE: { | ||
432 | + return state.setIn(['estimateList', 'isFetching'], false) | ||
433 | + .setIn(['estimateList', 'error'], action.payload); | ||
434 | + } | ||
435 | + | ||
406 | case TOP_LIST_REQUEST: { | 436 | case TOP_LIST_REQUEST: { |
407 | return state.setIn(['topList', 'isFetching'], true) | 437 | return state.setIn(['topList', 'isFetching'], true) |
408 | .setIn(['topList', 'error'], null); | 438 | .setIn(['topList', 'error'], null); |
@@ -230,6 +230,40 @@ export default class AllianceService { | @@ -230,6 +230,40 @@ export default class AllianceService { | ||
230 | }); | 230 | }); |
231 | } | 231 | } |
232 | 232 | ||
233 | + //(预估收入详细列表) | ||
234 | + /** | ||
235 | + * @param uid | ||
236 | + * @param type 1-订单收入,2-其他收入 | ||
237 | + * @param time_type 1-昨日,2-本月,3-上月 | ||
238 | + * @param page | ||
239 | + * @param size | ||
240 | + * @returns {Promise<T>} | ||
241 | + */ | ||
242 | + async fetchEstimateList(uid, tab_type, time_type, page, size) { | ||
243 | + | ||
244 | + let converted_tab_type, converted_time_type; | ||
245 | + | ||
246 | + let customBody = { | ||
247 | + uid, | ||
248 | + type: tab_type, | ||
249 | + time_type: time_type, | ||
250 | + page, | ||
251 | + size, | ||
252 | + method: 'app.union.shareOrder.queryEstimateDetails', | ||
253 | + } | ||
254 | + | ||
255 | + return await this.api.get({ | ||
256 | + url: '', | ||
257 | + body: customBody | ||
258 | + }) | ||
259 | + .then((json) => { | ||
260 | + return json; | ||
261 | + }) | ||
262 | + .catch((error) => { | ||
263 | + throw(error); | ||
264 | + }); | ||
265 | + } | ||
266 | + | ||
233 | //获取热卖Top100列表 | 267 | //获取热卖Top100列表 |
234 | async fetchTop100List(uid, page, limit) { | 268 | async fetchTop100List(uid, page, limit) { |
235 | let fromPage = Platform.OS === 'android' ? 'aFP_Alliance' : 'iFP_Alliance'; | 269 | let fromPage = Platform.OS === 'android' ? 'aFP_Alliance' : 'iFP_Alliance'; |
-
Please register or login to post a comment