Authored by 孙凯

Merge branch '5.4.1' of http://git.yoho.cn/mobile/YH_RNComponent into 5.4.1

  1 +'use strict';
  2 +
  3 +import React, {Component} from 'react';
  4 +import ReactNative, {
  5 + View,
  6 + TouchableOpacity,
  7 + StyleSheet,
  8 + Dimensions,
  9 +} from 'react-native';
  10 +import Immutable, {Map} from 'immutable';
  11 +import TimerMixin from 'react-timer-mixin';
  12 +
  13 +
  14 +import SlicedImage from '../../../common/components/SlicedImage';
  15 +import YH_Image from '../../../common/components/YH_Image';
  16 +
  17 +import HeadTitleCell from '../cell/HeadTitleCell';
  18 +import ImageSlider from '../cell/ImageSlider';
  19 +
  20 +
  21 +/**
  22 + * 首页 sale 楼层,
  23 + * 这个楼层是标题、banner、左带倒计时大图,右四小图
  24 + **/
  25 +export default class Sale1T1L4R extends Component{
  26 +
  27 +
  28 + constructor(props) {
  29 + super(props);
  30 +
  31 + this.state = {
  32 + remainTime : "",
  33 + };
  34 + }
  35 +
  36 + componentWillUnmount() {
  37 + this.timer && TimerMixin.clearTimeout(this.timer);
  38 + }
  39 +
  40 +
  41 + render(){
  42 +
  43 + let data = this.props.data;
  44 + let banner = data.get("banner");
  45 + let title = data.get("title");
  46 + let imglst = data.get("list");
  47 +
  48 + //初始化时间,待测
  49 +
  50 + let leftBigImageUrl = SlicedImage.getSlicedUrl(imglst.get(0).get("src"), leftBigImageWidth, leftBigImageHeight, 2);
  51 + let rightTopBigImageUrl = SlicedImage.getSlicedUrl(imglst.get(1).get("src"), rightBigImageWidth, rightBigImageHeight, 2);
  52 + let rightTopSmallImageUrl = SlicedImage.getSlicedUrl(imglst.get(2).get("src"), rightSmallImageWidth, rightSmallImageHeight, 2);
  53 + let rightBottomBigImageUrl = SlicedImage.getSlicedUrl(imglst.get(3).get("src"), rightBigImageWidth, rightBigImageHeight, 2);
  54 + let rightBottomSmallImageUrl = SlicedImage.getSlicedUrl(imglst.get(4).get("src"), rightSmallImageWidth, rightSmallImageHeight, 2);
  55 +
  56 + return(
  57 + <View style={styles.container}>
  58 + <HeadTitleCell title={title.get('title')} moreUrl={title.get('more_url')} />
  59 +
  60 + <ImageSlider
  61 + resource={banner}
  62 + sliderWidth={width}
  63 + sliderHeight={bannerHeight}
  64 + onPressSlideItem={this.props.onPressSlideItem}
  65 + />
  66 +
  67 + <View style={styles.imageContainer}>
  68 +
  69 + <TouchableOpacity style={styles.leftBigImageContainer} activeOpacity={1}
  70 + onPress={() => this.props.onPressImageItem && this.props.onPressImageItem(imglst.get(0).toJS())}>
  71 + <YH_Image style={styles.leftBigImage} url={leftBigImageUrl}/>
  72 +
  73 + <Image style={styles.timerImage} source={require("../../images/ic_limit_times.png")}/>
  74 +
  75 + <Text style={styles.timerText}>{remainTime}</Text>
  76 +
  77 + </TouchableOpacity>
  78 +
  79 + <TouchableOpacity style={styles.rightTopBigImageContainer} activeOpacity={1}
  80 + onPress={() => this.props.onPressImageItem && this.props.onPressImageItem(imglst.get(1).toJS())}>
  81 + <YH_Image style={styles.rightTopBigImage} url={rightTopBigImageUrl}/>
  82 + </TouchableOpacity>
  83 +
  84 + <TouchableOpacity style={styles.rightTopSmallImageContainer} activeOpacity={1}
  85 + onPress={() => this.props.onPressImageItem && this.props.onPressImageItem(imglst.get(2).toJS())}>
  86 + <YH_Image style={styles.rightTopSmallImage} url={rightTopSmallImageUrl}/>
  87 + </TouchableOpacity>
  88 +
  89 + <TouchableOpacity style={styles.rightBottomBigImageContainer} activeOpacity={1}
  90 + onPress={() => this.props.onPressImageItem && this.props.onPressImageItem(imglst.get(3).toJS())}>
  91 + <YH_Image style={styles.rightBottomBigImage} url={rightBottomBigImageUrl}/>
  92 + </TouchableOpacity>
  93 +
  94 + <TouchableOpacity style={styles.rightBottomSmallImageContainer} activeOpacity={1}
  95 + onPress={() => this.props.onPressImageItem && this.props.onPressImageItem(imglst.get(4).toJS())}>
  96 + <YH_Image style={styles.rightBottomSmallImage} url={rightBottomSmallImageUrl}/>
  97 + </TouchableOpacity>
  98 + </View>
  99 + </View>
  100 + );
  101 + }
  102 +
  103 +};
  104 +
  105 +let {width} = Dimensions.get('window');
  106 +const DEVICE_WIDTH_RATIO = width / 320;
  107 +
  108 +let bannerHeight = Math.floor(width / 3);
  109 +
  110 +let leftBigImageWidth = width * 310 / 740;
  111 +let leftBigImageHeight = leftBigImageWidth * 422 / 310;
  112 +
  113 +let rightBigImageWidth = width * 330 / 740;
  114 +let rightBigImageHeight = rightBigImageWidth * 210 / 330;
  115 +
  116 +let rightSmallImageWidth = width * 100 / 740;
  117 +let rightSmallImageHeight = rightSmallImageWidth * 210 / 100;
  118 +
  119 +
  120 +let styles = StyleSheet.create({
  121 +
  122 + container: {
  123 + width: width,
  124 + backgroundColor: "#e5e5e5",
  125 + },
  126 +
  127 + imageContainer: {
  128 + width: width,
  129 + height: 422 * DEVICE_WIDTH_RATIO,
  130 + },
  131 +
  132 + leftBigImageContainer: {
  133 + position: 'absolute',
  134 + top: 0,
  135 + left: 0,
  136 + width: leftBigImageWidth,
  137 + height: leftBigImageHeight,
  138 + },
  139 +
  140 + leftBigImage: {
  141 + width: leftBigImageWidth,
  142 + height: leftBigImageHeight,
  143 + },
  144 +
  145 + timerImage:{
  146 + position: 'absolute',
  147 + top: 20,
  148 + },
  149 +
  150 + timerText:{
  151 + position: 'absolute',
  152 + top: 50,
  153 + textAlign: 'center',
  154 + },
  155 +
  156 + rightTopBigImageContainer: {
  157 + position: 'absolute',
  158 + top: 0,
  159 + left: leftBigImageWidth,
  160 + width: rightBigImageWidth,
  161 + height: rightBigImageHeight,
  162 + },
  163 +
  164 + rightTopBigImage: {
  165 + width: rightBigImageWidth,
  166 + height: rightBigImageHeight,
  167 + },
  168 +
  169 + rightTopSmallImageContainer: {
  170 + position: 'absolute',
  171 + top: 0,
  172 + left: leftBigImageWidth,
  173 + width: rightSmallImageWidth,
  174 + height: rightSmallImageHeight,
  175 + },
  176 +
  177 + rightTopSmallImage: {
  178 + width: rightSmallImageWidth,
  179 + height: rightSmallImageHeight,
  180 + },
  181 +
  182 + rightBottomBigImageContainer: {
  183 + position: 'absolute',
  184 + top: rightBigImageHeight,
  185 + left: leftBigImageWidth,
  186 + width: rightBigImageWidth,
  187 + height: rightBigImageHeight,
  188 + marginTop: 2,
  189 + },
  190 +
  191 + rightBottomBigImage: {
  192 + width: rightBigImageWidth,
  193 + height: rightBigImageHeight,
  194 + },
  195 +
  196 + rightBottomSmallImageContainer: {
  197 + position: 'absolute',
  198 + top: rightBigImageHeight,
  199 + left: leftBigImageWidth + rightBigImageWidth,
  200 + width: rightSmallImageWidth,
  201 + height: rightSmallImageHeight,
  202 + marginTop: 2,
  203 + },
  204 +
  205 + rightBottomBigImage: {
  206 + width: rightSmallImageWidth,
  207 + height: rightSmallImageHeight,
  208 + },
  209 +
  210 +
  211 +
  212 +
  213 +});
  214 +
