Authored by 盖剑秋

Anti fraud tips and fix few bugs. reviewed by redding.

  1 +'use strict';
  2 +
  3 +import React, {Component} from 'react';
  4 +import Immutable, {Map} from 'immutable';
  5 +
  6 +import ReactNative, {
  7 + View,
  8 + Text,
  9 + Image,
  10 + ListView,
  11 + StyleSheet,
  12 + Dimensions,
  13 + TouchableOpacity,
  14 + InteractionManager,
  15 + Platform
  16 +} from 'react-native';
  17 +
  18 +export default class AntiFraudTip extends Component {
  19 +
  20 + constructor(props) {
  21 + super(props);
  22 + }
  23 +
  24 + render() {
  25 + return (
  26 + <TouchableOpacity activeOpacity={1} style={styles.container} onPress={
  27 + () => {
  28 + this.props.onPressAntiFraudTip && this.props.onPressAntiFraudTip();
  29 + }
  30 + }>
  31 + <View style={styles.leftPart}>
  32 + <View style={styles.topPart}>
  33 + <Image style={{
  34 + width: 14,
  35 + height: 14
  36 + }} source={require('../../image/tan_ic.png')}/>
  37 + <Text style={styles.codeText}>关于防诈骗的重要提醒
  38 + </Text>
  39 + </View>
  40 + <Text style={styles.otherText}>有货不会以任何理由要求您退货退款,请提高警惕。
  41 + </Text>
  42 + </View>
  43 + <Image style={{
  44 + width: 15,
  45 + height: 15
  46 + }} source={require('../../image/shared_next_icon.png')}/>
  47 + </TouchableOpacity>
  48 + );
  49 + }
  50 +}
  51 +
  52 +let {width, height} = Dimensions.get('window');
  53 +
  54 +let styles = StyleSheet.create({
  55 + container: {
  56 + width: width,
  57 + height: 63,
  58 + flexDirection: 'row',
  59 + backgroundColor: 'white',
  60 + borderColor: '#f0f0f0',
  61 + alignItems: 'center',
  62 + borderBottomWidth: 10
  63 + },
  64 +
  65 + codeText: {
  66 + fontSize: 14,
  67 + marginBottom: 0,
  68 + marginLeft: 4,
  69 + color: '#444444'
  70 + },
  71 + topPart: {
  72 + flexDirection: 'row',
  73 + marginLeft: 15,
  74 + alignItems: 'center',
  75 + marginTop: 8,
  76 + },
  77 + leftPart: {
  78 + width: width - 30,
  79 + flexDirection: 'column',
  80 + paddingBottom: 10
  81 + },
  82 +
  83 + otherText: {
  84 + fontSize: 12,
  85 + marginLeft: 15,
  86 + marginTop: 8,
  87 + color: '#b0b0b0',
  88 + }
  89 +});
@@ -16,6 +16,7 @@ import YohoGiveCoinCell from './YohoGiveCoinCell' @@ -16,6 +16,7 @@ import YohoGiveCoinCell from './YohoGiveCoinCell'
16 import YohoReturnCoinCell from './YohoReturnCoinCell' 16 import YohoReturnCoinCell from './YohoReturnCoinCell'
17 import Prompt from '../../../coupon/components/coupon/Prompt'; 17 import Prompt from '../../../coupon/components/coupon/Prompt';
18 import DistributionInfoCell from './DistributionInfoCell' 18 import DistributionInfoCell from './DistributionInfoCell'
  19 +import AntiFraudTip from './AntiFraudTip'
