index.js
14.4 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
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
import React, { Component } from 'react'
import { connect } from 'dva'
import { Tabs, WhiteSpace, Badge,Toast } from 'antd-mobile';
import { Form } from 'antd';
import InsuranceList from "../InsuranceList"
import styles from "./Tabs.css"
import css from "../../routes/GovernorTraining/css.less"
import MemberList from '../../components/MemberList/MemberList';
import Iscroll from "../../components/Iscroll";
class Tab extends Component{
constructor(props){
super(props);
this.state={
tabs:[{ title: <Badge >{this.props.title[0]}</Badge> },
{ title: <Badge >{this.props.title[1]}</Badge> }
],
chosenClientId:0,
chosenItm: '',
inputValue:'',
name:'',
currentStatus:'',
firstName:[],
nameList:props.nameList,
nameList1:props.nameList1,
checkTab:0,
}
}
onSearch = (val) => {
this.setState({
inputValue:val
})
}
componentWillMount(){
let that = this;
// that.props.dispatch({
// type:'myUser/getAllUser',
// payload:{
// "id":localStorage.getItem("id"),
// "currentState":0,
// },
// callback(data){
// that.setState({
// list:data,
// nameList:data,
// })
// }
// })
// this.props.dispatch({
// type:'myUser/getAllUser',
// payload:{
// "id":localStorage.getItem("id"),
// },
// callback(data){
// that.setState({
// list:data,
// nameList1:data,
// })
// }
// })
}
/* 删除客户 */
delete = (id)=>{
let that = this;
this.props.dispatch({
type:'myUser/deleteCustomer',
payload:{
"id":id,
},
callback(){
// this.getUaer()
}
})
}
history=()=>{
this.props.history()
}
go1=(item)=>{
console.log(item);
let storage = window.localStorage;
storage.setItem("riskName",item.riskName)
storage.setItem("riskCode",item.riskCode)
storage.setItem("calculationMethod",item.calculationMethod)
storage.setItem("selectd",1)
storage.setItem("seriNo",item.seriNo)
//storage.setItem("recipients",false)
storage.setItem("riskIntroduce",item.riskIntroduce)
storage.setItem("thumbnail",item.thumbnail)
//storage.setItem("recipientsName",'')
//storage.setItem("recipientsSex",true)
//storage.setItem("recipients",false)
let roleId =localStorage.getItem("roleId");
window.location.href= window.location.href.split('#')[0]+ '#/addplaneditor?riskName='+item.riskName+'&riskCode='+item.riskCode +'&calculationMethod='+ item.calculationMethod + '&thumbnail='+item.thumbnail+'&selectd=1&roleId='+ roleId +'&Id='+ localStorage.getItem('id') + '&seriNo='+item.seriNo+'&recipientsName='+ item.receiveName +'&recipientsSex='+item.receiveSex;
}
goPlanResult=(item)=>{
let storage = window.localStorage;
storage.setItem("seriNo",item.seriNo)
storage.setItem("calculationMethod",item.calculationMethod)
storage.setItem("riskCode",item.riskCode)
storage.setItem("riskName",item.riskName)
storage.setItem("thumbnail",item.thumbnail)
window.location.href= window.location.href.split('#')[0]+ '#/planResult?seriNo='+item.seriNo+'&riskName='+item.riskName +'&riskCode='+ item.riskCode +'&thumbnail='+item.thumbnail+'&recipientsName='+ item.receiveName +'&recipientsSex='+item.receiveSex;
}
go=(item)=>{
this.props.dispatch({
type:'planEditor/getMyPlanMessage',
payload:{
"seriNo":item.seriNo,
"interestRate":"0.03"
},
callback(data){
}
})
}
dispatch=(item)=>{
let that = this;
if(item.seriNo){
}else{
this.props.dispatch({
type: 'myUser/getAllUser',
payload: {
"id":localStorage.getItem("id"),
"currentState":this.state.currentStatus,
},
callback(){
that.props.amentClient();
}
})
}
}
goAddInsurance = (item)=>{
let storage = window.localStorage;
storage.setItem("riskName",item.riskName)
storage.setItem("riskCode",item.riskCode)
storage.setItem("calculationMethod",item.calculationMethod)
storage.setItem("selectd",1)
storage.setItem("seriNo",'')
//storage.setItem("recipients",false)
storage.setItem("riskIntroduce",item.riskIntroduce)
storage.setItem("thumbnail",item.thumbnail)
//storage.setItem("recipientsName",'')
//storage.setItem("recipientsSex",true)
//storage.setItem("recipients",false)
let roleId =localStorage.getItem("roleId");
window.location.href= window.location.href.split('#')[0]+ '#/addPlanEditor?riskName='+item.riskName+'&riskCode='+item.riskCode +'&calculationMethod='+ item.calculationMethod + '&riskIntroduce=&thumbnail='+item.thumbnail+'&selectd=1&roleId='+ roleId +'&Id='+ localStorage.getItem('id') + '&seriNo='
}
render() {
let checkTab = this.state.checkTab
if(sessionStorage.getItem("key") == '已提交'){
checkTab = 1
}
if(sessionStorage.getItem("key") == '我的'){
checkTab = 1
}
let showClient = this.props.storeNameList?this.props.storeNameList.length==0:false &&this.props.user;
let showClient1 = this.props.storeNameList1?this.props.storeNameList1.length==0:false &&this.props.user;
const { dataFilterToProp } = this.props;
return (
<div style={{height:'100%',backgroundColor:'white'}}>
<Tabs tabs={this.state.tabs}
initialPage={checkTab}
swipeable={false}
onChange={(tab, index) => {
let checkTab = tab.title.props.children;
sessionStorage.setItem( "key", checkTab);
}}
tabBarTextStyle={{fontSize:'.15rem',height:'.435rem'}}
>
<div className={!showClient||!showClient1?styles.tabs1:styles.tabs}>
{/*计划书列表---所有*/}
{this.props.allPlanList &&
<div>
<InsuranceList planList = {this.props.allPlanList} goAddInsurance={this.goAddInsurance} style={{paddingTop:'0.2rem',}}></InsuranceList>
<div className={styles.noMore}>
<div><img src={require('../../assets/image/no-more.png')} alt=""/>
<span>没有更多啦</span>
</div>
</div>
</div>
}
{/* 我的客户---无客户跟进中*/}
{ !this.props.myPlanList&& showClient && <div className={styles.clientless}>
<img src={require('../../assets/image/clientless.png')} alt="" className={styles.client}/>
<p>
您当前并未提交客户
</p>
<p>点击下方按钮添加</p>
<img src={require('../../assets/image/addUsers.png')} onClick={()=>{
this.props.addUser();
}} alt="" className={styles.add}/>
</div>}
{/*我的客户 --- 未提交*/}
{ !this.props.myPlanList&& !showClient &&
<div className={styles.less} style={{ width: '100%',height:'100%'}}>
{!this.props.hasClient[0] && <div className={styles.clientless}>
<img src={require('../../assets/image/clientless.png')} alt="" className={styles.client} />
<p>
您当前并无已提交客户
</p>
<p>点击下方按钮添加</p>
<img src={require('../../assets/image/addUsers.png')} onClick={() => {
this.props.addUser();
}} alt="" className={styles.add} />
</div>
}
{this.props.hasClient[0] &&
<div>
<MemberList
id="user1"
dataList={this.props.nameList}
renderType={['name']}
content={this.props.content}
handleEdit={(item) => {
// item 客户信息, false 未提交状态
this.props.goAddUser(item, false)
}}
filterData={keywords => {
dataFilterToProp(keywords, 0);
}}
renderItem={item => {
return <div className={css.managerItem} onClick={()=>{
let clientNeededInfo = {...item ,disabled1:true}
localStorage.setItem('clientNeededInfo', JSON.stringify(clientNeededInfo))
window.location.href = window.location.href.split('#')[0] + '#/addUser'
}}>
<span className={css.name}>{item.name}</span><span className={css.time}>{item.createTime.substr(0, 16)}</span>
</div>
}}
handleAction={item => {
this.props.delete(item.id)
}}
pTitle='客户' />
<div className={styles.btn_confirm} >
<img src={require('../../assets/image/add-user.png')} alt="" onClick={() => {
this.props.addUser();
}} />
</div>
</div>
}
</div>
}
</div>
{/*----tabs 右侧--*/}
<div style={{ position: 'relative',display: 'flex', minHeight:'100%', justifyContent: 'center',backgroundColor: '#fff',overflow: 'hidden'}}>
{/*计划书---我的*/}
{this.props.myPlanList && <div style={{marginBottom:'.3rem'}}>
<Iscroll id="myPlan2"
iscrollOptions={{
probeType:2
}}
>
<InsuranceList planList = {this.props.myPlanList} className={styles.last} history={this.history} my={true} go={this.go} go1={this.go1} goPlanResult={this.goPlanResult} getMyPlan = {this.props.getMyPlan}></InsuranceList>
<div className={styles.noMore}>
<div><img src={require('../../assets/image/no-more.png')} alt=""/>
<span>没有更多啦</span>
</div>
</div>
</Iscroll>
</div>}
{/* 我的客户 --- 无客户已提交*/}
{!this.props.myPlanList&& showClient1 && <div className={styles.clientless}>
<img src={require('../../assets/image/clientless.png')} alt="" className={styles.client}/>
<p>
您当前并无跟进客户
</p>
<p>点击下方按钮添加</p>
<img src={require('../../assets/image/addUsers.png')} onClick={() => {
this.props.addUser();
}} alt="" className={styles.add} />
</div>
}
{/*我的客户---有客户已提交 */}
{!this.props.myPlanList&& !showClient1 && <div className={styles.less} style={{width:'100%'}}>
{!this.props.hasClient[1] && <div className={styles.clientless}>
<img src={require('../../assets/image/clientless.png')} alt="" className={styles.client} />
<p>
您当前并无跟进客户
</p>
<p>点击下方按钮添加</p>
<img src={require('../../assets/image/addUsers.png')} onClick={() => {
this.props.addUser();
}} alt="" className={styles.add} />
</div>
}
{ this.props.hasClient[1] && <div style={{height:'100%'}}>
<MemberList
id="user2"
dataList={this.props.nameList1}
renderType={['name']}
isCheckClientStateForSwipe={true}
handleEdit={(item) => {
// item 客户信息, true 已提交状态
this.props.goAddUser(item, true)
}}
filterData={keywords => {
dataFilterToProp(keywords, 1);
}}
renderItem={item => {
let status = '未提交';
switch (item.currentState) {
// case '1':
// status = '待审核';
// break;
// case '2':
// status = '审核退回';
// break;
case '3':
status = '已提交';
break;
case '4':
status = '已成单';
break;
case '5':
status = '已上传';
break;
case '6':
status = '跟进中';
break;
case '7':
status = '停止跟进';
break;
default:
}
return <div className={css.clientItem}
style={{display:'flex'}}
onClick={()=>{
let clientNeededInfo = {...item ,disabled1:true}
localStorage.setItem('clientNeededInfo', JSON.stringify(clientNeededInfo))
//审核驳回的,可以修改,不能预览
if(item.currentState !=2){
window.location.href = window.location.href.split('#')[0] + '#/addUser'
}
}}>
<span className={css.name}>{item.name}</span>
<span className={css.time}>{item.createTime.substr(0, 16)}</span>
<span className={css.status}>{status}</span>
</div>
}}
handleAction={item => {
console.log(44);
this.props.delete(item.id)
}}
pTitle='客户' />
<div className={styles.btn_confirm} >
<img src={require('../../assets/image/add-user.png')} alt="" onClick={() => {
this.props.addUser();
}} />
</div>
</div>
}
</div>
}
</div>
</Tabs>
<WhiteSpace />
</div>
)
}
}
Tab.propsTypes = {}
export default connect(({myUser})=>({myUser}))(Form.create()(Tab))