Authored by chenl

增加逛详请埋点和分期选择银行卡页面。review by 孙凯。

@@ -136,7 +136,7 @@ export default class SingleImage extends React.Component { @@ -136,7 +136,7 @@ export default class SingleImage extends React.Component {
136 <TouchableOpacity style={styles.button} activeOpacity={0.5} onPress={() => { 136 <TouchableOpacity style={styles.button} activeOpacity={0.5} onPress={() => {
137 let pos_id = 105; 137 let pos_id = 105;
138 let product_id = value.product_id?value.product_id:''; 138 let product_id = value.product_id?value.product_id:'';
139 - this.props.onPressShopCar && this.props.onPressShopCar(value.product_skn,pos_id,product_id); 139 + this.props.onPressShopCar && this.props.onPressShopCar(value.product_skn,product_id,pos_id);
140 }}> 140 }}>
141 <Image source={require('../../image/dian_gwc_bt.png')} style={styles.image} resizeMode={'contain'}></Image> 141 <Image source={require('../../image/dian_gwc_bt.png')} style={styles.image} resizeMode={'contain'}></Image>
142 </TouchableOpacity> 142 </TouchableOpacity>
@@ -189,6 +189,7 @@ class DetailContainer extends Component { @@ -189,6 +189,7 @@ class DetailContainer extends Component {
189 let param = { 189 let param = {
190 pruduct_skn: product_skn, 190 pruduct_skn: product_skn,
191 fromPage: 'YH_GuangDetailViewController', 191 fromPage: 'YH_GuangDetailViewController',
  192 + pos_id: pos_id,
192 } 193 }
193 ReactNative.NativeModules.YH_CommonHelper.showChooseInfoView(param) 194 ReactNative.NativeModules.YH_CommonHelper.showChooseInfoView(param)
194 195
  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 + Alert,
  13 +} from 'react-native';
  14 +
  15 +import Immutable, {Map} from 'immutable';
  16 +
  17 +export default class ChangeBankCard extends React.Component {
  18 + constructor(props) {
  19 + super(props);
  20 + this.dataSource = new ListView.DataSource({
  21 + rowHasChanged: (r1, r2) => !Immutable.is(r1, r2),
  22 + });
  23 + this.renderRow = this.renderRow.bind(this);
  24 + this.renderSeparator = this.renderSeparator.bind(this);
  25 + this.renderFooter = this.renderFooter.bind(this);
  26 + }
  27 +
  28 + renderRow(rowData, sectionID, rowID, highlightRow) {
  29 + let title = rowData ? rowData.get("outBankNameNumb") : "";
  30 +
  31 + //判断是否为当前支付银行卡
  32 + let payCard = this.props.payCard;
  33 + let isPayCard = Immutable.is(payCard, rowData);
  34 + // cardIdNo
  35 +
  36 + return (
  37 + <TouchableOpacity key={"row_"+rowID} activeOpacity={0.5} onPress={() => {
  38 + this.props.changeBankCard && this.props.changeBankCard(); }}>
  39 + <View style={styles.choseCardContainer}>
  40 + <Text style={styles.choseCardTitle}>{title}</Text>
  41 + {
  42 + isPayCard ? <Image source={require("../../image/check_icon.png")}/> : null
  43 + }
  44 + </View>
  45 + </TouchableOpacity>
  46 + );
  47 + }
  48 +
  49 + renderSeparator(sectionID, rowID, adjacentRowHighlighted){
  50 + return (
  51 + <View key={"sep_"+rowID} style={styles.splitLine}/>
  52 + );
  53 + }
  54 +
  55 + renderFooter(){
  56 + return (
  57 + <View >
  58 + <View style={styles.choseCardContainer}>
  59 + <Text style={styles.choseCardTitle}>使用新卡还款</Text>
  60 + <Image style={{marginRight:4*DEVICE_WIDTH_RATIO}} source={require("../../image/arrow_gray.png")}/>
  61 + </View>
  62 + <View style={styles.splitLine}/>
  63 + </View>
  64 + );
  65 + }
  66 +
  67 + render() {
  68 + let{bankCardsList}=this.props;
  69 +
  70 + let bankCardArray = bankCardsList ? bankCardsList.toArray() : [];
  71 +
  72 + return (
  73 + <View style={styles.container}>
  74 + <View style={styles.changeCardContainer}>
  75 + <View style={styles.titleContainer}>
  76 + <Text style={{fontSize:16*DEVICE_WIDTH_RATIO,lineHeight:Math.ceil(30 * DEVICE_WIDTH_RATIO),color:'#444444'}}>选择支付方式</Text>
  77 + <TouchableOpacity style={styles.closeIcon} onPress={() => {this.props.closeBankSafePay && this.props.closeBankSafePay()}} >
  78 + <Image
  79 + source={require('../../image/close_ic.png')}
  80 + resizeMode={'contain'}
  81 + />
  82 + </TouchableOpacity>
  83 + </View>
  84 + <View style={styles.splitLine}/>
  85 +
  86 + <ListView
  87 + style={styles.cardListContainer}
  88 + conta
  89 + dataSource={this.dataSource.cloneWithRows(bankCardArray)}
  90 + enableEmptySections={true}
  91 + renderRow={this.renderRow}
  92 + renderSeparator={this.renderSeparator}
  93 + renderFooter={this.renderFooter}/>
  94 +
  95 + <View style={styles.splitLine}/>
  96 + </View>
  97 + </View>
  98 + );
  99 +
  100 + }
  101 +};
  102 +
  103 +let {width, height} = Dimensions.get('window');
  104 +const DEVICE_WIDTH_RATIO = width / 320;
  105 +
  106 +let styles = StyleSheet.create({
  107 + container: {
  108 + flex: 1,
  109 + backgroundColor: 'rgba(0, 0, 0, 0.3)',
  110 + alignItems: 'center',
  111 + position: 'absolute',
  112 + width: width,
  113 + height: height,
  114 + top: 0,
  115 + },
  116 + changeCardContainer: {
  117 + position: 'absolute',
  118 + bottom: 0,
  119 + width: width,
  120 + height: 375 * DEVICE_WIDTH_RATIO,
  121 + backgroundColor: 'white',
  122 + },
  123 + titleContainer: {
  124 + width: width,
  125 + height: 44 * DEVICE_WIDTH_RATIO,
  126 + alignItems: 'center',
  127 + position: 'relative',
  128 + },
  129 + closeIcon: {
  130 + position: 'absolute',
  131 + right: 10 * DEVICE_WIDTH_RATIO,
  132 + top: 0 * DEVICE_WIDTH_RATIO,
  133 + paddingLeft: 10 * DEVICE_WIDTH_RATIO,
  134 + paddingRight: 10 * DEVICE_WIDTH_RATIO,
  135 + paddingTop: 14 * DEVICE_WIDTH_RATIO,
  136 + },
  137 + splitLine: {
  138 + width: width,
  139 + height: 1,
  140 + backgroundColor: '#e5e5e5',
  141 + },
  142 + cardListContainer: {
  143 + width: width,
  144 + height: 200 * DEVICE_WIDTH_RATIO,
  145 + },
  146 + choseCardContainer: {
  147 + height: 44 * DEVICE_WIDTH_RATIO,
  148 + flexDirection: 'row',
  149 + alignItems: 'center',
  150 + justifyContent: 'space-between',
  151 + marginRight: 15 * DEVICE_WIDTH_RATIO,
  152 + },
  153 + choseCardTitle: {
  154 + marginLeft: 15 * DEVICE_WIDTH_RATIO,
  155 + color: '#444444',
  156 + fontSize: 14,
  157 + },
  158 +
  159 +
  160 +});
@@ -18,6 +18,7 @@ import YH_Image from '../../../common/components/YH_Image'; @@ -18,6 +18,7 @@ import YH_Image from '../../../common/components/YH_Image';
18 import SlicedImage from '../../../common/components/SlicedImage'; 18 import SlicedImage from '../../../common/components/SlicedImage';
19 import LoadingIndicator from '../../../common/components/LoadingIndicator'; 19 import LoadingIndicator from '../../../common/components/LoadingIndicator';
20 import BankSafePay from '../installment/BankSafePay'; 20 import BankSafePay from '../installment/BankSafePay';
  21 +import ChangeBankCard from '../installment/ChangeBankCard';
21 import ConfirmPay from '../installment/ConfirmPay'; 22 import ConfirmPay from '../installment/ConfirmPay';
22 import Prompt from '../../../coupon/components/coupon/Prompt'; 23 import Prompt from '../../../coupon/components/coupon/Prompt';
23 24
@@ -45,7 +46,7 @@ export default class MyOrderDetail extends React.Component { @@ -45,7 +46,7 @@ export default class MyOrderDetail extends React.Component {
45 46
46 render() { 47 render() {
47 48
48 - let {isFetching, orderInfo, showBankSafePayView, showConfirmPayView, payCard, formateData, tipMessage} = this.props.myOrderDetail; 49 + let {isFetching, orderInfo, showBankSafePayView, showChangeBankView, showConfirmPayView, bankCardsList, payCard, formateData, tipMessage} = this.props.myOrderDetail;
49 50
50 if(!orderInfo) 51 if(!orderInfo)
51 return null; 52 return null;
@@ -159,6 +160,16 @@ export default class MyOrderDetail extends React.Component { @@ -159,6 +160,16 @@ export default class MyOrderDetail extends React.Component {
159 /> 160 />
160 :null 161 :null
161 } 162 }
  163 + {showBankSafePayView ?
  164 + <ChangeBankCard
  165 + payCard={payCard}
  166 + bankCardsList={bankCardsList}
  167 + closeBankSafePay={this.props.closeBankSafePay}
  168 + bankSafePayNow={this.props.bankSafePayNow}
  169 + changeBankCard={this.props.changeBankCard}
  170 + />
  171 + :null
  172 + }
162 {showConfirmPayView? 173 {showConfirmPayView?
163 <ConfirmPay 174 <ConfirmPay
164 reSendConfirmPaySnsCode={this.props.reSendConfirmPaySnsCode} 175 reSendConfirmPaySnsCode={this.props.reSendConfirmPaySnsCode}
@@ -14,6 +14,7 @@ let InitialState = Record({ @@ -14,6 +14,7 @@ let InitialState = Record({
14 bankCardsList: List(), 14 bankCardsList: List(),
15 payCard: Map(), 15 payCard: Map(),
16 showBankSafePayView: false, 16 showBankSafePayView: false,
  17 + showChangeBankView: false,
17 showConfirmPayView: false, 18 showConfirmPayView: false,
18 repayTermList:List(), 19 repayTermList:List(),
19 prePaySuccessParam: Map(), 20 prePaySuccessParam: Map(),