ActivityOrderDetail.js
4.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
/**活动订单详情页*/
'use strict';
import React, {Component} from 'react';
import {Dimensions, Image, StyleSheet, Text, TouchableOpacity, View} from 'react-native';
import ListView from 'deprecated-react-native-listview'
import {Immutable} from 'immutable';
export default class ActivityOrderDetail extends Component {
constructor(props) {
super(props);
// this._renderRow = this._renderRow.bind(this);
this._renderHeader = this._renderHeader.bind(this);
// this.dataSource = new ListView.DataSource({
// rowHasChanged: (r1, r2) => !Immutable.is(r1, r2),
// });
}
_renderHeader() {
let orderCodes = this.props.orderDetail.orderCodes ? this.props.orderDetail.orderCodes.toArray() : [];
let orderCodeStr = '';
orderCodes&& orderCodes.map((orderCode, itemindex) =>
orderCodeStr = orderCodeStr + orderCode + (itemindex < orderCodes.length - 1 ? '\n' : '')
)
let isNewActity = this.props.orderDetail.type === 1 ? true : false;
let activityName = '活动名称:';
let activityTime = isNewActity ? '发放时间:' : '活动时间:';
let activityPrice = isNewActity ? '收益金额:' : '佣金金额:';
let activityAuth = isNewActity ? '被邀请人:' : '订单编号:';
let numOfLines = isNewActity ? 1 : orderCodes.length;
let lastText = isNewActity ? this.props.orderDetail.nickname : orderCodeStr;
return (
<View>
<View style={styles.header}>
<Text style={[styles.headerText]}>{this.props.orderDetail.statusStr}</Text>
</View>
<View style={styles.lineView}/>
<View style={styles.content}>
<Text style={styles.contentText}>{activityName}{this.props.orderDetail.activityName}</Text>
<View style={{flexDirection: 'row',width:width, overflow:'hidden'}}>
<Text style={styles.contentText}>{activityTime}</Text>
<Text style={styles.contentText} numberOfLines={2}>{this.props.orderDetail.timeStr}</Text>
</View>
<View style={{flexDirection: 'row'}}>
<Text style={styles.contentText}>{activityPrice}</Text>
<Text style={[styles.contentText, {fontWeight: 'bold', color: '#D0021B'}]}>{this.props.orderDetail.amountStr}</Text>
</View>
<View style={{flexDirection: 'row'}}>
<Text style={styles.contentText}>{activityAuth}</Text>
<Text style={[styles.contentText, {lineHeight: 18, paddingBottom: 0}]} numberOfLines={numOfLines}>{lastText}</Text>
</View>
</View>
</View>
)
}
render() {
let {orderDetail} = this.props;
let productList = orderDetail.productList ? orderDetail.productList.toArray() : [];
return (
<View style={styles.container}>
{this._renderHeader()}
</View>
);
}
}
let {width, height} = Dimensions.get('window');
let styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#f0f0f0',
alignItems: 'center'
},
contentContainer: {
width: width,
backgroundColor: 'white'
},
header: {
width: width,
height: 50,
flexDirection: 'row',
alignItems: 'center',
backgroundColor: '#FFFFFF',
},
content: {
width: width,
// height: 180,
overflow:'hidden',
padding: 15,
backgroundColor: '#FFFFFF',
},
headerText: {
fontFamily: 'PingFang-SC-Regular',
fontSize: 17,
paddingLeft: 15,
color: '#444444',
letterSpacing: -0,
fontWeight: 'bold',
},
contentText: {
fontFamily: 'PingFang-SC-Regular',
fontSize: 14,
paddingBottom: 10,
color: '#444444',
letterSpacing: -0,
},
rowView: {
width: width,
height: 86,
flexDirection: 'row',
padding: 10,
},
picImage: {
width: 50,
height: 66,
marginLeft: 5,
},
titleText: {
flex:1,
marginLeft: 10,
fontSize: 14,
color: '#444444',
letterSpacing: -0,
lineHeight: 18,
fontFamily: 'PingFang-SC-Regular',
},
priceText: {
fontFamily: 'PingFang-SC-Regular',
fontSize: 14,
color: '#D0021B',
textAlign: 'right',
letterSpacing: -0.4,
},
numText: {
marginTop: 5,
fontSize: 12,
color: '#B0B0B0',
letterSpacing: -0.34,
textAlign: 'right',
fontFamily: 'PingFang-SC-Medium',
},
lineView: {
width: width,
height: 0.5,
backgroundColor: '#e0e0e0'
},
rightView: {
width: 95,
}
});