Authored by chenl

增加有货分期银行卡图片和一些跳转规则。review by 草莓。

Showing 44 changed files with 266 additions and 2 deletions
@@ -27,6 +27,9 @@ import InstallmentStatusContainer from './containers/InstallmentStatusContainer' @@ -27,6 +27,9 @@ import InstallmentStatusContainer from './containers/InstallmentStatusContainer'
27 import RepayListContainer from './containers/RepayListContainer'; 27 import RepayListContainer from './containers/RepayListContainer';
28 import RepayDetailContainer from './containers/RepayDetailContainer'; 28 import RepayDetailContainer from './containers/RepayDetailContainer';
29 import RepayRecordListContainer from './containers/RepayRecordListContainer'; 29 import RepayRecordListContainer from './containers/RepayRecordListContainer';
  30 +import InstallmentAccountContainer from './containers/InstallmentAccountContainer';
  31 +import InstallmentMyCardContainer from './containers/InstallmentMyCardContainer';
  32 +
30 33
31 import { 34 import {
32 setPlatform, 35 setPlatform,
@@ -114,8 +117,25 @@ export default function native(platform) { @@ -114,8 +117,25 @@ export default function native(platform) {
114 <RepayRecordListContainer /> 117 <RepayRecordListContainer />
115 </Provider> 118 </Provider>
116 ) 119 )
  120 + } else if (type == 'installAccount') {
  121 + return (
  122 + <Provider store={store}>
  123 + <InstallmentAccountContainer />
  124 + </Provider>
  125 + )
  126 + } else if (type == 'installMyCard') {
  127 + return (
  128 + <Provider store={store}>
  129 + <InstallmentMyCardContainer />
  130 + </Provider>
  131 + )
  132 + } else if (type == 'installMyCardDetail') {
  133 + return (
  134 + <Provider store={store}>
  135 + <InstallmentMyCardContainer />
  136 + </Provider>
  137 + )
117 } 138 }
118 -  
119 } 139 }
120 }); 140 });
121 141
  1 +'use strict';
  2 +
  3 +import React, {Component} from 'react';
  4 +
  5 +import ReactNative, {
  6 + View,
  7 + Text,
  8 + Image,
  9 + TouchableOpacity,
  10 + StyleSheet,
  11 + Dimensions,
  12 +} from 'react-native';
  13 +
  14 +export default class AccountPageLineCell extends Component{
  15 +
  16 +
  17 + constructor(props) {
  18 + super(props);
  19 + }
  20 +
  21 +
  22 + render() {
  23 +
  24 + let {title} = this.props;
  25 +
  26 + return (
  27 + <TouchableOpacity
  28 + activeOpacity={1}
  29 + style={styles.container}
  30 + onPress={() => {this.props.onPress && this.props.onPress()}}>
  31 +
  32 + <View style={styles.cellContainer}>
  33 + <Text style={styles.title}>{title}</Text>
  34 + <Image style={styles.arrow} source={require("../../image/arrow_gray.png")}/>
  35 + </View>
  36 + </TouchableOpacity>
  37 + );
  38 + }
  39 +
  40 +};
  41 +
  42 +let {width, height} = Dimensions.get('window');
  43 +const DEVICE_WIDTH_RATIO = width / 320;
  44 +
  45 +
  46 +
  47 +let styles = StyleSheet.create({
  48 +
  49 + container: {
  50 + flex: 1,
  51 + },
  52 +
  53 + cellContainer: {
  54 + width: width,
  55 + height: 50 * DEVICE_WIDTH_RATIO,
  56 + backgroundColor: '#ffffff',
  57 + flexDirection: 'row',
  58 + justifyContent: 'center',
  59 + alignItems: 'center',
  60 + },
  61 +
  62 +
  63 + title:{
  64 + fontSize: 16,
  65 + color: '#444444',
  66 + textAlign: 'left',
  67 + fontWeight: 'bold',
  68 + flex: 1,
  69 + paddingLeft: 15 * DEVICE_WIDTH_RATIO,
  70 + },
  71 +
  72 + arrow:{
  73 + width: 7 * DEVICE_WIDTH_RATIO,
  74 + height: 12 * DEVICE_WIDTH_RATIO,
  75 + justifyContent: 'center',
  76 + alignItems: 'center',
  77 + marginRight: 15 * DEVICE_WIDTH_RATIO,
  78 + },
  79 +
  80 +});
  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 AccountPageLineCell from '../components/installment/AccountPageLineCell';
  20 +import ServerError from '../components/installment/ServerError';
  21 +
  22 +const actions = [
  23 + installmentActions,
  24 +];
  25 +function mapStateToProps(state) {
  26 + return {
  27 + ...state
  28 + };
  29 +}
  30 +function mapDispatchToProps(dispatch) {
  31 +
  32 + const creators = Map()
  33 + .merge(...actions)
  34 + .filter(value => typeof value === 'function')
  35 + .toObject();
  36 +
  37 + return {
  38 + actions: bindActionCreators(creators, dispatch),
  39 + dispatch
  40 + };
  41 +}
  42 +class InstallmentAccountContainer extends Component {
  43 + constructor(props) {
  44 + super(props);
  45 + this._onPressMyCard = this._onPressMyCard.bind(this);
  46 + }
  47 + componentDidMount() {
  48 + }
  49 +
  50 +
  51 + _onPressMyCard() {
  52 + this.props.actions.gotoMyCards();
  53 + }
  54 +
  55 + render() {
  56 + let {installmentStausPageInfo} = this.props.installment;
  57 + return (
  58 + <AccountPageLineCell
  59 + title={"我的银行卡"}
  60 + onPress={this._onPressMyCard}
  61 + />
  62 + );
  63 + }
  64 +}
  65 +let styles = StyleSheet.create({
  66 + container: {
  67 + flex: 1,
  68 + },
  69 +
  70 +});
  71 +
  72 +export default connect(mapStateToProps, mapDispatchToProps)(InstallmentAccountContainer);
  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 +import ServerError from '../components/installment/ServerError';
  21 +
  22 +const actions = [
  23 + installmentActions,
  24 +];
  25 +function mapStateToProps(state) {
  26 + return {
  27 + ...state
  28 + };
  29 +}
  30 +function mapDispatchToProps(dispatch) {
  31 +
  32 + const creators = Map()
  33 + .merge(...actions)
  34 + .filter(value => typeof value === 'function')
  35 + .toObject();
  36 +
  37 + return {
  38 + actions: bindActionCreators(creators, dispatch),
  39 + dispatch
  40 + };
  41 +}
  42 +class InstallmentMyCardContainer extends Component {
  43 + constructor(props) {
  44 + super(props);
  45 + this._onPressStatusPageBtn = this._onPressStatusPageBtn.bind(this);
  46 + this._reloadPage = this._reloadPage.bind(this);
  47 + }
  48 + componentDidMount() {
  49 + }
  50 +
  51 + _reloadPage() {
  52 + let {installmentStausPageInfo} = this.props.installment;
  53 + let {originalParams} = installmentStausPageInfo;
  54 + this.props.actions.setError(null);
  55 + this.props.actions.setInstallmentStausPageParams(originalParams.statusCode, originalParams.failReason, originalParams.uid);
  56 + }
  57 +
  58 + _onPressStatusPageBtn() {
  59 + this.props.actions.onPressStatusPageBtn();
  60 + }
  61 +
  62 + render() {
  63 + let {installmentStausPageInfo,error} = this.props.installment;
  64 + if (error) {
  65 + return (
  66 + <ServerError
  67 + reloadPage={this._reloadPage}
  68 + />
  69 + );
  70 + }
  71 + return (
  72 + <InstallmentStatus
  73 + installmentStausPageInfo={installmentStausPageInfo}
  74 + onPressStatusPageBtn={this._onPressStatusPageBtn}
  75 + />
  76 + );
  77 + }
  78 +}
  79 +let styles = StyleSheet.create({
  80 + container: {
  81 + flex: 1,
  82 + },
  83 +
  84 +});
  85 +
  86 +export default connect(mapStateToProps, mapDispatchToProps)(InstallmentMyCardContainer);
