Browse Source

修改 来电弹屏客户资料管理;

fanlongfei 6 years ago
parent
commit
f5041be899

+ 213 - 127
CallCenterWeb.UI/callScreen/call.js

@@ -12,7 +12,7 @@ var timestamp = Date.parse(new Date());
12 12
 var timer, n = 0;
13 13
 
14 14
 //测试数据
15
-// var phoneNumber = "15235457488";
15
+// var phoneNumber = "15235457489";
16 16
 // var CallID = "148";
17 17
 
18 18
 $(function() {
@@ -54,16 +54,19 @@ $(function() {
54 54
 	//获取电话所属地
55 55
 	if(phoneNumber) {
56 56
 		getPhoneLocation(); //获取来电归属地
57
-		getCustomer(); //获取来电客户信息
57
+		//获取客户类型
58
+		helper.getDropList.getlistDropByDic($('#head_form_cusType'), 'KHLX').then(function(){
59
+			getCustomer(); //获取来电客户信息
60
+		});
58 61
 	}
59 62
 	//根据关键词搜索公司 
60
-	$('#companySearch').on('click', getSearchCustomer);
63
+	// $('#companySearch').on('click', getSearchCustomer);
61 64
 
62 65
 	//保存来电客户信息
63 66
 	$('#head_form_btn_save').on('click', headFormSave);
64 67
 	
65 68
 	//清空来电客户信息
66
-	// $('#head_form_btn_reset').on('click', headFormReset);
69
+	// $('#head_form_btn_reset').on('click', headFormClean);
67 70
 
68 71
 	//点击IVR
69 72
 	$('#head_black_ivr').click(function() {
@@ -241,10 +244,20 @@ function getSearchCustomer() {
241 244
 	});
242 245
 }
243 246
 
247
+
248
+//清空head_form
249
+function headFormClean() {
250
+	//左侧信息清空;
251
+	$('#head_form_customer_id').val('');
252
+	$('.head_form').find('.form-control').val('');
253
+	$('.head_form').find('select.form-control').selectpicker('val', '0');
254
+	$('#head_form_tel').val(helper.filter.cutTel(phoneNumber));
255
+}
256
+
244 257
 /**
245 258
  * 根据电话获取 客户信息
246 259
  * */
247
- function getCustomer(){
260
+function getCustomer() {
248 261
 	$.ajax({
249 262
 		url: huayi.config.callcenter_url + 'CustomerNew/GetCustomerByTel',
250 263
 		type: 'get',
@@ -254,144 +267,69 @@ function getSearchCustomer() {
254 267
 		},
255 268
 		dataType: "json",
256 269
 		async: true,
257
-		success: function(data) {
258
-			if(data.state.toLowerCase() === 'success') {
270
+		success: function (data) {
271
+			if (data.state.toLowerCase() === 'success') {
259 272
 				var customerBase = data.data && data.data.CustomerBase;
260
-				if(customerBase){
273
+				if (customerBase) {
261 274
 					$('#head_form_customer_id').val(customerBase.F_CustomerId); //客户id
262
-					$('#head_form_cmpname').val(customerBase.F_CompanyName);//公司名称
263
-					$('#head_form_cmpaddress').val(customerBase.F_CompanyAddress);//公司地址
264
-					$('#head_form_legname').val(customerBase.F_LegalName);//法人姓名
265
-					$('#head_form_legtel').val(helper.filter.cutTel(customerBase.F_LegalTel));//法人电话
266
-					$('#head_form_subtrade').val(customerBase.F_SubTrade);//所属行业
267
-					//获取对应的联系人信息
268
-					getCustomerLists(1, customerBase.F_CustomerId);
269
-					$('#order_company').val(customerBase.F_CompanyName); //给工单的公司名称赋值
270
-				}
271
-			}
272
-		},
273
-	}); 
274
- }
275
- 
276
-/**
277
- * 根据电话获取 客户联系人列表
278
- * paramPage: 页数请求的是第几页
279
- * cid: 客户的id
280
- * */
281
-function getCustomerLists(paramPage, cid) {
282
-	$('#head_customer_info').html('');
283
-	$.ajax({
284
-		url: huayi.config.callcenter_url + 'CustomerNew/GetConList',
285
-		type: 'get',
286
-		data: {
287
-			cusid: cid, //客户id
288
-			pageindex: paramPage, //第几页
289
-			pagesize: 2,
290
-			tel: phoneNumber, //否	string	来电电话 例如:13663801989
291
-			token: $.cookie("token")
292
-		},
293
-		dataType: "json",
294
-		async: true,
295
-		success: function(returnValue) {
296
-			var tableDatas = returnValue.rows;
297
-			//异步获取列表数据
298
-			if(tableDatas && tableDatas.length > 0) {
299
-				$('#head_form_name').val(tableDatas[0].F_Name);//左侧姓名
300
-				$('#head_form_name').prop('readonly', true);
301
-				$('#order_name').val(tableDatas[0].F_Name);//右侧工单姓名
302
-				//加载内容
303
-				$('#head_customer_info').html('');
304
-				for(var i = 0, tableDatasLength = tableDatas.length; i < tableDatasLength; i++) {
305
-					var itmeHtml = '<div class="head_customer_info_item clearfix">' +
306
-						'<div class="head_customer_info_item_l pull-left">' +
307
-						'<p class="clearfix">' +
308
-						'<span>姓名</span>' +
309
-						'<span>' + tableDatas[i].F_Name + '</span>' +
310
-						'</p>' +
311
-						'<p>' +
312
-						'<span>电话</span>' +
313
-						'<span>' + helper.filter.cutTel(tableDatas[i].F_Telephone) + '</span>' +
314
-						'</p>' +
315
-						'<p>' +
316
-						'<span>是否主要联系人</span>' +
317
-						'<span>' + (tableDatas[i].F_IsMain === true ? '是' : '否') + '</span>' +
318
-						'</p>' +
319
-						'</div>' +
320
-						'<div class="head_customer_info_item_r pull-left" id="customerBtn_' + i + '">'+
321
-						// '选择' +
322
-						'</div>' +
323
-						'</div>'
324
-					$('#head_customer_info').append(itmeHtml);
325
-				}
326
-				if(tableDatasLength > 0) {
327
-					$.jqPaginator('#pagination', {
328
-						totalCounts: returnValue.total,
329
-						pageSize: 2,
330
-						currentPage: paramPage,
331
-						visiblePages: 10,
332
-						prev: '<li class="prev"><a href="javascript:;">上一页</a></li>',
333
-						next: '<li class="next"><a href="javascript:;">下一页</a></li>',
334
-						//page: '<li class="page"><a href="javascript:;">{{page}}</a></li>',
335
-						onPageChange: function(num, type) {
336
-							$('#page_number').text(num + "/" + Math.ceil(returnValue.total / 2));
337
-							//console.log(type + ':' + num);
338
-							if(type == 'change') {
339
-								getCustomerLists(num);
340
-							}
341
-						}
342
-					});
343
-				} else {
344
-					$('.head_customer_info_title').hide();
275
+
276
+					$('#head_form_name').val(customerBase.F_CustomerCode);//客户姓名
277
+					$('#head_form_tel').val(customerBase.F_LegalTel);//客户电话
278
+					$('#head_form_cusType').selectpicker('val', customerBase.F_CusType);//客户类型
279
+					$('#head_form_address').val(customerBase.F_CompanyAddress);//客户地址
280
+					$('#head_form_remark').val(helper.filter.cutTel(customerBase.F_Remark1));//备注
345 281
 				}
346
-			} else {
347
-				$('.head_customer_info_title').hide();
348
-				$('#head_form_name').val('');//联系人姓名
349
-				$('#head_form_name').prop('readonly', false);
350 282
 			}
351 283
 		},
352 284
 	});
353 285
 }
354 286
 
355
-
356
-//清空head_form
357
-function headFormClean() {
358
-	//左侧信息清空;
359
-	// $('#head_form_customer_id').val('');
360
-	$('.head_form').find('.form-control').val('');
361
-	$('#head_form_tel').val(helper.filter.cutTel(phoneNumber));
362
-}
363
-
364 287
 //保存来电客户信息
365 288
 function headFormSave() {
366
-	if(!$.trim($('#head_form_name').val())) {
289
+	if (!$.trim($('#head_form_name').val())) {
367 290
 		layer.confirm('请输入姓名!', {
368 291
 			icon: 2,
369 292
 			btn: ['确定']
370 293
 		});
371 294
 		return;
372 295
 	}
373
-// 	if(!regexs.phone.test($.trim($('#head_form_tel').val()))) {
374
-// 		layer.confirm('请输入正确的电话!', {
375
-// 			icon: 2,
376
-// 			btn: ['确定']
377
-// 		});
378
-// 		return;
379
-// 	}
380
-	
381
-	$.post(huayi.config.callcenter_url + 'CustomerNew/AddContact', {
382
-		F_CustomerId: $('#head_form_customer_id').val(),// int客户id
383
-		F_Name: $('#head_form_name').val(),//string 联系人姓名
384
-		F_Telephone: phoneNumber,// string电话
385
-		token: $.cookie("token")
386
-	}, function(result) {
387
-		result = $.parseJSON(result);
388
-		if(result.state.toLowerCase() === "success") {
389
-			//给 右侧新增工单赋值
390
-			$('#order_name').val($('#head_form_name').val()); //客户姓名
391
-			$('#order_company').val($('#head_form_cmpname').val()); //公司名称
392
-			layer.msg("保存成功");
296
+	if (!regexs.phone.test($.trim($('#head_form_tel').val()))) {
297
+		layer.confirm('请输入正确的电话!', {
298
+			icon: 2,
299
+			btn: ['确定']
300
+		});
301
+		return;
302
+	}
303
+	var wURL;
304
+	console.log($('#head_form_customer_id').val())
305
+	if ($('#head_form_customer_id').val()) {
306
+		wURL = "CustomerNew/Update";
307
+	} else {
308
+		wURL = "CustomerNew/Add";
309
+	}
310
+	$.ajax({
311
+		type: 'post',
312
+		url: huayi.config.callcenter_url + wURL,
313
+		dataType: 'json',
314
+		async: true,
315
+		data: {
316
+			F_CustomerId: $('#head_form_customer_id').val(), //	否	string	id
317
+			F_CustomerCode: $('#head_form_name').val(), //string 客户姓名
318
+			F_LegalTel: $('#head_form_tel').val(), //string 客户电话
319
+			F_CusType: $('#head_form_cusType').val(), //string 客户类型
320
+			F_CompanyAddress: $('#head_form_address').val(), //string 客户地址
321
+			F_Remark1: $('#head_form_remark').val(), // string 备注1(输入框即可)
322
+			token: $.cookie("token")
323
+		},
324
+		success: function (result) {
325
+			if (result.state.toLowerCase() === "success") {
326
+				//给 右侧新增工单赋值
327
+				$('#order_name').val($('#head_form_name').val()); //客户姓名
328
+				$('#order_tel').val($('#head_form_tel').val()); //客户电话
329
+				layer.msg("保存成功");
330
+			}
393 331
 		}
394
-	})
332
+	});
395 333
 }
396 334
 
397 335
 //获取知识库
@@ -914,7 +852,6 @@ function cleanOrderForm() {
914 852
 	$('#order_isover').find("input[type='radio'][value='0']").prop("checked", true);
915 853
 }
916 854
 
917
-
918 855
 //拉黑 保存
919 856
 function saveBlack() {
920 857
 	var reg = /^\+?[1-9][0-9]*$/;
@@ -1111,3 +1048,152 @@ function calloutopt(telphone) {
1111 1048
 		});
1112 1049
 	}
1113 1050
 }
1051
+
1052
+
1053
+/**
1054
+ * 以下得代码是原来的 之后不用记得删除
1055
+ */
1056
+
1057
+/**
1058
+ * 根据电话获取 客户信息
1059
+ * */
1060
+function getCustomer1() {
1061
+	$.ajax({
1062
+		url: huayi.config.callcenter_url + 'CustomerNew/GetCustomerByTel',
1063
+		type: 'get',
1064
+		data: {
1065
+			tel: phoneNumber, //否	string	来电电话 例如:13663801989
1066
+			token: $.cookie("token")
1067
+		},
1068
+		dataType: "json",
1069
+		async: true,
1070
+		success: function (data) {
1071
+			if (data.state.toLowerCase() === 'success') {
1072
+				var customerBase = data.data && data.data.CustomerBase;
1073
+				if (customerBase) {
1074
+					$('#head_form_customer_id').val(customerBase.F_CustomerId); //客户id
1075
+					$('#head_form_cmpname').val(customerBase.F_CompanyName);//公司名称
1076
+					$('#head_form_cmpaddress').val(customerBase.F_CompanyAddress);//公司地址
1077
+					$('#head_form_legname').val(customerBase.F_LegalName);//法人姓名
1078
+					$('#head_form_legtel').val(helper.filter.cutTel(customerBase.F_LegalTel));//法人电话
1079
+					$('#head_form_subtrade').val(customerBase.F_SubTrade);//所属行业
1080
+					//获取对应的联系人信息
1081
+					getCustomerLists(1, customerBase.F_CustomerId);
1082
+					$('#order_company').val(customerBase.F_CompanyName); //给工单的公司名称赋值
1083
+				}
1084
+			}
1085
+		},
1086
+	});
1087
+}
1088
+
1089
+/**
1090
+ * 根据电话获取 客户联系人列表
1091
+ * paramPage: 页数请求的是第几页
1092
+ * cid: 客户的id
1093
+ * */
1094
+function getCustomerLists1(paramPage, cid) {
1095
+	$('#head_customer_info').html('');
1096
+	$.ajax({
1097
+		url: huayi.config.callcenter_url + 'CustomerNew/GetConList',
1098
+		type: 'get',
1099
+		data: {
1100
+			cusid: cid, //客户id
1101
+			pageindex: paramPage, //第几页
1102
+			pagesize: 2,
1103
+			tel: phoneNumber, //否	string	来电电话 例如:13663801989
1104
+			token: $.cookie("token")
1105
+		},
1106
+		dataType: "json",
1107
+		async: true,
1108
+		success: function (returnValue) {
1109
+			var tableDatas = returnValue.rows;
1110
+			//异步获取列表数据
1111
+			if (tableDatas && tableDatas.length > 0) {
1112
+				$('#head_form_name').val(tableDatas[0].F_Name);//左侧姓名
1113
+				$('#head_form_name').prop('readonly', true);
1114
+				$('#order_name').val(tableDatas[0].F_Name);//右侧工单姓名
1115
+				//加载内容
1116
+				$('#head_customer_info').html('');
1117
+				for (var i = 0, tableDatasLength = tableDatas.length; i < tableDatasLength; i++) {
1118
+					var itmeHtml = '<div class="head_customer_info_item clearfix">' +
1119
+						'<div class="head_customer_info_item_l pull-left">' +
1120
+						'<p class="clearfix">' +
1121
+						'<span>姓名</span>' +
1122
+						'<span>' + tableDatas[i].F_Name + '</span>' +
1123
+						'</p>' +
1124
+						'<p>' +
1125
+						'<span>电话</span>' +
1126
+						'<span>' + helper.filter.cutTel(tableDatas[i].F_Telephone) + '</span>' +
1127
+						'</p>' +
1128
+						'<p>' +
1129
+						'<span>是否主要联系人</span>' +
1130
+						'<span>' + (tableDatas[i].F_IsMain === true ? '是' : '否') + '</span>' +
1131
+						'</p>' +
1132
+						'</div>' +
1133
+						'<div class="head_customer_info_item_r pull-left" id="customerBtn_' + i + '">' +
1134
+						// '选择' +
1135
+						'</div>' +
1136
+						'</div>'
1137
+					$('#head_customer_info').append(itmeHtml);
1138
+				}
1139
+				if (tableDatasLength > 0) {
1140
+					$.jqPaginator('#pagination', {
1141
+						totalCounts: returnValue.total,
1142
+						pageSize: 2,
1143
+						currentPage: paramPage,
1144
+						visiblePages: 10,
1145
+						prev: '<li class="prev"><a href="javascript:;">上一页</a></li>',
1146
+						next: '<li class="next"><a href="javascript:;">下一页</a></li>',
1147
+						//page: '<li class="page"><a href="javascript:;">{{page}}</a></li>',
1148
+						onPageChange: function (num, type) {
1149
+							$('#page_number').text(num + "/" + Math.ceil(returnValue.total / 2));
1150
+							//console.log(type + ':' + num);
1151
+							if (type == 'change') {
1152
+								getCustomerLists(num);
1153
+							}
1154
+						}
1155
+					});
1156
+				} else {
1157
+					$('.head_customer_info_title').hide();
1158
+				}
1159
+			} else {
1160
+				$('.head_customer_info_title').hide();
1161
+				$('#head_form_name').val('');//联系人姓名
1162
+				$('#head_form_name').prop('readonly', false);
1163
+			}
1164
+		},
1165
+	});
1166
+}
1167
+
1168
+//保存来电客户信息
1169
+function headFormSave1() {
1170
+	if (!$.trim($('#head_form_name').val())) {
1171
+		layer.confirm('请输入姓名!', {
1172
+			icon: 2,
1173
+			btn: ['确定']
1174
+		});
1175
+		return;
1176
+	}
1177
+	// 	if(!regexs.phone.test($.trim($('#head_form_tel').val()))) {
1178
+	// 		layer.confirm('请输入正确的电话!', {
1179
+	// 			icon: 2,
1180
+	// 			btn: ['确定']
1181
+	// 		});
1182
+	// 		return;
1183
+	// 	}
1184
+
1185
+	$.post(huayi.config.callcenter_url + 'CustomerNew/AddContact', {
1186
+		F_CustomerId: $('#head_form_customer_id').val(),// int客户id
1187
+		F_Name: $('#head_form_name').val(),//string 联系人姓名
1188
+		F_Telephone: phoneNumber,// string电话
1189
+		token: $.cookie("token")
1190
+	}, function (result) {
1191
+		result = $.parseJSON(result);
1192
+		if (result.state.toLowerCase() === "success") {
1193
+			//给 右侧新增工单赋值
1194
+			$('#order_name').val($('#head_form_name').val()); //客户姓名
1195
+			$('#order_company').val($('#head_form_cmpname').val()); //公司名称
1196
+			layer.msg("保存成功");
1197
+		}
1198
+	})
1199
+}

File diff suppressed because it is too large
+ 568 - 535
CallCenterWeb.UI/callScreen/callScreen.html


+ 3 - 3
CallCenterWeb.UI/commonTpl/addOrEditCusInfo.html

@@ -24,9 +24,9 @@
24 24
 						</div>
25 25
 					</li> -->
26 26
 				<li class="form-group">
27
-					<label for="customer_code" class="col-md-2"><b class="text_require">*</b>客户名</label>
27
+					<label for="customer_code" class="col-md-2"><b class="text_require">*</b>客户名</label>
28 28
 					<div class="col-md-9">
29
-						<input id="customer_code" class="form-control" type="text" autocomplete="off" placeholder="请输入客户名" />
29
+						<input id="customer_code" class="form-control" type="text" autocomplete="off" placeholder="请输入客户名" />
30 30
 					</div>
31 31
 				</li>
32 32
 				<li class="form-group">
@@ -36,7 +36,7 @@
36 36
 					</div>
37 37
 				</li>
38 38
 				<li class="form-group">
39
-					<label for="order_source" class="col-md-2">客户类型</label>
39
+					<label for="customer_type" class="col-md-2">客户类型</label>
40 40
 					<div class="col-md-9">
41 41
 						<select class="form-control input-sm selectpicker" id="customer_type" data-live-search="true">
42 42
 							<option value="0">请选择客户类型</option>

+ 1 - 1
CallCenterWeb.UI/commonTpl/cusDetails.html

@@ -25,7 +25,7 @@
25 25
 							<span id="customer_key"></span>
26 26
 						</li> -->
27 27
 				<li class="col-md-3 col-sm-4">
28
-					<label for="customer_code">客户名:</label>
28
+					<label for="customer_code">客户名:</label>
29 29
 					<span id="customer_code"></span>
30 30
 				</li>
31 31
 				<li class="col-md-3 col-sm-4">

+ 2 - 2
CallCenterWeb.UI/keHuManager/customerInfo.html

@@ -58,7 +58,7 @@
58 58
 						<input type="text" class="form-control" id="sc_key" placeholder="请输入关键词" />
59 59
 					</div>
60 60
 					<div class="form-group">
61
-						<input type="text" class="form-control" id="sc_code" placeholder="请输入客户名" />
61
+						<input type="text" class="form-control" id="sc_code" placeholder="请输入客户名" />
62 62
 					</div>
63 63
 					<div class="form-group">
64 64
 						<input type="text" class="form-control" id="sc_legtel" placeholder="请输入客户电话" />
@@ -106,7 +106,7 @@
106 106
 				<thead>
107 107
 					<tr>
108 108
 						<th data-checkbox="true"></th>
109
-						<th data-field="F_CustomerCode" data-align="center">客户名</th>
109
+						<th data-field="F_CustomerCode" data-align="center">客户名</th>
110 110
 						<!-- <th data-field="F_KeyWords" data-align="center">关键词</th> -->
111 111
 						<th data-field="F_LegalTel" data-align="center">客户电话</th>
112 112
 						<th data-field="F_CusType1" data-align="center">客户类型</th>

+ 4 - 4
CallCenterWeb.UI/keHuManager/js/addOrEditCusInfo.js

@@ -42,7 +42,7 @@ function getCustomer(ids) {
42 42
 			$('#customer_bedept').val(data.data && data.data.BeDeptName); // int 客户归属部门
43 43
 			if (cusBase) {
44 44
 				// $('#customer_key').val(cusBase.F_KeyWords); //string 关键词	
45
-				$('#customer_code').val(cusBase.F_CustomerCode); //string 客户名
45
+				$('#customer_code').val(cusBase.F_CustomerCode); //string 客户
46 46
 				$('#customer_lehalTel').val(cusBase.F_LegalTel); //string 客户电话
47 47
 				$('#customer_type').selectpicker('val', cusBase.F_CusType); //string 客户类型
48 48
 				$('#customer_comaddress').val(cusBase.F_CompanyAddress); //string 客户地址
@@ -164,7 +164,7 @@ function saveCustomer() {
164 164
 		data: {
165 165
 			F_CustomerId: edit_id, //	否	string	id
166 166
 			// F_KeyWords: $('#customer_key').val(), //string 关键词	
167
-			F_CustomerCode: $('#customer_code').val(), //string 客户名
167
+			F_CustomerCode: $('#customer_code').val(), //string 客户
168 168
 			F_LegalTel: $('#customer_lehalTel').val(), //string 客户电话
169 169
 			F_CusType: $('#customer_type').val(), //string 客户类型
170 170
 			F_CompanyAddress: $('#customer_comaddress').val(), //string 客户地址
@@ -432,8 +432,8 @@ function valideInput() {
432 432
 	var _that = $(this);
433 433
 	//console.log($(this).attr('id'));
434 434
 	switch ($(this).attr('id')) {
435
-		case 'customer_code': //验证客户名
436
-			valideMethods(_that, regexs.chOrenOrnum, '格式不正确(只能输入中文、英文、数字)!', false);
435
+		case 'customer_code': //验证客户
436
+			valideMethods(_that, regexs.userNameReg, '格式不正确(只能输入2-20位汉字可以包含·•)!', false);
437 437
 			break;
438 438
 		case 'customer_lehalTel': //验证客户电话
439 439
 			valideMethods(_that, regexs.phone, '您输入的电话号码格式不正确!', true);