Authored by chenl

增加分期订单。review by 张丽霞。

@@ -31,7 +31,8 @@ import InstallmentAccountContainer from './containers/InstallmentAccountContaine @@ -31,7 +31,8 @@ import InstallmentAccountContainer from './containers/InstallmentAccountContaine
31 import InstallmentMyCardContainer from './containers/InstallmentMyCardContainer'; 31 import InstallmentMyCardContainer from './containers/InstallmentMyCardContainer';
32 import InstallmentMyCardDetailContainer from './containers/InstallmentMyCardDetailContainer'; 32 import InstallmentMyCardDetailContainer from './containers/InstallmentMyCardDetailContainer';
33 import InstallmentMyCardAddContainer from './containers/InstallmentMyCardAddContainer'; 33 import InstallmentMyCardAddContainer from './containers/InstallmentMyCardAddContainer';
34 - 34 +import InstallmentMyOrderContainer from './containers/InstallmentMyOrderContainer';
  35 +import InstallmentMyOrderDetailContainer from './containers/InstallmentMyOrderDetailContainer';
35 36
36 import { 37 import {
37 setPlatform, 38 setPlatform,
@@ -143,6 +144,18 @@ export default function native(platform) { @@ -143,6 +144,18 @@ export default function native(platform) {
143 <InstallmentMyCardAddContainer /> 144 <InstallmentMyCardAddContainer />
144 </Provider> 145 </Provider>
145 ) 146 )
  147 + } else if (type == 'installMyOrder') {
  148 + return (
  149 + <Provider store={store}>
  150 + <InstallmentMyOrderContainer />
  151 + </Provider>
  152 + )
  153 + } else if (type == 'installMyOrderDetail') {
  154 + return (
  155 + <Provider store={store}>
  156 + <InstallmentMyOrderDetailContainer />
  157 + </Provider>
  158 + )
146 } 159 }
147 } 160 }
148 }); 161 });
  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 +} from 'react-native';
  12 +
  13 +import Immutable, {Map} from 'immutable';
  14 +import Toast from '../../../common/components/Toast';
  15 +
  16 +
  17 +export default class MyOrderDetail extends React.Component {
  18 + constructor(props) {
  19 + super(props);
  20 + }
  21 +
  22 + render() {
  23 +
  24 + let bankName = "农业银行";
  25 + let cardNo = "4561";
  26 + let userName = "**聪";
  27 + let mobile = "*****5865";
  28 + let isMaster = false;
  29 +
  30 + let cardDesc = isMaster ? "主卡,用于支付验证和还款验证。" : "副卡,仅用于还款验证。";
  31 + let cardTip = isMaster ? "如果您更换银行预留手机号,请先新增其他还款银行卡,并将新增银行卡切换为主卡。然后解除绑定此卡,重新绑定即可。"
  32 + : "如果您更换银行预留手机号,请先将银行卡解除绑定,再次重新绑定即可。";
  33 +
  34 + return (
  35 + <View style={styles.container}>
  36 + <View style={styles.cardDetailContainer}>
  37 + <Image style={styles.cardDetailImg} source={require("../../image/bank/b-ABC.png")}/>
  38 + <Text style={styles.cardDetailName}>{bankName}</Text>
  39 + <Text style={styles.cardDetailNo}>储蓄卡 | 尾号{cardNo}</Text>
  40 + </View>
  41 + <View style={styles.cardInfoContainer}>
  42 + <Text style={styles.cardInfoLabel}>持卡人</Text>
  43 + <Text style={styles.cardInfoData}>{userName}</Text>
  44 + </View>
  45 + <View style={styles.cardInfoLine}></View>
  46 + <View style={styles.cardInfoContainer}>
  47 + <Text style={styles.cardInfoLabel}>预留手机号</Text>
  48 + <Text style={styles.cardInfoData}>{mobile}</Text>
  49 + </View>
  50 + <View style={styles.cardInfoLine}></View>
  51 + <View style={styles.cardInfoContainer}>
  52 + <Text style={styles.cardInfoLabel}>分期银行</Text>
  53 + <Text style={styles.cardInfoData}>{cardDesc}</Text>
  54 + </View>
  55 + <View style={styles.cardTipContainer}>
  56 + <Text style={styles.cardTip}>{cardTip}</Text>
  57 + {
  58 + isMaster ? null :
  59 + <View style={styles.buttonContainer}>
  60 + <TouchableOpacity activeOpacity={1} onPress={() => {
  61 + this.props.onPressReleaseCard && this.props.onPressReleaseCard();}}>
  62 + <Text style={styles.releaseButton}>解除绑定</Text>
  63 + </TouchableOpacity>
  64 + <TouchableOpacity activeOpacity={1} onPress={() => {
  65 + this.props.onPressChangeCard && this.props.onPressChangeCard();}}>
  66 + <Text style={styles.changeButton}>切换为主卡</Text>
  67 + </TouchableOpacity>
  68 + </View>
  69 + }
  70 + </View>
  71 +
  72 + <Toast text="解绑成功" isVisible={false} />
  73 +
  74 + </View>
  75 + );
  76 + }
  77 +};
  78 +
  79 +let {width, height} = Dimensions.get('window');
  80 +const DEVICE_WIDTH_RATIO = width / 320;
  81 +
  82 +let styles = StyleSheet.create({
  83 + container: {
  84 + flex: 1,
  85 + backgroundColor: "#ffffff",
  86 + },
  87 +
  88 + cardDetailContainer:{
  89 + width: width,
  90 + height: 60 * DEVICE_WIDTH_RATIO,
  91 + backgroundColor: "#f8555b",
  92 + },
  93 +
  94 + cardDetailImg:{
  95 + position: 'absolute',
  96 + top: 10 * DEVICE_WIDTH_RATIO,
  97 + left: 15 * DEVICE_WIDTH_RATIO,
  98 + width: 40 * DEVICE_WIDTH_RATIO,
  99 + height: 40 * DEVICE_WIDTH_RATIO,
  100 + },
  101 +
  102 + cardDetailName:{
  103 + position: 'absolute',
  104 + top: 10 * DEVICE_WIDTH_RATIO,
  105 + left: 65 * DEVICE_WIDTH_RATIO,
  106 + width: 150 * DEVICE_WIDTH_RATIO,
  107 + height: 20 * DEVICE_WIDTH_RATIO,
  108 + fontSize: 15 * DEVICE_WIDTH_RATIO,
  109 + color: "white",
  110 + fontWeight: 'bold',
  111 + },
  112 +
  113 + cardDetailNo:{
  114 + position: 'absolute',
  115 + top: 30 * DEVICE_WIDTH_RATIO,
  116 + left: 65 * DEVICE_WIDTH_RATIO,
  117 + width: 150 * DEVICE_WIDTH_RATIO,
  118 + height: 30 * DEVICE_WIDTH_RATIO,
  119 + fontSize: 13 * DEVICE_WIDTH_RATIO,
  120 + color: "white",
  121 + },
  122 +
  123 + cardInfoContainer:{
  124 + width: width,
  125 + height: 44 * DEVICE_WIDTH_RATIO,
  126 + backgroundColor: "#ffffff",
  127 + flexDirection: 'row',
  128 + alignItems: 'center',
  129 + },
  130 +
  131 + cardInfoLabel:{
  132 + width: 125 * DEVICE_WIDTH_RATIO,
  133 + paddingLeft: 15 * DEVICE_WIDTH_RATIO,
  134 + fontSize: 14 * DEVICE_WIDTH_RATIO,
  135 + },
  136 +
  137 + cardInfoData:{
  138 + width: 150 * DEVICE_WIDTH_RATIO,
  139 + fontSize: 13 * DEVICE_WIDTH_RATIO,
  140 + },
  141 +
  142 + cardInfoLine:{
  143 + width: width - 15 * DEVICE_WIDTH_RATIO,
  144 + height: 0.5 * DEVICE_WIDTH_RATIO,
  145 + marginLeft: 15 * DEVICE_WIDTH_RATIO,
  146 + backgroundColor: "#b4b4b4",
  147 + },
  148 +
  149 + cardTipContainer:{
  150 + flex: 1,
  151 + backgroundColor: "#f0f0f0",
  152 + },
  153 +
  154 + cardTip: {
  155 + width: width,
  156 + paddingLeft: 15 * DEVICE_WIDTH_RATIO,
  157 + paddingRight: 10 * DEVICE_WIDTH_RATIO,
  158 + paddingTop: 10 * DEVICE_WIDTH_RATIO,
  159 + fontSize: 12 * DEVICE_WIDTH_RATIO,
  160 + color: "#b0b0b0",
  161 + },
  162 +
  163 + buttonContainer:{
  164 + width: width,
  165 + height: 100,
  166 + flexDirection: 'row',
  167 + alignItems: 'center',
  168 + justifyContent: 'center',
  169 + },
  170 +
  171 + releaseButton:{
  172 + width: 130 * DEVICE_WIDTH_RATIO,
  173 + height: 44 * DEVICE_WIDTH_RATIO,
  174 + fontSize:14 * DEVICE_WIDTH_RATIO,
  175 + paddingTop:12 * DEVICE_WIDTH_RATIO,
  176 + marginRight: 8 * DEVICE_WIDTH_RATIO,
  177 + color: '#000000',
  178 + textAlign: 'center',
  179 + borderColor:'#444444',
  180 + borderWidth:2,
  181 + borderRadius: 6,
  182 + },
  183 +
  184 + changeButton:{
  185 + width: 130 * DEVICE_WIDTH_RATIO,
  186 + height: 44 * DEVICE_WIDTH_RATIO,
  187 + fontSize:14 * DEVICE_WIDTH_RATIO,
  188 + paddingTop:12 * DEVICE_WIDTH_RATIO,
  189 + marginLeft: 8 * DEVICE_WIDTH_RATIO,
  190 + color: '#ffffff',
  191 + textAlign: 'center',
  192 + borderColor:'#444444',
  193 + borderWidth:2,
  194 + borderRadius: 6,
  195 + backgroundColor:'#444444',
  196 + },
  197 +
  198 +
  199 +});
  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 + LayoutAnimation,
  13 +} from 'react-native';
  14 +
  15 +import Immutable, {Map} from 'immutable';
  16 +import LoadingIndicator from '../../../common/components/LoadingIndicator';
  17 +import MyOrderListCell from './MyOrderListCell';
  18 +
  19 +
  20 +export default class MyOrderList extends React.Component {
  21 + constructor(props) {
  22 + super(props);
  23 + this.dataSource = new ListView.DataSource({
  24 + rowHasChanged: (r1, r2) => !Immutable.is(r1, r2),
  25 + });
  26 + }
  27 +
  28 + renderRow(rowData, sectionID, rowID, highlightRow) {
  29 + return (
  30 + <MyOrderListCell
  31 + data={rowData}
  32 + />
  33 + );
  34 + }
  35 +
  36 + render() {
  37 +
  38 +
  39 + let cardList = [{'cardNo':'6222024301058186063','cardBank':"ICBC"},{'cardNo':'6222024301058186063','cardBank':"BOC"}];
  40 +
  41 +
  42 + return (
  43 + <ListView
  44 + style={styles.container}
  45 + dataSource={this.dataSource.cloneWithRows(cardList)}
  46 + enableEmptySections={true}
  47 + renderRow={this.renderRow}
  48 + />
  49 + );
  50 +
  51 +
  52 + }
  53 +};
  54 +
  55 +let {width, height} = Dimensions.get('window');
  56 +const DEVICE_WIDTH_RATIO = width / 320;
  57 +
  58 +let styles = StyleSheet.create({
  59 + container: {
  60 + flex: 1,
  61 + },
  62 +
  63 +
  64 +});
  1 +'use strict';
  2 +import React from 'react';
  3 +import ReactNative, {
  4 + View,
  5 + Text,
  6 + Image,
  7 + StyleSheet,
  8 + Dimensions,
  9 + TouchableOpacity,
  10 +} from 'react-native';
  11 +
  12 +import Immutable, {Map} from 'immutable';
  13 +
  14 +export default class MyOrderListCell extends React.Component {
  15 + constructor(props) {
  16 + super(props);
  17 + }
  18 +
  19 + render() {
  20 + let{cardNo, cardBank} = this.props.data;
  21 +
  22 + let bankImg = this.getBankImage(cardBank);
  23 + let newCardNo = this.processBankCardNo(cardNo);
  24 +
  25 + return(
  26 + <TouchableOpacity activeOpacity={1} onPress={() => this.props.onPressCard && this.props.onPressCard()}>
  27 + <View style={styles.container} >
  28 + <Image style={styles.cardBg} source={bankImg} />
  29 + <Text style={styles.cardNo} numberOfLines={1}>
  30 + {newCardNo}
  31 + </Text>
  32 + </View>
  33 + </TouchableOpacity>
  34 + );
  35 + }
  36 +
  37 +
  38 + //正则替换卡号,保留后4位
  39 + processBankCardNo(cardNo){
  40 +
  41 + let newCardNo = cardNo.replace(/(\d+)(\d{4})$/, (a, b, c)=> {
  42 + return b.replace(/\d/g, '*') + c;
  43 + });
  44 +
  45 + return newCardNo;
  46 + }
  47 +
  48 +
  49 + getBankImage(bank){
  50 + let bankImg;
  51 + switch(bank){
  52 + case "ABC":
  53 + bankImg = require('../../image/bank/bank-ABC.png');
  54 + break;
  55 + case "BOC":
  56 + bankImg = require('../../image/bank/bank-BOC.png');
  57 + break;
  58 + case "CCB":
  59 + bankImg = require('../../image/bank/bank-CCB.png');
  60 + break;
  61 + case "CEB":
  62 + bankImg = require('../../image/bank/bank-CEB.png');
  63 + break;
  64 + case "CGB":
  65 + bankImg = require('../../image/bank/bank-CGB.png');
  66 + break;
  67 + case "CIB":
  68 + bankImg = require('../../image/bank/bank-CIB.png');
  69 + break;
  70 + case "CITIC":
  71 + bankImg = require('../../image/bank/bank-CITIC.png');
  72 + break;
  73 + case "CMBC":
  74 + bankImg = require('../../image/bank/bank-CMBC.png');
  75 + break;
  76 + case "ICBC":
  77 + bankImg = require('../../image/bank/bank-ICBC.png');
  78 + break;
  79 + case "PAYH":
  80 + bankImg = require('../../image/bank/bank-PAYH.png');
  81 + break;
  82 + case "PSBC":
  83 + bankImg = require('../../image/bank/bank-PSBC.png');
  84 + break;
  85 + default:
  86 + bankImg = require('../../image/bank/bank-EMPTY.png');
  87 + break;
  88 + }
  89 + return bankImg;
  90 + }
  91 +};
  92 +
  93 +
  94 +
  95 +
  96 +let {width, height} = Dimensions.get('window');
  97 +const DEVICE_WIDTH_RATIO = width / 320;
  98 +
  99 +let styles = StyleSheet.create({
  100 + container: {
  101 + flex: 1,
  102 + alignItems: 'center',
  103 + justifyContent: 'center',
  104 + paddingTop: 15 * DEVICE_WIDTH_RATIO,
  105 + paddingLeft: 15 * DEVICE_WIDTH_RATIO,
  106 + paddingRight: 15 * DEVICE_WIDTH_RATIO,
  107 +
  108 + },
  109 + cardBg:{
  110 + width: 290 * DEVICE_WIDTH_RATIO,
  111 + height: 100 * DEVICE_WIDTH_RATIO,
  112 + },
  113 +
  114 + cardNo:{
  115 + position: 'absolute',
  116 + top: 85,
  117 + left: 100,
  118 + color: "white",
  119 + fontSize: 22 * DEVICE_WIDTH_RATIO,
  120 +
  121 + }
  122 +});
  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 + ListView,
  14 + TouchableOpacity,
  15 +} from 'react-native'
  16 +
  17 +import {bindActionCreators} from 'redux';
  18 +import {connect} from 'react-redux';
  19 +import {Map} from 'immutable';
  20 +import * as cardListActions from '../reducers/bankCardList/cardListActions';
  21 +import ServerError from '../components/installment/ServerError';
  22 +import MyOrderList from '../components/order/MyOrderList';
  23 +
  24 +
  25 +const actions = [
  26 + cardListActions,
  27 +];
  28 +function mapStateToProps(state) {
  29 + return {
  30 + ...state
  31 + };
  32 +}
  33 +function mapDispatchToProps(dispatch) {
  34 +
  35 + const creators = Map()
  36 + .merge(...actions)
  37 + .filter(value => typeof value === 'function')
  38 + .toObject();
  39 +
  40 + return {
  41 + actions: bindActionCreators(creators, dispatch),
  42 + dispatch
  43 + };
  44 +}
  45 +class InstallmentMyOrderContainer extends Component {
  46 +
  47 + constructor(props) {
  48 + super(props);
  49 + }
  50 +
  51 + componentDidMount() {
  52 + // this.props.actions.getBankCards();
  53 + }
  54 +
  55 + render() {
  56 +
  57 + return (
  58 + <MyOrderList
  59 + style={styles.container}
  60 + orderList={[]}
  61 +
  62 + />
  63 + );
  64 + }
  65 +}
  66 +let styles = StyleSheet.create({
  67 + container: {
  68 + flex: 1,
  69 + },
  70 +
  71 +
  72 +});
  73 +
  74 +export default connect(mapStateToProps, mapDispatchToProps)(InstallmentMyOrderContainer);
  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 + ListView,
  14 + TouchableOpacity,
  15 +} from 'react-native'
  16 +
  17 +import {bindActionCreators} from 'redux';
  18 +import {connect} from 'react-redux';
  19 +import {Map} from 'immutable';
  20 +import * as cardListActions from '../reducers/bankCardList/cardListActions';
  21 +import ServerError from '../components/installment/ServerError';
  22 +import MyOrderDetail from '../components/order/MyOrderDetail';
  23 +
  24 +
  25 +const actions = [
  26 + cardListActions,
  27 +];
  28 +function mapStateToProps(state) {
  29 + return {
  30 + ...state
  31 + };
  32 +}
  33 +function mapDispatchToProps(dispatch) {
  34 +
  35 + const creators = Map()
  36 + .merge(...actions)
  37 + .filter(value => typeof value === 'function')
  38 + .toObject();
  39 +
  40 + return {
  41 + actions: bindActionCreators(creators, dispatch),
  42 + dispatch
  43 + };
  44 +}
  45 +class InstallmentMyOrderDetailContainer extends Component {
  46 +
  47 + constructor(props) {
  48 + super(props);
  49 + }
  50 +
  51 + componentDidMount() {
  52 + // this.props.actions.getBankCards();
  53 + }
  54 +
  55 + render() {
  56 +
  57 + let cardList = ['65325165465321654','99999999999999'];
  58 +
  59 + return (
  60 + <MyOrderDetail
  61 + style={styles.container}
  62 + cardList={cardList}
  63 +
  64 + />
  65 + );
  66 + }
  67 +}
  68 +let styles = StyleSheet.create({
  69 + container: {
  70 + flex: 1,
  71 + },
  72 +
  73 +
  74 +});
  75 +
  76 +export default connect(mapStateToProps, mapDispatchToProps)(InstallmentMyOrderDetailContainer);
@@ -233,7 +233,7 @@ export function productListForInstallment() { @@ -233,7 +233,7 @@ export function productListForInstallment() {
233 233
234 export function onPressOpenInstallment() { 234 export function onPressOpenInstallment() {
235 return (dispatch, getState) => { 235 return (dispatch, getState) => {
236 - let url = `http://m.yohobuy.com?openby:yohobuy={"action":"go.instalmentMyCard","params":{}}`; 236 + let url = `http://m.yohobuy.com?openby:yohobuy={"action":"go.instalmentOpen","params":{}}`;
237 ReactNative.NativeModules.YH_CommonHelper.jumpWithUrl(url); 237 ReactNative.NativeModules.YH_CommonHelper.jumpWithUrl(url);
238 } 238 }
239 } 239 }