wushaodong преди 4 години
родител
ревизия
f892320f66
променени са 5 файла, в които са добавени 230 реда и са изтрити 3 реда
  1. 16 0
      jscore/models/customer.js
  2. 7 0
      jscore/pages/Sales/Index.js
  3. 36 3
      jscore/pages/Sales/ReviewTodayList.js
  4. 163 0
      jscore/pages/Sales/SearchProcess.js
  5. 8 0
      jscore/services/customer.js

+ 16 - 0
jscore/models/customer.js

@@ -324,6 +324,22 @@ export default {
                 ResponseError(response);
             }
         },
+        * fetchEmployeeTree({payload, callback}, {call, put}) {
+            const response = yield call(customer.queryEmployeeTree, payload);
+            if (!response.code) {
+                callback(response.data)
+            } else {
+                ResponseError(response);
+            }
+        },
+        * queryStageCount({payload, callback}, {call, put}) {
+            const response = yield call(customer.queryStageCount, payload);
+            if (!response.code) {
+                callback(response.data)
+            } else {
+                ResponseError(response);
+            }
+        },
     },
     subscriptions: {
         setup({dispatch}) {

+ 7 - 0
jscore/pages/Sales/Index.js

@@ -20,6 +20,7 @@ import ProcessList from './ProcessList';
 import ProcessDetail from './ProcessDetail';
 import DispatchProcess from './DispatchProcess';
 import BrowseImage from './BrowseImage';
+import SearchProcess from './SearchProcess';
 
 const HomeStack = createStackNavigator({
         SalesHome: {
@@ -130,6 +131,12 @@ const HomeStack = createStackNavigator({
                 title: '资料图片',
             },
         },
+        SearchProcess: {
+            screen: SearchProcess,
+            navigationOptions: {
+                title: '进度统计',
+            },
+        },
     },
     {
         initialRouteName: 'SalesHome',

+ 36 - 3
jscore/pages/Sales/ReviewTodayList.js

@@ -22,7 +22,39 @@ class ReviewTodayList extends Component {
         };
     }
 
+    static navigationOptions = ({navigation}) => {
+        return {
+            headerRight: () => (
+                <TouchableOpacity onPress={() => navigation.state.params.onSearchPress()}>
+                    <Text style={{
+                        fontFamily: 'iconfont',
+                        color: '#333',
+                        fontSize: 18,
+                        paddingRight: 15,
+                    }}>{'\ue633'}</Text>
+                </TouchableOpacity>
+            ),
+        };
+    };
+
+    onSearchPress = () => {
+        this.props.navigation.navigate('SearchProcess', {
+            id: '',
+            callback: this.doSearch,
+        });
+    };
+
+    doSearch = (stage_progress, event, param) => {
+        this.state.stage_progress = stage_progress
+        this.state.count_param = event
+        this.state.param = param
+        this._fetchData(1);
+    };
+
     componentDidMount() {
+        this.props.navigation.setParams({
+            onSearchPress: this.onSearchPress,
+        });
         this._fetchData();
         this.refesh = DeviceEventEmitter.addListener('backRefesh', (param) => {
             this.props.dispatch(createAction('auth/fetchTipsCount')());
@@ -83,9 +115,10 @@ class ReviewTodayList extends Component {
                             style={ComponentsStyles.font15}>{item.project_text}</Text>
                         </Text>
                     </View>
-                    <View style={ComponentsStyles.itemViewEnd}>
-                        <Text style={ComponentsStyles.icon}>{'\ue65c'}</Text>
-                        <Text style={ComponentsStyles.font15}>{item.village}</Text>
+                    <View style={[ComponentsStyles.itemViewEnd,{width:'51%',}]}>
+                        <Text style={[ComponentsStyles.font15, {fontFamily: 'iconfont',}]}>
+                            <Text style={[ComponentsStyles.icon,  {textAlign:'right'}]}>{'\ue65c'} </Text>
+                            {item.village}</Text>
                     </View>
                 </View>
                 <View style={{

+ 163 - 0
jscore/pages/Sales/SearchProcess.js

@@ -0,0 +1,163 @@
+import React, {Component} from 'react';
+import {
+    View,
+    FlatList,
+    Text, StyleSheet, StatusBar,
+} from 'react-native';
+
+import {connect} from 'react-redux';
+import TreeSelect from 'react-native-tree-select';
+
+@connect(customer => ({...customer}))
+class SearchProcess extends Component {
+    // 搜索进度
+    constructor(props) {
+        super(props);
+        this.state = {
+            callback: this.props.navigation.state.params.callback,
+            data: [],
+            StageCount: [],
+            field: '',
+            store_id: '',
+        };
+    }
+
+    componentDidMount() {
+        this._fetchData();
+        this._fetchStageCount();
+    }
+
+    _fetchData = () => {
+        this.props.dispatch({
+            type: 'customer/fetchEmployeeTree',
+            callback: (data) => {
+                this.setState({data: data});
+            },
+        });
+    };
+
+    _fetchStageCount = (type, id) => {
+        this.props.dispatch({
+            type: 'customer/queryStageCount',
+            payload: {type, id},
+            callback: (data) => {
+                this.setState({StageCount: data});
+            },
+        });
+    };
+
+    _onClickLeaf = (item) => {
+        this._fetchStageCount(item.item.field, item.item.id);
+        this.setState({field: item.item.field, store_id: item.item.id});
+    };
+
+    _onStagePress = (stage_id, event) => {
+        const {field, store_id} = this.state;
+        let param = '';
+        if (field && store_id) {
+            param = field + '_' + store_id;
+        }
+        this.state.callback(stage_id, event, param);
+        this.props.navigation.goBack();
+    };
+
+    renderItem = (data, index) => {
+        return (
+            <View style={index % 2 === 0 ? styles.tableRowOdd : styles.tableRowEven}>
+                <Text
+                    onPress={() => this._onStagePress(data.stage_id, 'stage')}
+                    style={[styles.tableCell, {width: '30%'}]}>{data.stage}</Text>
+                <Text
+                    onPress={() => this._onStagePress(data.stage_id, 'total')}
+                    style={[styles.tableCell, {width: '20%'}]}>{data.total_count}</Text>
+                <Text
+                    onPress={() => this._onStagePress(data.stage_id, 'today')}
+                    style={[styles.tableCell, {width: '25%'}]}>{data.today_count}</Text>
+                <Text
+                    onPress={() => this._onStagePress(data.stage_id, 'overdue')}
+                    style={[styles.tableCell, {width: '25%'}]}>{data.overdue_count}</Text>
+            </View>
+        );
+    };
+
+    render() {
+        return (
+            <View style={{flex: 1, backgroundColor: '#fff'}}>
+                <StatusBar backgroundColor={'#fff'} barStyle='dark-content'/>
+                <TreeSelect
+                    data={this.state.data}
+                    // isOpen={true}
+                    // openIds={[3]}
+                    // defaultSelectedId={['B062']}
+                    isShowTreeId={false}
+
+                    selectType="single"
+                    itemStyle={{
+                        marginVertical: 10,
+                        // backgroudColor: '#8bb0ee',
+                        fontSize: 14,
+                        // color: '#2b90ea',
+                    }}
+                    selectedItemStyle={{
+                        backgroudColor: '#f7edca',
+                        fontSize: 14,
+                        // color: '#171e99'
+                    }}
+                    leafCanBeSelected={true}
+                    // onClickLeaf={this._onClickLeaf}
+                    onClick={this._onClickLeaf}
+                    treeNodeStyle={{
+                        openIcon: <Text style={{fontFamily: 'iconfont'}}>{'\ue617'}</Text>,
+                        closeIcon: <Text style={{fontFamily: 'iconfont'}}>{'\ue601'}</Text>,
+                    }}
+                />
+                <View>
+                    <View style={styles.tableHeader}>
+                        <Text style={[styles.tableHeaderItem, {width: '30%'}]}>阶段</Text>
+                        <Text style={[styles.tableHeaderItem, {width: '20%'}]}>总数</Text>
+                        <Text style={[styles.tableHeaderItem, {width: '25%'}]}>今日</Text>
+                        <Text style={[styles.tableHeaderItem, {width: '25%'}]}>逾期</Text>
+                    </View>
+                    <FlatList
+                        data={this.state.StageCount}
+                        renderItem={({item, index}) => this.renderItem(item, index)}
+                        keyExtractor={(item, index) => index.toString()}
+                    />
+                </View>
+            </View>
+        );
+    }
+}
+
+const styles = StyleSheet.create({
+    icon: {
+        fontFamily: 'iconfont',
+        fontSize: 14,
+        color: '#2b90ea',
+        padding: 3,
+    },
+    tableHeader: {
+        backgroundColor: '#03C762',
+        flexDirection: 'row',
+    },
+    tableHeaderItem: {
+        color: '#fff',
+        paddingVertical: 10,
+        textAlign: 'center',
+        // flex: 1
+    },
+    tableRowOdd: {
+        flexDirection: 'row',
+    },
+    tableRowEven: {
+        flexDirection: 'row',
+        backgroundColor: '#f8f8f8',
+    },
+    tableCell: {
+        color: '#666',
+        padding: 10,
+        textAlign: 'center',
+        // flex: 1
+    },
+});
+export default SearchProcess;

+ 8 - 0
jscore/services/customer.js

@@ -57,6 +57,14 @@ export async function queryProcessImage(params) {
     return request(`/order/get_files/?${stringify(params)}`);
 }
 
+export async function queryEmployeeTree(params) {
+    return request(`/account/employee_tree/`);
+}
+
+export async function queryStageCount(params) {
+    return request(`/customer/stage_count/?${stringify(params)}`);
+}
+
 export async function dispatchUser(params) {
     let formdata = new FormData();
     formdata.append('user', params.user[0]);