@@ -20,12 +20,17 @@ import installmentInitialState from './reducers/installment/installmentInitialSt @@ -20,12 +20,17 @@ import installmentInitialState from './reducers/installment/installmentInitialSt
20 20
21 import InstallmentContainer from './containers/InstallmentContainer'; 21 import InstallmentContainer from './containers/InstallmentContainer';
22 import OpenContainer from './containers/OpenContainer'; 22 import OpenContainer from './containers/OpenContainer';
  23 +import InstallmentStatusContainer from './containers/InstallmentStatusContainer';
23 24
24 import { 25 import {
25 setPlatform, 26 setPlatform,
26 setChannel, 27 setChannel,
27 } from './reducers/app/appActions'; 28 } from './reducers/app/appActions';
28 29
  30 +import {
  31 + setInstallmentStausPageParams,
  32 +} from './reducers/installment/installmentActions';
  33 +
29 function getInitialState() { 34 function getInitialState() {
30 const _initState = { 35 const _initState = {
31 app: (new appInitialState()), 36 app: (new appInitialState()),
@@ -56,6 +61,16 @@ export default function native(platform) { @@ -56,6 +61,16 @@ export default function native(platform) {
56 <OpenContainer /> 61 <OpenContainer />
57 </Provider> 62 </Provider>
58 ); 63 );
  64 + } else if (type == 'installStatus') {
  65 + let status = this.props.status;
  66 + let failReason = this.props.failReason;
  67 + let uid = this.props.uid;
  68 + store.dispatch(setInstallmentStausPageParams(status,failReason,uid));
  69 + return (
  70 + <Provider store={store}>
  71 + <InstallmentStatusContainer />
  72 + </Provider>
  73 + )
59 } 74 }
60 75
61 } 76 }
  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 + Platform,
  12 + ListView,
  13 +} from 'react-native';
  14 +
  15 +import Immutable, {Map} from 'immutable';
  16 +import ProductListCell from '../../../common/components/ListCell/ProductListCell';
  17 +
  18 +export default class InstallmentStatus extends React.Component {
  19 + constructor(props) {
  20 + super(props);
  21 + this._renderRow = this._renderRow.bind(this);
  22 + this._renderHeader=this._renderHeader.bind(this);
  23 + this.dataSource = new ListView.DataSource({
  24 + rowHasChanged: (r1, r2) => !Immutable.is(r1, r2),
  25 + });
  26 + }
  27 +
  28 + _renderRow(rowData, sectionID, rowID, highlightRow) {
  29 + let paddingLeft = rowID % 2 == 1 ? rowMarginHorizontal / 2 : rowMarginHorizontal;
  30 + let customStyle = rowID == 0 || rowID == 1 ? {paddingLeft} : {paddingLeft};
  31 + return (
  32 + <ProductListCell
  33 + style={[styles.listContainer, customStyle]}
  34 + key={'row' + rowID}
  35 + rowID={rowID}
  36 + data={rowData}
  37 + onPressProduct={this.props.onPressProductListProduct}
  38 + />
  39 + );
  40 + }
  41 +
  42 + _renderHeader() {
  43 + let {failReason,status,jumpUrl,statusInfo,goods} = this.props.installmentStausPageInfo;
  44 + let resultImg;
  45 + if (status == 'review') {
  46 + resultImg = require('../../image/review-img-1.png');
  47 + } else if (status == 'error') {
  48 + resultImg = require('../../image/review-img-2.png');
  49 + } else if (status == 'success') {
  50 + resultImg = require('../../image/review-img-4.png');
  51 + } else if (status == 'cancel') {
  52 + resultImg = require('../../image/review-img-5.png');
  53 + } else if (status == 'refresh') {
  54 + resultImg = require('../../image/review-img-6.png');
  55 + }
  56 + if (goods && goods.size > 0) {
  57 + headerContainerHeight = (235 + 27 + 20 + 79 + 84.5) * DEVICE_WIDTH_RATIO;
  58 + }
  59 + if (status == 'cancel') {
  60 + headerContainerHeight = (235 + 27 + 20 + 79 + 40) * DEVICE_WIDTH_RATIO;
  61 + }
  62 + return (
  63 + <View style={[styles.headerContainer,{height:headerContainerHeight}]}>
  64 + <Image
  65 + style={styles.statusIcon}
  66 + source={resultImg}
  67 + resizeMode={'contain'}
  68 + />
  69 + <Text style={styles.message}>
  70 + {statusInfo.get('message')}
  71 + </Text>
  72 + {status=='success'?
  73 + <View>
  74 + <Text style={{fontSize:12}}>
  75 + ¥
  76 + <Text style={{fontSize: 24}}>
  77 + {statusInfo.get('reason')}
  78 + </Text>
  79 + </Text>
  80 + </View>
  81 + :<View>
  82 + <Text style={styles.reason}>
  83 + {statusInfo.get('reason')}
  84 + </Text>
  85 + {statusInfo.get('reasonTwo') ?
  86 + <Text style={styles.reason}>
  87 + {statusInfo.get('reasonTwo')}
  88 + </Text>
  89 + :null
  90 + }
  91 + {statusInfo.get('reasonThird') ?
  92 + <Text style={styles.reason}>
  93 + {statusInfo.get('reasonThird')}
  94 + </Text>
  95 + :null
  96 + }
  97 + </View>
  98 + }
  99 +
  100 + <TouchableOpacity onPress={() => {this.props.onPressStatusPageBtn && this.props.onPressStatusPageBtn()}} >
  101 + <View style={styles.buttonContainer}>
  102 + <Text style={styles.button}>
  103 + {statusInfo.get('btnText')}
  104 + </Text>
  105 + </View>
  106 + </TouchableOpacity>
  107 +
  108 + {goods&&goods.size>0 ?
  109 + <View>
  110 + <View style={{
  111 + marginTop: 30 * DEVICE_WIDTH_RATIO,
  112 + width: width,
  113 + height: 10 * DEVICE_WIDTH_RATIO,
  114 + backgroundColor: '#e5e5e5',
  115 + }}/>
  116 + <Text style={{
  117 + width: width,
  118 + height: 44 * DEVICE_WIDTH_RATIO,
  119 + textAlign: 'center',
  120 + lineHeight: 29 *DEVICE_WIDTH_RATIO,
  121 + }}>
  122 + 分期专享
  123 + </Text>
  124 + <View style={{
  125 + width: width,
  126 + height: 0.5 * DEVICE_WIDTH_RATIO,
  127 + backgroundColor: '#e5e5e5',
  128 + }}/>
  129 + </View>
  130 + :null
  131 + }
  132 + </View>
  133 + )
  134 + }
  135 +
  136 + render() {
  137 + let {failReason,status,jumpUrl,statusInfo,goods} = this.props.installmentStausPageInfo;
  138 + let dataSource = goods.toArray();
  139 + return(
  140 + <View style={styles.container}>
  141 + <ListView
  142 + contentContainerStyle={styles.contentContainer}
  143 + enableEmptySections={true}
  144 + dataSource={this.dataSource.cloneWithRows(dataSource)}
  145 + renderRow={this._renderRow}
  146 + renderHeader={this._renderHeader}
  147 + onEndReached={() => {
  148 + if (goods && goods.size > 0) {
  149 + this.props.onEndReached && this.props.onEndReached();
  150 + }
  151 + }}
  152 + />
  153 + </View>
  154 + );
  155 + }
  156 +};
  157 +
  158 +let {width, height} = Dimensions.get('window');
  159 +let rowWidth = Math.ceil(137.5 * width / 320);
  160 +let rowHeight = Math.ceil(254 * width / 320);
  161 +let rowMarginTop = Math.ceil(10 * width / 320);
  162 +let rowMarginHorizontal = (width - rowWidth * 2) / 3;
  163 +const DEVICE_WIDTH_RATIO = width / 320;
  164 +let headerContainerHeight = (235 + 27 + 20 + 79) * DEVICE_WIDTH_RATIO;
  165 +
  166 +
  167 +let styles = StyleSheet.create({
  168 + container: {
  169 + flex: 1,
  170 + backgroundColor: 'white',
  171 + },
  172 + headerContainer: {
  173 + width: width,
  174 + alignItems: 'center',
  175 + height: headerContainerHeight,
  176 + },
  177 + contentContainer:{
  178 + flexDirection: 'row',
  179 + flexWrap: 'wrap',
  180 + },
  181 + listContainer: {
  182 + width: width / 2,
  183 + },
  184 + statusIcon: {
  185 + width: 110 * DEVICE_WIDTH_RATIO,
  186 + height: 110 * DEVICE_WIDTH_RATIO,
  187 + marginTop: 100 * DEVICE_WIDTH_RATIO,
  188 + marginBottom: 25 * DEVICE_WIDTH_RATIO,
  189 + },
  190 + message: {
  191 + fontSize: 12 * DEVICE_WIDTH_RATIO,
  192 + color: '#444444',
  193 + marginBottom: 15 * DEVICE_WIDTH_RATIO,
  194 + },
  195 + reason: {
  196 + width: 260 * DEVICE_WIDTH_RATIO,
  197 + fontSize: 12 * DEVICE_WIDTH_RATIO,
  198 + color: '#b0b0b0',
  199 + textAlign: 'center',
  200 + lineHeight: 20 * DEVICE_WIDTH_RATIO,
  201 + },
  202 + buttonContainer: {
  203 + marginTop: 35 * DEVICE_WIDTH_RATIO,
  204 + width: 235 * DEVICE_WIDTH_RATIO,
  205 + height: 44 * DEVICE_WIDTH_RATIO,
  206 + backgroundColor: '#222222',
  207 + borderRadius: 5 * DEVICE_WIDTH_RATIO,
  208 + },
  209 + button: {
  210 + color: 'white',
  211 + textAlign: 'center',
  212 + fontSize: 14 * DEVICE_WIDTH_RATIO,
  213 + backgroundColor: 'transparent',
  214 + lineHeight: 29 * DEVICE_WIDTH_RATIO,
  215 + },
  216 +});
