DeliveryDetail.js 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350
  1. import React, { Component } from 'react'
  2. import {
  3. StyleSheet,
  4. View,
  5. Image,
  6. StatusBar,
  7. Text,
  8. TouchableOpacity,
  9. PixelRatio,
  10. ScrollView,
  11. FlatList,
  12. ActivityIndicator,
  13. } from 'react-native'
  14. import { connect } from 'react-redux'
  15. import png from '../../../../static/images/defaultimg.jpg'
  16. import Icon from '../../../../components/Iconfont/Iconfont'
  17. import { NavigationActions } from '../../../../utils'
  18. import { ReturnDate } from '../../../../utils/utils'
  19. import * as authService from '../../../../services/auth'
  20. @connect(({ theme, ordersign }) => ({ ...theme, ...ordersign }))
  21. class DeliveryDetail extends Component {
  22. constructor() {
  23. super()
  24. this.state = { activeSection: 'suibianxie', SubmitLoad: false }
  25. }
  26. _toggle(key) {
  27. if (this.state.activeSection == key) {
  28. this.setState({ activeSection: key + 'asd' })
  29. } else {
  30. this.setState({ activeSection: key })
  31. }
  32. }
  33. async confirmSign(data) {
  34. this.setState({ SubmitLoad: true })
  35. data.saleOutOrderItemInfoDtos.map(item => {
  36. item.signNum = item.mainNum
  37. item.persistStatus = 'upd'
  38. })
  39. const result = await authService
  40. .confirmSign(data.pkOrgId, data.saleOutOrderItemInfoDtos)
  41. .catch(err => console.log(err.response.data.message))
  42. if (result && result.status == '200') {
  43. this.props.dispatch(NavigationActions.back())
  44. this.props.navigation.state.params()
  45. }
  46. this.setState({ SubmitLoad: false })
  47. }
  48. renderItem(item, index) {
  49. return (
  50. <View key={index} style={{ backgroundColor: '#FFF' }}>
  51. <View style={{ padding: 10 }}>
  52. <View
  53. style={{
  54. flexDirection: 'row',
  55. paddingBottom: 10,
  56. borderBottomColor: '#EEE',
  57. borderBottomWidth: 1,
  58. }}
  59. >
  60. <Image source={png} style={{ width: 80, height: 80 }} />
  61. <View style={{ flex: 1, marginLeft: 10 }}>
  62. <Text
  63. numberOfLines={2}
  64. style={{
  65. marginTop: 4,
  66. fontSize: 13,
  67. lineHeight: 18,
  68. color: '#333',
  69. }}
  70. >
  71. {item.goodsDisplayName}
  72. </Text>
  73. <Text
  74. numberOfLines={1}
  75. style={{
  76. marginTop: 4,
  77. fontSize: 12,
  78. lineHeight: 17,
  79. color: '#666',
  80. }}
  81. >
  82. 产品编码:{item.goodsCode}
  83. </Text>
  84. <TouchableOpacity
  85. activeOpacity={1}
  86. // onPress={() => this._toggle(index)}
  87. style={{
  88. flexDirection: 'row',
  89. justifyContent: 'space-between',
  90. }}
  91. >
  92. <Text
  93. numberOfLines={1}
  94. style={{ fontSize: 12, lineHeight: 17, color: '#666' }}
  95. >
  96. 订单编号:{item.reqOrderCodes}
  97. </Text>
  98. <Icon name="icon-icon-xiala" size={18} color={'#999'} />
  99. </TouchableOpacity>
  100. {/* 下拉 */}
  101. {/* <Collapsible collapsed={this.state.activeSection !== index}>
  102. {item.b.map((orderItem, key) =>
  103. this.orderIdRender(orderItem, key, item.b.length)
  104. )}
  105. </Collapsible> */}
  106. </View>
  107. </View>
  108. </View>
  109. <View
  110. style={{
  111. paddingHorizontal: 10,
  112. paddingBottom: 10,
  113. flexDirection: 'row',
  114. justifyContent: 'space-between',
  115. borderBottomColor: '#EEE',
  116. borderBottomWidth: 1,
  117. }}
  118. >
  119. <Text style={[styles.text333, { alignSelf: 'center' }]}>
  120. 发货数量:{item.shouldAssistNum}
  121. </Text>
  122. <View
  123. style={{
  124. flexDirection: 'row',
  125. alignSelf: 'center',
  126. paddingRight: 10,
  127. }}
  128. >
  129. <Text style={[styles.text333, { alignSelf: 'center' }]}>
  130. 签收数量:
  131. </Text>
  132. <Text style={styles.text333}>{item.assistNum}</Text>
  133. </View>
  134. </View>
  135. </View>
  136. )
  137. }
  138. orderIdRender(data, index, datalength) {
  139. return (
  140. <View key={index} style={{ marginBottom: 4 }}>
  141. <Text
  142. numberOfLines={1}
  143. style={{ fontSize: 12, lineHeight: 17, color: '#999' }}
  144. >
  145. <Text style={{ color: 'transparent' }}>订单编号:</Text>
  146. {data}
  147. </Text>
  148. </View>
  149. )
  150. }
  151. render() {
  152. const { appTheme, signDetailData } = this.props
  153. return (
  154. <View
  155. style={[
  156. styles.container,
  157. { backgroundColor: appTheme.backgroundColor },
  158. ]}
  159. >
  160. <StatusBar
  161. animated={true}
  162. barStyle={appTheme.barStyle}
  163. // barStyle={"dark-content"}
  164. backgroundColor={'transparent'}
  165. translucent={true}
  166. />
  167. {/* 头部 */}
  168. <View
  169. style={{
  170. height: HEADERSTYLE.height,
  171. paddingTop: HEADERSTYLE.paddingTop + 5,
  172. backgroundColor: '#fff',
  173. borderBottomColor: '#eee',
  174. borderBottomWidth: 1 / PixelRatio.get(),
  175. }}
  176. >
  177. <View
  178. style={{
  179. flex: 1,
  180. justifyContent: 'center',
  181. }}
  182. >
  183. <TouchableOpacity
  184. style={{ position: 'absolute', left: 10, flexDirection: 'row' }}
  185. onPress={() => this.props.dispatch(NavigationActions.back())}
  186. >
  187. <Icon
  188. name="icon-icon-fanhui"
  189. size={20}
  190. color={'#666'}
  191. style={{ marginTop: 4 }}
  192. />
  193. <Text
  194. style={{
  195. fontSize: 14,
  196. lineHeight: 20,
  197. color: '#666',
  198. alignSelf: 'center',
  199. }}
  200. >
  201. 返回
  202. </Text>
  203. </TouchableOpacity>
  204. <Text
  205. style={{
  206. alignSelf: 'center',
  207. fontSize: 18,
  208. lineHeight: 25,
  209. letterSpacing: 0.19,
  210. color: '#333',
  211. }}
  212. >
  213. 发货签收详情
  214. </Text>
  215. {/* <TouchableOpacity
  216. style={{ position: "absolute", right: 10 }}
  217. onPress={() => {}}
  218. >
  219. <Text
  220. style={{
  221. fontSize: 12,
  222. lineHeight: 14,
  223. letterSpacing: 0.14,
  224. color: "#666"
  225. }}
  226. >
  227. 复制
  228. </Text>
  229. </TouchableOpacity> */}
  230. </View>
  231. </View>
  232. {/* 单号行 */}
  233. <View
  234. style={{
  235. height: 30,
  236. backgroundColor: '#FFF',
  237. flexDirection: 'row',
  238. justifyContent: 'space-between',
  239. paddingHorizontal: 10,
  240. }}
  241. >
  242. <View style={{ justifyContent: 'center' }}>
  243. <Text style={styles.text666}>
  244. 发货单号:<Text style={styles.text666}>
  245. {signDetailData.billCode}
  246. </Text>
  247. </Text>
  248. </View>
  249. <View />
  250. <Text style={[styles.text666, { alignSelf: 'center' }]}>
  251. {ReturnDate(signDetailData.billDate)}
  252. </Text>
  253. </View>
  254. <ScrollView
  255. style={{
  256. flex: 1,
  257. marginTop: 10,
  258. }}
  259. >
  260. <FlatList
  261. keyExtractor={item => item.id}
  262. data={signDetailData.saleOutOrderItemInfoDtos}
  263. extraData={this.state}
  264. renderItem={({ item, index }) => this.renderItem(item, index)}
  265. />
  266. {/* {data.map((sect, key) => this.renderItem(sect, key))} */}
  267. </ScrollView>
  268. <View
  269. style={{
  270. height: 45,
  271. backgroundColor: '#FFF',
  272. flexDirection: 'row',
  273. justifyContent: 'space-between',
  274. }}
  275. >
  276. <View style={{ paddingLeft: 10, alignSelf: 'center' }}>
  277. <Text style={styles.text999}>
  278. 签收日期:{signDetailData.signTime
  279. ? ReturnDate(signDetailData.signTime, true)
  280. : ''}
  281. </Text>
  282. <Text style={styles.text999}>签收人:{signDetailData.siger}</Text>
  283. </View>
  284. {!this.state.SubmitLoad ? (
  285. <TouchableOpacity
  286. onPress={() => this.confirmSign(signDetailData)}
  287. style={{
  288. width: 120,
  289. backgroundColor: '#E14C46',
  290. justifyContent: 'center',
  291. }}
  292. >
  293. <Text
  294. style={{
  295. fontSize: 14,
  296. lineHeight: 20,
  297. color: '#FFF',
  298. alignSelf: 'center',
  299. }}
  300. >
  301. 确认签收
  302. </Text>
  303. </TouchableOpacity>
  304. ) : (
  305. <View
  306. style={{
  307. width: 120,
  308. backgroundColor: '#E14C46',
  309. justifyContent: 'center',
  310. }}
  311. >
  312. <ActivityIndicator />
  313. </View>
  314. )}
  315. </View>
  316. </View>
  317. )
  318. }
  319. }
  320. const styles = StyleSheet.create({
  321. container: {
  322. flex: 1,
  323. },
  324. text333: {
  325. fontSize: 12,
  326. lineHeight: 17,
  327. color: '#333',
  328. },
  329. text666: {
  330. fontSize: 12,
  331. lineHeight: 17,
  332. color: '#666',
  333. },
  334. text999: {
  335. fontSize: 12,
  336. lineHeight: 17,
  337. color: '#999',
  338. },
  339. })
  340. export default DeliveryDetail