wushaodong %!s(int64=4) %!d(string=hai) anos
pai
achega
cde96f333a

+ 16 - 0
jscore/models/customer.js

@@ -229,6 +229,22 @@ export default {
                 yield put(createAction('queryList')({checkCustomerRState: REFRESH_STATE.Ready}));
             }
         },
+        * getProcess({payload, callback}, {call, put}) {
+            const response = yield call(customer.getProcess, payload);
+            if (!response.code) {
+                callback(response.data)
+            } else {
+                ResponseError(response);
+            }
+        },
+        * addOrder({payload, callback}, {call, put}) {
+            const response = yield call(customer.addOrder, payload);
+            if (!response.code) {
+                callback()
+            } else {
+                ResponseError(response);
+            }
+        },
     },
     subscriptions: {
         setup({dispatch}) {

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

@@ -15,6 +15,7 @@ import WriteInternalReport from './WriteInternalReport';
 import CheckCustomerList from './CheckCustomerList';
 import checkCustomerDetail from './checkCustomerDetail';
 import CheckCustomer from './CheckCustomer';
+import UpdateProcess from './UpdateProcess';
 
 const HomeStack = createStackNavigator({
         SalesHome: {
@@ -95,6 +96,12 @@ const HomeStack = createStackNavigator({
                 title: '跟踪审核',
             },
         },
+        UpdateProcess: {
+            screen: UpdateProcess,
+            navigationOptions: {
+                title: '更新进度',
+            },
+        },
     },
     {
         initialRouteName: 'SalesHome',

+ 12 - 0
jscore/pages/Sales/ReviewDetail.js

@@ -375,6 +375,18 @@ class ReviewDetail extends Component {
                                 >重新分配</Text>
                             </List.Item>
                             }
+                            <List.Item>
+                                <Text
+                                    style={styles.modalText}
+                                    onPress={() => {
+                                        this.props.navigation.navigate('UpdateProcess', {
+                                            customer: customerDetail.id,
+                                        });
+                                        this.setState({moreModelVisible: false});
+                                    }
+                                    }
+                                >更新进度</Text>
+                            </List.Item>
                             <List.Item onPress={() => this.setState({moreModelVisible: false})}>
                                 <Text style={styles.modalText}>取消</Text>
                             </List.Item>

+ 218 - 0
jscore/pages/Sales/UpdateProcess.js

@@ -0,0 +1,218 @@
+import React, {Component} from 'react';
+import {
+    View,
+    Text,
+    Image,
+    ImageBackground,
+    TouchableOpacity,
+    StatusBar,
+    DeviceEventEmitter,
+    StyleSheet,
+    TextInput,
+    ScrollView,
+} from 'react-native';
+import {Provider, Toast, Button, List} from '@ant-design/react-native';
+import {connect} from 'react-redux';
+import {ComponentsStyles} from '../../components/ComponentsStyles';
+import MultiCameraButton from '../../components/MultiCameraButton';
+
+@connect(customer => ({...customer}))
+class UpdateProcess extends Component {
+    //  填写跟踪报告
+    constructor(props) {
+        super(props);
+        this.state = {
+            customer: this.props.navigation.state.params.customer,
+            notes: '',
+            now_process_text: '',
+            next_process_text: '',
+            next_process_id: '',
+            file: [],
+        };
+    };
+
+    componentDidMount() {
+        this._fetchData();
+    }
+
+    _fetchData = () => {
+        this.props.dispatch({
+            type: 'customer/getProcess',
+            payload: {customer: this.state.customer},
+            callback: (data) => {
+                if (data.error_message) {
+                    Toast.info(data.error_message, 2, () => {
+                        this.props.navigation.goBack();
+                    });
+                    return;
+                }
+                this.setState({
+                    now_process_text: data.now_process_text,
+                    next_process_text: data.next_process_text,
+                    next_process_id: data.next_process_id,
+                });
+            },
+        });
+    };
+    onSave = () => {
+        if (!this.state.file.length) {
+            Toast.info('请选择图片', 1);
+            return;
+        }
+        this.props.dispatch({
+            type: 'customer/addOrder',
+            payload: this.state,
+            callback: () => {
+                // 返回,刷新潜客跟踪列表或潜客完善列表
+                DeviceEventEmitter.emit('refeshBack');
+                this.props.navigation.goBack();
+            },
+        });
+
+    };
+    _delPhoto = (fileName) => {
+        let files = [];
+        const {file} = this.state;
+        for (let i in file) {
+            if (file[i].fileName !== fileName) {
+                files.push(file[i]);
+            }
+        }
+
+        this.setState({file: files});
+    };
+    onImgUpload = (file) => {
+        this.setState({
+            file,
+        });
+    };
+
+    render() {
+        const {loading} = this.props.customer;
+        return (
+            <Provider>
+                <StatusBar backgroundColor={'#fff'} barStyle='dark-content'/>
+                <ScrollView style={{backgroundColor: '#fff'}}>
+                    <View style={styles.infoContent}>
+                        <List>
+                            <List.Item
+                                extra={<Text style={ComponentsStyles.font15}>{this.state.now_process_text}</Text>}
+                                arrow="empty">
+                                <Text style={ComponentsStyles.font15}>当前进度</Text>
+                            </List.Item>
+                            <List.Item
+                                extra={<Text style={ComponentsStyles.font15}>{this.state.next_process_text}</Text>}
+                                arrow="empty">
+                                <Text style={ComponentsStyles.font15}>下一进度</Text>
+                            </List.Item>
+
+                        </List>
+                        <TextInput
+                            style={{
+                                height: 140,
+                                borderColor: '#eee',
+                                textAlignVertical: 'top',
+                                borderBottomWidth: 1,
+                                paddingTop: 10,
+                                paddingHorizontal: 10,
+                            }}
+                            onChangeText={text => this.setState({notes: text})}
+                            value={this.state.notes}
+                            multiline={true}
+                            numberOfLines={4}
+                            maxLength={1000}
+                            placeholder={'请填备注'}
+                        />
+
+                    </View>
+                    <View style={styles.paperBody}>
+                        {this.state.file.map((item, index) => (
+                            <View key={index} style={styles.paperBodyItem}>
+                                <ImageBackground
+                                    source={item.img_id ? {uri: item.uri} : {uri: item.uri}}
+                                    style={{width: 60, height: 60}}
+                                >
+                                    <View style={{flex: 1}}>
+                                        <View style={{
+                                            borderRadius: 4,
+                                            padding: 3,
+                                            flexDirection: 'row',
+                                            justifyContent: 'flex-end',
+                                        }}>
+                                            <TouchableOpacity onPress={() => this._delPhoto(item.fileName)}
+                                                              style={{
+                                                                  borderRadius: 20,
+                                                                  backgroundColor: '#b6b6b6',
+                                                              }}>
+                                                <Text style={{fontFamily: 'iconfont'}}>{'\ue606'}</Text>
+                                            </TouchableOpacity>
+                                        </View>
+                                    </View>
+                                </ImageBackground>
+                            </View>
+                        ))
+                        }
+                        <MultiCameraButton
+                            photos={this.state.file}
+                            onFileUpload={this.onImgUpload}
+                            maxFiles={6}
+                        >
+                            <Image
+                                source={require('../../../assets/images/add.png')}
+                                style={{width: 60, height: 60}}
+                            />
+                        </MultiCameraButton>
+                    </View>
+                </ScrollView>
+                <Button
+                    type="primary"
+                    disabled={loading}
+                    onPress={() => this.onSave()}
+                    style={ComponentsStyles.button}
+                >
+                    <Text style={{color: '#fff'}}>提交</Text></Button>
+            </Provider>
+        );
+    }
+}
+
+const styles = StyleSheet.create({
+    paperBody: {
+        flexDirection: 'row',
+        flexWrap: 'wrap',
+        // borderBottomWidth: 10,
+        // borderBottomColor: '#eee',
+        paddingLeft: 5,
+    },
+    paperBodyItem: {
+        alignItems: 'center',
+        margin: 2,
+        padding: 5,
+    },
+    dateInput: {
+        borderWidth: 0,
+        alignItems: 'flex-end',
+    },
+    infoContent: {
+        marginTop: 5,
+        backgroundColor: '#fff',
+    },
+    infoItem: {
+        flexDirection: 'row',
+        paddingVertical: 10,
+        borderBottomWidth: 1,
+        borderColor: '#eaeaea',
+        justifyContent: 'space-between',
+    },
+    infoItemLeft: {color: '#000', fontSize: 19},
+    infoItemRight: {fontSize: 15, paddingTop: 2},
+    modelItem: {
+        borderBottomWidth: 1,
+        borderColor: '#eaeaea',
+        textAlign: 'center',
+        paddingVertical: 8,
+        fontSize: 18,
+        color: '#000',
+    },
+});
+export default UpdateProcess;

+ 22 - 0
jscore/services/customer.js

@@ -33,6 +33,10 @@ export async function queryCheckCustomer(params) {
     return request(`/customer/review/?${stringify(params)}`);
 }
 
+export async function getProcess(params) {
+    return request(`/order/get_process/?customer_id=` + params.customer);
+}
+
 export async function dispatchUser(params) {
     let formdata = new FormData();
     formdata.append('user', params.user[0]);
@@ -42,6 +46,24 @@ export async function dispatchUser(params) {
     });
 }
 
+export async function addOrder(params) {
+    let formdata = new FormData();
+    formdata.append('notes', params.notes);
+    formdata.append('stage_progress', params.next_process_id);
+    formdata.append('source', 'app');
+    params.file.map((item, index) => {
+        formdata.append('file' + index.toString(), {
+            uri: item.uri,
+            type: 'application/octet-stream',
+            name: item.fileName,
+        });
+    });
+    return request('/customer/new_customer/' + params.customer + '/add_order/', {
+        method: 'POST',
+        body: formdata,
+    });
+}
+
 export async function againDispatchUser(params) {
     let formdata = new FormData();
     formdata.append('track_user', params.user[0]);