19 20
20 import ReactNative, { 21 import ReactNative, {
21 View, 22 View,
@@ -41,6 +42,9 @@ export default class Detail extends Component { @@ -41,6 +42,9 @@ export default class Detail extends Component {
41 } 42 }
42 renderRow(rowData, sectionID, rowID, highlightRow) { 43 renderRow(rowData, sectionID, rowID, highlightRow) {
43 switch (sectionID) { 44 switch (sectionID) {
  45 + case 'tip':
  46 + return(<AntiFraudTip onPressAntiFraudTip={this.props.onPressAntiFraudTip}/>)
  47 + break;
44 case 'address': 48 case 'address':
45 return (<AddressCell channel={this.props.channel} data={rowData}/>); 49 return (<AddressCell channel={this.props.channel} data={rowData}/>);
46 break; 50 break;
@@ -185,6 +189,9 @@ export default class Detail extends Component { @@ -185,6 +189,9 @@ export default class Detail extends Component {
185 } 189 }
186 190
187 let dataSource = { 191 let dataSource = {
  192 + 'tip': data
  193 + ? [1]
  194 + : [],
188 'address': data 195 'address': data
189 ? [addressBlob] 196 ? [addressBlob]
190 : [], 197 : [],
@@ -66,8 +66,10 @@ export default class Detail extends Component { @@ -66,8 +66,10 @@ export default class Detail extends Component {
66 66
67 render() { 67 render() {
68 let {pay_lefttime, counter_flag, is_cancel} = this.props.data.toJS(); 68 let {pay_lefttime, counter_flag, is_cancel} = this.props.data.toJS();
  69 + let marginTop = this.showTimer? -30 : 0;
  70 +
69 return ( 71 return (
70 - <View style={{backgroundColor: 'transparent'}}> 72 + <View style={{backgroundColor: 'transparent', marginTop}}>
71 {this.showTimer && this.state.timeLeft 73 {this.showTimer && this.state.timeLeft
72 ? <View style={styles.timerContainer}> 74 ? <View style={styles.timerContainer}>
73 <Image style={styles.clockImage} source={require('../../image/countDown.png')}/> 75 <Image style={styles.clockImage} source={require('../../image/countDown.png')}/>
@@ -54,8 +54,9 @@ class DetailContainer extends Component { @@ -54,8 +54,9 @@ class DetailContainer extends Component {
54 this.pushMultiPackageWithPackages = this.pushMultiPackageWithPackages.bind(this); 54 this.pushMultiPackageWithPackages = this.pushMultiPackageWithPackages.bind(this);
55 this.onPressReturnOrderCode = this.onPressReturnOrderCode.bind(this); 55 this.onPressReturnOrderCode = this.onPressReturnOrderCode.bind(this);
56 this.showDelayDeliveryNotice = this.showDelayDeliveryNotice.bind(this); 56 this.showDelayDeliveryNotice = this.showDelayDeliveryNotice.bind(this);
  57 + this.onPressAntiFraudTip = this.onPressAntiFraudTip.bind(this);
57 this.subscription = NativeAppEventEmitter.addListener( 58 this.subscription = NativeAppEventEmitter.addListener(
58 - 'YHNotificationChangeOnLinePayToCodPay', 59 + 'YHChangeOnLinePayToCodPayEvent',
59 (reminder) => { 60 (reminder) => {
60 this.props.actions.getDetail(); 61 this.props.actions.getDetail();
61 } 62 }
@@ -102,6 +103,10 @@ class DetailContainer extends Component { @@ -102,6 +103,10 @@ class DetailContainer extends Component {
102 ReactNative.NativeModules.YH_OrderHelper.onPressReturnOrderCode(); 103 ReactNative.NativeModules.YH_OrderHelper.onPressReturnOrderCode();
103 } 104 }
104 105
  106 + onPressAntiFraudTip() {
  107 +
  108 + }
  109 +
105 showDelayDeliveryNotice(noticeString){ 110 showDelayDeliveryNotice(noticeString){
106 NativeModules.YH_OrderHelper.deliveryDelayNotice(noticeString); 111 NativeModules.YH_OrderHelper.deliveryDelayNotice(noticeString);
107 } 112 }
@@ -120,6 +125,7 @@ class DetailContainer extends Component { @@ -120,6 +125,7 @@ class DetailContainer extends Component {
120 pushMultiPackageWithPackages={this.pushMultiPackageWithPackages} 125 pushMultiPackageWithPackages={this.pushMultiPackageWithPackages}
121 onPressReturnOrderCode={this.onPressReturnOrderCode} 126 onPressReturnOrderCode={this.onPressReturnOrderCode}
122 _onPressDelayNotice={this.showDelayDeliveryNotice} 127 _onPressDelayNotice={this.showDelayDeliveryNotice}
  128 + onPressAntiFraudTip={this.onPressAntiFraudTip}
123 /> 129 />
124 ); 130 );
125 } 131 }