Blame view

src/pages/crm_new/Settings/index.tsx 8.02 KB
b811d2f7   王强   pre_crm.
1
2
3
4
5
6
7
8
9
10
  /*
   * @Date: 2021-03-25 14:07:57
   * @LastEditors: wangqiang@feewee.cn
   * @LastEditTime: 2021-03-29 17:58:06
   */
  import React, { useState } from 'react';
  import { history } from 'umi';
  import { Card, ConfigProvider, List, Input, message, Row, Modal, Col } from 'antd';
  import zhCN from 'antd/lib/locale-provider/zh_CN';
  import { PageHeaderWrapper } from '@ant-design/pro-layout';
b811d2f7   王强   pre_crm.
11
12
13
14
15
16
17
18
19
  import {
    getFollowDeregulationTimesApi,
    saveFollowDeregulationTimesApi,
    getFindTakeAwayTimesApi,
    saveFindTakeAwayTimesApi,
    getFindInviteTimeApi,
    saveFindInviteTimeApi,
    getLegworkVisitApi,
    saveLegworkVisitApi,
32227eca   舒述军   首次接待试驾天数
20
21
    getTestDriveDay,
    saveTestDriveDay,
b811d2f7   王强   pre_crm.
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
  } from './api';
  import Item from './components/Item';
  
  enum Type {
    '邀约设置' = 1,
    '外勤拜访设置'
  }
  
  export default function Settings() {
    const [modalParams, setModalParams] = useState<{ title?: string, visible: boolean, type?: 1 | 2, value?: string | number }>({ visible: false });
    const [confirmLoading, setConfirmLoading] = useState(false);
  
    // Modal相关
    const getModalInfo = (type: 1 | 2) => {
      if (type === Type['邀约设置']) {
        getFindInviteTimeApi().then(res => {
          setModalParams({
            ...modalParams,
            type,
            title: Type[type],
            visible: true,
            value: `${res.data || ''}`
          });
        }).catch(error => {
          message.error(error.message);
        });
      }
      if (type === Type['外勤拜访设置']) {
        getLegworkVisitApi().then(res => {
          setModalParams({
            ...modalParams,
            type,
            title: Type[type],
            visible: true,
            value: `${res.data}`
          });
        }).catch(error => {
          message.error(error.message);
        });
      }
    };
  
    const onOk = () => {
      if (!modalParams.value) {
        message.error("请填写后再进行提交!");
        return false;
      }
      setConfirmLoading(true);
      if (modalParams.type === Type['邀约设置']) {
        saveFindInviteTimeApi({ inviteTime: +modalParams.value! }).then(res => {
          message.success(res.result);
          setModalParams({ ...modalParams, visible: false });
          setConfirmLoading(false);
        }).catch(error => {
          message.error(error.message);
          setConfirmLoading(false);
        });
      }
      if (modalParams.type === Type['外勤拜访设置']) {
        saveLegworkVisitApi({ legworkVisit: +modalParams.value! }).then(res => {
          message.success(res.result);
          setModalParams({ ...modalParams, visible: false });
          setConfirmLoading(false);
        }).catch(error => {
          message.error(error.message);
          setConfirmLoading(false);
        });
      }
    };
  
    const onCancel = () => {
      setModalParams({ ...modalParams, visible: false });
    };
  
    return (
      <PageHeaderWrapper title="设置">
        <ConfigProvider locale={zhCN}>
6959cd60   gongkun   增加设置内容
99
          <Card bordered={false}> 
b811d2f7   王强   pre_crm.
100
            <List itemLayout="horizontal">
8ed12793   gongkun   跟随设置
101
102
  
              {/* <Item title="销售线索转化有效时长(超期将被划走)" name="followChannelValidTime" suffix="&nbsp;&nbsp;小时" saveApi={saveFollowChannel} getApi={getFollowChannel} /> */}
b811d2f7   王强   pre_crm.
103
              {/* 集客跟进 */}
8ed12793   gongkun   跟随设置
104
              {/* <List.Item actions={[<a onClick={() => history.push('/crm/collectionFollowSetting')}>查看</a>]}>
b811d2f7   王强   pre_crm.
105
                <List.Item.Meta title="集客跟进" />
8ed12793   gongkun   跟随设置
106
              </List.Item> */}
b811d2f7   王强   pre_crm.
107
              {/* 潜客跟进 */}
8ed12793   gongkun   跟随设置
108
              {/* <List.Item actions={[<a onClick={() => history.push('/crm/potentialCollectionFollowSetting')}>查看</a>]}>
b811d2f7   王强   pre_crm.
109
                <List.Item.Meta title="潜客跟进" />
8ed12793   gongkun   跟随设置
110
111
              </List.Item> */}
  
a534ab95   gongkun   新增员工拉新奖励设置和首客推荐奖励设置
112
              {/* 龚昆修改整合:集客跟进,潜客跟进到一个新的页面 */}
b811d2f7   王强   pre_crm.
113
              <div style={{ width: '100%', height: 40 }} />
0fddd13d   舒述军   暂停区域线索站岗分配资格
114
              <List.Item actions={[<a onClick={() => history.push('/crm/closeClue')}>查看</a>]}>
072aa8b8   舒述军   样式修改
115
                <List.Item.Meta title="暂停区域线索站岗分配资格设置" />
0fddd13d   舒述军   暂停区域线索站岗分配资格
116
              </List.Item>
8ed12793   gongkun   跟随设置
117
118
119
              <List.Item actions={[<a onClick={() => history.push('/crm/followUpSettings')}>查看</a>]}>
                <List.Item.Meta title="跟进设置" />
              </List.Item>
a534ab95   gongkun   新增员工拉新奖励设置和首客推荐奖励设置
120
121
122
123
124
125
              {/* 龚昆新增:员工分享成交奖励设置 */}
              <List.Item actions={[<a onClick={() => history.push('/crm/RewardForEmployeeRecruitment')}>查看</a>]}>
                <List.Item.Meta title="员工分享成交奖励设置" />
              </List.Item>
              {/* 龚昆新增:首客推荐奖励设置 */}
              <List.Item actions={[<a onClick={() => history.push('/crm/FirstCustomerRecommendationReward')}>查看</a>]}>
113f0851   舒述军   替换门店选择
126
                <List.Item.Meta title="销顾首客推荐线索奖励设置" />
a534ab95   gongkun   新增员工拉新奖励设置和首客推荐奖励设置
127
              </List.Item>
b811d2f7   王强   pre_crm.
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
              {/* 跟进违规X次划走 */}
              <Item title="跟进违规X次划走" name="followDeregulationTimes" suffix="&nbsp;&nbsp;次" saveApi={saveFollowDeregulationTimesApi} getApi={getFollowDeregulationTimesApi} />
              {/* 划走X次放入公共池 */}
              <Item title="划走X次放入公共池" name="takeAwayTimes" suffix="&nbsp;&nbsp;次" saveApi={saveFindTakeAwayTimesApi} getApi={getFindTakeAwayTimesApi} />
              <div style={{ width: '100%', height: 40 }} />
              {/* 邀约设置 */}
              <List.Item actions={[<a onClick={() => getModalInfo(Type['邀约设置'])}>编辑</a>]}>
                <List.Item.Meta title="邀约设置" />
              </List.Item>
              {/* 外勤拜访设置 */}
              <List.Item actions={[<a onClick={() => getModalInfo(Type['外勤拜访设置'])}>编辑</a>]}>
                <List.Item.Meta title="外勤拜访设置" />
              </List.Item>
              {/* 集客归属地设置 */}
              <List.Item actions={[<a onClick={() => history.push('/crm/collectionRegionSetting')}>查看</a>]}>
                <List.Item.Meta title="集客归属地设置" />
              </List.Item>
32227eca   舒述军   首次接待试驾天数
145
              <Item title="首次接待试驾≥" name="days" suffix="&nbsp;&nbsp;天后下定或成交" saveApi={saveTestDriveDay} getApi={getTestDriveDay} />
b811d2f7   王强   pre_crm.
146
147
              <div style={{ width: '100%', height: 40 }} />
              {/* 销售顾问站岗轮换时间 */}
60b16288   舒述军   屏蔽部分功能
148
              {/* <Item title="销售顾问站岗轮换时间" name="standGuardRotate" suffix="&nbsp;&nbsp;小时" saveApi={saveStandGuardRotateApi} getApi={getStandGuardRotateApi} /> */}
b811d2f7   王强   pre_crm.
149
              {/* 直接集客销售顾问奖励设置 */}
dd77fb40   舒述军   fix
150
              {/* <Item title="直接集客销售顾问奖励" name="bonus" suffix="&nbsp;&nbsp;元/人" saveApi={saveGatherConsultantBonusApi} getApi={getGatherConsultantBonusApi} /> */}
b811d2f7   王强   pre_crm.
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
            </List>
            <Modal
              title={modalParams.title}
              visible={modalParams.visible}
              maskClosable={false}
              onOk={onOk}
              onCancel={onCancel}
              confirmLoading={confirmLoading}
              afterClose={() => setModalParams({ ...modalParams, title: undefined, type: undefined, value: undefined })}
            >
              {modalParams.type === Type['邀约设置'] ? (
                <Row justify="space-between" align="middle">
                  <Col><span>邀约时间设置</span></Col>
                  <Col>
                    <Input
                      allowClear
                      type="number"
                      value={modalParams.value}
                      onChange={e => setModalParams({ ...modalParams, value: e.target.value })}
                      prefix="到店前"
                      suffix="&nbsp;&nbsp;小时"
                    />
                  </Col>
                </Row>
              ) : null}
              {modalParams.type === Type['外勤拜访设置'] ? (
                <Row justify="space-between" align="middle">
                  <Col><span>客户拜访次数限制</span></Col>
                  <Col>
                    <Input
                      allowClear
                      type="number"
                      value={modalParams.value}
                      onChange={e => setModalParams({ ...modalParams, value: e.target.value })}
                      suffix="&nbsp;&nbsp;次"
                    />
                  </Col>
                </Row>
              ) : null}
            </Modal>
          </Card>
        </ConfigProvider>
      </PageHeaderWrapper>
    );
  }