Data.js
8.87 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
'use strict';
import React, {Component} from 'react';
import {DeviceEventEmitter, Dimensions, Image, StyleSheet, Text, TouchableOpacity, View, ScrollView} from 'react-native';
import HelpTipsModal from "./HelpTipsModal";
import SureModal from "./SureModal";
import WithdrawModal from "./WithdrawModal";
import ScrollableTabView from 'react-native-scrollable-tab-view';
import TabStatistics from '../components/TabStatistics';
import Statistics from "./Statistics";
import ReactNative from "react-native";
const tabTitles = ['昨日', '本月', '上月'];
export default class Data extends Component {
constructor(props) {
super(props);
}
componentDidMount() {
this.subscription = DeviceEventEmitter.addListener('BankCardBindSuccessEvent', () => {
this.props.refreshSettlementInfo && this.props.refreshSettlementInfo();
});
}
componentWillUnmount() {
this.subscription.remove();
}
render() {
let {
isShowHelp,
isShowSure,
isShowWithdrawal,
statisticsInfo
} = this.props;
let bindStatus = this.props.settlementInfo.settlementInfoData.hasBankCard;
let scrollEnabled = height < 667;
return (
<ScrollView style={styles.container} scrollEnabled = {scrollEnabled}>
<HelpTipsModal
tips={this.props.tips}
isShowHelp={isShowHelp}
hiddenHelpDialog={this.props.hiddenHelpDialog}/>
<SureModal
isShow={isShowSure}
hiddenSureDialog={this.props.hiddenSureDialog}
showWithdrawalDialog={this.props.showWithdrawalDialog}/>
<WithdrawModal
isShowWithdrawal={isShowWithdrawal}
hiddenWithDrawDialog={this.props.hiddenWithDrawDialog}/>
<View style={styles.headerBackground}>
<Text style={styles.canWithDrawText}>可提现金额</Text>
<View style={styles.amountView}>
<View style={styles.textView}>
<Text
style={styles.amountText}><Text style={{fontSize:30}}>¥</Text>{this.props.settlementInfo.settlementInfoData.settlementAmount}</Text>
<View style={styles.reminderView}>
<Image style={styles.reminderImage} source={require('../images/reminder.png')}/>
<Text style={styles.reminderText}>每月15日统一打款,节假日顺延</Text>
</View>
</View>
<View style={[styles.textView, {paddingRight: 30}]}>
<TouchableOpacity activeOpacity={1} onPress={() => {
if (!bindStatus) {
this.props.showHelpDialog && this.props.showHelpDialog('请先完成银行卡绑定');
return
}
if (!this.props.settlementInfo.settlementInfoData.settlementAmount || this.props.settlementInfo.settlementInfoData.settlementAmount === 0) {
return
}
if (this.props.settlementInfo.settlementInfoData.canSettlement) {
!this.props.addSettlement.isFetching && this.props.showSureDialog && this.props.showSureDialog();
} else {
this.props.showHelpDialog && this.props.showHelpDialog('您有正在处理中的提现,请耐心等待完成后再做新的提现操作');
}
}}>
<Text style={styles.amountButton}>提现</Text>
</TouchableOpacity>
</View>
</View>
</View>
<View style={styles.lineView}/>
<TouchableOpacity activeOpacity={1} style={styles.withdrawView} onPress={() => {
this.props.jumpWithUrl && this.props.jumpWithUrl('提现记录', 'withdrawalRecord');
}}>
<Text style={styles.hasWithDrawText}>已提现金额</Text>
<View style={[styles.textView, {flexDirection: 'row', paddingRight: 15, marginTop: 5}]}>
<Text
style={[styles.hasWithDrawText,{marginTop: -2}]}>¥{this.props.settlementInfo.settlementInfoData.historySettlementAmount}</Text>
<Image style={styles.arrowImage} source={require('../images/arrow.png')}/>
</View>
</TouchableOpacity>
<View style={{height: 10, backgroundColor: '#f0f0f0'}}/>
<TouchableOpacity activeOpacity={1} style={styles.withdrawView} onPress={() => {
this.props.jumpWithUrl && this.props.jumpWithUrl('全部佣金', 'orderIncome');
}}>
<Text style={styles.hasWithDrawText}>全部佣金数据</Text>
<View style={[styles.textView, {flexDirection: 'row', paddingRight: 15}]}>
<Image style={styles.arrowImage} source={require('../images/arrow.png')}/>
</View>
</TouchableOpacity>
<View style={{height: 10, backgroundColor: '#f0f0f0'}}/>
<ScrollableTabView
style={{backgroundColor: 'white'}}
locked={true}
scrollWithoutAnimation={true}
renderTabBar={() => <TabStatistics tabNames={tabTitles}/>}
onChangeTab={(obj) => {this.props.changeTab && this.props.changeTab(obj.i + 1);}}
>
<Statistics statisticsInfo={statisticsInfo} jumpWithUrl={this.props.jumpWithUrl}/>
<Statistics statisticsInfo={statisticsInfo} jumpWithUrl={this.props.jumpWithUrl}/>
<Statistics statisticsInfo={statisticsInfo} jumpWithUrl={this.props.jumpWithUrl}/>
</ScrollableTabView>
</ScrollView>
);
}
}
let {width, height} = Dimensions.get('window');
let styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#f0f0f0'
},
textStyle: {
flex: 1,
fontSize: 20,
marginTop: 20,
textAlign: 'center',
},
textView: {
flexDirection: 'column',
justifyContent: 'center',
alignItems: 'flex-start',
},
reminderImage: {
width: 11,
height: 11,
},
reminderView: {
marginTop: 2,
flexDirection: 'row',
alignItems: 'center',
},
reminderText: {
fontFamily: 'PingFang-SC-Regular',
color: '#B0B0B0',
fontSize: 10,
paddingLeft: 2
},
headerBackground: {
width: width,
height: 128,
backgroundColor: '#FFFFFF',
paddingTop: 23,
paddingLeft: 15,
paddingBottom: 25,
position: 'relative'
},
canWithDrawText: {
height: 20,
fontFamily: 'PingFang-SC-Regular',
fontSize: 12,
color: '#B0B0B0',
marginBottom:5,
},
amountView: {
width: width,
height: 58,
marginTop: 1,
flexDirection: 'row',
justifyContent: 'space-between'
},
amountText: {
fontSize: 48,
color: '#444444',
fontWeight: 'bold',
},
amountButton: {
fontFamily: 'PingFang-SC-Regular',
fontSize: 14,
fontWeight: 'bold',
backgroundColor: '#D0021B',
color: '#FFFFFF',
borderWidth: 1,
borderColor: '#D0021B',
borderRadius: 4,
overflow: 'hidden',
paddingTop: 5,
paddingLeft: 18,
paddingRight: 18,
paddingBottom: 5,
textAlign: 'center',
},
withdrawView: {
width: width,
height: 50,
backgroundColor: '#FFFFFF',
flexDirection: 'row',
paddingLeft: 15,
alignItems: 'center',
justifyContent: 'space-between'
},
hasWithDrawText: {
fontFamily: 'PingFang-SC-Regular',
fontSize: 14,
color: '#444444',
},
arrowImage: {
width: 16,
height: 16,
marginLeft: 2,
},
lineView: {
width: width,
height: 0.5,
backgroundColor: '#e0e0e0'
},
})
;