@@ -14,6 +14,7 @@ import ReactNative, { @@ -14,6 +14,7 @@ import ReactNative, {
14 14
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 18
18 export default class Open extends React.Component { 19 export default class Open extends React.Component {
19 constructor(props) { 20 constructor(props) {
@@ -30,16 +31,54 @@ export default class Open extends React.Component { @@ -30,16 +31,54 @@ export default class Open extends React.Component {
30 if (!rowData) { 31 if (!rowData) {
31 return null 32 return null
32 } 33 }
33 - return (  
34 - <OpenPageInputCell  
35 - cellParams={rowData}  
36 - snsCheckCodeEnable={this.props.openPageInfo.snsCheckCodeEnable}  
37 - snsCheckCodeText={this.props.openPageInfo.snsCheckCodeText}  
38 - onPressCardNoQuestion={this.props.onPressCardNoQuestion}  
39 - updateOpenPageCellInfo={this.props.updateOpenPageCellInfo}  
40 - onPressCheckCode={this.props.onPressCheckCode}  
41 - />  
42 - ); 34 + 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 +
  56 + </View>
  57 + <View style={{
  58 + width: width,
  59 + height: 0.5,
  60 + backgroundColor: '#e5e5e5',
  61 + }}/>
  62 + </View>
  63 +
  64 + );
  65 + }else {
  66 + return null;
  67 + }
  68 +
  69 + } else {
  70 + return (
  71 + <OpenPageInputCell
  72 + cellParams={rowData}
  73 + snsCheckCodeEnable={this.props.openPageInfo.snsCheckCodeEnable}
  74 + snsCheckCodeText={this.props.openPageInfo.snsCheckCodeText}
  75 + onPressCardNoQuestion={this.props.onPressCardNoQuestion}
  76 + updateOpenPageCellInfo={this.props.updateOpenPageCellInfo}
  77 + onPressCheckCode={this.props.onPressCheckCode}
  78 + />
  79 + );
  80 + }
  81 +
43 } 82 }
44 83
45 _renderHeader() { 84 _renderHeader() {
@@ -99,7 +138,7 @@ export default class Open extends React.Component { @@ -99,7 +138,7 @@ export default class Open extends React.Component {
99 138
100 render() { 139 render() {
101 let {openPageInfo} = this.props; 140 let {openPageInfo} = this.props;
102 - let {cellList, agreeProtocol,nextBtnEnable} = openPageInfo; 141 + let {cellList, agreeProtocol,nextBtnEnable,tipMessage} = openPageInfo;
103 if (cellList && cellList.size) { 142 if (cellList && cellList.size) {
104 cellList = cellList.toArray(); 143 cellList = cellList.toArray();
105 }else { 144 }else {
@@ -115,6 +154,11 @@ export default class Open extends React.Component { @@ -115,6 +154,11 @@ export default class Open extends React.Component {
115 renderHeader={this._renderHeader} 154 renderHeader={this._renderHeader}
116 renderFooter={this._renderFooter} 155 renderFooter={this._renderFooter}
117 /> 156 />
  157 + {tipMessage !== '' ? <Prompt
  158 + text={tipMessage}
  159 + duration={800}
  160 + onPromptHidden={this.props.tipMessageRemove}
  161 + /> : null}
118 </View> 162 </View>
119 ); 163 );
120 } 164 }
@@ -182,4 +226,19 @@ let styles = StyleSheet.create({ @@ -182,4 +226,19 @@ let styles = StyleSheet.create({
182 fontSize: 14 * DEVICE_WIDTH_RATIO, 226 fontSize: 14 * DEVICE_WIDTH_RATIO,
183 lineHeight: 26 * DEVICE_WIDTH_RATIO, 227 lineHeight: 26 * DEVICE_WIDTH_RATIO,
184 }, 228 },
  229 + bankCellContainer: {
  230 + width: width,
  231 + height: 44.5 * DEVICE_WIDTH_RATIO,
  232 + backgroundColor: 'white',
  233 + alignItems: 'flex-start',
  234 + flexDirection: 'column',
  235 + },
  236 + bankIconContainer: {
  237 + flexDirection: 'row',
  238 + height: 44 * DEVICE_WIDTH_RATIO,
  239 + marginLeft: 50 * DEVICE_WIDTH_RATIO,
  240 + },
  241 + bankIcon: {
  242 + marginTop: 12 * DEVICE_WIDTH_RATIO,
  243 + },
185 }); 244 });
@@ -35,7 +35,7 @@ export default class OpenPageInputCell extends React.Component { @@ -35,7 +35,7 @@ export default class OpenPageInputCell extends React.Component {
35 checkCodeColor = '#84c990'; 35 checkCodeColor = '#84c990';
36 } 36 }
37 let inputBoxWidth = 211 * DEVICE_WIDTH_RATIO; 37 let inputBoxWidth = 211 * DEVICE_WIDTH_RATIO;
38 - if (cellParams.inputKey == "sns-check-code") { 38 + if (cellParams.inputKey == "snsCheckCode") {
39 inputBoxWidth = 120 * DEVICE_WIDTH_RATIO; 39 inputBoxWidth = 120 * DEVICE_WIDTH_RATIO;
40 } 40 }
41 return( 41 return(
@@ -48,7 +48,7 @@ export default class OpenPageInputCell extends React.Component { @@ -48,7 +48,7 @@ export default class OpenPageInputCell extends React.Component {
48 <TextInput 48 <TextInput
49 autoCapitalize="none" 49 autoCapitalize="none"
50 placeholder={cellParams.placeholder} 50 placeholder={cellParams.placeholder}
51 - text={cellParams.text} 51 + value={cellParams.text}
52 onChange={this._updateCellParams} 52 onChange={this._updateCellParams}
53 style={[styles.textInput,{width:inputBoxWidth}]} 53 style={[styles.textInput,{width:inputBoxWidth}]}
54 maxLength={cellParams.maxLength} 54 maxLength={cellParams.maxLength}
@@ -63,7 +63,7 @@ export default class OpenPageInputCell extends React.Component { @@ -63,7 +63,7 @@ export default class OpenPageInputCell extends React.Component {
63 63
64 : null 64 : null
65 } 65 }
66 - {cellParams.inputKey == "sns-check-code" ? 66 + {cellParams.inputKey == "snsCheckCode" ?
67 <TouchableOpacity onPress={() => { 67 <TouchableOpacity onPress={() => {
68 this.props.onPressCheckCode && this.props.onPressCheckCode(); 68 this.props.onPressCheckCode && this.props.onPressCheckCode();
69 }}> 69 }}>
@@ -17,6 +17,12 @@ export default keyMirror({ @@ -17,6 +17,12 @@ export default keyMirror({
17 UPDATE_SNS_CHECK_CODE_ENABLE_STATUS: null, 17 UPDATE_SNS_CHECK_CODE_ENABLE_STATUS: null,
18 UPDATE_CELL_LIST: null, 18 UPDATE_CELL_LIST: null,
19 UPDATE_NEXT_BTN_ENABLE_STATUS: null, 19 UPDATE_NEXT_BTN_ENABLE_STATUS: null,
20 - UPDATE_NEXT_BTN_TEXT: null,  
21 UPDATE_SNS_CHECK_CODE_TEXT: null, 20 UPDATE_SNS_CHECK_CODE_TEXT: null,
  21 + UPDATE_TIP_MESSAGE: null,
  22 + NEXT_BTN_PROCESSING_REQUEST: null,
  23 + NEXT_BTN_PROCESSING_SUCCESS: null,
  24 + NEXT_BTN_PROCESSING_FAILURE: null,
  25 +
  26 + SET_INSTALLMENT_STATUS_PAGE_ORIGINAL_INFO: null,
  27 + SET_INSTALLMENT_STATUS_PAGE_GOODS: null,
22 }); 28 });
  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 installmentActions from '../reducers/installment/installmentActions';
  19 +import InstallmentStatus from '../components/installment/InstallmentStatus';
  20 +
  21 +const actions = [
  22 + installmentActions,
  23 +];
  24 +function mapStateToProps(state) {
  25 + return {
  26 + ...state
  27 + };
  28 +}
  29 +function mapDispatchToProps(dispatch) {
  30 +
  31 + const creators = Map()
  32 + .merge(...actions)
  33 + .filter(value => typeof value === 'function')
  34 + .toObject();
  35 +
  36 + return {
  37 + actions: bindActionCreators(creators, dispatch),
  38 + dispatch
  39 + };
  40 +}
  41 +class InstallmentStatusContainer extends Component {
  42 + constructor(props) {
  43 + super(props);
  44 + this._onPressStatusPageBtn = this._onPressStatusPageBtn.bind(this);
  45 + }
  46 + componentDidMount() {
  47 + }
  48 +
  49 + _onPressStatusPageBtn() {
  50 + this.props.actions.onPressStatusPageBtn();
  51 + }
  52 +
  53 + render() {
  54 + let {installmentStausPageInfo} = this.props.installment;
  55 + return (
  56 + <InstallmentStatus
  57 + installmentStausPageInfo={installmentStausPageInfo}
  58 + onPressStatusPageBtn={this._onPressStatusPageBtn}
  59 + />
  60 + );
  61 + }
  62 +}
  63 +let styles = StyleSheet.create({
  64 + container: {
  65 + flex: 1,
  66 + },
  67 +
  68 +});
  69 +
  70 +export default connect(mapStateToProps, mapDispatchToProps)(InstallmentStatusContainer);
@@ -46,6 +46,7 @@ class OpenContainer extends Component { @@ -46,6 +46,7 @@ class OpenContainer extends Component {
46 this._onPressCardNoQuestion = this._onPressCardNoQuestion.bind(this); 46 this._onPressCardNoQuestion = this._onPressCardNoQuestion.bind(this);
47 this._updateOpenPageCellInfo = this._updateOpenPageCellInfo.bind(this); 47 this._updateOpenPageCellInfo = this._updateOpenPageCellInfo.bind(this);
48 this._onPressCheckCode = this._onPressCheckCode.bind(this); 48 this._onPressCheckCode = this._onPressCheckCode.bind(this);
  49 + this._tipMessageRemove = this._tipMessageRemove.bind(this);
49 } 50 }
50 componentDidMount() { 51 componentDidMount() {
51 } 52 }
@@ -55,7 +56,6 @@ class OpenContainer extends Component { @@ -55,7 +56,6 @@ class OpenContainer extends Component {
55 } 56 }
56 57
57 _onPressOpenNext() { 58 _onPressOpenNext() {
58 - this.props.actions.updateNextBtnText('处理中...')  
59 this.props.actions.onPressOpenNext(); 59 this.props.actions.onPressOpenNext();
60 } 60 }
61 61
@@ -75,6 +75,10 @@ class OpenContainer extends Component { @@ -75,6 +75,10 @@ class OpenContainer extends Component {
75 this.props.actions.onPressCheckCode(); 75 this.props.actions.onPressCheckCode();
76 } 76 }
77 77
  78 + _tipMessageRemove() {
  79 + this.props.actions.updateTipMessage('');
  80 + }
  81 +
78 render() { 82 render() {
79 let {openPageInfo} = this.props.installment; 83 let {openPageInfo} = this.props.installment;
80 return ( 84 return (
@@ -87,6 +91,7 @@ class OpenContainer extends Component { @@ -87,6 +91,7 @@ class OpenContainer extends Component {
87 updateOpenPageCellInfo={this._updateOpenPageCellInfo} 91 updateOpenPageCellInfo={this._updateOpenPageCellInfo}
88 onPressCheckCode={this._onPressCheckCode} 92 onPressCheckCode={this._onPressCheckCode}
89 onPressOpenNext={this._onPressOpenNext} 93 onPressOpenNext={this._onPressOpenNext}
  94 + tipMessageRemove={this._tipMessageRemove}
90 /> 95 />
91 ); 96 );
92 } 97 }
@@ -20,8 +20,14 @@ UPDATE_AGREE_PROTOCOL_STATUS, @@ -20,8 +20,14 @@ UPDATE_AGREE_PROTOCOL_STATUS,
20 UPDATE_SNS_CHECK_CODE_ENABLE_STATUS, 20 UPDATE_SNS_CHECK_CODE_ENABLE_STATUS,
21 UPDATE_CELL_LIST, 21 UPDATE_CELL_LIST,
22 UPDATE_NEXT_BTN_ENABLE_STATUS, 22 UPDATE_NEXT_BTN_ENABLE_STATUS,
23 -UPDATE_NEXT_BTN_TEXT,  
24 UPDATE_SNS_CHECK_CODE_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,
  30 +SET_INSTALLMENT_STATUS_PAGE_GOODS,
25 31
26 } = require('../../constants/actionTypes').default; 32 } = require('../../constants/actionTypes').default;
27 const codeContent = { 33 const codeContent = {
@@ -109,17 +115,47 @@ export function updateNextBtnEnableStatus(status) { @@ -109,17 +115,47 @@ export function updateNextBtnEnableStatus(status) {
109 } 115 }
110 } 116 }
111 117
112 -export function updateNextBtnText(text) { 118 +export function updateSnsCheckCodeText(text) {
113 return { 119 return {
114 - type: UPDATE_NEXT_BTN_TEXT, 120 + type: UPDATE_SNS_CHECK_CODE_TEXT,
115 payload: text 121 payload: text
116 } 122 }
117 } 123 }
118 124
119 -export function updateSnsCheckCodeText(text) { 125 +export function updateTipMessage(message) {
120 return { 126 return {
121 - type: UPDATE_SNS_CHECK_CODE_TEXT,  
122 - payload: text 127 + type: UPDATE_TIP_MESSAGE,
  128 + payload: message
  129 + }
  130 +}
  131 +
  132 +export function nextBtnProcessingRequest() {
  133 + return {
  134 + type: NEXT_BTN_PROCESSING_REQUEST,
  135 + }
  136 +}
  137 +export function nextBtnProcessingFailure() {
  138 + return {
  139 + type: NEXT_BTN_PROCESSING_FAILURE
  140 + }
  141 +}
  142 +export function nextBtnProcessingSuccess() {
  143 + return {
  144 + type: NEXT_BTN_PROCESSING_SUCCESS
  145 + }
  146 +}
  147 +
  148 +export function setInstallmentStatusPageOriginalInfo(params) {
  149 + return {
  150 + type: SET_INSTALLMENT_STATUS_PAGE_ORIGINAL_INFO,
  151 + payload: params
  152 + }
  153 +}
  154 +
  155 +export function setInstallmentStatusPageGoods(goods) {
  156 + return {
  157 + type: SET_INSTALLMENT_STATUS_PAGE_GOODS,
  158 + payload: goods
123 } 159 }
124 } 160 }
125 161
@@ -222,10 +258,67 @@ export function onPressProtocol() { @@ -222,10 +258,67 @@ export function onPressProtocol() {
222 export function onPressOpenNext() { 258 export function onPressOpenNext() {
223 return (dispatch, getState) => { 259 return (dispatch, getState) => {
224 let {app, installment} = getState(); 260 let {app, installment} = getState();
225 - let {nextBtnEnable} = installment.openPageInfo;  
226 - if (!nextBtnEnable) {  
227 - return; 261 + let {nextBtnEnable,cellList,nextProcessing} = installment.openPageInfo;
  262 + let activateParams = {};
  263 + let newCellList = cellList;
  264 + // if (!nextBtnEnable) {
  265 + // return;
  266 + // }
  267 + ReactNative.NativeModules.YH_InstallmentHelper.gotoInstallmentStatusView('2', '您的授信未通过,在有货更多的消费,增加信用度,会大大提升审核通过率奥。');
  268 + return;
  269 + cellList.map((item, i) => {
  270 + if (item.get('inputKey') != 'BankIcon') {
  271 + activateParams[item.get('inputKey')]= item.get('text');
  272 + }
  273 + });
  274 + let activateService = (uid) => {
  275 + dispatch(nextBtnProcessingRequest());
  276 + console.log('----0000');
  277 + return new InstallmentService(app.host).checkVerifyCode(uid, activateParams.mobile, activateParams.snsCheckCode)
  278 + .then(json => {
  279 + if (json.result === '1') {
  280 +
  281 + return new InstallmentService(app.host).activateService(activateParams)
  282 + }else {
  283 + newCellList.map((item, i) => {
  284 + if (item.inputKey == 'snsCheckCode') {
  285 + item.text = '';
  286 + }
  287 + cellList[i] = item;
  288 + });
  289 + dispatch(updateTipMessage(json.message))
  290 + dispatch(updateCellList(cellList));
  291 + dispatch(nextBtnProcessingFailure());
  292 + }
  293 + })
  294 + .then(json => {
  295 + dispatch(nextBtnProcessingSuccess());
  296 + console.log('2222222');
  297 + console.log(json);
  298 + let tipMessage = '';
  299 + if (json.status == '3') {
  300 + json.failReason = json.failReason || '姓名、身份证、银行卡不匹配';
  301 + }
  302 + ReactNative.NativeModules.YH_InstallmentHelper.gotoInstallmentStatusView(json.status, json.failReason);
  303 + })
  304 + .catch(error => {
  305 + });
228 } 306 }
  307 +
  308 + ReactNative.NativeModules.YH_CommonHelper.uid()
  309 + .then(uid => {
  310 + activateService(uid);
  311 + })
  312 + .catch(error => {
  313 + ReactNative.NativeModules.YH_CommonHelper.login()
  314 + .then(uid => {
  315 + activateService(uid);
  316 + })
  317 + .catch(error => {
  318 +
  319 + });
  320 + });
  321 +
229 }; 322 };
230 } 323 }
231 324
@@ -247,6 +340,62 @@ export function onPressCardNoQuestion() { @@ -247,6 +340,62 @@ export function onPressCardNoQuestion() {
247 }; 340 };
248 } 341 }
249 342
  343 +export function getBankInfo(cellInfo,cardNo) {
  344 + return (dispatch, getState) => {
  345 +
  346 + let bankInfo = (uid) => {
  347 + let {app, installment} = getState();
  348 + let {cellList,snsCheckCodeEnable} = installment.openPageInfo;
  349 + cellList = cellList.toJS();
  350 + let newCellList = cellList;
  351 + let nextBtnEnable = true;
  352 + return new InstallmentService(app.host).fentchBankInfo(cardNo,uid)
  353 + .then(json => {
  354 + let bankIconInfo = {
  355 + inputKey: 'BankIcon',
  356 + bankCode: '',
  357 + bankName: '',
  358 + bankText: '',
  359 + show: true,
  360 + };
  361 + if (json.bankCode) {
  362 + bankIconInfo.bankCode = json.bankCode;
  363 + bankIconInfo.bankName = json.bankName;
  364 + }
  365 + if (json.businessSupport === '1') {
  366 + bankIconInfo.bankCode = '';
  367 + bankIconInfo.bankName = '';
  368 + bankIconInfo.bankText = '暂不支持此银行卡';
  369 + }
  370 +
  371 + newCellList.map((item, i) => {
  372 + if (item.inputKey == 'BankIcon') {
  373 + item = bankIconInfo;
  374 + }
  375 + cellList[i] = item;
  376 + });
  377 + dispatch(updateCellList(cellList));
  378 + })
  379 + .catch(error => {
  380 + });
  381 + }
  382 +
  383 + ReactNative.NativeModules.YH_CommonHelper.uid()
  384 + .then(uid => {
  385 + bankInfo(uid);
  386 + })
  387 + .catch(error => {
  388 + ReactNative.NativeModules.YH_CommonHelper.login()
  389 + .then(uid => {
  390 + bankInfo(uid);
  391 + })
  392 + .catch(error => {
  393 +
  394 + });
  395 + });
  396 + }
  397 +}
  398 +
250 export function updateOpenPageCellInfo(cellInfo) { 399 export function updateOpenPageCellInfo(cellInfo) {
251 return (dispatch, getState) => { 400 return (dispatch, getState) => {
252 let {app, installment} = getState(); 401 let {app, installment} = getState();
@@ -256,14 +405,37 @@ export function updateOpenPageCellInfo(cellInfo) { @@ -256,14 +405,37 @@ export function updateOpenPageCellInfo(cellInfo) {
256 let cardNoValid = false; 405 let cardNoValid = false;
257 let mobileValid = false; 406 let mobileValid = false;
258 let nextBtnEnable = true; 407 let nextBtnEnable = true;
  408 +
  409 + if (cellInfo.inputKey == "cardNo") {
  410 + let value = cellInfo.text;
  411 + console.log('value');
  412 + console.log(value);
  413 + let cardNo = value.replace(/\s/g, '');
  414 + let newCardNo = value.replace(/[^\d]/g, '').replace(/(\d{4})(?=\d)/g, '$1 ');
  415 + console.log('newCardNo');
  416 + console.log(newCardNo);
  417 + cellInfo.text = newCardNo;
  418 + if (cardNo && cardNo.length >= 16) {
  419 + cardNoValid = true;
  420 + dispatch(getBankInfo(cellInfo,value));
  421 + }else {
  422 + cardNoValid = false;
  423 + cellInfo.showBankIcon = false;
  424 + }
  425 +
  426 + }else if (cellInfo.inputKey == "mobile" && cellInfo.text.length ==11) {
  427 + mobileValid = true;
  428 + }
  429 +
  430 +
259 newCellList.map((item, i) => { 431 newCellList.map((item, i) => {
260 - if (item.inputKey == 'cardNo' && item.text.length >=13) { 432 + if (item.inputKey == 'cardNo' && item.text.length >=16 && cellInfo.inputKey != 'cardNo') {
261 cardNoValid = true; 433 cardNoValid = true;
262 - } else if (item.inputKey == 'mobile' && item.text.length ==11) { 434 + } else if (item.inputKey == 'mobile' && item.text.length ==11 && cellInfo.inputKey != 'mobile') {
263 mobileValid = true; 435 mobileValid = true;
264 } 436 }
265 if (item.inputKey == cellInfo.inputKey) { 437 if (item.inputKey == cellInfo.inputKey) {
266 - item.text = cellInfo.text; 438 + item = cellInfo;
267 } 439 }
268 if (item.text == '') { 440 if (item.text == '') {
269 nextBtnEnable = false; 441 nextBtnEnable = false;
@@ -275,6 +447,8 @@ export function updateOpenPageCellInfo(cellInfo) { @@ -275,6 +447,8 @@ export function updateOpenPageCellInfo(cellInfo) {
275 }else { 447 }else {
276 snsCheckCodeEnable = false; 448 snsCheckCodeEnable = false;
277 } 449 }
  450 + console.log('cellInfo');
  451 + console.log(cellInfo);
278 dispatch(updateCellList(cellList)); 452 dispatch(updateCellList(cellList));
279 dispatch(updateSnsCheckCodeEnableStatus(snsCheckCodeEnable)); 453 dispatch(updateSnsCheckCodeEnableStatus(snsCheckCodeEnable));
280 dispatch(updateNextBtnEnableStatus(nextBtnEnable)); 454 dispatch(updateNextBtnEnableStatus(nextBtnEnable));
@@ -362,3 +536,112 @@ export function onPressCheckCode() { @@ -362,3 +536,112 @@ export function onPressCheckCode() {
362 536
363 }; 537 };
364 } 538 }
  539 +
  540 +export function setInstallmentStausPageParams(statusCode, failReason, uid) {
  541 + return (dispatch, getState) => {
  542 + let {app, installment} = getState();
  543 + let status ='';
  544 + let jumpUrl = '';
  545 + let statusInfo = {};
  546 + if (statusCode == '2') {//成功
  547 + //请求用户信用额度
  548 + return new InstallmentService(app.host).getQueryCreditInfo('5448919')
  549 + .then(json => {
  550 + console.log('---额度');
  551 + console.log(json);
  552 + status = 'success',
  553 + statusInfo = {
  554 + message: '可用额度',
  555 + reason: json.currCreditLimit,
  556 + btnText: '去逛逛',
  557 + }
  558 + jumpUrl = `http://m.yohobuy.com/home/installment/index?uid=${uid}?openby:yohobuy={"action":"go.instalmentlist","params":{"title":"分期专享"}}`;
  559 + let params = {
  560 + statusCode,
  561 + status,
  562 + jumpUrl,
  563 + statusInfo,
  564 + };
  565 + dispatch(setInstallmentStatusPageOriginalInfo(params));
  566 + dispatch(getInstallmentProductAndAdvertisement(1));
  567 + })
  568 + .catch(error => {
  569 + });
  570 + }else {
  571 + switch (statusCode) {
  572 + case '1':{
  573 + status = 'review',
  574 + statusInfo = {
  575 + message: '审核中',
  576 + reason: '审核结果会在5分钟内短信通知您',
  577 + btnText: '先去逛逛',
  578 + }
  579 + }
  580 + break;
  581 + case '3':{
  582 + status = 'error',
  583 + statusInfo = {
  584 + message: '审核未通过暂时无法授信',
  585 + reason: failReason,
  586 + btnText: '重新申请',
  587 + }
  588 + }
  589 + break;
  590 + case '4':{
  591 + status = 'cancel',
  592 + statusInfo = {
  593 + message: '账户已注销',
  594 + reason: '您的有货分期账户经本人确认已注销,',
  595 + reasonTwo: '如有疑问,请联系客服。',
  596 + reasonThird: '提示:已注销用户不可再开通',
  597 + btnText: '先去逛逛',
  598 + }
  599 + }
  600 + break;
  601 + case '5':{
  602 + status = 'error',
  603 + statusInfo = {
  604 + message: '审核未通过暂时无法授信',
  605 + reason: '您的授信未通过,在有货更多的消费,增加信用度,会大大提升审核通过率奥。',
  606 + btnText: '重新申请',
  607 + }
  608 + }
  609 + break;
  610 + default:
  611 +
  612 + }
  613 + }
  614 + console.log('---1111');
  615 +
  616 + let params = {
  617 + statusCode,
  618 + status,
  619 + jumpUrl,
  620 + statusInfo,
  621 + };
  622 + dispatch(setInstallmentStatusPageOriginalInfo(params));
  623 + };
  624 +}
  625 +
  626 +export function getInstallmentProductAndAdvertisement(page) {
  627 + return (dispatch, getState) => {
  628 + let {app, installment} = getState();
  629 + return new InstallmentService(app.host).getSearchIntallment(page)
  630 + .then(json => {
  631 + dispatch(setInstallmentStatusPageGoods(json.product_list))
  632 + console.log('goods');
  633 + console.log(json);
  634 + })
  635 + .catch(error => {
  636 + });
  637 + };
  638 +}
  639 +
  640 +// onPressStatusPageBtn
  641 +export function onPressStatusPageBtn(page) {
  642 + return (dispatch, getState) => {
  643 + let {app, installment} = getState();
  644 + let {jumpUrl} = installment.installmentStausPageInfo;
  645 + ReactNative.NativeModules.YH_CommonHelper.jumpWithUrl(jumpUrl);
  646 + };
  647 +}
@@ -18,7 +18,14 @@ let openPageParams=[{ @@ -18,7 +18,14 @@ let openPageParams=[{
18 title: '卡号:', 18 title: '卡号:',
19 placeholder: '银行卡号', 19 placeholder: '银行卡号',
20 text: '', 20 text: '',
21 - maxLength: 19, 21 + maxLength: 23,
  22 + showBankIcon: false,
  23 + },{
  24 + inputKey: 'BankIcon',
  25 + bankCode: '',
  26 + bankName: '',
  27 + bankText: '',
  28 + show: false,
22 },{ 29 },{
23 inputKey: 'mobile', 30 inputKey: 'mobile',
24 title: '手机号:', 31 title: '手机号:',
@@ -26,7 +33,7 @@ let openPageParams=[{ @@ -26,7 +33,7 @@ let openPageParams=[{
26 text: '', 33 text: '',
27 maxLength: 11, 34 maxLength: 11,
28 },{ 35 },{
29 - inputKey: 'sns-check-code', 36 + inputKey: 'snsCheckCode',
30 title: '验证码:', 37 title: '验证码:',
31 placeholder: '请输入验证码', 38 placeholder: '请输入验证码',
32 text: '', 39 text: '',
@@ -55,11 +62,20 @@ let InitialState = Record({ @@ -55,11 +62,20 @@ let InitialState = Record({
55 agreeProtocol: true, 62 agreeProtocol: true,
56 nextBtnEnable: false, 63 nextBtnEnable: false,
57 nextBtnText: '下一步', 64 nextBtnText: '下一步',
  65 + nextProcessing: false,
58 snsCheckCodeEnable: false, 66 snsCheckCodeEnable: false,
59 snsCheckCodeText: '获取验证码', 67 snsCheckCodeText: '获取验证码',
60 banks: banks.join('、'), 68 banks: banks.join('、'),
61 showBankAlert: false, 69 showBankAlert: false,
62 bankList: Immutable.fromJS(banks), 70 bankList: Immutable.fromJS(banks),
  71 + tipMessage: '',
  72 + })),
  73 + installmentStausPageInfo:new (Record({
  74 + statusCode: '',
  75 + status: 'success',
  76 + jumpUrl: '',
  77 + statusInfo:Map(),
  78 + goods: List(),
63 })), 79 })),
64 }); 80 });
65 81
@@ -21,6 +21,13 @@ const { @@ -21,6 +21,13 @@ const {
21 UPDATE_NEXT_BTN_ENABLE_STATUS, 21 UPDATE_NEXT_BTN_ENABLE_STATUS,
22 UPDATE_NEXT_BTN_TEXT, 22 UPDATE_NEXT_BTN_TEXT,
23 UPDATE_SNS_CHECK_CODE_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,
  30 + SET_INSTALLMENT_STATUS_PAGE_GOODS,
24 31
25 } = require('../../constants/actionTypes').default; 32 } = require('../../constants/actionTypes').default;
26 33
@@ -60,10 +67,26 @@ export default function appReducer(state = initialState, action) { @@ -60,10 +67,26 @@ export default function appReducer(state = initialState, action) {
60 return state.setIn(['openPageInfo', 'cellList'], Immutable.fromJS(action.payload)); 67 return state.setIn(['openPageInfo', 'cellList'], Immutable.fromJS(action.payload));
61 case UPDATE_NEXT_BTN_ENABLE_STATUS: 68 case UPDATE_NEXT_BTN_ENABLE_STATUS:
62 return state.setIn(['openPageInfo', 'nextBtnEnable'], action.payload); 69 return state.setIn(['openPageInfo', 'nextBtnEnable'], action.payload);
63 - case UPDATE_NEXT_BTN_TEXT:  
64 - return state.setIn(['openPageInfo', 'nextBtnText'], action.payload);  
65 case UPDATE_SNS_CHECK_CODE_TEXT: 70 case UPDATE_SNS_CHECK_CODE_TEXT:
66 return state.setIn(['openPageInfo', 'snsCheckCodeText'], action.payload); 71 return state.setIn(['openPageInfo', 'snsCheckCodeText'], action.payload);
  72 + case UPDATE_TIP_MESSAGE:
  73 + return state.setIn(['openPageInfo', 'tipMessage'], action.payload);
  74 + case NEXT_BTN_PROCESSING_REQUEST:
  75 + return state.setIn(['openPageInfo', 'nextBtnText'], '处理中...')
  76 + .setIn(['openPageInfo', 'nextProcessing'], true);
  77 + case NEXT_BTN_PROCESSING_SUCCESS:
  78 + return state.setIn(['openPageInfo', 'nextBtnText'], '下一步')
  79 + .setIn(['openPageInfo', 'nextProcessing'], false);
  80 + case NEXT_BTN_PROCESSING_FAILURE:
  81 + return state.setIn(['openPageInfo', 'nextBtnText'], '下一步')
  82 + .setIn(['openPageInfo', 'nextProcessing'], false);
  83 + case SET_INSTALLMENT_STATUS_PAGE_ORIGINAL_INFO:
  84 + return state.setIn(['installmentStausPageInfo', 'statusCode'],action.payload.status)
  85 + .setIn(['installmentStausPageInfo', 'status'], action.payload.status)
  86 + .setIn(['installmentStausPageInfo', 'jumpUrl'], action.payload.jumpUrl)
  87 + .setIn(['installmentStausPageInfo', 'statusInfo'], Immutable.fromJS(action.payload.statusInfo));
  88 + case SET_INSTALLMENT_STATUS_PAGE_GOODS:
  89 + return state.setIn(['installmentStausPageInfo', 'goods'], Immutable.fromJS(action.payload));
67 } 90 }
68 91
69 return state; 92 return state;
@@ -61,4 +61,122 @@ export default class InstallmentService { @@ -61,4 +61,122 @@ export default class InstallmentService {
61 throw(error); 61 throw(error);
62 }); 62 });
63 } 63 }
  64 +
  65 + async fentchBankInfo(cardNo,uid) {
  66 + return await this.api.get({
  67 + url: '',
  68 + body: {
  69 + method: 'user.instalment.getBankInfoByCardNo',
  70 + cardNo,
  71 + uid,
  72 + }
  73 + })
  74 + .then((json) => {
  75 + return json;
  76 + })
  77 + .catch((error) => {
  78 + throw(error);
  79 + });
  80 + }
  81 +
  82 + async checkVerifyCode(uid, mobile, snsCheckCode) {
  83 + console.log('snsCheckCode');
  84 + console.log(snsCheckCode);
  85 + return await this.api.get({
  86 + url: '',
  87 + body: {
  88 + method: 'user.instalment.validateSnsCheckCode',
  89 + uid,
  90 + mobile,
  91 + snsCheckCode,
  92 + codeType: 1, // 授信
  93 + }
  94 + })
  95 + .then((json) => {
  96 + console.log('---json');
  97 + console.log(json);
  98 + return json;
  99 + })
  100 + .catch((error) => {
  101 + throw(error);
  102 + });
  103 + }
  104 +
  105 + /**
  106 + * 开通服务
  107 + *
  108 + * @param 参数
  109 + * uid 用户id
  110 + * userName 姓名
  111 + * identityCardNo 身份证号码
  112 + * cardNo 银行卡号码
  113 + * mobile 手机号码
  114 + * snsCheckCode 验证码
  115 + * @returns {*}
  116 + */
  117 + async activateService(params) {
  118 + return await this.api.get({
  119 + url: '',
  120 + body: {
  121 + method: 'user.instalment.activate',
  122 + ...params,
  123 + }
  124 + })
  125 + .then((json) => {
  126 + return json;
  127 + })
  128 + .catch((error) => {
  129 + throw(error);
  130 + });
  131 + }
  132 +
  133 + async getSearchIntallment(page) {
  134 + return await this.api.get({
  135 + url: '',
  136 + body: {
  137 + method: 'app.search.instalment',
  138 + limit: '50',
  139 + order: 's_t_desc',
  140 + page: page
  141 + }
  142 + })
  143 + .then((json) => {
  144 + return json;
  145 + })
  146 + .catch((error) => {
  147 + throw(error);
  148 + });
  149 + }
  150 +
  151 + async getQueryCreditInfo(uid) {
  152 + return await this.api.get({
  153 + url: '',
  154 + body: {
  155 + method: 'user.instalment.queryCreditLimit',
  156 + uid,
  157 + }
  158 + })
  159 + .then((json) => {
  160 + return json;
  161 + })
  162 + .catch((error) => {
  163 + throw(error);
  164 + });
  165 + }
  166 +
  167 + async getResources(content_code) {
  168 + return await this.serviceAPI.get({
  169 + url: '/operations/api/v5/resource/get',
  170 + body: {
  171 + content_code,
  172 + platform: 'iphone'
  173 + }
  174 + })
  175 + .then((json) => {
  176 + return json;
  177 + })
  178 + .catch((error) => {
  179 + throw(error);
  180 + });
  181 + }
64 } 182 }