import React, {Component} from 'react';
import {
View,
Text,
StyleSheet,
ScrollView,
TouchableOpacity,
Dimensions, DeviceEventEmitter,
} from 'react-native';
import {Tabs, Provider, Button, List} from '@ant-design/react-native';
import {createAction} from '../../utils';
import {connect} from 'react-redux';
import CallPhone from '../../components/CallPhone';
import ComponentsStyles from '../../components/ComponentsStyles';
import RefreshFlatList from 'react-native-refresh-flatlist';
const tabs = [
{title: '基本信息', id: 1},
{title: '进度明细', id: 2},
];
const {width} = Dimensions.get('window');
@connect(customer => ({...customer}))
class ProcessDetail extends Component {
// 潜客跟踪
constructor(props) {
super(props);
this.state = {
page: 1,
rows: 10,
order_id: this.props.navigation.state.params.order_id,
source: this.props.navigation.state.params.source,
};
};
componentDidMount() {
this._fetchProcessReoprt();
this._fetchData();
this.refeshProcess = DeviceEventEmitter.addListener('refeshProcess', (param) => {
this._fetchProcessReoprt(1);
});
this.refeshProcessDetail = DeviceEventEmitter.addListener('refeshProcessDetail', (param) => {
this._fetchData();
});
}
componentWillUnmount() {
this.refeshProcess.remove();
this.refeshProcessDetail.remove();
}
_fetchData = () => {
this.props.dispatch({
type: 'customer/fetchProcessDetail',
payload: {id: this.state.order_id},
});
};
_fetchMore = () => {
const {page, totalRecord} = this.props.customer;
if (page * this.state.rows >= totalRecord) {
return;
}
const currentPage = page + 1;
this._fetchProcessReoprt(currentPage);
};
_keyExtractor = (item, index) => {
return index.toString();
};
_fetchProcessReoprt = (page) => {
if (page) {
this.state.page = page;
}
this.props.dispatch(createAction('customer/fetchProcessRecord')(this.state));
};
baseInfo = (ProcessDetailData) => {
return
{ProcessDetailData.name}} arrow="empty">
单号
{ProcessDetailData.no}} arrow="empty">
姓名
电话
{'\ue61a'}
CallPhone(ProcessDetailData.tel, 1)}>
{ProcessDetailData.tel}
{ProcessDetailData.address}}
wrap
multipleLine arrow="empty">
地址
{ProcessDetailData.village}}
wrap
multipleLine arrow="empty">
小区
{ProcessDetailData.project_text}}
arrow="empty">
项目
{ProcessDetailData.status_text}}
arrow="empty">
订单状态
{ProcessDetailData.stage_progress_text}}
arrow="empty">
阶段进度
{ProcessDetailData.service_user_text}}
arrow="empty">
当前服务人员
{ProcessDetailData.create_time_f}}
arrow="empty">
下单时间
;
};
gotoImage = (id, has_img) => {
if (has_img) {
this.props.navigation.navigate('BrowseImage',
{
id: id,
},
);
}
};
renderItem = (data) => {
const item = data.item;
return this.gotoImage(item.id, item.has_img)}
style={styles.reportMain}>
{'\ue619'} {item.user_text}
{'\ue6cc'}
{item.operation_time_f}
{'\ue6ed'}
{item.operation}
{item.has_img &&
{'\ue61b'}
}
{'\ue605'}
{item.notes}
;
};
render() {
const {processRecordData, processRecordRState, processDetail} = this.props.customer;
return (
{/*基本信息*/}
{this.baseInfo(processDetail)}
{/* 跟踪记录*/}
this.renderItem(item)}
keyExtractor={this._keyExtractor}
themeColor="#5eafe4"
refreshState={processRecordRState}
footerRefreshingText="正在加载"
footerFailureText="加载失败"
onHeaderRefresh={() => this._fetchProcessReoprt(1)}
onFooterRefresh={() => this._fetchMore()}
ListHeaderComponent={() => }
ItemSeparatorComponent={() => }
/>
{this.state.source === 1 ?
:
}
);
}
}
const styles = StyleSheet.create({
descView: {
marginHorizontal: 15,
paddingVertical: 2,
borderBottomWidth: 1,
borderBottomColor: '#eee',
},
descText: {
color: '#928f8f',
paddingVertical: 2,
},
telItemView: {
flex: 1,
flexDirection: 'row',
marginLeft: 15,
paddingRight: 18,
paddingVertical: 8,
borderBottomWidth: 0.5,
borderBottomColor: '#eaeaea',
},
telName: {
color: '#333',
fontSize: 18,
},
telView: {
flex: 1,
flexDirection: 'row',
justifyContent: 'flex-end',
alignItems: 'center',
},
telText: {
color: '#2b90ea',
fontSize: 15,
},
listStyle: {
// borderBottomWidth: 10,
borderBottomColor: '#f6f7f8',
},
reportMain: {
marginTop: 5,
backgroundColor: '#fff',
paddingHorizontal: 10,
// borderWidth:1,
},
customerText: {
color: '#333',
fontSize: 16,
},
row5: {
flexDirection: 'row',
paddingVertical: 3,
},
red5: {
fontSize: 15,
color: 'red',
padding: 2,
},
});
export default ProcessDetail;