还款页面,review by redding
Showing
22 changed files
with
866 additions
and
493 deletions
@@ -16,11 +16,14 @@ import configureStore from './store/configureStore'; | @@ -16,11 +16,14 @@ import configureStore from './store/configureStore'; | ||
16 | import {Record, List, Map} from 'immutable'; | 16 | import {Record, List, Map} from 'immutable'; |
17 | 17 | ||
18 | import appInitialState from './reducers/app/appInitialState'; | 18 | import appInitialState from './reducers/app/appInitialState'; |
19 | -import installmentInitialState from './reducers/installment/installmentInitialState'; | 19 | +import installmentInitialState from './reducers/installment/installment/installmentInitialState'; |
20 | +import newRegisterInitialState from './reducers/installment/newRegister/newRegisterInitialState'; | ||
21 | +import repayListInitialState from './reducers/installment/repayList/repayListInitialState'; | ||
20 | 22 | ||
21 | import InstallmentContainer from './containers/InstallmentContainer'; | 23 | import InstallmentContainer from './containers/InstallmentContainer'; |
22 | import OpenContainer from './containers/OpenContainer'; | 24 | import OpenContainer from './containers/OpenContainer'; |
23 | import InstallmentStatusContainer from './containers/InstallmentStatusContainer'; | 25 | import InstallmentStatusContainer from './containers/InstallmentStatusContainer'; |
26 | +import RepayListContainer from './containers/RepayListContainer'; | ||
24 | 27 | ||
25 | import { | 28 | import { |
26 | setPlatform, | 29 | setPlatform, |
@@ -29,12 +32,14 @@ import { | @@ -29,12 +32,14 @@ import { | ||
29 | 32 | ||
30 | import { | 33 | import { |
31 | setInstallmentStausPageParams, | 34 | setInstallmentStausPageParams, |
32 | -} from './reducers/installment/installmentActions'; | 35 | +} from './reducers/installment/installment/installmentActions'; |
33 | 36 | ||
34 | function getInitialState() { | 37 | function getInitialState() { |
35 | const _initState = { | 38 | const _initState = { |
36 | app: (new appInitialState()), | 39 | app: (new appInitialState()), |
37 | installment: (new installmentInitialState()), | 40 | installment: (new installmentInitialState()), |
41 | + newRegister: (new newRegisterInitialState()), | ||
42 | + repayList: (new repayListInitialState()), | ||
38 | }; | 43 | }; |
39 | return _initState; | 44 | return _initState; |
40 | } | 45 | } |
@@ -71,6 +76,12 @@ export default function native(platform) { | @@ -71,6 +76,12 @@ export default function native(platform) { | ||
71 | <InstallmentStatusContainer /> | 76 | <InstallmentStatusContainer /> |
72 | </Provider> | 77 | </Provider> |
73 | ) | 78 | ) |
79 | + } else if (type == 'repayList') { | ||
80 | + return ( | ||
81 | + <Provider store={store}> | ||
82 | + <RepayListContainer /> | ||
83 | + </Provider> | ||
84 | + ); | ||
74 | } | 85 | } |
75 | 86 | ||
76 | } | 87 | } |
@@ -52,6 +52,7 @@ export default class AlreadyOpened extends React.Component { | @@ -52,6 +52,7 @@ export default class AlreadyOpened extends React.Component { | ||
52 | onPressTabBtn={this.props.onPressTabBtn} | 52 | onPressTabBtn={this.props.onPressTabBtn} |
53 | onPressMoreProducts={this.props.onPressMoreProducts} | 53 | onPressMoreProducts={this.props.onPressMoreProducts} |
54 | onPressProtocol={this.props.onPressProtocol} | 54 | onPressProtocol={this.props.onPressProtocol} |
55 | + gotoRepayListPageWithDays={this.props.gotoRepayListPageWithDays} | ||
55 | /> | 56 | /> |
56 | ) | 57 | ) |
57 | } | 58 | } |
@@ -62,6 +63,10 @@ export default class AlreadyOpened extends React.Component { | @@ -62,6 +63,10 @@ export default class AlreadyOpened extends React.Component { | ||
62 | <AlreadyOpenedFooter | 63 | <AlreadyOpenedFooter |
63 | alreadyOpenedPageInfo={alreadyOpenedPageInfo} | 64 | alreadyOpenedPageInfo={alreadyOpenedPageInfo} |
64 | onPressMoreProducts={this.props.onPressMoreProducts} | 65 | onPressMoreProducts={this.props.onPressMoreProducts} |
66 | + gotoRepayListPageWithDays={this.props.gotoRepayListPageWithDays} | ||
67 | + repayRecordCell={this.props.repayRecordCell} | ||
68 | + installmentOrderCell={this.props.installmentOrderCell} | ||
69 | + installmentAccountCell={this.props.installmentAccountCell} | ||
65 | /> | 70 | /> |
66 | ) | 71 | ) |
67 | } | 72 | } |
@@ -34,7 +34,7 @@ export default class AlreadyOpenedFooter extends React.Component { | @@ -34,7 +34,7 @@ export default class AlreadyOpenedFooter extends React.Component { | ||
34 | }}/> | 34 | }}/> |
35 | 35 | ||
36 | <TouchableOpacity activeOpacity={1.0} onPress={() => { | 36 | <TouchableOpacity activeOpacity={1.0} onPress={() => { |
37 | - this.props.monthRepay && this.props.monthRepay(); | 37 | + this.props.gotoRepayListPageWithDays && this.props.gotoRepayListPageWithDays('30'); |
38 | }}> | 38 | }}> |
39 | <View style={styles.cellContainer}> | 39 | <View style={styles.cellContainer}> |
40 | <Text style={styles.cellTitle}>本月待还金额:</Text> | 40 | <Text style={styles.cellTitle}>本月待还金额:</Text> |
@@ -52,7 +52,7 @@ export default class AlreadyOpenedFooter extends React.Component { | @@ -52,7 +52,7 @@ export default class AlreadyOpenedFooter extends React.Component { | ||
52 | }}/> | 52 | }}/> |
53 | 53 | ||
54 | <TouchableOpacity activeOpacity={1.0} onPress={() => { | 54 | <TouchableOpacity activeOpacity={1.0} onPress={() => { |
55 | - this.props.totalRepayCell && this.props.totalRepayCell(); | 55 | + this.props.gotoRepayListPageWithDays && this.props.gotoRepayListPageWithDays('0'); |
56 | }}> | 56 | }}> |
57 | <View style={styles.cellContainer}> | 57 | <View style={styles.cellContainer}> |
58 | <Text style={styles.cellTitle}>待还总金额:</Text> | 58 | <Text style={styles.cellTitle}>待还总金额:</Text> |
@@ -66,7 +66,7 @@ export default class AlreadyOpenedHeader extends React.Component { | @@ -66,7 +66,7 @@ export default class AlreadyOpenedHeader extends React.Component { | ||
66 | {isOverdue? | 66 | {isOverdue? |
67 | <Text style={[styles.imageText,{fontSize:12*DEVICE_WIDTH_RATIO,marginBottom:15*DEVICE_WIDTH_RATIO}]}>您有¥{creditInfo.get('initCreditLimit')}已逾期,点击 | 67 | <Text style={[styles.imageText,{fontSize:12*DEVICE_WIDTH_RATIO,marginBottom:15*DEVICE_WIDTH_RATIO}]}>您有¥{creditInfo.get('initCreditLimit')}已逾期,点击 |
68 | <TouchableOpacity activeOpacity={0.5} onPress={() => { | 68 | <TouchableOpacity activeOpacity={0.5} onPress={() => { |
69 | - this.props.onPressOverdue && this.props.onPressOverdue(); | 69 | + this.props.gotoRepayListPageWithDays && this.props.gotoRepayListPageWithDays('-1'); |
70 | }}> | 70 | }}> |
71 | <View style={{borderColor:'white',borderBottomWidth:0.5*DEVICE_WIDTH_RATIO}}> | 71 | <View style={{borderColor:'white',borderBottomWidth:0.5*DEVICE_WIDTH_RATIO}}> |
72 | <Text style={[styles.imageText]}>查看详情</Text> | 72 | <Text style={[styles.imageText]}>查看详情</Text> |
@@ -75,9 +75,7 @@ export default class AlreadyOpenedHeader extends React.Component { | @@ -75,9 +75,7 @@ export default class AlreadyOpenedHeader extends React.Component { | ||
75 | </Text> | 75 | </Text> |
76 | :null | 76 | :null |
77 | } | 77 | } |
78 | - <TouchableOpacity activeOpacity={0.5} onPress={() => { | ||
79 | - this.props.onPressProtocol && this.props.onPressProtocol(); | ||
80 | - }}> | 78 | + <TouchableOpacity activeOpacity={0.5} onPress={() => {this.props.gotoRepayListPageWithDays &&this.props.gotoRepayListPageWithDays('7')}} > |
81 | <View style={{width:95*DEVICE_WIDTH_RATIO,height:30*DEVICE_WIDTH_RATIO,borderRadius:15*DEVICE_WIDTH_RATIO,alignItems:'center',backgroundColor:'rgba(69, 74, 76, 0.5)',marginTop:15*DEVICE_WIDTH_RATIO}}> | 79 | <View style={{width:95*DEVICE_WIDTH_RATIO,height:30*DEVICE_WIDTH_RATIO,borderRadius:15*DEVICE_WIDTH_RATIO,alignItems:'center',backgroundColor:'rgba(69, 74, 76, 0.5)',marginTop:15*DEVICE_WIDTH_RATIO}}> |
82 | <Text style={[styles.imageText,{lineHeight:20*DEVICE_WIDTH_RATIO}]}>明细</Text> | 80 | <Text style={[styles.imageText,{lineHeight:20*DEVICE_WIDTH_RATIO}]}>明细</Text> |
83 | </View> | 81 | </View> |
@@ -15,6 +15,7 @@ import ReactNative, { | @@ -15,6 +15,7 @@ import ReactNative, { | ||
15 | import Immutable, {Map} from 'immutable'; | 15 | import Immutable, {Map} from 'immutable'; |
16 | import OpenPageInputCell from './OpenPageInputCell'; | 16 | import OpenPageInputCell from './OpenPageInputCell'; |
17 | import Prompt from '../../../coupon/components/coupon/Prompt'; | 17 | import Prompt from '../../../coupon/components/coupon/Prompt'; |
18 | +import SlicedImage from '../../../common/components/SlicedImage'; | ||
18 | 19 | ||
19 | export default class Open extends React.Component { | 20 | export default class Open extends React.Component { |
20 | constructor(props) { | 21 | constructor(props) { |
@@ -28,44 +29,40 @@ export default class Open extends React.Component { | @@ -28,44 +29,40 @@ export default class Open extends React.Component { | ||
28 | } | 29 | } |
29 | 30 | ||
30 | _renderRow(rowData, sectionID, rowID, highlightRow) { | 31 | _renderRow(rowData, sectionID, rowID, highlightRow) { |
32 | + let {bankInfo} = this.props.openPageInfo; | ||
31 | if (!rowData) { | 33 | if (!rowData) { |
32 | return null | 34 | return null |
33 | } | 35 | } |
34 | if (rowData.get('inputKey') == 'BankIcon') { | 36 | if (rowData.get('inputKey') == 'BankIcon') { |
35 | - rowData = rowData.toJS(); | ||
36 | - | ||
37 | - if ( rowData.show == true) { | ||
38 | - let imageUrl = ''; | ||
39 | - if (rowData.bankCode != '') { | ||
40 | - let imageName = rowData.bankCode +''; | ||
41 | - // imageUrl = require('../../image/' + imageName + '.png'); | ||
42 | - imageUrl = require('../../image/check_icon.png'); | ||
43 | - } | ||
44 | - return( | ||
45 | - <View style={styles.bankCellContainer}> | ||
46 | - <View style={styles.bankIconContainer}> | ||
47 | - {rowData.bankCode !='' ? | ||
48 | - <Image | ||
49 | - style={styles.bankIcon} | ||
50 | - source={imageUrl} | ||
51 | - resizeMode={'contain'} | ||
52 | - /> | ||
53 | - :null} | ||
54 | - <Text style={{marginTop: 15*DEVICE_WIDTH_RATIO,marginLeft:5*DEVICE_WIDTH_RATIO,}}>{rowData.bankName?rowData.bankName:rowData.bankText}</Text> | ||
55 | - | 37 | + if (bankInfo) { |
38 | + bankInfo = bankInfo.toJS(); | ||
39 | + if (bankInfo.show == true) { | ||
40 | + return( | ||
41 | + <View style={styles.bankCellContainer}> | ||
42 | + <View style={styles.bankIconContainer}> | ||
43 | + {bankInfo.bankCode !='' ? | ||
44 | + <SlicedImage source={{uri: bankInfo.bankLogo}} style={{width:16,height:16}}/> | ||
45 | + | ||
46 | + :null} | ||
47 | + <Text style={{marginLeft:5*DEVICE_WIDTH_RATIO,}}>{bankInfo.bankName?bankInfo.bankName:bankInfo.bankText}</Text> | ||
48 | + | ||
49 | + </View> | ||
50 | + <View style={{ | ||
51 | + width: width, | ||
52 | + height: 0.5, | ||
53 | + backgroundColor: '#e5e5e5', | ||
54 | + }}/> | ||
56 | </View> | 55 | </View> |
57 | - <View style={{ | ||
58 | - width: width, | ||
59 | - height: 0.5, | ||
60 | - backgroundColor: '#e5e5e5', | ||
61 | - }}/> | ||
62 | - </View> | ||
63 | - | ||
64 | - ); | 56 | + |
57 | + ); | ||
58 | + }else { | ||
59 | + return null; | ||
60 | + } | ||
65 | }else { | 61 | }else { |
66 | return null; | 62 | return null; |
67 | } | 63 | } |
68 | 64 | ||
65 | + | ||
69 | } else { | 66 | } else { |
70 | return ( | 67 | return ( |
71 | <OpenPageInputCell | 68 | <OpenPageInputCell |
@@ -237,6 +234,7 @@ let styles = StyleSheet.create({ | @@ -237,6 +234,7 @@ let styles = StyleSheet.create({ | ||
237 | flexDirection: 'row', | 234 | flexDirection: 'row', |
238 | height: 44 * DEVICE_WIDTH_RATIO, | 235 | height: 44 * DEVICE_WIDTH_RATIO, |
239 | marginLeft: 50 * DEVICE_WIDTH_RATIO, | 236 | marginLeft: 50 * DEVICE_WIDTH_RATIO, |
237 | + alignItems: 'center', | ||
240 | }, | 238 | }, |
241 | bankIcon: { | 239 | bankIcon: { |
242 | marginTop: 12 * DEVICE_WIDTH_RATIO, | 240 | marginTop: 12 * DEVICE_WIDTH_RATIO, |
1 | +'use strict'; | ||
2 | +import React from 'react'; | ||
3 | +import ReactNative, { | ||
4 | + View, | ||
5 | + Text, | ||
6 | + Image, | ||
7 | + StyleSheet, | ||
8 | + Dimensions, | ||
9 | + PixelRatio, | ||
10 | + TouchableOpacity, | ||
11 | + ListView, | ||
12 | +} from 'react-native'; | ||
13 | + | ||
14 | +import Immutable, {Map} from 'immutable'; | ||
15 | + | ||
16 | +export default class AlreadyOpened extends React.Component { | ||
17 | + constructor(props) { | ||
18 | + super(props); | ||
19 | + } | ||
20 | + | ||
21 | + render() { | ||
22 | + let{repaymentList}=this.props; | ||
23 | + if (!repaymentList || repaymentList.size == 0) { | ||
24 | + return ( | ||
25 | + <View style={styles.container}> | ||
26 | + <Image | ||
27 | + style={styles.emptyIcon} | ||
28 | + source={require('../../image/review-img-3.png')} | ||
29 | + resizeMode={'contain'} | ||
30 | + /> | ||
31 | + <Text> | ||
32 | + 暂无待还款订单 | ||
33 | + </Text> | ||
34 | + | ||
35 | + <TouchableOpacity onPress={() => {this.props.onPressGoNew && this.props.onPressGoNew()}} > | ||
36 | + <View style={styles.buttonContainer}> | ||
37 | + <Text style={styles.button}> | ||
38 | + 去逛逛 | ||
39 | + </Text> | ||
40 | + </View> | ||
41 | + </TouchableOpacity> | ||
42 | + | ||
43 | + </View> | ||
44 | + ); | ||
45 | + }else { | ||
46 | + return( | ||
47 | + <View style={styles.container}> | ||
48 | + | ||
49 | + <Text> | ||
50 | + RepayList page | ||
51 | + </Text> | ||
52 | + </View> | ||
53 | + ); | ||
54 | + } | ||
55 | + | ||
56 | + } | ||
57 | +}; | ||
58 | + | ||
59 | +let {width, height} = Dimensions.get('window'); | ||
60 | +const DEVICE_WIDTH_RATIO = width / 320; | ||
61 | + | ||
62 | +let styles = StyleSheet.create({ | ||
63 | + container: { | ||
64 | + flex: 1, | ||
65 | + backgroundColor: 'white', | ||
66 | + alignItems: 'center', | ||
67 | + }, | ||
68 | + emptyIcon: { | ||
69 | + width: 110 * DEVICE_WIDTH_RATIO, | ||
70 | + height: 110 * DEVICE_WIDTH_RATIO, | ||
71 | + marginTop: 100 * DEVICE_WIDTH_RATIO, | ||
72 | + marginBottom: 25 * DEVICE_WIDTH_RATIO, | ||
73 | + }, | ||
74 | + | ||
75 | + buttonContainer: { | ||
76 | + marginTop: 35 * DEVICE_WIDTH_RATIO, | ||
77 | + width: 235 * DEVICE_WIDTH_RATIO, | ||
78 | + height: 44 * DEVICE_WIDTH_RATIO, | ||
79 | + backgroundColor: '#222222', | ||
80 | + borderRadius: 5 * DEVICE_WIDTH_RATIO, | ||
81 | + }, | ||
82 | + button: { | ||
83 | + color: 'white', | ||
84 | + textAlign: 'center', | ||
85 | + fontSize: 14 * DEVICE_WIDTH_RATIO, | ||
86 | + backgroundColor: 'transparent', | ||
87 | + lineHeight: 29 * DEVICE_WIDTH_RATIO, | ||
88 | + }, | ||
89 | +}); |
@@ -19,6 +19,7 @@ export default keyMirror({ | @@ -19,6 +19,7 @@ export default keyMirror({ | ||
19 | UPDATE_NEXT_BTN_ENABLE_STATUS: null, | 19 | UPDATE_NEXT_BTN_ENABLE_STATUS: null, |
20 | UPDATE_SNS_CHECK_CODE_TEXT: null, | 20 | UPDATE_SNS_CHECK_CODE_TEXT: null, |
21 | UPDATE_TIP_MESSAGE: null, | 21 | UPDATE_TIP_MESSAGE: null, |
22 | + UPDATE_BANK_INFO: null, | ||
22 | NEXT_BTN_PROCESSING_REQUEST: null, | 23 | NEXT_BTN_PROCESSING_REQUEST: null, |
23 | NEXT_BTN_PROCESSING_SUCCESS: null, | 24 | NEXT_BTN_PROCESSING_SUCCESS: null, |
24 | NEXT_BTN_PROCESSING_FAILURE: null, | 25 | NEXT_BTN_PROCESSING_FAILURE: null, |
@@ -34,4 +35,7 @@ export default keyMirror({ | @@ -34,4 +35,7 @@ export default keyMirror({ | ||
34 | SET_ALREADY_PAGE_AMT_INFO: null, | 35 | SET_ALREADY_PAGE_AMT_INFO: null, |
35 | SET_ALREADY_PAGE_OVERDUE_STATUS: null, | 36 | SET_ALREADY_PAGE_OVERDUE_STATUS: null, |
36 | SET_ALREADY_PAGE_CREDIT_INFO: null, | 37 | SET_ALREADY_PAGE_CREDIT_INFO: null, |
38 | + | ||
39 | + SET_QUERY_DAYS: null, | ||
40 | + SET_REPAYMENT_LIST: null, | ||
37 | }); | 41 | }); |
@@ -14,7 +14,7 @@ import { | @@ -14,7 +14,7 @@ import { | ||
14 | import {bindActionCreators} from 'redux'; | 14 | import {bindActionCreators} from 'redux'; |
15 | import {connect} from 'react-redux'; | 15 | import {connect} from 'react-redux'; |
16 | import {Map} from 'immutable'; | 16 | import {Map} from 'immutable'; |
17 | -import * as installmentActions from '../reducers/installment/installmentActions'; | 17 | +import * as installmentActions from '../reducers/installment/installment/installmentActions'; |
18 | import Installment from '../components/installment/Installment'; | 18 | import Installment from '../components/installment/Installment'; |
19 | import AlreadyOpened from '../components/installment/AlreadyOpened'; | 19 | import AlreadyOpened from '../components/installment/AlreadyOpened'; |
20 | import InstallmentStatus from '../components/installment/InstallmentStatus'; | 20 | import InstallmentStatus from '../components/installment/InstallmentStatus'; |
@@ -49,6 +49,10 @@ class InstallmentContainer extends Component { | @@ -49,6 +49,10 @@ class InstallmentContainer extends Component { | ||
49 | this._getNewUserPageInfo = this._getNewUserPageInfo.bind(this); | 49 | this._getNewUserPageInfo = this._getNewUserPageInfo.bind(this); |
50 | this._onPressMoreProducts = this._onPressMoreProducts.bind(this); | 50 | this._onPressMoreProducts = this._onPressMoreProducts.bind(this); |
51 | this._onPressProtocol = this._onPressProtocol.bind(this); | 51 | this._onPressProtocol = this._onPressProtocol.bind(this); |
52 | + this._gotoRepayListPageWithDays = this._gotoRepayListPageWithDays.bind(this); | ||
53 | + this._repayRecordCell = this._repayRecordCell.bind(this); | ||
54 | + this._installmentOrderCell = this._installmentOrderCell.bind(this); | ||
55 | + this._installmentAccountCell = this._installmentAccountCell.bind(this); | ||
52 | } | 56 | } |
53 | componentDidMount() { | 57 | componentDidMount() { |
54 | this.props.actions.getInstallmentStatus(); | 58 | this.props.actions.getInstallmentStatus(); |
@@ -78,6 +82,23 @@ class InstallmentContainer extends Component { | @@ -78,6 +82,23 @@ class InstallmentContainer extends Component { | ||
78 | this.props.actions.onPressTabBtn(); | 82 | this.props.actions.onPressTabBtn(); |
79 | } | 83 | } |
80 | 84 | ||
85 | + _gotoRepayListPageWithDays(days) { | ||
86 | + console.log('------12112'); | ||
87 | + this.props.actions.gotoRepayListPageWithDays(days); | ||
88 | + } | ||
89 | + | ||
90 | + _repayRecordCell() {//还款记录 | ||
91 | + | ||
92 | + } | ||
93 | + | ||
94 | + _installmentOrderCell() {//分期订单: | ||
95 | + | ||
96 | + } | ||
97 | + | ||
98 | + _installmentAccountCell() {//账户管理: | ||
99 | + | ||
100 | + } | ||
101 | + | ||
81 | render() { | 102 | render() { |
82 | let {isFetching,open,alreadyOpenedPageInfo,installmentStatus,installmentStausPageInfo} = this.props.installment; | 103 | let {isFetching,open,alreadyOpenedPageInfo,installmentStatus,installmentStausPageInfo} = this.props.installment; |
83 | let {status} = installmentStatus; | 104 | let {status} = installmentStatus; |
@@ -100,6 +121,10 @@ class InstallmentContainer extends Component { | @@ -100,6 +121,10 @@ class InstallmentContainer extends Component { | ||
100 | getAlreadyPageInfo={this._getAlreadyPageInfo} | 121 | getAlreadyPageInfo={this._getAlreadyPageInfo} |
101 | onPressMoreProducts={this._onPressMoreProducts} | 122 | onPressMoreProducts={this._onPressMoreProducts} |
102 | onPressProtocol={this._onPressProtocol} | 123 | onPressProtocol={this._onPressProtocol} |
124 | + gotoRepayListPageWithDays={this._gotoRepayListPageWithDays} | ||
125 | + repayRecordCell={this._repayRecordCell} | ||
126 | + installmentOrderCell={this._installmentOrderCell} | ||
127 | + installmentAccountCell={this._installmentAccountCell} | ||
103 | /> | 128 | /> |
104 | ); | 129 | ); |
105 | } else if (status == 'OpenStatus') { | 130 | } else if (status == 'OpenStatus') { |
@@ -15,7 +15,7 @@ import { | @@ -15,7 +15,7 @@ import { | ||
15 | import {bindActionCreators} from 'redux'; | 15 | import {bindActionCreators} from 'redux'; |
16 | import {connect} from 'react-redux'; | 16 | import {connect} from 'react-redux'; |
17 | import {Map} from 'immutable'; | 17 | import {Map} from 'immutable'; |
18 | -import * as installmentActions from '../reducers/installment/installmentActions'; | 18 | +import * as installmentActions from '../reducers/installment/installment/installmentActions'; |
19 | import InstallmentStatus from '../components/installment/InstallmentStatus'; | 19 | import InstallmentStatus from '../components/installment/InstallmentStatus'; |
20 | 20 | ||
21 | const actions = [ | 21 | const actions = [ |
@@ -15,10 +15,10 @@ import { | @@ -15,10 +15,10 @@ import { | ||
15 | import {bindActionCreators} from 'redux'; | 15 | import {bindActionCreators} from 'redux'; |
16 | import {connect} from 'react-redux'; | 16 | import {connect} from 'react-redux'; |
17 | import {Map} from 'immutable'; | 17 | import {Map} from 'immutable'; |
18 | -import * as installmentActions from '../reducers/installment/installmentActions'; | 18 | +import * as newRegisterActions from '../reducers/installment/newRegister/newRegisterActions'; |
19 | import Open from '../components/installment/Open'; | 19 | import Open from '../components/installment/Open'; |
20 | const actions = [ | 20 | const actions = [ |
21 | - installmentActions, | 21 | + newRegisterActions, |
22 | ]; | 22 | ]; |
23 | function mapStateToProps(state) { | 23 | function mapStateToProps(state) { |
24 | return { | 24 | return { |
@@ -80,10 +80,10 @@ class OpenContainer extends Component { | @@ -80,10 +80,10 @@ class OpenContainer extends Component { | ||
80 | } | 80 | } |
81 | 81 | ||
82 | render() { | 82 | render() { |
83 | - let {openPageInfo} = this.props.installment; | 83 | + let {newRegister} = this.props; |
84 | return ( | 84 | return ( |
85 | <Open | 85 | <Open |
86 | - openPageInfo={openPageInfo} | 86 | + openPageInfo={newRegister} |
87 | onPressProtocol={this._onPressProtocol} | 87 | onPressProtocol={this._onPressProtocol} |
88 | onPressOpenInstallment={this._onPressOpenInstallment} | 88 | onPressOpenInstallment={this._onPressOpenInstallment} |
89 | onPressCheckbox={this._onPressCheckbox} | 89 | onPressCheckbox={this._onPressCheckbox} |
1 | +'use strict' | ||
2 | + | ||
3 | +import React, {Component} from 'react'; | ||
4 | +import { | ||
5 | + StyleSheet, | ||
6 | + Dimensions, | ||
7 | + Platform, | ||
8 | + View, | ||
9 | + NativeModules, | ||
10 | + InteractionManager, | ||
11 | + NativeAppEventEmitter, | ||
12 | + Text, | ||
13 | +} from 'react-native' | ||
14 | + | ||
15 | +import {bindActionCreators} from 'redux'; | ||
16 | +import {connect} from 'react-redux'; | ||
17 | +import {Map} from 'immutable'; | ||
18 | +import * as newRegisterActions from '../reducers/installment/repayList/repayListActions'; | ||
19 | +import RepayList from '../components/installment/RepayList'; | ||
20 | +const actions = [ | ||
21 | + newRegisterActions, | ||
22 | +]; | ||
23 | +function mapStateToProps(state) { | ||
24 | + return { | ||
25 | + ...state | ||
26 | + }; | ||
27 | +} | ||
28 | +function mapDispatchToProps(dispatch) { | ||
29 | + | ||
30 | + const creators = Map() | ||
31 | + .merge(...actions) | ||
32 | + .filter(value => typeof value === 'function') | ||
33 | + .toObject(); | ||
34 | + | ||
35 | + return { | ||
36 | + actions: bindActionCreators(creators, dispatch), | ||
37 | + dispatch | ||
38 | + }; | ||
39 | +} | ||
40 | +class RepayListContainer extends Component { | ||
41 | + constructor(props) { | ||
42 | + super(props); | ||
43 | + this._onPressGoNew = this._onPressGoNew.bind(this); | ||
44 | + } | ||
45 | + componentDidMount() { | ||
46 | + this.props.actions.getQueryAmtList("0"); | ||
47 | + } | ||
48 | + | ||
49 | + _onPressGoNew() { | ||
50 | + this.props.actions.getoNewArrival(); | ||
51 | + } | ||
52 | + | ||
53 | + render() { | ||
54 | + let {queryDays,repaymentList} = this.props.repayList; | ||
55 | + return ( | ||
56 | + <RepayList | ||
57 | + repaymentList={repaymentList} | ||
58 | + onPressGoNew={this._onPressGoNew} | ||
59 | + /> | ||
60 | + ); | ||
61 | + } | ||
62 | +} | ||
63 | +let styles = StyleSheet.create({ | ||
64 | + container: { | ||
65 | + flex: 1, | ||
66 | + }, | ||
67 | + | ||
68 | +}); | ||
69 | + | ||
70 | +export default connect(mapStateToProps, mapDispatchToProps)(RepayListContainer); |
1 | import {combineReducers} from 'redux'; | 1 | import {combineReducers} from 'redux'; |
2 | import app from './app/appReducer'; | 2 | import app from './app/appReducer'; |
3 | -import installment from './installment/installmentReducer'; | 3 | +import installment from './installment/installment/installmentReducer'; |
4 | +import newRegister from './installment/newRegister/newRegisterReducer'; | ||
5 | +import repayList from './installment/repayList/repayListReducer'; | ||
4 | 6 | ||
5 | const rootReducer = combineReducers({ | 7 | const rootReducer = combineReducers({ |
6 | app, | 8 | app, |
7 | installment, | 9 | installment, |
10 | + newRegister, | ||
11 | + repayList, | ||
8 | }); | 12 | }); |
9 | 13 | ||
10 | export default rootReducer; | 14 | export default rootReducer; |
1 | 'use strict'; | 1 | 'use strict'; |
2 | 2 | ||
3 | import ReactNative from 'react-native'; | 3 | import ReactNative from 'react-native'; |
4 | -import InstallmentService from '../../services/InstallmentService'; | 4 | +import InstallmentService from '../../../services/InstallmentService'; |
5 | 5 | ||
6 | const { | 6 | const { |
7 | 7 | ||
@@ -15,17 +15,6 @@ GET_INSTALLMENT_STATUS_REQUEST, | @@ -15,17 +15,6 @@ GET_INSTALLMENT_STATUS_REQUEST, | ||
15 | GET_INSTALLMENT_STATUS_SUCCESS, | 15 | GET_INSTALLMENT_STATUS_SUCCESS, |
16 | GET_INSTALLMENT_STATUS_FAILURE, | 16 | GET_INSTALLMENT_STATUS_FAILURE, |
17 | 17 | ||
18 | -UPDATE_SHOW_BANK_ALERT_STATUS, | ||
19 | -UPDATE_AGREE_PROTOCOL_STATUS, | ||
20 | -UPDATE_SNS_CHECK_CODE_ENABLE_STATUS, | ||
21 | -UPDATE_CELL_LIST, | ||
22 | -UPDATE_NEXT_BTN_ENABLE_STATUS, | ||
23 | -UPDATE_SNS_CHECK_CODE_TEXT, | ||
24 | -UPDATE_TIP_MESSAGE, | ||
25 | -NEXT_BTN_PROCESSING_REQUEST, | ||
26 | -NEXT_BTN_PROCESSING_SUCCESS, | ||
27 | -NEXT_BTN_PROCESSING_FAILURE, | ||
28 | - | ||
29 | SET_INSTALLMENT_STATUS_PAGE_ORIGINAL_INFO, | 18 | SET_INSTALLMENT_STATUS_PAGE_ORIGINAL_INFO, |
30 | SET_INSTALLMENT_STATUS_PAGE_GOODS, | 19 | SET_INSTALLMENT_STATUS_PAGE_GOODS, |
31 | SET_STATUS_PAGE_ADVERTISEMENT, | 20 | SET_STATUS_PAGE_ADVERTISEMENT, |
@@ -38,18 +27,13 @@ SET_ALREADY_PAGE_AMT_INFO, | @@ -38,18 +27,13 @@ SET_ALREADY_PAGE_AMT_INFO, | ||
38 | SET_ALREADY_PAGE_OVERDUE_STATUS, | 27 | SET_ALREADY_PAGE_OVERDUE_STATUS, |
39 | SET_ALREADY_PAGE_CREDIT_INFO, | 28 | SET_ALREADY_PAGE_CREDIT_INFO, |
40 | 29 | ||
41 | -} = require('../../constants/actionTypes').default; | 30 | +} = require('../../../constants/actionTypes').default; |
42 | const codeContent = { | 31 | const codeContent = { |
43 | openN: '0876085ff46bed27f1a1eb6ee8b68987', | 32 | openN: '0876085ff46bed27f1a1eb6ee8b68987', |
44 | openY: 'c233ad4ca91fef45ed7d0b26d9953e61', | 33 | openY: 'c233ad4ca91fef45ed7d0b26d9953e61', |
45 | advertisement: 'f3fe0793a7d59479542a14b15359c47d' | 34 | advertisement: 'f3fe0793a7d59479542a14b15359c47d' |
46 | }; | 35 | }; |
47 | 36 | ||
48 | -var Timer = function() { | ||
49 | - this.counter = 0; | ||
50 | - this.countdownTimer = null; | ||
51 | -}; | ||
52 | - | ||
53 | export function productListForInstallmentRequest(){ | 37 | export function productListForInstallmentRequest(){ |
54 | return { | 38 | return { |
55 | type: INSTALLMENT_PRODUCT_REQUEST, | 39 | type: INSTALLMENT_PRODUCT_REQUEST, |
@@ -90,71 +74,6 @@ export function featchInstallmentStatusFailure(error) { | @@ -90,71 +74,6 @@ export function featchInstallmentStatusFailure(error) { | ||
90 | } | 74 | } |
91 | } | 75 | } |
92 | 76 | ||
93 | -export function updateShowBankAlertStatus(status) { | ||
94 | - return { | ||
95 | - type: UPDATE_SHOW_BANK_ALERT_STATUS, | ||
96 | - payload: status | ||
97 | - } | ||
98 | -} | ||
99 | - | ||
100 | -export function updateAgreeProtocolStatus(status) { | ||
101 | - return { | ||
102 | - type: UPDATE_AGREE_PROTOCOL_STATUS, | ||
103 | - payload: status | ||
104 | - } | ||
105 | -} | ||
106 | - | ||
107 | -export function updateSnsCheckCodeEnableStatus(status) { | ||
108 | - return { | ||
109 | - type: UPDATE_SNS_CHECK_CODE_ENABLE_STATUS, | ||
110 | - payload: status | ||
111 | - } | ||
112 | -} | ||
113 | - | ||
114 | -export function updateCellList(cellList) { | ||
115 | - return { | ||
116 | - type: UPDATE_CELL_LIST, | ||
117 | - payload: cellList | ||
118 | - } | ||
119 | -} | ||
120 | - | ||
121 | -export function updateNextBtnEnableStatus(status) { | ||
122 | - return { | ||
123 | - type: UPDATE_NEXT_BTN_ENABLE_STATUS, | ||
124 | - payload: status | ||
125 | - } | ||
126 | -} | ||
127 | - | ||
128 | -export function updateSnsCheckCodeText(text) { | ||
129 | - return { | ||
130 | - type: UPDATE_SNS_CHECK_CODE_TEXT, | ||
131 | - payload: text | ||
132 | - } | ||
133 | -} | ||
134 | - | ||
135 | -export function updateTipMessage(message) { | ||
136 | - return { | ||
137 | - type: UPDATE_TIP_MESSAGE, | ||
138 | - payload: message | ||
139 | - } | ||
140 | -} | ||
141 | - | ||
142 | -export function nextBtnProcessingRequest() { | ||
143 | - return { | ||
144 | - type: NEXT_BTN_PROCESSING_REQUEST, | ||
145 | - } | ||
146 | -} | ||
147 | -export function nextBtnProcessingFailure() { | ||
148 | - return { | ||
149 | - type: NEXT_BTN_PROCESSING_FAILURE | ||
150 | - } | ||
151 | -} | ||
152 | -export function nextBtnProcessingSuccess() { | ||
153 | - return { | ||
154 | - type: NEXT_BTN_PROCESSING_SUCCESS | ||
155 | - } | ||
156 | -} | ||
157 | - | ||
158 | export function setInstallmentStatusPageOriginalInfo(params) { | 77 | export function setInstallmentStatusPageOriginalInfo(params) { |
159 | return { | 78 | return { |
160 | type: SET_INSTALLMENT_STATUS_PAGE_ORIGINAL_INFO, | 79 | type: SET_INSTALLMENT_STATUS_PAGE_ORIGINAL_INFO, |
@@ -225,6 +144,7 @@ export function setAlreadPageCreditInfo(creditInfo) { | @@ -225,6 +144,7 @@ export function setAlreadPageCreditInfo(creditInfo) { | ||
225 | } | 144 | } |
226 | } | 145 | } |
227 | 146 | ||
147 | + | ||
228 | export function productListForInstallment() { | 148 | export function productListForInstallment() { |
229 | return (dispatch, getState) => { | 149 | return (dispatch, getState) => { |
230 | let {app, installment} = getState(); | 150 | let {app, installment} = getState(); |
@@ -325,293 +245,6 @@ export function getInstallmentStatus() { | @@ -325,293 +245,6 @@ export function getInstallmentStatus() { | ||
325 | } | 245 | } |
326 | } | 246 | } |
327 | 247 | ||
328 | -export function onPressProtocol() { | ||
329 | - return (dispatch, getState) => { | ||
330 | - //跳转原生静态页面 | ||
331 | - let url = `://m.yohobuy.com/home/installment/agreement?openby:yohobuy={"action":"go.h5","params":{"url":"http://m.yohobuy.com/home/installment/agreement"}}`; | ||
332 | - ReactNative.NativeModules.YH_CommonHelper.jumpWithUrl(url); | ||
333 | - }; | ||
334 | -} | ||
335 | - | ||
336 | -export function onPressOpenNext() { | ||
337 | - return (dispatch, getState) => { | ||
338 | - let {app, installment} = getState(); | ||
339 | - let {nextBtnEnable,cellList,nextProcessing} = installment.openPageInfo; | ||
340 | - let activateParams = {}; | ||
341 | - let newCellList = cellList; | ||
342 | - // if (!nextBtnEnable) { | ||
343 | - // return; | ||
344 | - // } | ||
345 | - ReactNative.NativeModules.YH_InstallmentHelper.gotoInstallmentStatusView('2', '您的授信未通过,在有货更多的消费,增加信用度,会大大提升审核通过率奥。'); | ||
346 | - return; | ||
347 | - cellList.map((item, i) => { | ||
348 | - if (item.get('inputKey') != 'BankIcon') { | ||
349 | - activateParams[item.get('inputKey')]= item.get('text'); | ||
350 | - } | ||
351 | - }); | ||
352 | - let activateService = (uid) => { | ||
353 | - dispatch(nextBtnProcessingRequest()); | ||
354 | - return new InstallmentService(app.host).checkVerifyCode(uid, activateParams.mobile, activateParams.snsCheckCode) | ||
355 | - .then(json => { | ||
356 | - if (json.result === '1') { | ||
357 | - return new InstallmentService(app.host).activateService(activateParams) | ||
358 | - }else { | ||
359 | - newCellList.map((item, i) => { | ||
360 | - if (item.inputKey == 'snsCheckCode') { | ||
361 | - item.text = ''; | ||
362 | - } | ||
363 | - cellList[i] = item; | ||
364 | - }); | ||
365 | - dispatch(updateTipMessage(json.message)) | ||
366 | - dispatch(updateCellList(cellList)); | ||
367 | - dispatch(nextBtnProcessingFailure()); | ||
368 | - } | ||
369 | - }) | ||
370 | - .then(json => { | ||
371 | - dispatch(nextBtnProcessingSuccess()); | ||
372 | - console.log('2222222'); | ||
373 | - console.log(json); | ||
374 | - let tipMessage = ''; | ||
375 | - if (json.status == '3') { | ||
376 | - json.failReason = json.failReason || '姓名、身份证、银行卡不匹配'; | ||
377 | - } | ||
378 | - ReactNative.NativeModules.YH_InstallmentHelper.gotoInstallmentStatusView(json.status, json.failReason); | ||
379 | - }) | ||
380 | - .catch(error => { | ||
381 | - }); | ||
382 | - } | ||
383 | - | ||
384 | - ReactNative.NativeModules.YH_CommonHelper.uid() | ||
385 | - .then(uid => { | ||
386 | - activateService(uid); | ||
387 | - }) | ||
388 | - .catch(error => { | ||
389 | - ReactNative.NativeModules.YH_CommonHelper.login() | ||
390 | - .then(uid => { | ||
391 | - activateService(uid); | ||
392 | - }) | ||
393 | - .catch(error => { | ||
394 | - | ||
395 | - }); | ||
396 | - }); | ||
397 | - | ||
398 | - }; | ||
399 | -} | ||
400 | - | ||
401 | -export function onPressCheckbox() { | ||
402 | - return (dispatch, getState) => { | ||
403 | - let {app, installment} = getState(); | ||
404 | - let {agreeProtocol} = installment.openPageInfo; | ||
405 | - agreeProtocol = !agreeProtocol; | ||
406 | - dispatch(updateAgreeProtocolStatus(agreeProtocol)); | ||
407 | - }; | ||
408 | -} | ||
409 | - | ||
410 | -export function onPressCardNoQuestion() { | ||
411 | - return (dispatch, getState) => { | ||
412 | - let {app, installment} = getState(); | ||
413 | - let {showBankAlert} = installment.openPageInfo; | ||
414 | - showBankAlert = !showBankAlert; | ||
415 | - dispatch(updateShowBankAlertStatus(showBankAlert)); | ||
416 | - }; | ||
417 | -} | ||
418 | - | ||
419 | -export function getBankInfo(cellInfo,cardNo) { | ||
420 | - return (dispatch, getState) => { | ||
421 | - | ||
422 | - let bankInfo = (uid) => { | ||
423 | - let {app, installment} = getState(); | ||
424 | - let {cellList,snsCheckCodeEnable} = installment.openPageInfo; | ||
425 | - cellList = cellList.toJS(); | ||
426 | - let newCellList = cellList; | ||
427 | - let nextBtnEnable = true; | ||
428 | - return new InstallmentService(app.host).fentchBankInfo(cardNo,uid) | ||
429 | - .then(json => { | ||
430 | - let bankIconInfo = { | ||
431 | - inputKey: 'BankIcon', | ||
432 | - bankCode: '', | ||
433 | - bankName: '', | ||
434 | - bankText: '', | ||
435 | - show: true, | ||
436 | - }; | ||
437 | - if (json.bankCode) { | ||
438 | - bankIconInfo.bankCode = json.bankCode; | ||
439 | - bankIconInfo.bankName = json.bankName; | ||
440 | - } | ||
441 | - if (json.businessSupport === '1') { | ||
442 | - bankIconInfo.bankCode = ''; | ||
443 | - bankIconInfo.bankName = ''; | ||
444 | - bankIconInfo.bankText = '暂不支持此银行卡'; | ||
445 | - } | ||
446 | - | ||
447 | - newCellList.map((item, i) => { | ||
448 | - if (item.inputKey == 'BankIcon') { | ||
449 | - item = bankIconInfo; | ||
450 | - } | ||
451 | - cellList[i] = item; | ||
452 | - }); | ||
453 | - dispatch(updateCellList(cellList)); | ||
454 | - }) | ||
455 | - .catch(error => { | ||
456 | - }); | ||
457 | - } | ||
458 | - | ||
459 | - ReactNative.NativeModules.YH_CommonHelper.uid() | ||
460 | - .then(uid => { | ||
461 | - bankInfo(uid); | ||
462 | - }) | ||
463 | - .catch(error => { | ||
464 | - ReactNative.NativeModules.YH_CommonHelper.login() | ||
465 | - .then(uid => { | ||
466 | - bankInfo(uid); | ||
467 | - }) | ||
468 | - .catch(error => { | ||
469 | - | ||
470 | - }); | ||
471 | - }); | ||
472 | - } | ||
473 | -} | ||
474 | - | ||
475 | -export function updateOpenPageCellInfo(cellInfo) { | ||
476 | - return (dispatch, getState) => { | ||
477 | - let {app, installment} = getState(); | ||
478 | - let {cellList,snsCheckCodeEnable} = installment.openPageInfo; | ||
479 | - cellList = cellList.toJS(); | ||
480 | - let newCellList = cellList; | ||
481 | - let cardNoValid = false; | ||
482 | - let mobileValid = false; | ||
483 | - let nextBtnEnable = true; | ||
484 | - | ||
485 | - if (cellInfo.inputKey == "cardNo") { | ||
486 | - let value = cellInfo.text; | ||
487 | - console.log('value'); | ||
488 | - console.log(value); | ||
489 | - let cardNo = value.replace(/\s/g, ''); | ||
490 | - let newCardNo = value.replace(/[^\d]/g, '').replace(/(\d{4})(?=\d)/g, '$1 '); | ||
491 | - console.log('newCardNo'); | ||
492 | - console.log(newCardNo); | ||
493 | - cellInfo.text = newCardNo; | ||
494 | - if (cardNo && cardNo.length >= 16) { | ||
495 | - cardNoValid = true; | ||
496 | - dispatch(getBankInfo(cellInfo,value)); | ||
497 | - }else { | ||
498 | - cardNoValid = false; | ||
499 | - cellInfo.showBankIcon = false; | ||
500 | - } | ||
501 | - | ||
502 | - }else if (cellInfo.inputKey == "mobile" && cellInfo.text.length ==11) { | ||
503 | - mobileValid = true; | ||
504 | - } | ||
505 | - | ||
506 | - | ||
507 | - newCellList.map((item, i) => { | ||
508 | - if (item.inputKey == 'cardNo' && item.text.length >=16 && cellInfo.inputKey != 'cardNo') { | ||
509 | - cardNoValid = true; | ||
510 | - } else if (item.inputKey == 'mobile' && item.text.length ==11 && cellInfo.inputKey != 'mobile') { | ||
511 | - mobileValid = true; | ||
512 | - } | ||
513 | - if (item.inputKey == cellInfo.inputKey) { | ||
514 | - item = cellInfo; | ||
515 | - } | ||
516 | - if (item.text == '') { | ||
517 | - nextBtnEnable = false; | ||
518 | - } | ||
519 | - cellList[i] = item; | ||
520 | - }); | ||
521 | - if (cardNoValid && mobileValid) { | ||
522 | - snsCheckCodeEnable = true; | ||
523 | - }else { | ||
524 | - snsCheckCodeEnable = false; | ||
525 | - } | ||
526 | - console.log('cellInfo'); | ||
527 | - console.log(cellInfo); | ||
528 | - dispatch(updateCellList(cellList)); | ||
529 | - dispatch(updateSnsCheckCodeEnableStatus(snsCheckCodeEnable)); | ||
530 | - dispatch(updateNextBtnEnableStatus(nextBtnEnable)); | ||
531 | - }; | ||
532 | -} | ||
533 | - | ||
534 | -/** | ||
535 | - * 倒计时 | ||
536 | - * | ||
537 | - * @param start 启动回调 | ||
538 | - * @param tick 进度回调 | ||
539 | - * @param complete 完成回调 | ||
540 | - */ | ||
541 | -Timer.prototype.startCountdown = function(start, tick, complete) { | ||
542 | - var self = this; | ||
543 | - | ||
544 | - if (this.counter > 0 || this.countdownTimer) { | ||
545 | - return; | ||
546 | - } else { | ||
547 | - this.counter = 59; | ||
548 | - } | ||
549 | - | ||
550 | - | ||
551 | - // 启动回调 | ||
552 | - if (start) { | ||
553 | - start.call(this); | ||
554 | - } | ||
555 | - | ||
556 | - if (tick) { | ||
557 | - tick.call(this, this.counter); | ||
558 | - } | ||
559 | - | ||
560 | - this.complete = complete; | ||
561 | - | ||
562 | - | ||
563 | - // 开始计时器 | ||
564 | - this.countdownTimer = setInterval(function() { | ||
565 | - self.counter--; | ||
566 | - | ||
567 | - if (self.counter <= 0) { | ||
568 | - if (complete) { | ||
569 | - clearInterval(self.countdownTimer); | ||
570 | - | ||
571 | - // 重置计时器 | ||
572 | - self.counter = 0; | ||
573 | - self.countdownTimer = null; | ||
574 | - complete.call(self); | ||
575 | - } | ||
576 | - } | ||
577 | - | ||
578 | - // 完成回调 | ||
579 | - if (tick && self.counter > 0) { | ||
580 | - tick.call(self, self.counter); | ||
581 | - } | ||
582 | - }, 1000); | ||
583 | - | ||
584 | - return this; | ||
585 | -}; | ||
586 | - | ||
587 | -export function onPressCheckCode() { | ||
588 | - return (dispatch, getState) => { | ||
589 | - let {app, installment} = getState(); | ||
590 | - let {cellList,snsCheckCodeEnable,snsCheckCodeText} = installment.openPageInfo; | ||
591 | - if (snsCheckCodeEnable && snsCheckCodeText == '获取验证码') { | ||
592 | - return new InstallmentService(app.host).sendVerifyCode('17705176933') | ||
593 | - .then(json => { | ||
594 | - | ||
595 | - let status = 0; | ||
596 | - let snsText = ''; | ||
597 | - new Timer().startCountdown(function() { | ||
598 | - }, function(counter) { | ||
599 | - // 进度回调 | ||
600 | - snsText = counter + 's'; | ||
601 | - dispatch(updateSnsCheckCodeText(snsText)); | ||
602 | - }, function() { | ||
603 | - // 倒计时结束后再次显示 "获取验证码" | ||
604 | - snsText = '获取验证码'; | ||
605 | - dispatch(updateSnsCheckCodeText(snsText)); | ||
606 | - }); | ||
607 | - dispatch(updateSnsCheckCodeText(snsText)); | ||
608 | - }) | ||
609 | - .catch(error => { | ||
610 | - }); | ||
611 | - } | ||
612 | - | ||
613 | - }; | ||
614 | -} | ||
615 | 248 | ||
616 | export function setInstallmentStausPageParams(statusCode, failReason, uid) { | 249 | export function setInstallmentStausPageParams(statusCode, failReason, uid) { |
617 | return (dispatch, getState) => { | 250 | return (dispatch, getState) => { |
@@ -810,3 +443,11 @@ export function onPressTabBtn() { | @@ -810,3 +443,11 @@ export function onPressTabBtn() { | ||
810 | ReactNative.NativeModules.YH_InstallmentHelper.helpAction(); | 443 | ReactNative.NativeModules.YH_InstallmentHelper.helpAction(); |
811 | }; | 444 | }; |
812 | } | 445 | } |
446 | + | ||
447 | + | ||
448 | +export function gotoRepayListPageWithDays(days) { | ||
449 | + return (dispatch, getState) => { | ||
450 | + let {app, installment} = getState(); | ||
451 | + ReactNative.NativeModules.YH_InstallmentHelper.gotoRepayListPage(days); | ||
452 | + }; | ||
453 | +} |
1 | +'use strict'; | ||
2 | + | ||
3 | +import Immutable,{Record, List, Map} from 'immutable'; | ||
4 | + | ||
5 | +let InitialState = Record({ | ||
6 | + isFetching:false, | ||
7 | + uid: '', | ||
8 | + installmentStatus:new (Record({ | ||
9 | + isFetching:false, | ||
10 | + status: '', | ||
11 | + error: null, | ||
12 | + })), | ||
13 | + open:new (Record({ | ||
14 | + productListForInstallment:new (Record({ | ||
15 | + list:List(), | ||
16 | + page:1, | ||
17 | + totalPage:1, | ||
18 | + })), | ||
19 | + installmentInfo:'', | ||
20 | + })), | ||
21 | + alreadyOpenedPageInfo:new (Record({ | ||
22 | + tabFocusIndex: 1, | ||
23 | + goods: List(), | ||
24 | + isOverdue: false, | ||
25 | + content: Map(), | ||
26 | + notice: Map(), | ||
27 | + installmentInfo:Map(), | ||
28 | + creditInfo: Map(), | ||
29 | + })), | ||
30 | + | ||
31 | + installmentStausPageInfo:new (Record({ | ||
32 | + statusCode: '', | ||
33 | + status: 'success', | ||
34 | + jumpUrl: '', | ||
35 | + statusInfo:Map(), | ||
36 | + goods: List(), | ||
37 | + advertisement: false, | ||
38 | + })), | ||
39 | +}); | ||
40 | + | ||
41 | +export default InitialState; |
@@ -14,18 +14,6 @@ const { | @@ -14,18 +14,6 @@ const { | ||
14 | GET_INSTALLMENT_STATUS_SUCCESS, | 14 | GET_INSTALLMENT_STATUS_SUCCESS, |
15 | GET_INSTALLMENT_STATUS_FAILURE, | 15 | GET_INSTALLMENT_STATUS_FAILURE, |
16 | 16 | ||
17 | - UPDATE_SHOW_BANK_ALERT_STATUS, | ||
18 | - UPDATE_AGREE_PROTOCOL_STATUS, | ||
19 | - UPDATE_SNS_CHECK_CODE_ENABLE_STATUS, | ||
20 | - UPDATE_CELL_LIST, | ||
21 | - UPDATE_NEXT_BTN_ENABLE_STATUS, | ||
22 | - UPDATE_NEXT_BTN_TEXT, | ||
23 | - UPDATE_SNS_CHECK_CODE_TEXT, | ||
24 | - UPDATE_TIP_MESSAGE, | ||
25 | - NEXT_BTN_PROCESSING_REQUEST, | ||
26 | - NEXT_BTN_PROCESSING_SUCCESS, | ||
27 | - NEXT_BTN_PROCESSING_FAILURE, | ||
28 | - | ||
29 | SET_INSTALLMENT_STATUS_PAGE_ORIGINAL_INFO, | 17 | SET_INSTALLMENT_STATUS_PAGE_ORIGINAL_INFO, |
30 | SET_INSTALLMENT_STATUS_PAGE_GOODS, | 18 | SET_INSTALLMENT_STATUS_PAGE_GOODS, |
31 | SET_STATUS_PAGE_ADVERTISEMENT, | 19 | SET_STATUS_PAGE_ADVERTISEMENT, |
@@ -38,7 +26,7 @@ const { | @@ -38,7 +26,7 @@ const { | ||
38 | SET_ALREADY_PAGE_OVERDUE_STATUS, | 26 | SET_ALREADY_PAGE_OVERDUE_STATUS, |
39 | SET_ALREADY_PAGE_CREDIT_INFO, | 27 | SET_ALREADY_PAGE_CREDIT_INFO, |
40 | 28 | ||
41 | -} = require('../../constants/actionTypes').default; | 29 | +} = require('../../../constants/actionTypes').default; |
42 | 30 | ||
43 | const initialState = new InitialState; | 31 | const initialState = new InitialState; |
44 | 32 | ||
@@ -67,29 +55,6 @@ export default function appReducer(state = initialState, action) { | @@ -67,29 +55,6 @@ export default function appReducer(state = initialState, action) { | ||
67 | case GET_INSTALLMENT_STATUS_FAILURE: | 55 | case GET_INSTALLMENT_STATUS_FAILURE: |
68 | return state.setIn(['installmentStatus', 'isFetching'], false) | 56 | return state.setIn(['installmentStatus', 'isFetching'], false) |
69 | .setIn(['installmentStatus', 'error'], action.payload); | 57 | .setIn(['installmentStatus', 'error'], action.payload); |
70 | - case UPDATE_SHOW_BANK_ALERT_STATUS: | ||
71 | - return state.setIn(['openPageInfo', 'showBankAlert'], action.payload); | ||
72 | - case UPDATE_AGREE_PROTOCOL_STATUS: | ||
73 | - return state.setIn(['openPageInfo', 'agreeProtocol'], action.payload); | ||
74 | - case UPDATE_SNS_CHECK_CODE_ENABLE_STATUS: | ||
75 | - return state.setIn(['openPageInfo', 'snsCheckCodeEnable'], action.payload); | ||
76 | - case UPDATE_CELL_LIST: | ||
77 | - return state.setIn(['openPageInfo', 'cellList'], Immutable.fromJS(action.payload)); | ||
78 | - case UPDATE_NEXT_BTN_ENABLE_STATUS: | ||
79 | - return state.setIn(['openPageInfo', 'nextBtnEnable'], action.payload); | ||
80 | - case UPDATE_SNS_CHECK_CODE_TEXT: | ||
81 | - return state.setIn(['openPageInfo', 'snsCheckCodeText'], action.payload); | ||
82 | - case UPDATE_TIP_MESSAGE: | ||
83 | - return state.setIn(['openPageInfo', 'tipMessage'], action.payload); | ||
84 | - case NEXT_BTN_PROCESSING_REQUEST: | ||
85 | - return state.setIn(['openPageInfo', 'nextBtnText'], '处理中...') | ||
86 | - .setIn(['openPageInfo', 'nextProcessing'], true); | ||
87 | - case NEXT_BTN_PROCESSING_SUCCESS: | ||
88 | - return state.setIn(['openPageInfo', 'nextBtnText'], '下一步') | ||
89 | - .setIn(['openPageInfo', 'nextProcessing'], false); | ||
90 | - case NEXT_BTN_PROCESSING_FAILURE: | ||
91 | - return state.setIn(['openPageInfo', 'nextBtnText'], '下一步') | ||
92 | - .setIn(['openPageInfo', 'nextProcessing'], false); | ||
93 | case SET_INSTALLMENT_STATUS_PAGE_ORIGINAL_INFO: | 58 | case SET_INSTALLMENT_STATUS_PAGE_ORIGINAL_INFO: |
94 | return state.setIn(['installmentStausPageInfo', 'statusCode'],action.payload.status) | 59 | return state.setIn(['installmentStausPageInfo', 'statusCode'],action.payload.status) |
95 | .setIn(['installmentStausPageInfo', 'status'], action.payload.status) | 60 | .setIn(['installmentStausPageInfo', 'status'], action.payload.status) |
1 | +'use strict'; | ||
2 | + | ||
3 | +import ReactNative from 'react-native'; | ||
4 | +import InstallmentService from '../../../services/InstallmentService'; | ||
5 | + | ||
6 | +const { | ||
7 | + | ||
8 | +SET_PLATFORM, | ||
9 | + | ||
10 | +UPDATE_SHOW_BANK_ALERT_STATUS, | ||
11 | +UPDATE_AGREE_PROTOCOL_STATUS, | ||
12 | +UPDATE_SNS_CHECK_CODE_ENABLE_STATUS, | ||
13 | +UPDATE_CELL_LIST, | ||
14 | +UPDATE_NEXT_BTN_ENABLE_STATUS, | ||
15 | +UPDATE_SNS_CHECK_CODE_TEXT, | ||
16 | +UPDATE_TIP_MESSAGE, | ||
17 | +UPDATE_BANK_INFO, | ||
18 | +NEXT_BTN_PROCESSING_REQUEST, | ||
19 | +NEXT_BTN_PROCESSING_SUCCESS, | ||
20 | +NEXT_BTN_PROCESSING_FAILURE, | ||
21 | + | ||
22 | +} = require('../../../constants/actionTypes').default; | ||
23 | + | ||
24 | +var Timer = function() { | ||
25 | + this.counter = 0; | ||
26 | + this.countdownTimer = null; | ||
27 | +}; | ||
28 | + | ||
29 | +export function updateShowBankAlertStatus(status) { | ||
30 | + return { | ||
31 | + type: UPDATE_SHOW_BANK_ALERT_STATUS, | ||
32 | + payload: status | ||
33 | + } | ||
34 | +} | ||
35 | + | ||
36 | +export function updateAgreeProtocolStatus(status) { | ||
37 | + return { | ||
38 | + type: UPDATE_AGREE_PROTOCOL_STATUS, | ||
39 | + payload: status | ||
40 | + } | ||
41 | +} | ||
42 | + | ||
43 | +export function updateSnsCheckCodeEnableStatus(status) { | ||
44 | + return { | ||
45 | + type: UPDATE_SNS_CHECK_CODE_ENABLE_STATUS, | ||
46 | + payload: status | ||
47 | + } | ||
48 | +} | ||
49 | + | ||
50 | +export function updateCellList(cellList) { | ||
51 | + return { | ||
52 | + type: UPDATE_CELL_LIST, | ||
53 | + payload: cellList | ||
54 | + } | ||
55 | +} | ||
56 | + | ||
57 | +export function updateNextBtnEnableStatus(status) { | ||
58 | + return { | ||
59 | + type: UPDATE_NEXT_BTN_ENABLE_STATUS, | ||
60 | + payload: status | ||
61 | + } | ||
62 | +} | ||
63 | + | ||
64 | +export function updateSnsCheckCodeText(text) { | ||
65 | + return { | ||
66 | + type: UPDATE_SNS_CHECK_CODE_TEXT, | ||
67 | + payload: text | ||
68 | + } | ||
69 | +} | ||
70 | + | ||
71 | +export function updateTipMessage(message) { | ||
72 | + return { | ||
73 | + type: UPDATE_TIP_MESSAGE, | ||
74 | + payload: message | ||
75 | + } | ||
76 | +} | ||
77 | + | ||
78 | + | ||
79 | +// updateBankInfo | ||
80 | +export function updateBankInfo(bankInfo) { | ||
81 | + return { | ||
82 | + type: UPDATE_BANK_INFO, | ||
83 | + payload: bankInfo, | ||
84 | + } | ||
85 | +} | ||
86 | + | ||
87 | +export function nextBtnProcessingRequest() { | ||
88 | + return { | ||
89 | + type: NEXT_BTN_PROCESSING_REQUEST, | ||
90 | + } | ||
91 | +} | ||
92 | +export function nextBtnProcessingFailure() { | ||
93 | + return { | ||
94 | + type: NEXT_BTN_PROCESSING_FAILURE | ||
95 | + } | ||
96 | +} | ||
97 | +export function nextBtnProcessingSuccess() { | ||
98 | + return { | ||
99 | + type: NEXT_BTN_PROCESSING_SUCCESS | ||
100 | + } | ||
101 | +} | ||
102 | + | ||
103 | +export function onPressProtocol() { | ||
104 | + return (dispatch, getState) => { | ||
105 | + //跳转原生静态页面 | ||
106 | + let url = `://m.yohobuy.com/home/installment/agreement?openby:yohobuy={"action":"go.h5","params":{"url":"http://m.yohobuy.com/home/installment/agreement"}}`; | ||
107 | + ReactNative.NativeModules.YH_CommonHelper.jumpWithUrl(url); | ||
108 | + }; | ||
109 | +} | ||
110 | + | ||
111 | +export function onPressOpenNext() { | ||
112 | + return (dispatch, getState) => { | ||
113 | + let {app, newRegister} = getState(); | ||
114 | + let {nextBtnEnable,cellList,nextProcessing} = newRegister; | ||
115 | + let activateParams = {}; | ||
116 | + let newCellList = cellList; | ||
117 | + // if (!nextBtnEnable) { | ||
118 | + // return; | ||
119 | + // } | ||
120 | + ReactNative.NativeModules.YH_InstallmentHelper.gotoInstallmentStatusView('2', '您的授信未通过,在有货更多的消费,增加信用度,会大大提升审核通过率奥。'); | ||
121 | + return; | ||
122 | + cellList.map((item, i) => { | ||
123 | + if (item.get('inputKey') != 'BankIcon') { | ||
124 | + activateParams[item.get('inputKey')]= item.get('text'); | ||
125 | + } | ||
126 | + }); | ||
127 | + let activateService = (uid) => { | ||
128 | + dispatch(nextBtnProcessingRequest()); | ||
129 | + return new InstallmentService(app.host).checkVerifyCode(uid, activateParams.mobile, activateParams.snsCheckCode) | ||
130 | + .then(json => { | ||
131 | + if (json.result === '1') { | ||
132 | + return new InstallmentService(app.host).activateService(activateParams) | ||
133 | + }else { | ||
134 | + newCellList.map((item, i) => { | ||
135 | + if (item.inputKey == 'snsCheckCode') { | ||
136 | + item.text = ''; | ||
137 | + } | ||
138 | + cellList[i] = item; | ||
139 | + }); | ||
140 | + dispatch(updateTipMessage(json.message)) | ||
141 | + dispatch(updateCellList(cellList)); | ||
142 | + dispatch(nextBtnProcessingFailure()); | ||
143 | + } | ||
144 | + }) | ||
145 | + .then(json => { | ||
146 | + dispatch(nextBtnProcessingSuccess()); | ||
147 | + console.log('2222222'); | ||
148 | + console.log(json); | ||
149 | + let tipMessage = ''; | ||
150 | + if (json.status == '3') { | ||
151 | + json.failReason = json.failReason || '姓名、身份证、银行卡不匹配'; | ||
152 | + } | ||
153 | + ReactNative.NativeModules.YH_InstallmentHelper.gotoInstallmentStatusView(json.status, json.failReason); | ||
154 | + }) | ||
155 | + .catch(error => { | ||
156 | + }); | ||
157 | + } | ||
158 | + | ||
159 | + ReactNative.NativeModules.YH_CommonHelper.uid() | ||
160 | + .then(uid => { | ||
161 | + activateService(uid); | ||
162 | + }) | ||
163 | + .catch(error => { | ||
164 | + ReactNative.NativeModules.YH_CommonHelper.login() | ||
165 | + .then(uid => { | ||
166 | + activateService(uid); | ||
167 | + }) | ||
168 | + .catch(error => { | ||
169 | + | ||
170 | + }); | ||
171 | + }); | ||
172 | + | ||
173 | + }; | ||
174 | +} | ||
175 | + | ||
176 | +export function onPressCheckbox() { | ||
177 | + return (dispatch, getState) => { | ||
178 | + let {app, newRegister} = getState(); | ||
179 | + let {agreeProtocol} = newRegister; | ||
180 | + agreeProtocol = !agreeProtocol; | ||
181 | + dispatch(updateAgreeProtocolStatus(agreeProtocol)); | ||
182 | + }; | ||
183 | +} | ||
184 | + | ||
185 | +export function onPressCardNoQuestion() { | ||
186 | + return (dispatch, getState) => { | ||
187 | + let {app, newRegister} = getState(); | ||
188 | + let {showBankAlert} = newRegister; | ||
189 | + showBankAlert = !showBankAlert; | ||
190 | + dispatch(updateShowBankAlertStatus(showBankAlert)); | ||
191 | + }; | ||
192 | +} | ||
193 | + | ||
194 | +export function getBankInfo(cellInfo,cardNo) { | ||
195 | + return (dispatch, getState) => { | ||
196 | + let bankInfo = (uid) => { | ||
197 | + let {app, newRegister} = getState(); | ||
198 | + let {snsCheckCodeEnable} = newRegister; | ||
199 | + let bankInfo = { | ||
200 | + bankCode: '', | ||
201 | + bankName: '', | ||
202 | + bankText: '', | ||
203 | + bankLogo: '', | ||
204 | + show: false, | ||
205 | + }; | ||
206 | + let nextBtnEnable = true; | ||
207 | + return new InstallmentService('http://api-test2.yohops.com:9999/').fentchBankInfo(cardNo,uid) | ||
208 | + .then(json => { | ||
209 | + console.log('--1'); | ||
210 | + console.log(json); | ||
211 | + if (json.businessSupport == '0' && json.bankCode && json.bankCode != '') { | ||
212 | + bankInfo.bankCode = json.bankCode; | ||
213 | + bankInfo.bankName = json.bankName; | ||
214 | + bankInfo.bankLogo = json.bankLogo; | ||
215 | + bankInfo.show = true; | ||
216 | + }else { | ||
217 | + bankInfo.bankCode = ''; | ||
218 | + bankInfo.bankName = ''; | ||
219 | + bankInfo.bankText = '暂不支持此银行卡'; | ||
220 | + bankInfo.show = true; | ||
221 | + } | ||
222 | + console.log('-----bankInfo 1'); | ||
223 | + console.log(bankInfo); | ||
224 | + dispatch(updateBankInfo(bankInfo)); | ||
225 | + }) | ||
226 | + .catch(error => { | ||
227 | + }); | ||
228 | + } | ||
229 | + | ||
230 | + ReactNative.NativeModules.YH_CommonHelper.uid() | ||
231 | + .then(uid => { | ||
232 | + bankInfo(uid); | ||
233 | + }) | ||
234 | + .catch(error => { | ||
235 | + ReactNative.NativeModules.YH_CommonHelper.login() | ||
236 | + .then(uid => { | ||
237 | + bankInfo(uid); | ||
238 | + }) | ||
239 | + .catch(error => { | ||
240 | + | ||
241 | + }); | ||
242 | + }); | ||
243 | + } | ||
244 | +} | ||
245 | + | ||
246 | +export function updateOpenPageCellInfo(cellInfo) { | ||
247 | + return (dispatch, getState) => { | ||
248 | + let {app, newRegister} = getState(); | ||
249 | + let {cellList,snsCheckCodeEnable} = newRegister; | ||
250 | + cellList = cellList.toJS(); | ||
251 | + let newCellList = cellList; | ||
252 | + let cardNoValid = false; | ||
253 | + let mobileValid = false; | ||
254 | + let nextBtnEnable = true; | ||
255 | + | ||
256 | + if (cellInfo.inputKey == "cardNo") { | ||
257 | + let value = cellInfo.text; | ||
258 | + console.log('value'); | ||
259 | + console.log(value); | ||
260 | + let cardNo = value.replace(/\s/g, ''); | ||
261 | + let newCardNo = value.replace(/[^\d]/g, '').replace(/(\d{4})(?=\d)/g, '$1 '); | ||
262 | + console.log('newCardNo'); | ||
263 | + console.log(newCardNo); | ||
264 | + cellInfo.text = newCardNo; | ||
265 | + if (cardNo && cardNo.length >= 16) { | ||
266 | + cardNoValid = true; | ||
267 | + dispatch(getBankInfo(cellInfo,value)); | ||
268 | + }else { | ||
269 | + cardNoValid = false; | ||
270 | + cellInfo.showBankIcon = false; | ||
271 | + dispatch(updateBankInfo({ | ||
272 | + show: false, | ||
273 | + })); | ||
274 | + } | ||
275 | + | ||
276 | + }else if (cellInfo.inputKey == "mobile" && cellInfo.text.length ==11) { | ||
277 | + mobileValid = true; | ||
278 | + } | ||
279 | + | ||
280 | + | ||
281 | + newCellList.map((item, i) => { | ||
282 | + if (item.inputKey == 'cardNo' && item.text.length >=16 && cellInfo.inputKey != 'cardNo') { | ||
283 | + cardNoValid = true; | ||
284 | + } else if (item.inputKey == 'mobile' && item.text.length ==11 && cellInfo.inputKey != 'mobile') { | ||
285 | + mobileValid = true; | ||
286 | + } | ||
287 | + if (item.inputKey == cellInfo.inputKey) { | ||
288 | + item = cellInfo; | ||
289 | + } | ||
290 | + if (item.text == '') { | ||
291 | + nextBtnEnable = false; | ||
292 | + } | ||
293 | + cellList[i] = item; | ||
294 | + }); | ||
295 | + if (cardNoValid && mobileValid) { | ||
296 | + snsCheckCodeEnable = true; | ||
297 | + }else { | ||
298 | + snsCheckCodeEnable = false; | ||
299 | + } | ||
300 | + console.log('cellInfo'); | ||
301 | + console.log(cellInfo); | ||
302 | + dispatch(updateCellList(cellList)); | ||
303 | + dispatch(updateSnsCheckCodeEnableStatus(snsCheckCodeEnable)); | ||
304 | + dispatch(updateNextBtnEnableStatus(nextBtnEnable)); | ||
305 | + }; | ||
306 | +} | ||
307 | + | ||
308 | +/** | ||
309 | + * 倒计时 | ||
310 | + * | ||
311 | + * @param start 启动回调 | ||
312 | + * @param tick 进度回调 | ||
313 | + * @param complete 完成回调 | ||
314 | + */ | ||
315 | +Timer.prototype.startCountdown = function(start, tick, complete) { | ||
316 | + var self = this; | ||
317 | + | ||
318 | + if (this.counter > 0 || this.countdownTimer) { | ||
319 | + return; | ||
320 | + } else { | ||
321 | + this.counter = 59; | ||
322 | + } | ||
323 | + | ||
324 | + | ||
325 | + // 启动回调 | ||
326 | + if (start) { | ||
327 | + start.call(this); | ||
328 | + } | ||
329 | + | ||
330 | + if (tick) { | ||
331 | + tick.call(this, this.counter); | ||
332 | + } | ||
333 | + | ||
334 | + this.complete = complete; | ||
335 | + | ||
336 | + | ||
337 | + // 开始计时器 | ||
338 | + this.countdownTimer = setInterval(function() { | ||
339 | + self.counter--; | ||
340 | + | ||
341 | + if (self.counter <= 0) { | ||
342 | + if (complete) { | ||
343 | + clearInterval(self.countdownTimer); | ||
344 | + | ||
345 | + // 重置计时器 | ||
346 | + self.counter = 0; | ||
347 | + self.countdownTimer = null; | ||
348 | + complete.call(self); | ||
349 | + } | ||
350 | + } | ||
351 | + | ||
352 | + // 完成回调 | ||
353 | + if (tick && self.counter > 0) { | ||
354 | + tick.call(self, self.counter); | ||
355 | + } | ||
356 | + }, 1000); | ||
357 | + | ||
358 | + return this; | ||
359 | +}; | ||
360 | + | ||
361 | +export function onPressCheckCode() { | ||
362 | + return (dispatch, getState) => { | ||
363 | + let {app, newRegister} = getState(); | ||
364 | + let {cellList,snsCheckCodeEnable,snsCheckCodeText} = newRegister; | ||
365 | + if (snsCheckCodeEnable && snsCheckCodeText == '获取验证码') { | ||
366 | + return new InstallmentService(app.host).sendVerifyCode('17705176933') | ||
367 | + .then(json => { | ||
368 | + | ||
369 | + let status = 0; | ||
370 | + let snsText = ''; | ||
371 | + new Timer().startCountdown(function() { | ||
372 | + }, function(counter) { | ||
373 | + // 进度回调 | ||
374 | + snsText = counter + 's'; | ||
375 | + dispatch(updateSnsCheckCodeText(snsText)); | ||
376 | + }, function() { | ||
377 | + // 倒计时结束后再次显示 "获取验证码" | ||
378 | + snsText = '获取验证码'; | ||
379 | + dispatch(updateSnsCheckCodeText(snsText)); | ||
380 | + }); | ||
381 | + dispatch(updateSnsCheckCodeText(snsText)); | ||
382 | + }) | ||
383 | + .catch(error => { | ||
384 | + }); | ||
385 | + } | ||
386 | + | ||
387 | + }; | ||
388 | +} |
@@ -45,49 +45,18 @@ let banks = ['农业银行', '中国银行', '工商银行', '建设银行', ' | @@ -45,49 +45,18 @@ let banks = ['农业银行', '中国银行', '工商银行', '建设银行', ' | ||
45 | let InitialState = Record({ | 45 | let InitialState = Record({ |
46 | isFetching:false, | 46 | isFetching:false, |
47 | uid: '', | 47 | uid: '', |
48 | - installmentStatus:new (Record({ | ||
49 | - isFetching:false, | ||
50 | - status: '', | ||
51 | - error: null, | ||
52 | - })), | ||
53 | - open:new (Record({ | ||
54 | - productListForInstallment:new (Record({ | ||
55 | - list:List(), | ||
56 | - page:1, | ||
57 | - totalPage:1, | ||
58 | - })), | ||
59 | - installmentInfo:'', | ||
60 | - })), | ||
61 | - alreadyOpenedPageInfo:new (Record({ | ||
62 | - tabFocusIndex: 1, | ||
63 | - goods: List(), | ||
64 | - isOverdue: false, | ||
65 | - content: Map(), | ||
66 | - notice: Map(), | ||
67 | - installmentInfo:Map(), | ||
68 | - creditInfo: Map(), | ||
69 | - })), | ||
70 | - openPageInfo:new (Record({ //开通有货分期页面数据 | ||
71 | - cellList: Immutable.fromJS(openPageParams), | ||
72 | - agreeProtocol: true, | ||
73 | - nextBtnEnable: false, | ||
74 | - nextBtnText: '下一步', | ||
75 | - nextProcessing: false, | ||
76 | - snsCheckCodeEnable: false, | ||
77 | - snsCheckCodeText: '获取验证码', | ||
78 | - banks: banks.join('、'), | ||
79 | - showBankAlert: false, | ||
80 | - bankList: Immutable.fromJS(banks), | ||
81 | - tipMessage: '', | ||
82 | - })), | ||
83 | - installmentStausPageInfo:new (Record({ | ||
84 | - statusCode: '', | ||
85 | - status: 'success', | ||
86 | - jumpUrl: '', | ||
87 | - statusInfo:Map(), | ||
88 | - goods: List(), | ||
89 | - advertisement: false, | ||
90 | - })), | 48 | + cellList: Immutable.fromJS(openPageParams), |
49 | + agreeProtocol: true, | ||
50 | + nextBtnEnable: false, | ||
51 | + nextBtnText: '下一步', | ||
52 | + nextProcessing: false, | ||
53 | + snsCheckCodeEnable: false, | ||
54 | + snsCheckCodeText: '获取验证码', | ||
55 | + banks: banks.join('、'), | ||
56 | + showBankAlert: false, | ||
57 | + bankList: Immutable.fromJS(banks), | ||
58 | + tipMessage: '', | ||
59 | + bankInfo: Immutable.fromJS(), | ||
91 | }); | 60 | }); |
92 | 61 | ||
93 | export default InitialState; | 62 | export default InitialState; |
1 | +'use strict'; | ||
2 | + | ||
3 | +import InitialState from './newRegisterInitialState'; | ||
4 | +import Immutable, {Map} from 'immutable'; | ||
5 | + | ||
6 | +const { | ||
7 | + SET_PLATFORM, | ||
8 | + | ||
9 | + UPDATE_SHOW_BANK_ALERT_STATUS, | ||
10 | + UPDATE_AGREE_PROTOCOL_STATUS, | ||
11 | + UPDATE_SNS_CHECK_CODE_ENABLE_STATUS, | ||
12 | + UPDATE_CELL_LIST, | ||
13 | + UPDATE_NEXT_BTN_ENABLE_STATUS, | ||
14 | + UPDATE_NEXT_BTN_TEXT, | ||
15 | + UPDATE_SNS_CHECK_CODE_TEXT, | ||
16 | + UPDATE_TIP_MESSAGE, | ||
17 | + UPDATE_BANK_INFO, | ||
18 | + NEXT_BTN_PROCESSING_REQUEST, | ||
19 | + NEXT_BTN_PROCESSING_SUCCESS, | ||
20 | + NEXT_BTN_PROCESSING_FAILURE, | ||
21 | + | ||
22 | +} = require('../../../constants/actionTypes').default; | ||
23 | + | ||
24 | +const initialState = new InitialState; | ||
25 | + | ||
26 | +export default function appReducer(state = initialState, action) { | ||
27 | + if (!(state instanceof InitialState)) return initialState.merge(state); | ||
28 | + | ||
29 | + switch (action.type) { | ||
30 | + case UPDATE_SHOW_BANK_ALERT_STATUS: | ||
31 | + return state.set('showBankAlert', action.payload); | ||
32 | + case UPDATE_AGREE_PROTOCOL_STATUS: | ||
33 | + return state.set('agreeProtocol', action.payload); | ||
34 | + case UPDATE_SNS_CHECK_CODE_ENABLE_STATUS: | ||
35 | + return state.set('snsCheckCodeEnable', action.payload); | ||
36 | + case UPDATE_CELL_LIST: | ||
37 | + return state.set('cellList', Immutable.fromJS(action.payload)); | ||
38 | + case UPDATE_NEXT_BTN_ENABLE_STATUS: | ||
39 | + return state.set('nextBtnEnable', action.payload); | ||
40 | + case UPDATE_SNS_CHECK_CODE_TEXT: | ||
41 | + return state.set('snsCheckCodeText', action.payload); | ||
42 | + case UPDATE_TIP_MESSAGE: | ||
43 | + return state.set('tipMessage', action.payload); | ||
44 | + case UPDATE_BANK_INFO: | ||
45 | + return state.set('bankInfo', Immutable.fromJS(action.payload)); | ||
46 | + case NEXT_BTN_PROCESSING_REQUEST: | ||
47 | + return state.set('nextBtnText', '处理中...') | ||
48 | + .set('nextProcessing', true); | ||
49 | + case NEXT_BTN_PROCESSING_SUCCESS: | ||
50 | + return state.set('nextBtnText', '下一步') | ||
51 | + .set('nextProcessing', false); | ||
52 | + case NEXT_BTN_PROCESSING_FAILURE: | ||
53 | + return state.set('nextBtnText', '下一步') | ||
54 | + .set('nextProcessing', false); | ||
55 | + } | ||
56 | + | ||
57 | + return state; | ||
58 | +} |
1 | +'use strict'; | ||
2 | + | ||
3 | +import ReactNative from 'react-native'; | ||
4 | +import InstallmentService from '../../../services/InstallmentService'; | ||
5 | + | ||
6 | +const { | ||
7 | + | ||
8 | +SET_PLATFORM, | ||
9 | +SET_QUERY_DAYS, | ||
10 | +SET_REPAYMENT_LIST, | ||
11 | + | ||
12 | +} = require('../../../constants/actionTypes').default; | ||
13 | + | ||
14 | +export function setQueryDays(days){ | ||
15 | + return { | ||
16 | + type: SET_QUERY_DAYS, | ||
17 | + payload: days, | ||
18 | + } | ||
19 | +} | ||
20 | + | ||
21 | +// SET_REPAYMENT_LIST | ||
22 | +export function setRepaymentList(list){ | ||
23 | + return { | ||
24 | + type: SET_REPAYMENT_LIST, | ||
25 | + payload: list, | ||
26 | + } | ||
27 | +} | ||
28 | + | ||
29 | +export function getQueryAmtList(days) { | ||
30 | + return (dispatch, getState) => { | ||
31 | + let {app, rePayList} = getState(); | ||
32 | + return new InstallmentService(app.host).getQueryAmtList(days) | ||
33 | + .then(json => { | ||
34 | + if (json && json.length > 0) { | ||
35 | + dispatch(setRepaymentList(json)); | ||
36 | + } | ||
37 | + }) | ||
38 | + .catch(error => { | ||
39 | + }); | ||
40 | + }; | ||
41 | +} | ||
42 | + | ||
43 | +export function getoNewArrival() { | ||
44 | + return (dispatch, getState) => { | ||
45 | + let {app, rePayList} = getState(); | ||
46 | + let jumpUrl = `http://m.yohobuy.com/product/new/?openby:yohobuy={"action":"go.new","params":{"title":"新品到着"}}`; | ||
47 | + ReactNative.NativeModules.YH_CommonHelper.jumpWithUrl(jumpUrl); | ||
48 | + | ||
49 | + }; | ||
50 | +} |
1 | +'use strict'; | ||
2 | + | ||
3 | +import InitialState from './repayListInitialState'; | ||
4 | +import Immutable, {Map} from 'immutable'; | ||
5 | + | ||
6 | +const { | ||
7 | + SET_QUERY_DAYS, | ||
8 | + SET_REPAYMENT_LIST, | ||
9 | + | ||
10 | +} = require('../../../constants/actionTypes').default; | ||
11 | + | ||
12 | +const initialState = new InitialState; | ||
13 | + | ||
14 | +export default function appReducer(state = initialState, action) { | ||
15 | + if (!(state instanceof InitialState)) return initialState.merge(state); | ||
16 | + | ||
17 | + switch (action.type) { | ||
18 | + case SET_QUERY_DAYS:{ | ||
19 | + return state.set('queryDays', action.payload); | ||
20 | + } | ||
21 | + case SET_REPAYMENT_LIST: { | ||
22 | + return state.set('repaymentList', Immutable.from(action.payload)); | ||
23 | + } | ||
24 | + } | ||
25 | + | ||
26 | + return state; | ||
27 | +} |
@@ -206,4 +206,23 @@ export default class InstallmentService { | @@ -206,4 +206,23 @@ export default class InstallmentService { | ||
206 | throw(error); | 206 | throw(error); |
207 | }); | 207 | }); |
208 | } | 208 | } |
209 | + | ||
210 | + // 获取用户待还列表信息 queryDays -1:逾期待还;0:全部待还;7:七日待还;30:本月待还 | ||
211 | + async getQueryAmtList(queryDays) { | ||
212 | + return await this.api.get({ | ||
213 | + url: '', | ||
214 | + body: { | ||
215 | + method: 'app.order.queryAmtList', | ||
216 | + pageSize: '20', | ||
217 | + queryDays, | ||
218 | + } | ||
219 | + }) | ||
220 | + .then((json) => { | ||
221 | + return json; | ||
222 | + }) | ||
223 | + .catch((error) => { | ||
224 | + throw(error); | ||
225 | + }); | ||
226 | + } | ||
227 | + | ||
209 | } | 228 | } |
-
Please register or login to post a comment