@@ -233,7 +233,6 @@ export function productListForInstallment() { @@ -233,7 +233,6 @@ export function productListForInstallment() {
233 233
234 export function onPressOpenInstallment() { 234 export function onPressOpenInstallment() {
235 return (dispatch, getState) => { 235 return (dispatch, getState) => {
236 - // ReactNative.NativeModules.YH_InstallmentHelper.goToOpenInstallment();  
237 let url = `http://m.yohobuy.com?openby:yohobuy={"action":"go.instalmentOpen","params":{}}`; 236 let url = `http://m.yohobuy.com?openby:yohobuy={"action":"go.instalmentOpen","params":{}}`;
238 ReactNative.NativeModules.YH_CommonHelper.jumpWithUrl(url); 237 ReactNative.NativeModules.YH_CommonHelper.jumpWithUrl(url);
239 } 238 }
@@ -551,3 +550,10 @@ export function gotoRepayRecordList() { @@ -551,3 +550,10 @@ export function gotoRepayRecordList() {
551 ReactNative.NativeModules.YH_InstallmentHelper.gotoRepayRecordListPage(); 550 ReactNative.NativeModules.YH_InstallmentHelper.gotoRepayRecordListPage();
552 }; 551 };
553 } 552 }
  553 +
  554 +
  555 +
  556 +export function gotoMyCards() {
  557 + let url = `http://m.yohobuy.com?openby:yohobuy={"action":"go.instalmentMyCard","params":{}}`;
  558 + ReactNative.NativeModules.YH_CommonHelper.jumpWithUrl(url);
  559 +}