index.tsx
8.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
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
/*
* @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';
import {
getFollowDeregulationTimesApi,
saveFollowDeregulationTimesApi,
getFindTakeAwayTimesApi,
saveFindTakeAwayTimesApi,
getFindInviteTimeApi,
saveFindInviteTimeApi,
getLegworkVisitApi,
saveLegworkVisitApi,
getTestDriveDay,
saveTestDriveDay,
} 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}>
<Card bordered={false}>
<List itemLayout="horizontal">
{/* <Item title="销售线索转化有效时长(超期将被划走)" name="followChannelValidTime" suffix=" 小时" saveApi={saveFollowChannel} getApi={getFollowChannel} /> */}
{/* 集客跟进 */}
{/* <List.Item actions={[<a onClick={() => history.push('/crm/collectionFollowSetting')}>查看</a>]}>
<List.Item.Meta title="集客跟进" />
</List.Item> */}
{/* 潜客跟进 */}
{/* <List.Item actions={[<a onClick={() => history.push('/crm/potentialCollectionFollowSetting')}>查看</a>]}>
<List.Item.Meta title="潜客跟进" />
</List.Item> */}
{/* 龚昆修改整合:集客跟进,潜客跟进到一个新的页面 */}
<div style={{ width: '100%', height: 40 }} />
<List.Item actions={[<a onClick={() => history.push('/crm/closeClue')}>查看</a>]}>
<List.Item.Meta title="暂停区域线索站岗分配资格设置" />
</List.Item>
<List.Item actions={[<a onClick={() => history.push('/crm/followUpSettings')}>查看</a>]}>
<List.Item.Meta title="跟进设置" />
</List.Item>
{/* 龚昆新增:员工分享成交奖励设置 */}
<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>]}>
<List.Item.Meta title="销顾首客推荐线索奖励设置" />
</List.Item>
{/* 跟进违规X次划走 */}
<Item title="跟进违规X次划走" name="followDeregulationTimes" suffix=" 次" saveApi={saveFollowDeregulationTimesApi} getApi={getFollowDeregulationTimesApi} />
{/* 划走X次放入公共池 */}
<Item title="划走X次放入公共池" name="takeAwayTimes" suffix=" 次" 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>
<Item title="首次接待试驾≥" name="days" suffix=" 天后下定或成交" saveApi={saveTestDriveDay} getApi={getTestDriveDay} />
<div style={{ width: '100%', height: 40 }} />
{/* 销售顾问站岗轮换时间 */}
{/* <Item title="销售顾问站岗轮换时间" name="standGuardRotate" suffix=" 小时" saveApi={saveStandGuardRotateApi} getApi={getStandGuardRotateApi} /> */}
{/* 直接集客销售顾问奖励设置 */}
{/* <Item title="直接集客销售顾问奖励" name="bonus" suffix=" 元/人" saveApi={saveGatherConsultantBonusApi} getApi={getGatherConsultantBonusApi} /> */}
</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=" 小时"
/>
</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=" 次"
/>
</Col>
</Row>
) : null}
</Modal>
</Card>
</ConfigProvider>
</PageHeaderWrapper>
);
}