DeliveryDetail.js 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  1. import React, { Component } from 'react'
  2. import {
  3. StyleSheet,
  4. View,
  5. Image,
  6. StatusBar,
  7. Dimensions,
  8. PixelRatio,
  9. TouchableOpacity,
  10. Text,
  11. FlatList,
  12. ScrollView,
  13. } from 'react-native'
  14. import { connect } from 'react-redux'
  15. import StatusBacg from '../../static/images/Order-status.png'
  16. import LogPng from '../../static/images/LogPng.png'
  17. import Icon from '../../components/Iconfont/Iconfont'
  18. import { NavigationActions, createAction } from '../../utils'
  19. import { ScaleUtil, ReturnDate } from '../../utils/utils'
  20. import redblue from '../../static/images/ic-redblue.png'
  21. import { ImageBaseUrl } from '../../utils/fetch/Fetchx'
  22. const { width, height } = Dimensions.get('window')
  23. @connect(({ theme }) => ({ ...theme }))
  24. class DeliveryDetail extends Component {
  25. // 头部
  26. header() {
  27. return (
  28. <View
  29. style={{
  30. height: HEADERSTYLE.height,
  31. paddingTop: HEADERSTYLE.paddingTop + 5,
  32. backgroundColor: '#fff',
  33. borderBottomColor: '#eee',
  34. borderBottomWidth: 1 / PixelRatio.get(),
  35. }}
  36. >
  37. <View
  38. style={{
  39. flex: 1,
  40. justifyContent: 'center',
  41. }}
  42. >
  43. <TouchableOpacity
  44. style={{ position: 'absolute', left: 10, flexDirection: 'row' }}
  45. onPress={() => this.props.dispatch(NavigationActions.back())}
  46. >
  47. <Icon
  48. name="icon-icon-fanhui"
  49. size={20}
  50. color={'#666'}
  51. style={{ marginTop: 4 }}
  52. />
  53. <Text
  54. style={{
  55. fontSize: 14,
  56. lineHeight: 20,
  57. color: '#666',
  58. alignSelf: 'center',
  59. }}
  60. >
  61. 返回
  62. </Text>
  63. </TouchableOpacity>
  64. <Text
  65. style={{
  66. alignSelf: 'center',
  67. fontSize: 18,
  68. lineHeight: 25,
  69. letterSpacing: 0.19,
  70. color: '#333',
  71. }}
  72. >
  73. 操作日志
  74. </Text>
  75. </View>
  76. </View>
  77. )
  78. }
  79. logInfo(item, index, maxlen) {
  80. return (
  81. <View
  82. style={{
  83. height: 60,
  84. paddingVertical: 10,
  85. marginLeft: 10,
  86. borderBottomColor: '#CCC',
  87. borderBottomWidth: maxlen == index ? 0 : 1 / PixelRatio.get(),
  88. }}
  89. >
  90. <Text
  91. style={{
  92. fontSize: 13,
  93. lineHeight: 18,
  94. color: '#333',
  95. marginBottom: 4,
  96. }}
  97. >
  98. {item.orderDescription}
  99. </Text>
  100. <Text
  101. style={{
  102. fontSize: 12,
  103. lineHeight: 17,
  104. color: '#666',
  105. }}
  106. >
  107. {ReturnDate(item.creationTime)}
  108. </Text>
  109. </View>
  110. )
  111. }
  112. render() {
  113. // const { appTheme } = this.props;
  114. const { logData } = this.props.navigation.state.params
  115. return (
  116. <View
  117. style={[
  118. styles.container,
  119. { backgroundColor: '#FFF' },
  120. // { backgroundColor: appTheme.backgroundColor }
  121. ]}
  122. >
  123. {this.header()}
  124. <View style={{ height: 10, backgroundColor: '#F7F7F7' }} />
  125. <View
  126. style={{
  127. backgroundColor: '#FFF',
  128. paddingVertical: 15,
  129. paddingLeft: 10,
  130. flexDirection: 'row',
  131. }}
  132. >
  133. <View style={{ width: 35, paddingTop: 10 }}>
  134. <Image
  135. source={LogPng}
  136. style={{ width: 20, height: 20, alignSelf: 'center' }}
  137. />
  138. <View
  139. style={{
  140. width: 1,
  141. backgroundColor: '#DDD',
  142. flex: 1,
  143. alignSelf: 'center',
  144. }}
  145. />
  146. {logData.map((item, index) => {
  147. if (index != 0) {
  148. return (
  149. <View
  150. key={index}
  151. style={{
  152. width: 6,
  153. height: 6,
  154. position: 'absolute',
  155. alignSelf: 'center',
  156. marginTop: 17,
  157. top: 60 * index,
  158. backgroundColor: '#CCC',
  159. borderRadius: 6,
  160. }}
  161. />
  162. )
  163. }
  164. })}
  165. </View>
  166. <FlatList
  167. keyExtractor={(item, index) => index}
  168. data={logData}
  169. style={{ flex: 1 }}
  170. extraData={this.state}
  171. renderItem={({ item, index }) =>
  172. this.logInfo(item, index, logData.length - 1)
  173. }
  174. />
  175. </View>
  176. </View>
  177. )
  178. }
  179. }
  180. const styles = StyleSheet.create({
  181. container: {
  182. flex: 1,
  183. },
  184. })
  185. export default DeliveryDetail