我的联盟新增二次确认和资源位展示 --review by 戴强
Showing
9 changed files
with
427 additions
and
14 deletions
@@ -6,8 +6,10 @@ import {Dimensions, Image, ListView, StyleSheet, Text, TouchableOpacity, View, N | @@ -6,8 +6,10 @@ import {Dimensions, Image, ListView, StyleSheet, Text, TouchableOpacity, View, N | ||
6 | import {Immutable} from 'immutable'; | 6 | import {Immutable} from 'immutable'; |
7 | import ProductListCell from '../../common/components/ListCell/ProductListCell'; | 7 | import ProductListCell from '../../common/components/ListCell/ProductListCell'; |
8 | import HelpTipsModal from "./HelpTipsModal"; | 8 | import HelpTipsModal from "./HelpTipsModal"; |
9 | +import SureModal from "./SureModal"; | ||
9 | import WithdrawModal from "./WithdrawModal"; | 10 | import WithdrawModal from "./WithdrawModal"; |
10 | import GuideModal from "./GuideModal"; | 11 | import GuideModal from "./GuideModal"; |
12 | +import BannerSwiper from './BannerSwiper'; | ||
11 | 13 | ||
12 | export default class Alliance extends Component { | 14 | export default class Alliance extends Component { |
13 | constructor(props) { | 15 | constructor(props) { |
@@ -30,7 +32,7 @@ export default class Alliance extends Component { | @@ -30,7 +32,7 @@ export default class Alliance extends Component { | ||
30 | <View style={styles.helpView}> | 32 | <View style={styles.helpView}> |
31 | <Text style={styles.canWithDrawText}>可提现金额</Text> | 33 | <Text style={styles.canWithDrawText}>可提现金额</Text> |
32 | <TouchableOpacity activeOpacity={1} onPress={() => { | 34 | <TouchableOpacity activeOpacity={1} onPress={() => { |
33 | - this.props.showHelpDialog && this.props.showHelpDialog('仅计算当天凌晨4点前产生的有效订单结算后的可提现金额,具体说明请参见规则说明'); | 35 | + this.props.showHelpDialog && this.props.showHelpDialog('仅计算当天12点前产生的有效订单结算后的可提现金额,具体说明请参见规则说明'); |
34 | }}> | 36 | }}> |
35 | <Image style={styles.helpImage} source={require('../images/help.png')}/> | 37 | <Image style={styles.helpImage} source={require('../images/help.png')}/> |
36 | </TouchableOpacity> | 38 | </TouchableOpacity> |
@@ -47,7 +49,7 @@ export default class Alliance extends Component { | @@ -47,7 +49,7 @@ export default class Alliance extends Component { | ||
47 | return | 49 | return |
48 | } | 50 | } |
49 | if (this.props.settlementInfo.settlementInfoData.canSettlement) { | 51 | if (this.props.settlementInfo.settlementInfoData.canSettlement) { |
50 | - !this.props.addSettlement.isFetching && this.props.showWithdrawalDialog && this.props.showWithdrawalDialog(); | 52 | + !this.props.addSettlement.isFetching && this.props.showSureDialog && this.props.showSureDialog(); |
51 | } else { | 53 | } else { |
52 | this.props.showHelpDialog && this.props.showHelpDialog('您有正在处理中的提现,请耐心等待完成后再做新的提现操作'); | 54 | this.props.showHelpDialog && this.props.showHelpDialog('您有正在处理中的提现,请耐心等待完成后再做新的提现操作'); |
53 | } | 55 | } |
@@ -67,17 +69,7 @@ export default class Alliance extends Component { | @@ -67,17 +69,7 @@ export default class Alliance extends Component { | ||
67 | </View> | 69 | </View> |
68 | </TouchableOpacity> | 70 | </TouchableOpacity> |
69 | <View style={{height: 10, backgroundColor: '#f0f0f0'}}/> | 71 | <View style={{height: 10, backgroundColor: '#f0f0f0'}}/> |
70 | - <View style={styles.withdrawView}> | ||
71 | - <Text style={[styles.hasWithDrawText, {fontWeight: 'bold'}]}>最近订单</Text> | ||
72 | - </View> | ||
73 | - <View style={styles.titleBottomLine}/> | ||
74 | - {this.props.recentlyOrder.recentlyOrder_list.toArray().length > 0 ? null : | ||
75 | - <View style={styles.emptyOrderView}> | ||
76 | - <Text style={[styles.hasWithDrawText, {color: '#B0B0B0', justifyContent: 'center', width: 98}]}>您暂时没有订单</Text> | ||
77 | - </View> | ||
78 | - } | ||
79 | </View> | 72 | </View> |
80 | - | ||
81 | ) | 73 | ) |
82 | } | 74 | } |
83 | 75 | ||
@@ -86,6 +78,30 @@ export default class Alliance extends Component { | @@ -86,6 +78,30 @@ export default class Alliance extends Component { | ||
86 | let customStyle = rowID === 0 || rowID === 1 ? {paddingLeft} : {paddingLeft}; | 78 | let customStyle = rowID === 0 || rowID === 1 ? {paddingLeft} : {paddingLeft}; |
87 | let hasOrder = this.props.recentlyOrder.recentlyOrder_list.toArray().length > 0; | 79 | let hasOrder = this.props.recentlyOrder.recentlyOrder_list.toArray().length > 0; |
88 | switch (sectionID) { | 80 | switch (sectionID) { |
81 | + case 'resourceList': { | ||
82 | + return( | ||
83 | + <View> | ||
84 | + <BannerSwiper resource={rowData} row_ID={rowID} resourceJumpWithUrl={this.props.resourceJumpWithUrl}/> | ||
85 | + <View style={{height: 10, backgroundColor: '#f0f0f0'}}/> | ||
86 | + </View> | ||
87 | + ); | ||
88 | + } | ||
89 | + case 'orderListHeader': { | ||
90 | + return ( | ||
91 | + <View> | ||
92 | + <View style={styles.orderView}> | ||
93 | + <Text style={[styles.hasWithDrawText, {fontWeight: 'bold'}]}>最近订单</Text> | ||
94 | + <Text style={styles.orderTipsText}>当天订单第二天显示</Text> | ||
95 | + </View> | ||
96 | + <View style={styles.titleBottomLine}/> | ||
97 | + {this.props.recentlyOrder.recentlyOrder_list.toArray().length > 0 ? null : | ||
98 | + <View style={styles.emptyOrderView}> | ||
99 | + <Text style={[styles.hasWithDrawText, {color: '#B0B0B0', justifyContent: 'center'}]}>您暂时没有订单</Text> | ||
100 | + </View> | ||
101 | + } | ||
102 | + </View> | ||
103 | + ) | ||
104 | + } | ||
89 | case 'orderList': { | 105 | case 'orderList': { |
90 | let status = rowData.get('status') === '10' ? '待确认' : ''; | 106 | let status = rowData.get('status') === '10' ? '待确认' : ''; |
91 | return ( | 107 | return ( |
@@ -157,12 +173,16 @@ export default class Alliance extends Component { | @@ -157,12 +173,16 @@ export default class Alliance extends Component { | ||
157 | render() { | 173 | render() { |
158 | let { | 174 | let { |
159 | isShowHelp, | 175 | isShowHelp, |
176 | + isShowSure, | ||
160 | isShowWithdrawal, | 177 | isShowWithdrawal, |
178 | + resourceInfo, | ||
161 | recentlyOrder, | 179 | recentlyOrder, |
162 | topList, | 180 | topList, |
163 | } = this.props; | 181 | } = this.props; |
164 | 182 | ||
165 | let dataSource = { | 183 | let dataSource = { |
184 | + resourceList: resourceInfo.resourceList ? resourceInfo.resourceList.toArray() : [], | ||
185 | + orderListHeader: ['最近订单'], | ||
166 | orderList: recentlyOrder.recentlyOrder_list ? recentlyOrder.recentlyOrder_list.toArray() : [], | 186 | orderList: recentlyOrder.recentlyOrder_list ? recentlyOrder.recentlyOrder_list.toArray() : [], |
167 | orderListFooter: ['查看全部'], | 187 | orderListFooter: ['查看全部'], |
168 | productListTitle: ['推荐商品'], | 188 | productListTitle: ['推荐商品'], |
@@ -178,6 +198,10 @@ export default class Alliance extends Component { | @@ -178,6 +198,10 @@ export default class Alliance extends Component { | ||
178 | tips={this.props.tips} | 198 | tips={this.props.tips} |
179 | isShowHelp={isShowHelp} | 199 | isShowHelp={isShowHelp} |
180 | hiddenHelpDialog={this.props.hiddenHelpDialog}/> | 200 | hiddenHelpDialog={this.props.hiddenHelpDialog}/> |
201 | + <SureModal | ||
202 | + isShow={isShowSure} | ||
203 | + hiddenSureDialog={this.props.hiddenSureDialog} | ||
204 | + showWithdrawalDialog={this.props.showWithdrawalDialog}/> | ||
181 | <WithdrawModal | 205 | <WithdrawModal |
182 | isShowWithdrawal={isShowWithdrawal} | 206 | isShowWithdrawal={isShowWithdrawal} |
183 | hiddenWithDrawDialog={this.props.hiddenWithDrawDialog}/> | 207 | hiddenWithDrawDialog={this.props.hiddenWithDrawDialog}/> |
@@ -285,11 +309,26 @@ let styles = StyleSheet.create({ | @@ -285,11 +309,26 @@ let styles = StyleSheet.create({ | ||
285 | alignItems: 'center', | 309 | alignItems: 'center', |
286 | justifyContent: 'space-between' | 310 | justifyContent: 'space-between' |
287 | }, | 311 | }, |
312 | + orderView: { | ||
313 | + width: width, | ||
314 | + height: 44, | ||
315 | + backgroundColor: '#FFFFFF', | ||
316 | + flexDirection: 'row', | ||
317 | + paddingLeft: 15, | ||
318 | + alignItems: 'center', | ||
319 | + }, | ||
288 | hasWithDrawText: { | 320 | hasWithDrawText: { |
289 | fontFamily: 'PingFang-SC-Regular', | 321 | fontFamily: 'PingFang-SC-Regular', |
290 | fontSize: 14, | 322 | fontSize: 14, |
291 | color: '#444444', | 323 | color: '#444444', |
292 | }, | 324 | }, |
325 | + orderTipsText: { | ||
326 | + marginLeft: 4, | ||
327 | + fontFamily: 'PingFang-SC-Regular', | ||
328 | + fontSize: 12, | ||
329 | + color: '#B0B0B0', | ||
330 | + letterSpacing: -0.16, | ||
331 | + }, | ||
293 | arrowImage: { | 332 | arrowImage: { |
294 | width: 16, | 333 | width: 16, |
295 | height: 16, | 334 | height: 16, |
js/alliance/components/BannerSwiper.js
0 → 100644
1 | +'use strict'; | ||
2 | + | ||
3 | +import React from 'react'; | ||
4 | +import ReactNative from 'react-native'; | ||
5 | +import YH_Swiper from '../../common/components/YH_Swiper'; | ||
6 | +import YH_Image from '../../common/components/YH_Image'; | ||
7 | +import {getSlicedUrl} from '../../classify/utils/Utils'; | ||
8 | + | ||
9 | +const { | ||
10 | + View, | ||
11 | + TouchableOpacity, | ||
12 | + StyleSheet, | ||
13 | + Dimensions, | ||
14 | + Platform, | ||
15 | +} = ReactNative; | ||
16 | + | ||
17 | +import Immutable, {Map} from 'immutable'; | ||
18 | + | ||
19 | +export default class BannerSwiper extends React.Component { | ||
20 | + | ||
21 | + constructor(props) { | ||
22 | + super (props); | ||
23 | + } | ||
24 | + | ||
25 | + shouldComponentUpdate(nextProps){ | ||
26 | + if (Immutable.is(nextProps.resource, this.props.resource)) { | ||
27 | + return false; | ||
28 | + } else { | ||
29 | + return true; | ||
30 | + } | ||
31 | + } | ||
32 | + | ||
33 | + render() { | ||
34 | + | ||
35 | + let {resource ,row_ID} = this.props; | ||
36 | + if (!resource) { | ||
37 | + return null; | ||
38 | + } | ||
39 | + let template_name = resource?resource.get('template_name'):''; | ||
40 | + let template_id = resource?resource.get('template_id'):0; | ||
41 | + let data = resource.get('data').toJS(); | ||
42 | + | ||
43 | + if (data.length == 1) { | ||
44 | + let newSrc = getSlicedUrl(data[0].src, width, swiperHeight); | ||
45 | + return ( | ||
46 | + <View style={styles.container}> | ||
47 | + <TouchableOpacity | ||
48 | + activeOpacity={1} | ||
49 | + style={{width: width, height: swiperHeight}} | ||
50 | + onPress={() => { | ||
51 | + this.props.resourceJumpWithUrl && this.props.resourceJumpWithUrl(data[0].url) | ||
52 | + }} | ||
53 | + > | ||
54 | + <YH_Image | ||
55 | + url={newSrc} | ||
56 | + style={{ width: width, height: swiperHeight}} | ||
57 | + /> | ||
58 | + </TouchableOpacity> | ||
59 | + </View> | ||
60 | + ); | ||
61 | + } else { | ||
62 | + return ( | ||
63 | + <View style={styles.container}> | ||
64 | + <YH_Swiper | ||
65 | + style={styles.banner} | ||
66 | + showsButtons={false} | ||
67 | + loop={true} | ||
68 | + autoplay={true} | ||
69 | + autoplayTimeout={2} | ||
70 | + paginationStyle={{bottom: 8}} | ||
71 | + width={width} | ||
72 | + height={swiperHeight} | ||
73 | + > | ||
74 | + {data.map((item, i) => { | ||
75 | + let newSrc = getSlicedUrl(item.src, width, swiperHeight); | ||
76 | + return ( | ||
77 | + <TouchableOpacity | ||
78 | + key={i} | ||
79 | + activeOpacity={1} | ||
80 | + onPress={() => { | ||
81 | + this.props.resourceJumpWithUrl && this.props.resourceJumpWithUrl(item.url) | ||
82 | + }} | ||
83 | + > | ||
84 | + <YH_Image | ||
85 | + url={newSrc} | ||
86 | + style={{width: width, height: swiperHeight}} | ||
87 | + /> | ||
88 | + </TouchableOpacity> | ||
89 | + ); | ||
90 | + })} | ||
91 | + </YH_Swiper> | ||
92 | + </View> | ||
93 | + ); | ||
94 | + } | ||
95 | + } | ||
96 | +} | ||
97 | + | ||
98 | +let {width, height} = Dimensions.get('window'); | ||
99 | +const DEVICE_WIDTH_RATIO = width / 375; | ||
100 | +let swiperHeight = Math.ceil(118 * DEVICE_WIDTH_RATIO); | ||
101 | + | ||
102 | +let styles = StyleSheet.create({ | ||
103 | + container: { | ||
104 | + width: width, | ||
105 | + height: swiperHeight, | ||
106 | + backgroundColor: 'white', | ||
107 | + }, | ||
108 | + | ||
109 | +}); |
js/alliance/components/SureModal.js
0 → 100644
1 | +'use strict'; | ||
2 | + | ||
3 | +import React from 'react'; | ||
4 | +import ReactNative from 'react-native'; | ||
5 | + | ||
6 | +const { | ||
7 | + AppRegistry, | ||
8 | + StyleSheet, | ||
9 | + Text, | ||
10 | + View, | ||
11 | + Dimensions, | ||
12 | + TouchableOpacity, | ||
13 | + Modal, | ||
14 | +} = ReactNative; | ||
15 | + | ||
16 | + | ||
17 | +export default class SureModal extends React.Component { | ||
18 | + constructor(props) { | ||
19 | + super(props); | ||
20 | + } | ||
21 | + | ||
22 | + render() { | ||
23 | + return ( | ||
24 | + <Modal | ||
25 | + visible={this.props.isShow} | ||
26 | + animationType={'none'} | ||
27 | + transparent={true} | ||
28 | + onRequestClose={() => { | ||
29 | + }}> | ||
30 | + <View style={styles.modalContainer}> | ||
31 | + <View style={styles.modalView}> | ||
32 | + <View style={styles.confirmTitleContainer}> | ||
33 | + <Text style={styles.confirmTitle}>申请提现后不能取消,确定要提现吗?</Text> | ||
34 | + </View> | ||
35 | + <View style={{width: '100%', height: 0.5, backgroundColor: '#e0e0e0'}}/> | ||
36 | + <View style={styles.confirmBtnContainer}> | ||
37 | + <TouchableOpacity | ||
38 | + style={{width: '49%', alignItems: 'center', justifyContent: 'center', height: 45.5}} | ||
39 | + onPress={() => { | ||
40 | + this.props.hiddenSureDialog && this.props.hiddenSureDialog(); | ||
41 | + }}> | ||
42 | + <Text style={{fontSize: 17, color: '#444444', letterSpacing: -0.41}}>取消</Text> | ||
43 | + </TouchableOpacity> | ||
44 | + <View style={{width: 0.5, height: 45, backgroundColor: '#e0e0e0'}}/> | ||
45 | + <TouchableOpacity | ||
46 | + style={{width: '49%', alignItems: 'center', justifyContent: 'center', height: 45.5}} | ||
47 | + onPress={() => { | ||
48 | + this.props.hiddenSureDialog && this.props.hiddenSureDialog(); | ||
49 | + this.props.showWithdrawalDialog && this.props.showWithdrawalDialog(); | ||
50 | + }}> | ||
51 | + <Text style={{ | ||
52 | + fontSize: 17, | ||
53 | + color: '#d0021b', | ||
54 | + letterSpacing: -0.41, | ||
55 | + fontWeight: '500' | ||
56 | + }}>确定</Text> | ||
57 | + </TouchableOpacity> | ||
58 | + </View> | ||
59 | + </View> | ||
60 | + </View> | ||
61 | + </Modal> | ||
62 | + ); | ||
63 | + } | ||
64 | +}; | ||
65 | + | ||
66 | +let {width, height} = Dimensions.get('window'); | ||
67 | + | ||
68 | +let styles = StyleSheet.create({ | ||
69 | + modalContainer: { | ||
70 | + flex: 1, | ||
71 | + width: width, | ||
72 | + height: height, | ||
73 | + alignItems: 'center', | ||
74 | + justifyContent: 'center', | ||
75 | + backgroundColor: 'rgba(0, 0, 0, 0.4)', | ||
76 | + }, | ||
77 | + modalView: { | ||
78 | + width: 270, | ||
79 | + borderRadius: 5, | ||
80 | + alignItems: 'center', | ||
81 | + backgroundColor: '#ffffff', | ||
82 | + }, | ||
83 | + confirmBtnContainer: { | ||
84 | + width: '100%', | ||
85 | + height: 44.5, | ||
86 | + flexDirection: 'row', | ||
87 | + }, | ||
88 | + confirmTitleContainer: { | ||
89 | + alignItems: 'center' | ||
90 | + }, | ||
91 | + confirmTitle: { | ||
92 | + paddingTop: 20, | ||
93 | + paddingLeft: 30, | ||
94 | + paddingRight: 30, | ||
95 | + paddingBottom: 20, | ||
96 | + color: '#444444', | ||
97 | + fontSize: 14, | ||
98 | + lineHeight: 24, | ||
99 | + textAlign: 'center', | ||
100 | + letterSpacing: -0.09, | ||
101 | + fontFamily: 'PingFang-SC-Regular', | ||
102 | + }, | ||
103 | + confirmContent: { | ||
104 | + marginLeft: 30, | ||
105 | + marginRight: 30, | ||
106 | + marginBottom: 20, | ||
107 | + color: '#444444', | ||
108 | + fontSize: 14, | ||
109 | + lineHeight: 24, | ||
110 | + textAlign: 'center', | ||
111 | + letterSpacing: -0.09, | ||
112 | + fontFamily: 'PingFang-SC-Regular', | ||
113 | + includeFontPadding: false, | ||
114 | + }, | ||
115 | + click: { | ||
116 | + width: '100%', | ||
117 | + alignItems: 'center', | ||
118 | + justifyContent: 'center' | ||
119 | + }, | ||
120 | + sure: { | ||
121 | + fontSize: 17, | ||
122 | + color: '#D0021B', | ||
123 | + letterSpacing: -0.41, | ||
124 | + fontWeight: 'bold' | ||
125 | + }, | ||
126 | +}); |
@@ -10,6 +10,9 @@ export default keyMirror({ | @@ -10,6 +10,9 @@ export default keyMirror({ | ||
10 | SHOW_HELP_DIALOG: null, | 10 | SHOW_HELP_DIALOG: null, |
11 | DISMISS_HELP_DIALOG: null, | 11 | DISMISS_HELP_DIALOG: null, |
12 | 12 | ||
13 | + SHOW_SURE_DIALOG: null, | ||
14 | + DISMISS_SURE_DIALOG: null, | ||
15 | + | ||
13 | SET_ORDER_CODE: null, | 16 | SET_ORDER_CODE: null, |
14 | 17 | ||
15 | SHOW_WITHDRAW_DIALOG: null, | 18 | SHOW_WITHDRAW_DIALOG: null, |
@@ -23,6 +26,10 @@ export default keyMirror({ | @@ -23,6 +26,10 @@ export default keyMirror({ | ||
23 | ADD_SETTLEMENT_SUCCESS: null, | 26 | ADD_SETTLEMENT_SUCCESS: null, |
24 | ADD_SETTLEMENT_FAILURE: null, | 27 | ADD_SETTLEMENT_FAILURE: null, |
25 | 28 | ||
29 | + RESOURCE_INFO_REQUEST: null, | ||
30 | + RESOURCE_INFO_SUCCESS: null, | ||
31 | + RESOURCE_INFO_FAILURE: null, | ||
32 | + | ||
26 | RECENTLY_ORDER_REQUEST: null, | 33 | RECENTLY_ORDER_REQUEST: null, |
27 | RECENTLY_ORDER_SUCCESS: null, | 34 | RECENTLY_ORDER_SUCCESS: null, |
28 | RECENTLY_ORDER_FAILURE: null, | 35 | RECENTLY_ORDER_FAILURE: null, |
@@ -47,10 +47,13 @@ class AllianceContainer extends Component { | @@ -47,10 +47,13 @@ class AllianceContainer extends Component { | ||
47 | this._hiddenGuideDialog = this._hiddenGuideDialog.bind(this); | 47 | this._hiddenGuideDialog = this._hiddenGuideDialog.bind(this); |
48 | this._showHelpDialog = this._showHelpDialog.bind(this); | 48 | this._showHelpDialog = this._showHelpDialog.bind(this); |
49 | this._hiddenHelpDialog = this._hiddenHelpDialog.bind(this); | 49 | this._hiddenHelpDialog = this._hiddenHelpDialog.bind(this); |
50 | + this._showSureDialog = this._showSureDialog.bind(this); | ||
51 | + this._hiddenSureDialog = this._hiddenSureDialog.bind(this); | ||
50 | this._showWithDrawDialog = this._showWithDrawDialog.bind(this); | 52 | this._showWithDrawDialog = this._showWithDrawDialog.bind(this); |
51 | this._hiddenWithDrawDialog = this._hiddenWithDrawDialog.bind(this); | 53 | this._hiddenWithDrawDialog = this._hiddenWithDrawDialog.bind(this); |
52 | this._jumpWithUrl = this._jumpWithUrl.bind(this); | 54 | this._jumpWithUrl = this._jumpWithUrl.bind(this); |
53 | this._onPressProduct = this._onPressProduct.bind(this); | 55 | this._onPressProduct = this._onPressProduct.bind(this); |
56 | + this._resourceJumpWithUrl = this._resourceJumpWithUrl.bind(this); | ||
54 | this._onEndReached = this._onEndReached.bind(this); | 57 | this._onEndReached = this._onEndReached.bind(this); |
55 | 58 | ||
56 | AsyncStorage.getItem(AsyncStorageKey, (error, value) => { | 59 | AsyncStorage.getItem(AsyncStorageKey, (error, value) => { |
@@ -76,6 +79,7 @@ class AllianceContainer extends Component { | @@ -76,6 +79,7 @@ class AllianceContainer extends Component { | ||
76 | 79 | ||
77 | componentDidMount() { | 80 | componentDidMount() { |
78 | this.props.actions.getSettlementInfo(); | 81 | this.props.actions.getSettlementInfo(); |
82 | + this.props.actions.getResourceInfo(); | ||
79 | this.props.actions.getRecentlyOrderLimitTen(); | 83 | this.props.actions.getRecentlyOrderLimitTen(); |
80 | this.props.actions.getTop100List(); | 84 | this.props.actions.getTop100List(); |
81 | } | 85 | } |
@@ -104,6 +108,14 @@ class AllianceContainer extends Component { | @@ -104,6 +108,14 @@ class AllianceContainer extends Component { | ||
104 | this.props.actions.hiddenHelpDialog(); | 108 | this.props.actions.hiddenHelpDialog(); |
105 | } | 109 | } |
106 | 110 | ||
111 | + _showSureDialog() { | ||
112 | + this.props.actions.showSureDialog(); | ||
113 | + } | ||
114 | + | ||
115 | + _hiddenSureDialog() { | ||
116 | + this.props.actions.hiddenSureDialog(); | ||
117 | + } | ||
118 | + | ||
107 | _showWithDrawDialog() { | 119 | _showWithDrawDialog() { |
108 | this.props.actions.getAddSettlement(); | 120 | this.props.actions.getAddSettlement(); |
109 | } | 121 | } |
@@ -120,6 +132,10 @@ class AllianceContainer extends Component { | @@ -120,6 +132,10 @@ class AllianceContainer extends Component { | ||
120 | ReactNative.NativeModules.YH_CommonHelper.jumpWithUrl(url); | 132 | ReactNative.NativeModules.YH_CommonHelper.jumpWithUrl(url); |
121 | } | 133 | } |
122 | 134 | ||
135 | + _resourceJumpWithUrl(url) { | ||
136 | + ReactNative.NativeModules.YH_CommonHelper.jumpWithUrl(url); | ||
137 | + } | ||
138 | + | ||
123 | _onPressProduct(product) { | 139 | _onPressProduct(product) { |
124 | let productSkn = product && product.get('product_skn', 0); | 140 | let productSkn = product && product.get('product_skn', 0); |
125 | let is_global = product && product.get('is_global', 'N'); | 141 | let is_global = product && product.get('is_global', 'N'); |
@@ -149,9 +165,11 @@ class AllianceContainer extends Component { | @@ -149,9 +165,11 @@ class AllianceContainer extends Component { | ||
149 | render() { | 165 | render() { |
150 | let { | 166 | let { |
151 | showHelpDialog, | 167 | showHelpDialog, |
168 | + showSureDialog, | ||
152 | showWithdrawalDialog, | 169 | showWithdrawalDialog, |
153 | settlementInfo, | 170 | settlementInfo, |
154 | addSettlement, | 171 | addSettlement, |
172 | + resourceInfo, | ||
155 | recentlyOrder, | 173 | recentlyOrder, |
156 | topList | 174 | topList |
157 | } = this.props.alliance; | 175 | } = this.props.alliance; |
@@ -163,18 +181,23 @@ class AllianceContainer extends Component { | @@ -163,18 +181,23 @@ class AllianceContainer extends Component { | ||
163 | <Alliance | 181 | <Alliance |
164 | isShowGuide={isShowGuide} | 182 | isShowGuide={isShowGuide} |
165 | isShowHelp={showHelpDialog} | 183 | isShowHelp={showHelpDialog} |
184 | + isShowSure={showSureDialog} | ||
166 | isShowWithdrawal={showWithdrawalDialog} | 185 | isShowWithdrawal={showWithdrawalDialog} |
167 | settlementInfo={settlementInfo} | 186 | settlementInfo={settlementInfo} |
168 | addSettlement={addSettlement} | 187 | addSettlement={addSettlement} |
188 | + resourceInfo={resourceInfo} | ||
169 | recentlyOrder={recentlyOrder} | 189 | recentlyOrder={recentlyOrder} |
170 | topList={topList} | 190 | topList={topList} |
171 | tips={tip} | 191 | tips={tip} |
172 | hiddenGuideDialog={this._hiddenGuideDialog} | 192 | hiddenGuideDialog={this._hiddenGuideDialog} |
173 | showHelpDialog={this._showHelpDialog} | 193 | showHelpDialog={this._showHelpDialog} |
174 | hiddenHelpDialog={this._hiddenHelpDialog} | 194 | hiddenHelpDialog={this._hiddenHelpDialog} |
195 | + showSureDialog={this._showSureDialog} | ||
196 | + hiddenSureDialog={this._hiddenSureDialog} | ||
175 | showWithdrawalDialog={this._showWithDrawDialog} | 197 | showWithdrawalDialog={this._showWithDrawDialog} |
176 | hiddenWithDrawDialog={this._hiddenWithDrawDialog} | 198 | hiddenWithDrawDialog={this._hiddenWithDrawDialog} |
177 | jumpWithUrl={this._jumpWithUrl} | 199 | jumpWithUrl={this._jumpWithUrl} |
200 | + resourceJumpWithUrl={this._resourceJumpWithUrl} | ||
178 | onPressProduct={this._onPressProduct} | 201 | onPressProduct={this._onPressProduct} |
179 | onEndReached={this._onEndReached} | 202 | onEndReached={this._onEndReached} |
180 | /> | 203 | /> |
@@ -9,6 +9,9 @@ const { | @@ -9,6 +9,9 @@ const { | ||
9 | SHOW_HELP_DIALOG, | 9 | SHOW_HELP_DIALOG, |
10 | DISMISS_HELP_DIALOG, | 10 | DISMISS_HELP_DIALOG, |
11 | 11 | ||
12 | + SHOW_SURE_DIALOG, | ||
13 | + DISMISS_SURE_DIALOG, | ||
14 | + | ||
12 | SHOW_WITHDRAW_DIALOG, | 15 | SHOW_WITHDRAW_DIALOG, |
13 | DISMISS_WITHDRAW_DIALOG, | 16 | DISMISS_WITHDRAW_DIALOG, |
14 | 17 | ||
@@ -22,6 +25,10 @@ const { | @@ -22,6 +25,10 @@ const { | ||
22 | ADD_SETTLEMENT_SUCCESS, | 25 | ADD_SETTLEMENT_SUCCESS, |
23 | ADD_SETTLEMENT_FAILURE, | 26 | ADD_SETTLEMENT_FAILURE, |
24 | 27 | ||
28 | + RESOURCE_INFO_REQUEST, | ||
29 | + RESOURCE_INFO_SUCCESS, | ||
30 | + RESOURCE_INFO_FAILURE, | ||
31 | + | ||
25 | RECENTLY_ORDER_REQUEST, | 32 | RECENTLY_ORDER_REQUEST, |
26 | RECENTLY_ORDER_SUCCESS, | 33 | RECENTLY_ORDER_SUCCESS, |
27 | RECENTLY_ORDER_FAILURE, | 34 | RECENTLY_ORDER_FAILURE, |
@@ -56,6 +63,18 @@ export function hiddenHelpDialog() { | @@ -56,6 +63,18 @@ export function hiddenHelpDialog() { | ||
56 | } | 63 | } |
57 | } | 64 | } |
58 | 65 | ||
66 | +export function showSureDialog() { | ||
67 | + return { | ||
68 | + type: SHOW_SURE_DIALOG, | ||
69 | + } | ||
70 | +} | ||
71 | + | ||
72 | +export function hiddenSureDialog() { | ||
73 | + return { | ||
74 | + type: DISMISS_SURE_DIALOG, | ||
75 | + } | ||
76 | +} | ||
77 | + | ||
59 | export function showWithDrawDialog() { | 78 | export function showWithDrawDialog() { |
60 | return { | 79 | return { |
61 | type: SHOW_WITHDRAW_DIALOG, | 80 | type: SHOW_WITHDRAW_DIALOG, |
@@ -115,6 +134,26 @@ export function addSettlementFailure(error) { | @@ -115,6 +134,26 @@ export function addSettlementFailure(error) { | ||
115 | }; | 134 | }; |
116 | } | 135 | } |
117 | 136 | ||
137 | +export function getResourceRequest() { | ||
138 | + return { | ||
139 | + type: RESOURCE_INFO_REQUEST, | ||
140 | + }; | ||
141 | +} | ||
142 | + | ||
143 | +export function getResourceSuccess(json) { | ||
144 | + return { | ||
145 | + type: RESOURCE_INFO_SUCCESS, | ||
146 | + payload: json | ||
147 | + }; | ||
148 | +} | ||
149 | + | ||
150 | +export function getResourceFailure(error) { | ||
151 | + return { | ||
152 | + type: RESOURCE_INFO_FAILURE, | ||
153 | + payload: error | ||
154 | + }; | ||
155 | +} | ||
156 | + | ||
118 | export function recentlyOrderRequest() { | 157 | export function recentlyOrderRequest() { |
119 | return { | 158 | return { |
120 | type: RECENTLY_ORDER_REQUEST, | 159 | type: RECENTLY_ORDER_REQUEST, |
@@ -268,6 +307,20 @@ export function getAddSettlement() { | @@ -268,6 +307,20 @@ export function getAddSettlement() { | ||
268 | }; | 307 | }; |
269 | } | 308 | } |
270 | 309 | ||
310 | +export function getResourceInfo() { | ||
311 | + return (dispatch, getState) => { | ||
312 | + let {app} = getState(); | ||
313 | + dispatch(getResourceRequest()); | ||
314 | + return new AllianceService(app.host).fetchResourceInfo() | ||
315 | + .then(json => { | ||
316 | + dispatch(getResourceSuccess(json)); | ||
317 | + }) | ||
318 | + .catch(error => { | ||
319 | + dispatch(getResourceFailure(error)); | ||
320 | + }); | ||
321 | + }; | ||
322 | +} | ||
323 | + | ||
271 | export function getRecentlyOrderLimitTen() { | 324 | export function getRecentlyOrderLimitTen() { |
272 | return (dispatch, getState) => { | 325 | return (dispatch, getState) => { |
273 | let {app} = getState(); | 326 | let {app} = getState(); |
@@ -493,4 +546,4 @@ function exposeProductListData(json) { | @@ -493,4 +546,4 @@ function exposeProductListData(json) { | ||
493 | } | 546 | } |
494 | res.product_list = list; | 547 | res.product_list = list; |
495 | return res; | 548 | return res; |
496 | -} | ||
549 | +} |
@@ -6,6 +6,7 @@ import {List, Map, Record} from 'immutable'; | @@ -6,6 +6,7 @@ import {List, Map, Record} from 'immutable'; | ||
6 | let InitialState = Record({ | 6 | let InitialState = Record({ |
7 | orderCode: 0, | 7 | orderCode: 0, |
8 | showHelpDialog: false, | 8 | showHelpDialog: false, |
9 | + showSureDialog: false, | ||
9 | showWithdrawalDialog: false, | 10 | showWithdrawalDialog: false, |
10 | 11 | ||
11 | settlementInfo: new (Record({ | 12 | settlementInfo: new (Record({ |
@@ -20,6 +21,12 @@ let InitialState = Record({ | @@ -20,6 +21,12 @@ let InitialState = Record({ | ||
20 | data: List(), | 21 | data: List(), |
21 | })), | 22 | })), |
22 | 23 | ||
24 | + resourceInfo: new (Record({ | ||
25 | + isFetching: false, | ||
26 | + error: null, | ||
27 | + resourceList: List(), | ||
28 | + })), | ||
29 | + | ||
23 | recentlyOrder: new (Record({ | 30 | recentlyOrder: new (Record({ |
24 | isFetching: false, | 31 | isFetching: false, |
25 | error: null, | 32 | error: null, |
@@ -7,6 +7,9 @@ const { | @@ -7,6 +7,9 @@ const { | ||
7 | SHOW_HELP_DIALOG, | 7 | SHOW_HELP_DIALOG, |
8 | DISMISS_HELP_DIALOG, | 8 | DISMISS_HELP_DIALOG, |
9 | 9 | ||
10 | + SHOW_SURE_DIALOG, | ||
11 | + DISMISS_SURE_DIALOG, | ||
12 | + | ||
10 | SHOW_WITHDRAW_DIALOG, | 13 | SHOW_WITHDRAW_DIALOG, |
11 | DISMISS_WITHDRAW_DIALOG, | 14 | DISMISS_WITHDRAW_DIALOG, |
12 | 15 | ||
@@ -20,6 +23,10 @@ const { | @@ -20,6 +23,10 @@ const { | ||
20 | ADD_SETTLEMENT_SUCCESS, | 23 | ADD_SETTLEMENT_SUCCESS, |
21 | ADD_SETTLEMENT_FAILURE, | 24 | ADD_SETTLEMENT_FAILURE, |
22 | 25 | ||
26 | + RESOURCE_INFO_REQUEST, | ||
27 | + RESOURCE_INFO_SUCCESS, | ||
28 | + RESOURCE_INFO_FAILURE, | ||
29 | + | ||
23 | RECENTLY_ORDER_REQUEST, | 30 | RECENTLY_ORDER_REQUEST, |
24 | RECENTLY_ORDER_SUCCESS, | 31 | RECENTLY_ORDER_SUCCESS, |
25 | RECENTLY_ORDER_FAILURE, | 32 | RECENTLY_ORDER_FAILURE, |
@@ -56,6 +63,14 @@ export default function couponReducer(state = initialState, action) { | @@ -56,6 +63,14 @@ export default function couponReducer(state = initialState, action) { | ||
56 | case DISMISS_HELP_DIALOG: { | 63 | case DISMISS_HELP_DIALOG: { |
57 | return state.set('showHelpDialog', false); | 64 | return state.set('showHelpDialog', false); |
58 | } | 65 | } |
66 | + | ||
67 | + case SHOW_SURE_DIALOG: { | ||
68 | + return state.set('showSureDialog', true); | ||
69 | + } | ||
70 | + case DISMISS_SURE_DIALOG: { | ||
71 | + return state.set('showSureDialog', false); | ||
72 | + } | ||
73 | + | ||
59 | case SHOW_WITHDRAW_DIALOG: { | 74 | case SHOW_WITHDRAW_DIALOG: { |
60 | return state.set('showWithdrawalDialog', true); | 75 | return state.set('showWithdrawalDialog', true); |
61 | } | 76 | } |
@@ -90,15 +105,31 @@ export default function couponReducer(state = initialState, action) { | @@ -90,15 +105,31 @@ export default function couponReducer(state = initialState, action) { | ||
90 | 105 | ||
91 | case ADD_SETTLEMENT_SUCCESS: { | 106 | case ADD_SETTLEMENT_SUCCESS: { |
92 | return state.setIn(['addSettlement', 'isFetching'], true) | 107 | return state.setIn(['addSettlement', 'isFetching'], true) |
108 | + .set('showWithdrawalDialog', action.payload.isShow) | ||
93 | .setIn(['addSettlement', 'error'], null); | 109 | .setIn(['addSettlement', 'error'], null); |
94 | } | 110 | } |
95 | 111 | ||
96 | case ADD_SETTLEMENT_FAILURE: { | 112 | case ADD_SETTLEMENT_FAILURE: { |
97 | return state.setIn(['addSettlement', 'isFetching'], false) | 113 | return state.setIn(['addSettlement', 'isFetching'], false) |
98 | - .set('showWithdrawalDialog', action.payload.isShow) | ||
99 | .setIn(['addSettlement', 'error'], null); | 114 | .setIn(['addSettlement', 'error'], null); |
100 | } | 115 | } |
101 | 116 | ||
117 | + case RESOURCE_INFO_REQUEST: { | ||
118 | + return state.setIn(['resourceInfo', 'isFetching'], true) | ||
119 | + .setIn(['resourceInfo', 'error'], action.payload); | ||
120 | + } | ||
121 | + | ||
122 | + case RESOURCE_INFO_SUCCESS: { | ||
123 | + return state.setIn(['resourceInfo', 'isFetching'], false) | ||
124 | + .setIn(['resourceInfo', 'resourceList'], Immutable.fromJS(action.payload)) | ||
125 | + .setIn(['resourceInfo', 'error'], null); | ||
126 | + } | ||
127 | + | ||
128 | + case RESOURCE_INFO_FAILURE: { | ||
129 | + return state.setIn(['resourceInfo', 'isFetching'], false) | ||
130 | + .setIn(['resourceInfo', 'error'], null); | ||
131 | + } | ||
132 | + | ||
102 | case RECENTLY_ORDER_REQUEST: { | 133 | case RECENTLY_ORDER_REQUEST: { |
103 | return state.setIn(['recentlyOrder', 'isFetching'], true) | 134 | return state.setIn(['recentlyOrder', 'isFetching'], true) |
104 | .setIn(['recentlyOrder', 'error'], null); | 135 | .setIn(['recentlyOrder', 'error'], null); |
@@ -47,6 +47,24 @@ export default class AllianceService { | @@ -47,6 +47,24 @@ export default class AllianceService { | ||
47 | }); | 47 | }); |
48 | } | 48 | } |
49 | 49 | ||
50 | + //获取资源位 | ||
51 | + async fetchResourceInfo() { | ||
52 | + let fromPage = Platform.OS === 'android' ? 'aFP_Alliance' : 'iFP_Alliance'; | ||
53 | + return await this.api.get({ | ||
54 | + url: '/operations/api/v5/resource/get', | ||
55 | + body: { | ||
56 | + content_code: 'c2802b9fb47c148dff37ece842bf190e', | ||
57 | + fromPage | ||
58 | + } | ||
59 | + }) | ||
60 | + .then((json) => { | ||
61 | + return json; | ||
62 | + }) | ||
63 | + .catch((error) => { | ||
64 | + throw(error); | ||
65 | + }); | ||
66 | + } | ||
67 | + | ||
50 | //(用户前台获取个人推广近期订单(10个)) | 68 | //(用户前台获取个人推广近期订单(10个)) |
51 | async fetchRecentlyOrderLimitTen(uid) { | 69 | async fetchRecentlyOrderLimitTen(uid) { |
52 | return await this.api.get({ | 70 | return await this.api.get({ |
-
Please register or login to post a comment