CustomerContact.js 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285
  1. import React, { Component } from 'react'
  2. import {
  3. StyleSheet,
  4. View,
  5. Text,
  6. StatusBar,
  7. TouchableOpacity,
  8. PixelRatio,
  9. FlatList,
  10. } from 'react-native'
  11. import { connect } from 'react-redux'
  12. import Icon from '../../../components/Iconfont/Iconfont'
  13. import { NavigationActions, createAction } from '../../../utils'
  14. import Collapsible from 'react-native-collapsible'
  15. import * as Animatable from 'react-native-animatable'
  16. @connect(({ theme, mine }) => ({ ...theme, ...mine }))
  17. class CustomerContact extends Component {
  18. constructor(props) {
  19. super(props)
  20. this.state = {
  21. collapsed: 'dsadsa',
  22. }
  23. // console.disableYellowBox = true;
  24. }
  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. contactList(item, key) {
  80. return (
  81. <View>
  82. <TouchableOpacity
  83. onPress={() =>
  84. this.state.collapsed == item.id
  85. ? this.setState({ collapsed: 'dsadsa' })
  86. : this.setState({ collapsed: item.id })
  87. }
  88. style={{
  89. padding: 10,
  90. backgroundColor: '#FFF',
  91. flexDirection: 'row',
  92. }}
  93. >
  94. <View
  95. style={{
  96. width: 40,
  97. height: 40,
  98. borderRadius: 20,
  99. backgroundColor: '#F0C47C',
  100. justifyContent: 'center',
  101. }}
  102. >
  103. <Text
  104. style={{
  105. fontSize: 18,
  106. lineHeight: 25,
  107. color: '#FFF',
  108. alignSelf: 'center',
  109. }}
  110. >
  111. {item.name && item.name.slice(0, 1)}
  112. </Text>
  113. </View>
  114. <View style={{ marginLeft: 20, justifyContent: 'center' }}>
  115. <View style={{ flexDirection: 'row', marginBottom: 3 }}>
  116. <Text style={{ fontSize: 15, lineHeight: 21, color: '#333' }}>
  117. {item.name}
  118. </Text>
  119. <Text
  120. style={{
  121. fontSize: 14,
  122. lineHeight: 20,
  123. color: '#333',
  124. marginLeft: 20,
  125. }}
  126. >
  127. {item.phone}
  128. </Text>
  129. </View>
  130. <Text style={{ fontSize: 12, lineHeight: 17, color: '#999' }}>
  131. {item.contactTypeName}
  132. </Text>
  133. </View>
  134. </TouchableOpacity>
  135. <Collapsible
  136. collapsed={item.id !== this.state.collapsed}
  137. align={'center'}
  138. >
  139. {/* 阴影效果 -----*/}
  140. <View
  141. style={{
  142. height: 1 / PixelRatio.get(),
  143. backgroundColor: '#e8e5de',
  144. }}
  145. />
  146. <View
  147. style={{
  148. height: 1 / PixelRatio.get(),
  149. backgroundColor: '#eae7e0',
  150. }}
  151. />
  152. <View
  153. style={{
  154. height: 1 / PixelRatio.get(),
  155. backgroundColor: '#edeae2',
  156. }}
  157. />
  158. <View
  159. style={{
  160. height: 1 / PixelRatio.get(),
  161. backgroundColor: '#efece4',
  162. }}
  163. />
  164. <View
  165. style={{
  166. height: 1 / PixelRatio.get(),
  167. backgroundColor: '#f2efe7',
  168. }}
  169. />
  170. <View
  171. style={{
  172. height: 1 / PixelRatio.get(),
  173. backgroundColor: '#f7f4ec',
  174. }}
  175. />
  176. <View
  177. style={{
  178. height: 1 / PixelRatio.get(),
  179. backgroundColor: '#faf7ef',
  180. }}
  181. />
  182. <View
  183. style={{
  184. height: 1 / PixelRatio.get(),
  185. backgroundColor: '#fcf9f1',
  186. }}
  187. />
  188. <View
  189. style={{
  190. height: 1 / PixelRatio.get(),
  191. backgroundColor: '#fdfaf2',
  192. }}
  193. />
  194. {/* 阴影效果 ^^^^ */}
  195. <Animatable.View
  196. duration={300}
  197. transition="backgroundColor"
  198. style={{
  199. marginHorizontal: 10,
  200. marginBottom: 10,
  201. padding: 10,
  202. backgroundColor: '#FFFBF2',
  203. }}
  204. >
  205. <Animatable.Text
  206. duration={300}
  207. easing="ease-out"
  208. animation={'zoomIn'}
  209. style={{ fontSize: 13, lineHeight: 22, color: '#666' }}
  210. >
  211. 电话:{item.tel}
  212. </Animatable.Text>
  213. <Animatable.Text
  214. duration={300}
  215. easing="ease-out"
  216. animation={'zoomIn'}
  217. style={{ fontSize: 13, lineHeight: 22, color: '#666' }}
  218. >
  219. 传真:{item.fax}
  220. </Animatable.Text>
  221. <Animatable.Text
  222. duration={300}
  223. easing="ease-out"
  224. animation={'zoomIn'}
  225. style={{ fontSize: 13, lineHeight: 22, color: '#666' }}
  226. >
  227. 邮箱:{item.email}
  228. </Animatable.Text>
  229. <Animatable.Text
  230. duration={300}
  231. easing="ease-out"
  232. animation={'zoomIn'}
  233. style={{ fontSize: 13, lineHeight: 22, color: '#666' }}
  234. >
  235. 地址:{item.address}
  236. </Animatable.Text>
  237. </Animatable.View>
  238. </Collapsible>
  239. </View>
  240. )
  241. }
  242. render() {
  243. const { appTheme, ContactInfo } = this.props
  244. return (
  245. <View
  246. style={[
  247. styles.container,
  248. { backgroundColor: appTheme.backgroundColor },
  249. ]}
  250. >
  251. <StatusBar
  252. animated={true}
  253. barStyle={appTheme.barStyle}
  254. // barStyle={"dark-content"}
  255. backgroundColor={'transparent'}
  256. translucent={true}
  257. />
  258. {this.header()}
  259. <FlatList
  260. keyExtractor={(item, index) => item.id + index}
  261. ItemSeparatorComponent={() => (
  262. <View style={{ height: 1, backgroundColor: '#EEE' }} />
  263. )}
  264. data={ContactInfo}
  265. renderItem={({ item, index }) => this.contactList(item, index)}
  266. // legacyImplementation={true}
  267. />
  268. </View>
  269. )
  270. }
  271. }
  272. const styles = StyleSheet.create({
  273. container: {
  274. flex: 1,
  275. },
  276. })
  277. export default CustomerContact