Showing
10 changed files
with
538 additions
and
10 deletions
@@ -4,6 +4,7 @@ import React, {Component} from 'react'; | @@ -4,6 +4,7 @@ import React, {Component} from 'react'; | ||
4 | import {DeviceEventEmitter, Dimensions, Image, StyleSheet, Text, TextInput, TouchableOpacity, View, Linking, Platform} from 'react-native'; | 4 | import {DeviceEventEmitter, Dimensions, Image, StyleSheet, Text, TextInput, TouchableOpacity, View, Linking, Platform} from 'react-native'; |
5 | import SureBankCardModal from "./SureBankCardModal"; | 5 | import SureBankCardModal from "./SureBankCardModal"; |
6 | import BankBranchModal from "./BankBranchModal"; | 6 | import BankBranchModal from "./BankBranchModal"; |
7 | +import CityPicker from './common/CityPicker' | ||
7 | 8 | ||
8 | export default class BankCard extends Component { | 9 | export default class BankCard extends Component { |
9 | 10 | ||
@@ -21,6 +22,9 @@ export default class BankCard extends Component { | @@ -21,6 +22,9 @@ export default class BankCard extends Component { | ||
21 | bankCode: '', | 22 | bankCode: '', |
22 | cardNo: '', | 23 | cardNo: '', |
23 | bankBranch: '', | 24 | bankBranch: '', |
25 | + bankCityId: '', | ||
26 | + bankLocationStr: '', | ||
27 | + isShowLocationAlert: false, | ||
24 | } | 28 | } |
25 | } | 29 | } |
26 | 30 | ||
@@ -77,12 +81,20 @@ export default class BankCard extends Component { | @@ -77,12 +81,20 @@ export default class BankCard extends Component { | ||
77 | return | 81 | return |
78 | } | 82 | } |
79 | 83 | ||
84 | + let bankCityId = this.state.bankCityId | ||
85 | + | ||
86 | + if (!bankCityId) { | ||
87 | + this.setState({messageTips: '请输入开户城市'}); | ||
88 | + return | ||
89 | + } | ||
90 | + | ||
80 | this.setState({messageTips: '', isUpdate: true}); | 91 | this.setState({messageTips: '', isUpdate: true}); |
81 | - this.props.checkBankCard && this.props.checkBankCard(this.state.name, this.state.number, this.state.bankCode, this.state.cardNo,bankBranch); | 92 | + this.props.checkBankCard && this.props.checkBankCard(this.state.name, this.state.number, this.state.bankCode, this.state.cardNo,bankBranch, bankCityId); |
82 | } | 93 | } |
83 | 94 | ||
84 | renderUnBind() { | 95 | renderUnBind() { |
85 | let checkMessage = this.state.messageTips || this.props.checkBankCardResult.message; | 96 | let checkMessage = this.state.messageTips || this.props.checkBankCardResult.message; |
97 | + | ||
86 | if (this.state.isShow) { | 98 | if (this.state.isShow) { |
87 | return ( | 99 | return ( |
88 | <View> | 100 | <View> |
@@ -126,6 +138,26 @@ export default class BankCard extends Component { | @@ -126,6 +138,26 @@ export default class BankCard extends Component { | ||
126 | </View> | 138 | </View> |
127 | <View style={styles.lineView}/> | 139 | <View style={styles.lineView}/> |
128 | <View style={styles.inputView}> | 140 | <View style={styles.inputView}> |
141 | + <Text style={[styles.wordText, {width: 76, color: '#444444'}]}>开户城市</Text> | ||
142 | + <TouchableOpacity | ||
143 | + style={{flexDirection: 'row', height: 44, alignItems: 'center'}} activeOpacity={0.8} | ||
144 | + onPress={() => { | ||
145 | + this.setState({ | ||
146 | + isShowLocationAlert: true | ||
147 | + }) | ||
148 | + }} | ||
149 | + > | ||
150 | + <Text style={[styles.wordText, { | ||
151 | + width: width-124, | ||
152 | + paddingLeft: Platform.OS === 'ios' ? 0 : 12, | ||
153 | + color: this.state.bankLocationStr === '' ? '#b0b0b0' : '#444444' | ||
154 | + }]}>{this.state.bankLocationStr === '' ? '请选择开户城市' : this.state.bankLocationStr}</Text> | ||
155 | + <Image style={styles.arrowImage} source={require('../images/arrow.png')}/> | ||
156 | + </TouchableOpacity> | ||
157 | + | ||
158 | + </View> | ||
159 | + <View style={styles.lineView}/> | ||
160 | + <View style={styles.inputView}> | ||
129 | <Text style={[styles.wordText, {width: 76, color: '#444444'}]}>分行 支行</Text> | 161 | <Text style={[styles.wordText, {width: 76, color: '#444444'}]}>分行 支行</Text> |
130 | <TextInput | 162 | <TextInput |
131 | ref="subBrandNameInput" | 163 | ref="subBrandNameInput" |
@@ -196,6 +228,15 @@ export default class BankCard extends Component { | @@ -196,6 +228,15 @@ export default class BankCard extends Component { | ||
196 | 228 | ||
197 | return ( | 229 | return ( |
198 | <View style={styles.container}> | 230 | <View style={styles.container}> |
231 | + <CityPicker | ||
232 | + isShow={this.state.isShowLocationAlert} | ||
233 | + setCityInfo={({bankCityId, bankLocationStr})=> { | ||
234 | + this.setState({ | ||
235 | + bankCityId, | ||
236 | + bankLocationStr | ||
237 | + }) | ||
238 | + }} | ||
239 | + /> | ||
199 | <BankBranchModal | 240 | <BankBranchModal |
200 | isShow={isShowBankAlert} | 241 | isShow={isShowBankAlert} |
201 | hiddenBankTipsAlert={this.props.hiddenBankTipsAlert}/> | 242 | hiddenBankTipsAlert={this.props.hiddenBankTipsAlert}/> |
@@ -122,17 +122,17 @@ export default class Data extends Component { | @@ -122,17 +122,17 @@ export default class Data extends Component { | ||
122 | 122 | ||
123 | if (this.props.settlementInfo.settlementInfoData.canSettlement) { | 123 | if (this.props.settlementInfo.settlementInfoData.canSettlement) { |
124 | 124 | ||
125 | - if (this.props.settlementInfo.settlementInfoData.settlementAmount <= 500) { | ||
126 | - !this.props.addSettlement.isFetching && this.props.showSureDialog && this.props.showSureDialog(); | ||
127 | - | ||
128 | - } else { | 125 | + // if (this.props.settlementInfo.settlementInfoData.settlementAmount <= 500) { |
126 | + // !this.props.addSettlement.isFetching && this.props.showSureDialog && this.props.showSureDialog(); | ||
127 | + // | ||
128 | + // } else { | ||
129 | if (!isIDBind) { | 129 | if (!isIDBind) { |
130 | this.props.showBindAlertDialog && this.props.showBindAlertDialog(); | 130 | this.props.showBindAlertDialog && this.props.showBindAlertDialog(); |
131 | return | 131 | return |
132 | } else { | 132 | } else { |
133 | this.props.showCheckSettleDialog && this.props.showCheckSettleDialog(); | 133 | this.props.showCheckSettleDialog && this.props.showCheckSettleDialog(); |
134 | } | 134 | } |
135 | - } | 135 | + // } |
136 | 136 | ||
137 | } else { | 137 | } else { |
138 | this.props.showHelpDialog && this.props.showHelpDialog('您有正在处理中的提现,请耐心等待完成后再做新的提现操作'); | 138 | this.props.showHelpDialog && this.props.showHelpDialog('您有正在处理中的提现,请耐心等待完成后再做新的提现操作'); |
js/alliance/components/common/CityPicker.js
0 → 100644
1 | +/** | ||
2 | + * CityPicker.js | ||
3 | + *@author dennis | ||
4 | + *@createtime 8/22/19 | ||
5 | + *@description 城市选着器 | ||
6 | + */ | ||
7 | + | ||
8 | +'use strict' | ||
9 | + | ||
10 | + | ||
11 | +import React, {Component} from 'react' | ||
12 | + | ||
13 | + | ||
14 | +import { | ||
15 | + Modal, | ||
16 | + StyleSheet, | ||
17 | + TouchableOpacity, | ||
18 | + View, | ||
19 | + Text, | ||
20 | + Image, | ||
21 | + FlatList, | ||
22 | +} from 'react-native' | ||
23 | + | ||
24 | +import {bindActionCreators} from 'redux' | ||
25 | + | ||
26 | +import {connect} from 'react-redux' | ||
27 | + | ||
28 | +import {Map} from 'immutable' | ||
29 | + | ||
30 | +import * as allianceActions from '../../reducers/alliance/allianceActions' | ||
31 | + | ||
32 | +const actions = [ | ||
33 | + allianceActions, | ||
34 | +]; | ||
35 | + | ||
36 | + | ||
37 | +function mapStateToProps(state) { | ||
38 | + return { | ||
39 | + ...state | ||
40 | + }; | ||
41 | +} | ||
42 | + | ||
43 | +function mapDispatchToProps(dispatch) { | ||
44 | + | ||
45 | + const creators = Map() | ||
46 | + .merge(...actions) | ||
47 | + .filter(value => typeof value === 'function') | ||
48 | + .toObject(); | ||
49 | + | ||
50 | + return { | ||
51 | + actions: bindActionCreators(creators, dispatch), | ||
52 | + dispatch | ||
53 | + }; | ||
54 | +} | ||
55 | + | ||
56 | + | ||
57 | + | ||
58 | +class CityPicker extends Component{ | ||
59 | + | ||
60 | + constructor(props) { | ||
61 | + super(props) | ||
62 | + | ||
63 | + this.state = { | ||
64 | + province: '', | ||
65 | + city: '', | ||
66 | + currentLevel: 0, | ||
67 | + currenctProvinceid: 0, | ||
68 | + currentCityid: 0, | ||
69 | + isShow: props.isShow, | ||
70 | + | ||
71 | + } | ||
72 | + } | ||
73 | + | ||
74 | + | ||
75 | + componentDidMount() { | ||
76 | + | ||
77 | + this.props.actions.getLocationList() | ||
78 | + } | ||
79 | + | ||
80 | + componentWillReceiveProps(nextProps){ | ||
81 | + // if (this.props.isShow != nextProps.isShow) { | ||
82 | + this.setState({ | ||
83 | + isShow: nextProps.isShow | ||
84 | + }) | ||
85 | + // } | ||
86 | + } | ||
87 | + | ||
88 | + startDismiss = () => { | ||
89 | + this.setState({ | ||
90 | + isShow: false | ||
91 | + }) | ||
92 | + } | ||
93 | + | ||
94 | + pressLocationLevel = (level) => { | ||
95 | + this.setState({ | ||
96 | + currentLevel: level | ||
97 | + }) | ||
98 | + | ||
99 | + } | ||
100 | + | ||
101 | + pressItem = (item) => { | ||
102 | + | ||
103 | + if (this.state.currentLevel == 0) { | ||
104 | + | ||
105 | + if (item.id !== this.state.currenctProvinceid) { | ||
106 | + this.setState({ | ||
107 | + currenctProvinceid: item.id, | ||
108 | + province: item.caption, | ||
109 | + currentCityid: 0, | ||
110 | + city: '' | ||
111 | + }) | ||
112 | + | ||
113 | + this.props.setCityInfo && this.props.setCityInfo({ | ||
114 | + bankCityId: '', | ||
115 | + bankLocationStr: '', | ||
116 | + }) | ||
117 | + this.props.actions.getLocationSuccess(item.sub, 1) | ||
118 | + } | ||
119 | + | ||
120 | + } else { | ||
121 | + if (item.id !== this.state.currentCityid) { | ||
122 | + this.setState({ | ||
123 | + currentCityid: item.id, | ||
124 | + city: item.caption, | ||
125 | + }) | ||
126 | + | ||
127 | + this.props.setCityInfo && this.props.setCityInfo({ | ||
128 | + bankCityId: item.id, | ||
129 | + bankLocationStr: item.caption, | ||
130 | + }) | ||
131 | + } | ||
132 | + } | ||
133 | + } | ||
134 | + | ||
135 | + renderItem = ({item, index}) => { | ||
136 | + | ||
137 | + let currentid = this.state.currentLevel == 0 ? this.state.currenctProvinceid : this.state.currentCityid | ||
138 | + let isSelected = item.id == currentid | ||
139 | + return ( | ||
140 | + <View style={styles.item}> | ||
141 | + <TouchableOpacity | ||
142 | + style={[styles.item, styles.itemRow]} | ||
143 | + activeOpacity={1} | ||
144 | + onPress={() => { | ||
145 | + this.pressItem(item) | ||
146 | + }} | ||
147 | + > | ||
148 | + <Text style={isSelected ? styles.locationNameChoosen : styles.locationName}>{item.caption}</Text> | ||
149 | + | ||
150 | + {isSelected ? <Image | ||
151 | + resizeMode={'contain'} | ||
152 | + source={require('../../../brandStore/image/filter/brandstore_filter_selected.png')} | ||
153 | + style={styles.selectImage}/>: null} | ||
154 | + | ||
155 | + | ||
156 | + </TouchableOpacity> | ||
157 | + </View> | ||
158 | + ) | ||
159 | + } | ||
160 | + | ||
161 | + render() { | ||
162 | + | ||
163 | + let { | ||
164 | + cityLocationInfo | ||
165 | + } = this.props.alliance | ||
166 | + | ||
167 | + | ||
168 | + let allData = this.state.currentLevel == 0 ? cityLocationInfo.get('provinceList').toJS() : cityLocationInfo.get('cityList').toJS() | ||
169 | + | ||
170 | + allData = allData || [] | ||
171 | + | ||
172 | + return ( | ||
173 | + <Modal | ||
174 | + visible={this.state.isShow} | ||
175 | + animationType={'none'} | ||
176 | + transparent={true} | ||
177 | + onRequestClose={() => { | ||
178 | + }} | ||
179 | + > | ||
180 | + <View style={styles.container}> | ||
181 | + <View style={[styles.mask]}> | ||
182 | + <TouchableOpacity | ||
183 | + activeOpacity={1} | ||
184 | + onPress={this.startDismiss} | ||
185 | + style={styles.modalBackground}/> | ||
186 | + </View> | ||
187 | + | ||
188 | + <View style={styles.contentContainer}> | ||
189 | + <View style={styles.titleContainer}> | ||
190 | + <Text style={styles.title}> | ||
191 | + {'开户城市'} | ||
192 | + </Text> | ||
193 | + <TouchableOpacity style={styles.closeBtn} | ||
194 | + activeOpacity={1} | ||
195 | + onPress={this.startDismiss} | ||
196 | + > | ||
197 | + <Image | ||
198 | + resizeMode={'contain'} | ||
199 | + source={require('../../../studentCertification/images/close.png')} | ||
200 | + style={styles.closeBtnImg}> | ||
201 | + | ||
202 | + </Image> | ||
203 | + </TouchableOpacity> | ||
204 | + </View> | ||
205 | + | ||
206 | + <View style={styles.locationChoosenContainer}> | ||
207 | + <TouchableOpacity | ||
208 | + activeOpacity={1} | ||
209 | + style={this.state.currentLevel == 0 ? styles.areaChoosen : null} | ||
210 | + onPress={() => { | ||
211 | + this.pressLocationLevel(0) | ||
212 | + }} | ||
213 | + > | ||
214 | + | ||
215 | + <Text style={this.state.currentLevel == 0 ? styles.areaCurrent : styles.area}>{this.state.province || '请选择'}</Text> | ||
216 | + </TouchableOpacity> | ||
217 | + <TouchableOpacity | ||
218 | + activeOpacity={1} | ||
219 | + style={this.state.currentLevel == 1 ? styles.areaChoosen : null} | ||
220 | + onPress={() => { | ||
221 | + this.pressLocationLevel(1) | ||
222 | + }} | ||
223 | + > | ||
224 | + <Text style={this.state.currentLevel == 1 ? styles.areaCurrent : styles.area}>{this.state.city || '请选择'}</Text> | ||
225 | + </TouchableOpacity> | ||
226 | + | ||
227 | + </View> | ||
228 | + | ||
229 | + <FlatList | ||
230 | + renderItem={this.renderItem} | ||
231 | + data={allData} | ||
232 | + initialNumToRender={100} | ||
233 | + keyExtractor={(item, index) => '' + index} | ||
234 | + showsVerticalScrollIndicator={false} | ||
235 | + style={styles.contentlist} | ||
236 | + /> | ||
237 | + | ||
238 | + </View> | ||
239 | + | ||
240 | + | ||
241 | + | ||
242 | + | ||
243 | + </View> | ||
244 | + </Modal> | ||
245 | + ) | ||
246 | + } | ||
247 | +} | ||
248 | + | ||
249 | + | ||
250 | +const styles = StyleSheet.create({ | ||
251 | + container: { | ||
252 | + flex: 1, | ||
253 | + justifyContent: 'flex-end' | ||
254 | + }, | ||
255 | + modalBackground: { | ||
256 | + flex: 1, | ||
257 | + }, | ||
258 | + | ||
259 | + mask: { | ||
260 | + position: 'absolute', | ||
261 | + top: 0, | ||
262 | + left: 0, | ||
263 | + right: 0, | ||
264 | + bottom: 0, | ||
265 | + backgroundColor: 'rgba(0, 0, 0, 1)', | ||
266 | + opacity: 0.4 | ||
267 | + }, | ||
268 | + | ||
269 | + contentContainer: { | ||
270 | + paddingTop: 20, | ||
271 | + backgroundColor: '#FFFFFF', | ||
272 | + overflow: 'hidden', | ||
273 | + paddingBottom: 3, | ||
274 | + }, | ||
275 | + | ||
276 | + titleContainer: { | ||
277 | + flexDirection: 'row', | ||
278 | + alignItems: 'center', | ||
279 | + height: 40, | ||
280 | + | ||
281 | + }, | ||
282 | + | ||
283 | + title: { | ||
284 | + flex: 1, | ||
285 | + textAlign: 'center', | ||
286 | + fontSize: 18, | ||
287 | + color: 'gray' | ||
288 | + }, | ||
289 | + | ||
290 | + closeBtn: { | ||
291 | + width: 25, | ||
292 | + height: 25, | ||
293 | + marginRight: 10, | ||
294 | + }, | ||
295 | + | ||
296 | + closeBtnImg: { | ||
297 | + width: 15, | ||
298 | + height: 15, | ||
299 | + }, | ||
300 | + | ||
301 | + selectImage: { | ||
302 | + tintColor: 'red', | ||
303 | + marginLeft: 10, | ||
304 | + }, | ||
305 | + | ||
306 | + locationChoosenContainer: { | ||
307 | + flexDirection: 'row', | ||
308 | + height: 35, | ||
309 | + borderBottomWidth: 1, | ||
310 | + borderBottomColor: '#f5f5f5', | ||
311 | + // paddingLeft: 20, | ||
312 | + }, | ||
313 | + | ||
314 | + areaChoosen: { | ||
315 | + | ||
316 | + borderBottomWidth: 2, | ||
317 | + borderBottomColor: 'red' | ||
318 | + }, | ||
319 | + | ||
320 | + area: { | ||
321 | + fontSize: 15, | ||
322 | + color: 'black', | ||
323 | + marginHorizontal: 10, | ||
324 | + }, | ||
325 | + | ||
326 | + areaCurrent: { | ||
327 | + fontSize: 15, | ||
328 | + color: 'red', | ||
329 | + marginHorizontal: 10, | ||
330 | + }, | ||
331 | + | ||
332 | + locationName: { | ||
333 | + fontSize: 15, | ||
334 | + color: 'black' | ||
335 | + }, | ||
336 | + | ||
337 | + locationNameChoosen: { | ||
338 | + fontSize: 15, | ||
339 | + color: 'red' | ||
340 | + }, | ||
341 | + | ||
342 | + contentlist: { | ||
343 | + height: 200, | ||
344 | + paddingTop: 20, | ||
345 | + paddingLeft: 20, | ||
346 | + | ||
347 | + }, | ||
348 | + | ||
349 | + item: { | ||
350 | + | ||
351 | + height: 40, | ||
352 | + justifyContent: 'flex-start', | ||
353 | + | ||
354 | + }, | ||
355 | + | ||
356 | + itemRow: { | ||
357 | + flexDirection: 'row' | ||
358 | + } | ||
359 | + | ||
360 | +}) | ||
361 | + | ||
362 | + | ||
363 | + | ||
364 | +export default connect(mapStateToProps, mapDispatchToProps)(CityPicker) |
@@ -193,4 +193,8 @@ export default keyMirror({ | @@ -193,4 +193,8 @@ export default keyMirror({ | ||
193 | INVITE_YOHO_RESOURCEINFO_REQUEST: null, | 193 | INVITE_YOHO_RESOURCEINFO_REQUEST: null, |
194 | INVITE_YOHO_RESOURCEINFO_SUCCESS: null, | 194 | INVITE_YOHO_RESOURCEINFO_SUCCESS: null, |
195 | INVITE_YOHO_RESOURCEINFO_FAILURE: null, | 195 | INVITE_YOHO_RESOURCEINFO_FAILURE: null, |
196 | + | ||
197 | + GET_LOCATION_REQUEST: null, | ||
198 | + GET_LOCATION_SUCCESS: null, | ||
199 | + GET_LOCATION_FAILURE: null, | ||
196 | }); | 200 | }); |
@@ -62,8 +62,8 @@ class BankCardContainer extends Component { | @@ -62,8 +62,8 @@ class BankCardContainer extends Component { | ||
62 | ReactNative.NativeModules.YH_CommonHelper.jumpWithUrl(url); | 62 | ReactNative.NativeModules.YH_CommonHelper.jumpWithUrl(url); |
63 | } | 63 | } |
64 | 64 | ||
65 | - _checkBankCard(name, idCardNo, bankCode, bankCardNo,bankBranch) { | ||
66 | - this.props.actions.checkBankCard(name, idCardNo, bankCode, bankCardNo,bankBranch); | 65 | + _checkBankCard(name, idCardNo, bankCode, bankCardNo,bankBranch,bankCityId) { |
66 | + this.props.actions.checkBankCard(name, idCardNo, bankCode, bankCardNo,bankBranch, bankCityId); | ||
67 | } | 67 | } |
68 | 68 | ||
69 | _bindBankCard(bankInfo) { | 69 | _bindBankCard(bankInfo) { |
@@ -144,8 +144,36 @@ const { | @@ -144,8 +144,36 @@ const { | ||
144 | HIDE_TOAST, | 144 | HIDE_TOAST, |
145 | SHOW_LOADING, | 145 | SHOW_LOADING, |
146 | 146 | ||
147 | + GET_LOCATION_REQUEST, | ||
148 | + GET_LOCATION_SUCCESS, | ||
149 | + GET_LOCATION_FAILURE, | ||
150 | + | ||
147 | } = require('../../constants/actionTypes').default; | 151 | } = require('../../constants/actionTypes').default; |
148 | 152 | ||
153 | + | ||
154 | +export function getLocationRequest(level) { | ||
155 | + return { | ||
156 | + type: GET_LOCATION_REQUEST, | ||
157 | + payload: level | ||
158 | + } | ||
159 | +} | ||
160 | + | ||
161 | +export function getLocationSuccess(json, level) { | ||
162 | + return { | ||
163 | + type: GET_LOCATION_SUCCESS, | ||
164 | + payload: json, | ||
165 | + level | ||
166 | + } | ||
167 | +} | ||
168 | + | ||
169 | +export function getLocatonFailure(error, level) { | ||
170 | + return { | ||
171 | + type: GET_LOCATION_FAILURE, | ||
172 | + payload: error, | ||
173 | + level | ||
174 | + } | ||
175 | +} | ||
176 | + | ||
149 | export function showTipsAlertDialog() { | 177 | export function showTipsAlertDialog() { |
150 | return { | 178 | return { |
151 | type: SHOW_TIPS_ALERT_DIALOG, | 179 | type: SHOW_TIPS_ALERT_DIALOG, |
@@ -1385,12 +1413,12 @@ export function getBankList() { | @@ -1385,12 +1413,12 @@ export function getBankList() { | ||
1385 | }; | 1413 | }; |
1386 | } | 1414 | } |
1387 | 1415 | ||
1388 | -export function checkBankCard(name, idCardNo, bankCode, bankCardNo,bankBranch) { | 1416 | +export function checkBankCard(name, idCardNo, bankCode, bankCardNo,bankBranch, bankCityId) { |
1389 | return (dispatch, getState) => { | 1417 | return (dispatch, getState) => { |
1390 | let {app} = getState(); | 1418 | let {app} = getState(); |
1391 | let fetchCheckBankCard = (uid) => { | 1419 | let fetchCheckBankCard = (uid) => { |
1392 | dispatch(checkBankCardRequest()); | 1420 | dispatch(checkBankCardRequest()); |
1393 | - return new AllianceService(app.host).fetchCheckBankCard(uid, name, idCardNo, bankCode, bankCardNo,bankBranch) | 1421 | + return new AllianceService(app.host).fetchCheckBankCard(uid, name, idCardNo, bankCode, bankCardNo,bankBranch, bankCityId) |
1394 | .then(json => { | 1422 | .then(json => { |
1395 | dispatch(showBankInfoDialog()); | 1423 | dispatch(showBankInfoDialog()); |
1396 | dispatch(checkBankCardSuccess(json)); //校验成功后,显示二次确认弹框 | 1424 | dispatch(checkBankCardSuccess(json)); //校验成功后,显示二次确认弹框 |
@@ -1592,3 +1620,18 @@ export function getIdentityCardInfo() { | @@ -1592,3 +1620,18 @@ export function getIdentityCardInfo() { | ||
1592 | }); | 1620 | }); |
1593 | }; | 1621 | }; |
1594 | } | 1622 | } |
1623 | + | ||
1624 | + | ||
1625 | +export function getLocationList(level=0, id=0) { | ||
1626 | + return (dispatch, getState) => { | ||
1627 | + let {app} = getState(); | ||
1628 | + dispatch(getLocationRequest(level)) | ||
1629 | + return new AllianceService(app.host).getLocationList(id) | ||
1630 | + .then(json => { | ||
1631 | + dispatch(getLocationSuccess(json, level)) | ||
1632 | + }) | ||
1633 | + .catch(error => { | ||
1634 | + dispatch(getLocatonFailure(error, level)) | ||
1635 | + }) | ||
1636 | + } | ||
1637 | +} |
@@ -178,6 +178,7 @@ let InitialState = Record({ | @@ -178,6 +178,7 @@ let InitialState = Record({ | ||
178 | bankCardNo: null, | 178 | bankCardNo: null, |
179 | bankCode: null, | 179 | bankCode: null, |
180 | bankBranch: '', | 180 | bankBranch: '', |
181 | + bankCityId: '', | ||
181 | error: null, | 182 | error: null, |
182 | })), | 183 | })), |
183 | 184 | ||
@@ -238,6 +239,15 @@ let InitialState = Record({ | @@ -238,6 +239,15 @@ let InitialState = Record({ | ||
238 | list: List(), | 239 | list: List(), |
239 | })), | 240 | })), |
240 | 241 | ||
242 | + cityLocationInfo: new (Record({ | ||
243 | + isProvinceFetching: false, | ||
244 | + isCityFetching: false, | ||
245 | + provinceError: null, | ||
246 | + cityError: null, | ||
247 | + provinceList: List(), | ||
248 | + cityList: List(), | ||
249 | + })) | ||
250 | + | ||
241 | }); | 251 | }); |
242 | 252 | ||
243 | export default InitialState; | 253 | export default InitialState; |
@@ -141,6 +141,10 @@ const { | @@ -141,6 +141,10 @@ const { | ||
141 | QUERY_INVITE_YOHOLIST_SUCCESS, | 141 | QUERY_INVITE_YOHOLIST_SUCCESS, |
142 | QUERY_INVITE_YOHOLIST_FAILURE, | 142 | QUERY_INVITE_YOHOLIST_FAILURE, |
143 | 143 | ||
144 | + GET_LOCATION_REQUEST, | ||
145 | + GET_LOCATION_SUCCESS, | ||
146 | + GET_LOCATION_FAILURE, | ||
147 | + | ||
144 | } = require('../../constants/actionTypes').default; | 148 | } = require('../../constants/actionTypes').default; |
145 | 149 | ||
146 | const initialState = new InitialState; | 150 | const initialState = new InitialState; |
@@ -584,6 +588,7 @@ export default function couponReducer(state = initialState, action) { | @@ -584,6 +588,7 @@ export default function couponReducer(state = initialState, action) { | ||
584 | bankCode, | 588 | bankCode, |
585 | bankCardNo, | 589 | bankCardNo, |
586 | bankBranch, | 590 | bankBranch, |
591 | + bankCityId, | ||
587 | } = action.payload; | 592 | } = action.payload; |
588 | return state.setIn(['checkBankCardResult', 'isFetching'], false) | 593 | return state.setIn(['checkBankCardResult', 'isFetching'], false) |
589 | .setIn(['checkBankCardResult', 'name'], name) | 594 | .setIn(['checkBankCardResult', 'name'], name) |
@@ -591,6 +596,7 @@ export default function couponReducer(state = initialState, action) { | @@ -591,6 +596,7 @@ export default function couponReducer(state = initialState, action) { | ||
591 | .setIn(['checkBankCardResult', 'bankCode'], bankCode) | 596 | .setIn(['checkBankCardResult', 'bankCode'], bankCode) |
592 | .setIn(['checkBankCardResult', 'bankCardNo'], bankCardNo) | 597 | .setIn(['checkBankCardResult', 'bankCardNo'], bankCardNo) |
593 | .setIn(['checkBankCardResult', 'bankBranch'], bankBranch) | 598 | .setIn(['checkBankCardResult', 'bankBranch'], bankBranch) |
599 | + .setIn(['checkBankCardResult', 'bankCityId'], bankCityId) | ||
594 | .setIn(['checkBankCardResult', 'message'], null) | 600 | .setIn(['checkBankCardResult', 'message'], null) |
595 | .setIn(['checkBankCardResult', 'error'], null); | 601 | .setIn(['checkBankCardResult', 'error'], null); |
596 | } | 602 | } |
@@ -758,6 +764,42 @@ export default function couponReducer(state = initialState, action) { | @@ -758,6 +764,42 @@ export default function couponReducer(state = initialState, action) { | ||
758 | .setIn(['inviteYohoList', 'error'], action.payload); | 764 | .setIn(['inviteYohoList', 'error'], action.payload); |
759 | } | 765 | } |
760 | 766 | ||
767 | + case GET_LOCATION_REQUEST: { | ||
768 | + | ||
769 | + if (action.payload == 0) {//province | ||
770 | + return state.setIn(['cityLocationInfo', 'isProvinceFetching'], true) | ||
771 | + .setIn(['cityLocationInfo', 'provinceError'], null) | ||
772 | + } else { | ||
773 | + return state.setIn(['cityLocationInfo', 'isCityFetching'], true) | ||
774 | + .setIn(['cityLocationInfo', 'cityError'], null) | ||
775 | + } | ||
776 | + } | ||
777 | + | ||
778 | + case GET_LOCATION_SUCCESS: { | ||
779 | + | ||
780 | + if (action.level == 0) {//province | ||
781 | + return state.setIn(['cityLocationInfo', 'isProvinceFetching'], false) | ||
782 | + .setIn(['cityLocationInfo', 'provinceError'], null) | ||
783 | + .setIn(['cityLocationInfo', 'provinceList'], Immutable.fromJS(action.payload)) | ||
784 | + } else { | ||
785 | + return state.setIn(['cityLocationInfo', 'isCityFetching'], false) | ||
786 | + .setIn(['cityLocationInfo', 'cityError'], null) | ||
787 | + .setIn(['cityLocationInfo', 'cityList'], Immutable.fromJS(action.payload)) | ||
788 | + } | ||
789 | + } | ||
790 | + | ||
791 | + case GET_LOCATION_FAILURE: { | ||
792 | + if (action.level == 0) {//province | ||
793 | + return state.setIn(['cityLocationInfo', 'isProvinceFetching'], false) | ||
794 | + .setIn(['cityLocationInfo', 'provinceError'], null) | ||
795 | + .setIn(['cityLocationInfo', 'provinceList'], Immutable.fromJS([])) | ||
796 | + } else { | ||
797 | + return state.setIn(['cityLocationInfo', 'isCityFetching'], false) | ||
798 | + .setIn(['cityLocationInfo', 'cityError'], null) | ||
799 | + .setIn(['cityLocationInfo', 'cityList'], Immutable.fromJS([])) | ||
800 | + } | ||
801 | + } | ||
802 | + | ||
761 | } | 803 | } |
762 | return state; | 804 | return state; |
763 | } | 805 | } |
@@ -509,4 +509,23 @@ export default class AllianceService { | @@ -509,4 +509,23 @@ export default class AllianceService { | ||
509 | }); | 509 | }); |
510 | } | 510 | } |
511 | 511 | ||
512 | + // 获取省市列表 | ||
513 | + | ||
514 | + async getLocationList(id = 0) { | ||
515 | + return await this.api.get({ | ||
516 | + url: '', | ||
517 | + body: { | ||
518 | + method: 'app.address.getlist', | ||
519 | + id | ||
520 | + } | ||
521 | + }) | ||
522 | + .then((json) => { | ||
523 | + return json; | ||
524 | + }) | ||
525 | + .catch((error) => { | ||
526 | + throw(error); | ||
527 | + }); | ||
528 | + | ||
529 | + } | ||
530 | + | ||
512 | } | 531 | } |
-
Please register or login to post a comment