CustomerAddress.js 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289
  1. import React, { Component } from 'react'
  2. import {
  3. StyleSheet,
  4. View,
  5. Text,
  6. Dimensions,
  7. StatusBar,
  8. TouchableOpacity,
  9. PixelRatio,
  10. FlatList,
  11. } from 'react-native'
  12. import { connect } from 'react-redux'
  13. import Collapsible from 'react-native-collapsible'
  14. import Icon from '../../../components/Iconfont/Iconfont'
  15. import { NavigationActions, createAction } from '../../../utils'
  16. const { width, height } = Dimensions.get('window')
  17. @connect(({ theme, mine }) => ({ ...theme, ...mine }))
  18. class CustomerAddress extends Component {
  19. constructor(props) {
  20. super(props)
  21. this.state = { collapsed: 'dsadsa' }
  22. // console.disableYellowBox = true;
  23. }
  24. // 头部
  25. header() {
  26. return (
  27. <View
  28. style={{
  29. height: HEADERSTYLE.height,
  30. paddingTop: HEADERSTYLE.paddingTop + 5,
  31. backgroundColor: '#fff',
  32. borderBottomColor: '#eee',
  33. borderBottomWidth: 1 / PixelRatio.get(),
  34. }}
  35. >
  36. <View
  37. style={{
  38. flex: 1,
  39. justifyContent: 'center',
  40. }}
  41. >
  42. <TouchableOpacity
  43. style={{ position: 'absolute', left: 10, flexDirection: 'row' }}
  44. onPress={() => this.props.dispatch(NavigationActions.back())}
  45. >
  46. <Icon
  47. name="icon-icon-fanhui"
  48. size={20}
  49. color={'#666'}
  50. style={{ marginTop: 4 }}
  51. />
  52. <Text
  53. style={{
  54. fontSize: 14,
  55. lineHeight: 20,
  56. color: '#666',
  57. alignSelf: 'center',
  58. }}
  59. >
  60. 返回
  61. </Text>
  62. </TouchableOpacity>
  63. <Text
  64. style={{
  65. alignSelf: 'center',
  66. fontSize: 18,
  67. lineHeight: 25,
  68. letterSpacing: 0.19,
  69. color: '#333',
  70. }}
  71. >
  72. 客户收货地址
  73. </Text>
  74. </View>
  75. </View>
  76. )
  77. }
  78. AddressList(item) {
  79. return (
  80. <View
  81. style={{
  82. marginTop: 10,
  83. padding: 10,
  84. backgroundColor: '#FFF',
  85. }}
  86. >
  87. <View style={{ flex: 1, flexDirection: 'row' }}>
  88. <View style={{ flex: 1, paddingRight: 5 }} />
  89. <View style={{ flex: 16 }}>
  90. <Text
  91. style={{
  92. flex: 1,
  93. fontSize: 15,
  94. lineHeight: 21,
  95. color: '#333',
  96. fontWeight: '600',
  97. }}
  98. >
  99. {item.customerName}
  100. </Text>
  101. </View>
  102. </View>
  103. <View style={{ flex: 1, flexDirection: 'row', marginTop: 5 }}>
  104. <View style={{ flex: 1, paddingRight: 5 }}>
  105. <Icon
  106. name="icon-icon-dizhi"
  107. size={18}
  108. style={{ alignSelf: 'flex-end' }}
  109. />
  110. </View>
  111. <View style={{ flex: 16 }}>
  112. <Text
  113. style={{ flex: 1, fontSize: 13, lineHeight: 18, color: '#333' }}
  114. >
  115. {item.countryName +
  116. item.provinceCode +
  117. item.cityName +
  118. item.countyName +
  119. item.townName +
  120. item.detailAddr}
  121. </Text>
  122. </View>
  123. </View>
  124. <View
  125. style={{
  126. flex: 1,
  127. flexDirection: 'row',
  128. marginTop: 10,
  129. paddingLeft: 27,
  130. }}
  131. >
  132. <TouchableOpacity
  133. onPress={() =>
  134. this.state.collapsed == item.id
  135. ? this.setState({ collapsed: 'dsadsa' })
  136. : this.setState({ collapsed: item.id })
  137. }
  138. style={{ flex: 16, marginTop: 3, flexDirection: 'row' }}
  139. >
  140. <Text
  141. style={{
  142. fontSize: 13,
  143. lineHeight: 18,
  144. color: '#666',
  145. marginRight: 6,
  146. }}
  147. >
  148. 联系人一:{item.firstReceiver}
  149. </Text>
  150. <Text
  151. style={{ flex: 1, fontSize: 13, lineHeight: 18, color: '#666' }}
  152. >
  153. {item.firstReceiverPhone}
  154. </Text>
  155. <Text
  156. style={{ flex: 1, fontSize: 13, lineHeight: 18, color: '#666' }}
  157. >
  158. {item.firstReceiverTel}
  159. </Text>
  160. <Icon
  161. name="icon-icon-xiala"
  162. size={14}
  163. color={'#666'}
  164. style={{ alignSelf: 'center' }}
  165. />
  166. </TouchableOpacity>
  167. </View>
  168. <Collapsible
  169. collapsed={item.id !== this.state.collapsed}
  170. align={'center'}
  171. >
  172. <View
  173. style={{
  174. flex: 16,
  175. marginTop: 7,
  176. marginLeft: 25,
  177. flexDirection: 'row',
  178. }}
  179. >
  180. <Text
  181. style={{
  182. fontSize: 13,
  183. lineHeight: 18,
  184. color: '#666',
  185. marginRight: 6,
  186. }}
  187. >
  188. 联系人二:{item.secondReceiver}
  189. </Text>
  190. <Text
  191. style={{ flex: 1, fontSize: 13, lineHeight: 18, color: '#666' }}
  192. >
  193. {item.secondReceiverPhone}
  194. </Text>
  195. <Text
  196. style={{ flex: 1, fontSize: 13, lineHeight: 18, color: '#666' }}
  197. >
  198. {item.secondReceiverTel}
  199. </Text>
  200. </View>
  201. <View
  202. style={{
  203. flex: 16,
  204. marginTop: 7,
  205. marginLeft: 25,
  206. flexDirection: 'row',
  207. }}
  208. >
  209. <Text
  210. style={{
  211. fontSize: 13,
  212. lineHeight: 18,
  213. color: '#666',
  214. marginRight: 6,
  215. }}
  216. >
  217. 联系人三:{item.thirdReceiver}
  218. </Text>
  219. <Text
  220. style={{ flex: 1, fontSize: 13, lineHeight: 18, color: '#666' }}
  221. >
  222. {item.thirdReceiverPhone}
  223. </Text>
  224. <Text
  225. style={{ flex: 1, fontSize: 13, lineHeight: 18, color: '#666' }}
  226. >
  227. {item.thirdReceiverTel}
  228. </Text>
  229. </View>
  230. </Collapsible>
  231. </View>
  232. )
  233. }
  234. render() {
  235. const { appTheme, AddressInfo } = this.props
  236. return (
  237. <View
  238. style={[
  239. styles.container,
  240. { backgroundColor: appTheme.backgroundColor },
  241. ]}
  242. >
  243. <StatusBar
  244. animated={true}
  245. barStyle={appTheme.barStyle}
  246. // barStyle={"dark-content"}
  247. backgroundColor={'transparent'}
  248. translucent={true}
  249. />
  250. {this.header()}
  251. <FlatList
  252. extraData={this.state.collapsed}
  253. keyExtractor={(item, index) => index}
  254. data={AddressInfo}
  255. renderItem={({ item, index }) => this.AddressList(item, index)}
  256. // legacyImplementation={true}
  257. />
  258. </View>
  259. )
  260. }
  261. }
  262. const styles = StyleSheet.create({
  263. container: {
  264. flex: 1,
  265. },
  266. pngstyle: {
  267. width: width,
  268. },
  269. buttonStyle: {
  270. backgroundColor: 'transparent',
  271. flexDirection: 'column',
  272. alignItems: 'center',
  273. },
  274. buttonText: {
  275. marginTop: 9,
  276. fontSize: 14,
  277. color: '#FFF',
  278. },
  279. })
  280. export default CustomerAddress