Authored by 盖剑秋

Finish delivery info cell for order detail. reviewed by redding.

@@ -15,6 +15,7 @@ import MultiPackageCell from './MultiPackageCell' @@ -15,6 +15,7 @@ import MultiPackageCell from './MultiPackageCell'
15 import YohoGiveCoinCell from './YohoGiveCoinCell' 15 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 19
19 import ReactNative, { 20 import ReactNative, {
20 View, 21 View,
@@ -49,6 +50,9 @@ export default class Detail extends Component { @@ -49,6 +50,9 @@ export default class Detail extends Component {
49 case 'orderHistory': 50 case 'orderHistory':
50 return (<OrderHistoryCell data={rowData}/>); 51 return (<OrderHistoryCell data={rowData}/>);
51 break; 52 break;
  53 + case 'deliveryOffline':
  54 + return (<DistributionInfoCell/>);
  55 + break;
52 case 'express': 56 case 'express':
53 return (<ExpressCell data={rowData} onPressExpress={() => { 57 return (<ExpressCell data={rowData} onPressExpress={() => {
54 let {order_code, firstProductSKN, expressType} = this.props.resource; 58 let {order_code, firstProductSKN, expressType} = this.props.resource;
@@ -122,13 +126,19 @@ export default class Detail extends Component { @@ -122,13 +126,19 @@ export default class Detail extends Component {
122 } else if (expressType == 0 && data) { //OrderDetailExpressTypeOnRecive 126 } else if (expressType == 0 && data) { //OrderDetailExpressTypeOnRecive
123 expressBlob = [accept_address, acceptTime]; 127 expressBlob = [accept_address, acceptTime];
124 } 128 }
  129 + let is_delivery_offline = 'N';
  130 + if (data) {
  131 + is_delivery_offline = data.get('let is_delivery_offline');
  132 + }
  133 + let showDeliveryOffline = is_delivery_offline && is_delivery_offline == 'Y';
125 134
126 let orderInfoBlob = { 135 let orderInfoBlob = {
127 orderCode: order_code, 136 orderCode: order_code,
128 orderStatus: data && data.get('status_str'), 137 orderStatus: data && data.get('status_str'),
129 orderTime: data && data.get('create_time'), 138 orderTime: data && data.get('create_time'),
130 payWay: data && data.get('payment_name'), 139 payWay: data && data.get('payment_name'),
131 - expressExisted: expressBlob 140 + expressExisted: expressBlob,
  141 + showDeliveryOffline,
132 } 142 }
133 143
134 let paymentInfoBlob = { 144 let paymentInfoBlob = {
@@ -184,6 +194,9 @@ export default class Detail extends Component { @@ -184,6 +194,9 @@ export default class Detail extends Component {
184 'orderHistory': isPresaleOrder 194 'orderHistory': isPresaleOrder
185 ? [orderHistoryBlob] 195 ? [orderHistoryBlob]
186 : [], 196 : [],
  197 + 'deliveryOffline': showDeliveryOffline
  198 + ?[1]
  199 + :[],
187 'express': expressBlob 200 'express': expressBlob
188 ? [expressBlob] 201 ? [expressBlob]
189 : [], 202 : [],
  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 DistributionInfoCell extends Component {
  19 +
  20 + constructor(props) {
  21 + super(props);
  22 + }
  23 +
  24 + render() {
  25 + return (
  26 + <View style={[styles.container, containerSeparator]}>
  27 + <View style={styles.leftPart}>
  28 + <Image style={{
  29 + width: 22,
  30 + height: 22
  31 + }} source={require('../../image/xxd_ic.png')}/>
  32 + </View>
  33 + <View style={[styles.rightPart, rightSeparator]}>
  34 + <View style={styles.topPart}>
  35 + <Text style={styles.codeText}>订单编号:{orderCode}</Text>
  36 + </View>
  37 + <Text style={styles.otherText}>配送方式:门店取货</Text>
  38 + </View>
  39 + </View>
  40 + );
  41 + }
  42 +}
  43 +
  44 +let {width, height} = Dimensions.get('window');
  45 +
  46 +let styles = StyleSheet.create({
  47 + container: {
  48 + width: width,
  49 + flexDirection: 'row',
  50 + backgroundColor: 'white',
  51 + borderColor: '#f0f0f0',
  52 + borderBottomWidth: 10
  53 + },
  54 +
  55 + topPart: {
  56 + width: width - 45,
  57 + height: 20,
  58 + flexDirection: 'row',
  59 + alignItems: 'center',
  60 + marginTop: 13,
  61 + marginBottom: 2
  62 + },
  63 +
  64 + codeText: {
  65 + fontSize: 14,
  66 + marginBottom: 0,
  67 + color: '#444444'
  68 + },
  69 +
  70 + copyButton: {
  71 + marginLeft: 10,
  72 + width: 44,
  73 + height: 18,
  74 + borderColor: '#444444',
  75 + borderWidth: 1,
  76 + justifyContent: 'center',
  77 + alignItems: 'center'
  78 + },
  79 +
  80 + leftPart: {
  81 + width: 45,
  82 + justifyContent: 'center',
  83 + alignItems: 'center'
  84 + },
  85 +
  86 + rightPart: {
  87 + width: width - 45,
  88 + flexDirection: 'column',
  89 + borderColor: '#ededed',
  90 + paddingBottom: 10
  91 + },
  92 +
  93 + otherText: {
  94 + fontSize: 12,
  95 + marginBottom: 3,
  96 + color: '#b0b0b0'
  97 + }
  98 +});
@@ -22,9 +22,9 @@ export default class OrderInfoCell extends Component { @@ -22,9 +22,9 @@ export default class OrderInfoCell extends Component {
22 } 22 }
23 23
24 render() { 24 render() {
25 - let {orderCode, orderStatus, orderTime, payWay, expressExisted} = this.props.data;  
26 - let containerSeparator = expressExisted? {borderBottomWidth:0}:{};  
27 - let rightSeparator = expressExisted?{borderBottomWidth:0.5}:{}; 25 + let {orderCode, orderStatus, orderTime, payWay, expressExisted, showDeliveryOffline} = this.props.data;
  26 + let containerSeparator = expressExisted || showDeliveryOffline ? {borderBottomWidth:0}:{};
  27 + let rightSeparator = expressExisted || showDeliveryOffline ?{borderBottomWidth:0.5}:{};
28 let timeInt = parseInt(orderTime) * 1000; 28 let timeInt = parseInt(orderTime) * 1000;
29 let date = new Date(timeInt); 29 let date = new Date(timeInt);
30 let timeStr = date.getFullYear() + '.' + ((date.getMonth() + 1) > 9 30 let timeStr = date.getFullYear() + '.' + ((date.getMonth() + 1) > 9