123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277 |
- import React, {Component} from 'react';
- import {
- StyleSheet,
- View,
- Text,
- StatusBar,
- Dimensions,
- Image,
- TouchableOpacity,
- ScrollView,
- RefreshControl,
- DeviceEventEmitter,
- Platform,
- } from 'react-native';
- import {Provider} from '@ant-design/react-native';
- import {connect} from 'react-redux';
- import CheckPrem from '../../components/CheckPrem';
- import IconBadge from 'react-native-icon-badge';
- import {createAction} from '../../utils';
- import {ComponentsStyles} from '../../components/ComponentsStyles';
- import {Tooltip} from 'react-native-elements';
- import SyncStorage from 'sync-storage';
- const {width} = Dimensions.get('window');
- const qkgl = [
- {
- name: '客户报备',
- img: require('../../../assets/images/jdws2.png'),
- navetion: 'ReportCustomerList',
- param: {report_status: ''},
- premission: 'customer.view_report_customer',
- },
- {
- name: '报备审核',
- img: require('../../../assets/images/qksh2.png'),
- navetion: 'ReportCustomerList',
- param: {report_status: 0},
- badge: 'report_customer_count',
- premission: 'customer.check_report_customer',
- },
- {
- name: '客户跟踪',
- img: require('../../../assets/images/jrxg2.png'),
- navetion: 'ReviewTodayList',
- param: {status: 1},
- premission: 'customer.view_new_customer',
- },
- {
- name: '跟踪审核',
- img: require('../../../assets/images/jryg2.png'),
- navetion: 'CheckCustomerList',
- param: {},
- premission: 'customer.check_review',
- badge: 'review_count',
- },
- {
- name: '进度跟踪',
- img: require('../../../assets/images/jdgl2.png'),
- navetion: 'ProcessList',
- param: {source:1},
- premission: 'order.view_order',
- },
- {
- name: '进度审核',
- img: require('../../../assets/images/jcgl2.png'),
- navetion: 'ProcessList',
- param: {status: 3, source:2},
- badge: 'order_count',
- premission: 'order.order_process_dispatch',
- },
- ];
- @connect(auth => ({...auth}))
- class SalesHome extends Component {
- constructor(props) {
- super(props);
- this.state = {
- page: 1,
- };
- }
- static navigationOptions = {
- headerShown: false, //隐藏顶部导航栏
- };
- componentDidMount() {
- this._entry = DeviceEventEmitter.addListener('ShowWhiteStatusBar', (param) => {
- this._setStatusBar();
- });
- this._fetchData();
- }
- _fetchData = () => {
- this.props.dispatch(createAction('auth/fetchTipsCount')());
- };
- componentWillUnmount() {
- this._entry.remove();
- }
- _setStatusBar = () => {
- StatusBar.setBarStyle('dark-content');
- if (Platform.OS === 'android') {
- StatusBar.setTranslucent(false);
- StatusBar.setBackgroundColor('#f2f2f2');
- }
- };
- onItemPrss = (navetion, param, premission) => {
- const prem = CheckPrem(navetion, premission);
- if (prem) {
- this.props.navigation.navigate(navetion, param);
- }
- };
- render() {
- const {tipsCount, loading} = this.props.auth;
- const qinake = [
- {name: '今日新增', count: tipsCount.today_report, tips: '管理范围内,新增报备且已审核的客户数量。'},
- {name: '本月新增', count: tipsCount.mouth_report, tips: '管理范围内,新增报备且已审核的客户数量。'},
- {name: '总报备', count: tipsCount.general_report, tips: '管理范围内,总的报备且已审核的客户数量。'},
- ];
- return (
- <View style={styles.container}>
- <StatusBar backgroundColor={'#f2f2f2'} barStyle='dark-content'/>
- <Provider>
- <ScrollView
- refreshControl={
- <RefreshControl
- refreshing={loading}
- onRefresh={() => {
- this._fetchData();
- }}
- />}
- >
- <View style={styles.monthView}>
- <View style={{flexDirection: 'row'}}>
- {qinake.map((item, index) => (
- <Tooltip
- key={index}
- withOverlay={false}
- skipAndroidStatusBar={true}
- height={50}
- popover={<Text style={ComponentsStyles.toolTipText}>{item.tips}</Text>}>
- <View style={{
- padding: 10,
- width: (width - 20) / 3,
- alignItems: 'center',
- }}>
- <Text style={{color: '#fffe37'}}>{item.name}</Text>
- <Text style={styles.countText}>{item.count}</Text>
- </View>
- </Tooltip>
- ))}
- </View>
- </View>
- <View style={styles.itemView}>
- <View style={[styles.titleView, {flexDirection: 'row'}]}>
- <Text style={styles.titleText}>客户服务管理</Text>
- </View>
- <View style={styles.fixBody}>
- {qkgl.map((item, index) => (
- <TouchableOpacity
- key={index}
- style={styles.fixBodyItem}
- onPress={() => this.onItemPrss(item.navetion, item.param, item.premission)}
- >
- <IconBadge
- MainElement={
- <Image
- source={item.img}
- style={styles.img}/>
- }
- BadgeElement={
- <Text style={{
- color: '#FFFFFF',
- fontSize: 10,
- }}>{tipsCount[item.badge]}</Text>
- }
- IconBadgeStyle={
- {
- minWidth: 8 + 6 * (tipsCount[item.badge] ? tipsCount[item.badge] : '').toString().length,
- height: 15,
- left: 30,
- top: -2,
- borderRadius: 10,
- backgroundColor: '#ff3d27',
- }
- }
- Hidden={!tipsCount[item.badge]}
- />
- <Text style={styles.nameText}>{item.name}</Text>
- </TouchableOpacity>
- ))}
- </View>
- </View>
- </ScrollView>
- </Provider>
- </View>
- );
- }
- }
- const styles = StyleSheet.create({
- monthText: {
- color: '#fff',
- fontSize: 18,
- padding: 10,
- paddingBottom: 0,
- },
- container: {
- flex: 1,
- paddingHorizontal: 10,
- marginTop: ComponentsStyles.top_margin,
- },
- fixBody: {
- flexDirection: 'row',
- flexWrap: 'wrap',
- },
- fixBodyItem: {
- alignItems: 'center',
- margin: 2,
- // borderWidth: 1,
- padding: 3,
- width: (width - 40) / 4,
- },
- img: {
- height: 30,
- width: 30,
- },
- nameText: {
- paddingVertical: 3,
- },
- itemView: {
- marginVertical: 5,
- borderRadius: 5,
- backgroundColor: '#fff',
- },
- titleView: {
- paddingVertical: 5,
- paddingLeft: 10,
- },
- titleText: {
- color: '#333',
- fontSize: 18,
- },
- monthView: {
- marginVertical: 10,
- backgroundColor: '#0f89f7',
- borderRadius: 5,
- },
- countText: {
- color: '#fff',
- fontSize: 18,
- paddingTop: 5,
- },
- searchBarIcon: {
- fontFamily: 'iconfont',
- fontSize: 14,
- paddingHorizontal: 5,
- color: '#ababab',
- },
- searchBarInput: {
- justifyContent: 'center',
- backgroundColor: '#fff',
- borderRadius: 15,
- flexDirection: 'row',
- flex: 1,
- margin: Platform.OS === 'ios' ? 0 : 5,
- padding: Platform.OS === 'ios' ? 0 : 5,
- },
- });
- export default SalesHome;
|