import React, { Component } from 'react'
import {
StyleSheet,
View,
Image,
StatusBar,
Text,
TouchableOpacity,
PixelRatio,
ScrollView,
FlatList,
ActivityIndicator,
} from 'react-native'
import { connect } from 'react-redux'
import png from '../../../../static/images/defaultimg.jpg'
import Icon from '../../../../components/Iconfont/Iconfont'
import { NavigationActions } from '../../../../utils'
import { ReturnDate } from '../../../../utils/utils'
import * as authService from '../../../../services/auth'
@connect(({ theme, ordersign }) => ({ ...theme, ...ordersign }))
class DeliveryDetail extends Component {
constructor() {
super()
this.state = { activeSection: 'suibianxie', SubmitLoad: false }
}
_toggle(key) {
if (this.state.activeSection == key) {
this.setState({ activeSection: key + 'asd' })
} else {
this.setState({ activeSection: key })
}
}
async confirmSign(data) {
this.setState({ SubmitLoad: true })
data.saleOutOrderItemInfoDtos.map(item => {
item.signNum = item.mainNum
item.persistStatus = 'upd'
})
const result = await authService
.confirmSign(data.pkOrgId, data.saleOutOrderItemInfoDtos)
.catch(err => console.log(err.response.data.message))
if (result && result.status == '200') {
this.props.dispatch(NavigationActions.back())
this.props.navigation.state.params()
}
this.setState({ SubmitLoad: false })
}
renderItem(item, index) {
return (
{item.goodsDisplayName}
产品编码:{item.goodsCode}
this._toggle(index)}
style={{
flexDirection: 'row',
justifyContent: 'space-between',
}}
>
订单编号:{item.reqOrderCodes}
{/* 下拉 */}
{/*
{item.b.map((orderItem, key) =>
this.orderIdRender(orderItem, key, item.b.length)
)}
*/}
发货数量:{item.shouldAssistNum}
签收数量:
{item.assistNum}
)
}
orderIdRender(data, index, datalength) {
return (
订单编号:
{data}
)
}
render() {
const { appTheme, signDetailData } = this.props
return (
{/* 头部 */}
this.props.dispatch(NavigationActions.back())}
>
返回
发货签收详情
{/* {}}
>
复制
*/}
{/* 单号行 */}
发货单号:
{signDetailData.billCode}
{ReturnDate(signDetailData.billDate)}
item.id}
data={signDetailData.saleOutOrderItemInfoDtos}
extraData={this.state}
renderItem={({ item, index }) => this.renderItem(item, index)}
/>
{/* {data.map((sect, key) => this.renderItem(sect, key))} */}
签收日期:{signDetailData.signTime
? ReturnDate(signDetailData.signTime, true)
: ''}
签收人:{signDetailData.siger}
{!this.state.SubmitLoad ? (
this.confirmSign(signDetailData)}
style={{
width: 120,
backgroundColor: '#E14C46',
justifyContent: 'center',
}}
>
确认签收
) : (
)}
)
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
},
text333: {
fontSize: 12,
lineHeight: 17,
color: '#333',
},
text666: {
fontSize: 12,
lineHeight: 17,
color: '#666',
},
text999: {
fontSize: 12,
lineHeight: 17,
color: '#999',
},
})
export default DeliveryDetail