|
|
@@ -12,16 +12,16 @@ var timestamp = Date.parse(new Date());
|
|
12
|
12
|
var timer, n = 0;
|
|
13
|
13
|
|
|
14
|
14
|
//测试数据
|
|
15
|
|
-//var phoneNumber = "15235457489";
|
|
16
|
|
-//var CallID = "148";
|
|
|
15
|
+var phoneNumber = "15235457489";
|
|
|
16
|
+var CallID = "148";
|
|
17
|
17
|
|
|
18
|
18
|
$(function() {
|
|
19
|
19
|
//初始化一些数据
|
|
20
|
20
|
$(".hidCallID").val(CallID);
|
|
21
|
21
|
|
|
22
|
|
- $(".tel").text(phoneNumber); //左侧来电号码
|
|
23
|
|
- $("#head_form_tel").val(phoneNumber); //左侧电话
|
|
24
|
|
- $("#order_tel").val(phoneNumber); //右侧工单电话
|
|
|
22
|
+ $(".tel").text(helper.filter.cutTel(phoneNumber)); //左侧来电号码
|
|
|
23
|
+ // $("#head_form_tel").val(phoneNumber); //左侧电话
|
|
|
24
|
+ // $("#order_tel").val(phoneNumber); //右侧工单电话
|
|
25
|
25
|
|
|
26
|
26
|
$(".ldtime").text(top.getNowFormatDate()); //左侧来电时间
|
|
27
|
27
|
$(".thsc").text("00:00"); //通话时间
|
|
|
@@ -56,34 +56,35 @@ $(function() {
|
|
56
|
56
|
if(phoneNumber) {
|
|
57
|
57
|
getPhoneLocation(); //获取来电归属地
|
|
58
|
58
|
// 区域 项目 期号三级联动
|
|
59
|
|
- helper.getDropList.getProLocations($('#head_form_rengin'), $('#head_form_pro'), $('#head_form_floor'));
|
|
60
|
|
- helper.getDropList.getProLocations($('#order_rengin'), $('#order_pro'), $('#order_floor'));
|
|
61
|
|
-
|
|
62
|
|
- $('#head_form_rengin').on('change', function() {
|
|
63
|
|
- //清空房间号
|
|
64
|
|
- if($('#head_form_room_select')) {
|
|
65
|
|
- $('#head_form_room_select').empty();
|
|
66
|
|
- $('#head_form_room_input').show().siblings('.bootstrap-select').hide();
|
|
67
|
|
- }
|
|
68
|
|
- });
|
|
69
|
|
- $('#head_form_pro').on('change', function() {
|
|
70
|
|
- //清空房间号
|
|
71
|
|
- if($('#head_form_room_select')) {
|
|
72
|
|
- $('#head_form_room_select').empty();
|
|
73
|
|
- $('#head_form_room_input').show().siblings('.bootstrap-select').hide();
|
|
74
|
|
- }
|
|
75
|
|
- });
|
|
|
59
|
+ // helper.getDropList.getProLocations($('#head_form_rengin'), $('#head_form_pro'), $('#head_form_floor'));
|
|
|
60
|
+ // helper.getDropList.getProLocations($('#order_rengin'), $('#order_pro'), $('#order_floor'));
|
|
|
61
|
+// $('#head_form_rengin').on('change', function() {
|
|
|
62
|
+// //清空房间号
|
|
|
63
|
+// if($('#head_form_room_select')) {
|
|
|
64
|
+// $('#head_form_room_select').empty();
|
|
|
65
|
+// $('#head_form_room_input').show().siblings('.bootstrap-select').hide();
|
|
|
66
|
+// }
|
|
|
67
|
+// });
|
|
|
68
|
+// $('#head_form_pro').on('change', function() {
|
|
|
69
|
+// //清空房间号
|
|
|
70
|
+// if($('#head_form_room_select')) {
|
|
|
71
|
+// $('#head_form_room_select').empty();
|
|
|
72
|
+// $('#head_form_room_input').show().siblings('.bootstrap-select').hide();
|
|
|
73
|
+// }
|
|
|
74
|
+// });
|
|
76
|
75
|
|
|
77
|
76
|
//监听期号的改变 获取房间号 下拉或输入框
|
|
78
|
|
- $('#head_form_floor').on('change', getRoomNumber);
|
|
79
|
|
-
|
|
80
|
|
- getCustomerLists(1); //获取来电客户信息
|
|
|
77
|
+ // $('#head_form_floor').on('change', getRoomNumber);
|
|
|
78
|
+ getCustomer(); //获取来电客户信息
|
|
81
|
79
|
}
|
|
|
80
|
+ //根据关键词搜索公司
|
|
|
81
|
+ $('#companySearch').on('click', getSearchCustomer);
|
|
82
|
82
|
|
|
83
|
83
|
//保存来电客户信息
|
|
84
|
84
|
$('#head_form_btn_save').on('click', headFormSave);
|
|
|
85
|
+
|
|
85
|
86
|
//清空来电客户信息
|
|
86
|
|
- $('#head_form_btn_reset').on('click', headFormReset);
|
|
|
87
|
+ // $('#head_form_btn_reset').on('click', headFormReset);
|
|
87
|
88
|
|
|
88
|
89
|
//点击IVR
|
|
89
|
90
|
$('#head_black_ivr').click(function() {
|
|
|
@@ -251,22 +252,80 @@ function getPhoneLocation() {
|
|
251
|
252
|
});
|
|
252
|
253
|
}
|
|
253
|
254
|
|
|
|
255
|
+//根据关键词搜索公司
|
|
|
256
|
+function getSearchCustomer() {
|
|
|
257
|
+ $.ajax({
|
|
|
258
|
+ url: huayi.config.callcenter_url + 'CustomerNew/GetListByKey',
|
|
|
259
|
+ type: 'get',
|
|
|
260
|
+ data: {
|
|
|
261
|
+ keywords: $('#head_form_search').val(),// 关键词
|
|
|
262
|
+ token: $.cookie("token")
|
|
|
263
|
+ },
|
|
|
264
|
+ dataType: "json",
|
|
|
265
|
+ async: true,
|
|
|
266
|
+ success: function(data) {
|
|
|
267
|
+ if(data.state.toLowerCase() === 'success') {
|
|
|
268
|
+ var customerBase = data.data;
|
|
|
269
|
+ if(customerBase){
|
|
|
270
|
+ $('#head_form_cmpname').val(customerBase.F_CompanyName);//公司名称
|
|
|
271
|
+ $('#head_form_cmpaddress').val(customerBase.F_CompanyAddress);//公司地址
|
|
|
272
|
+ $('#head_form_legname').val(customerBase.F_LegalName);//法人姓名
|
|
|
273
|
+ $('#head_form_legtel').val(helper.filter.cutTel(customerBase.F_LegalTel));//法人电话
|
|
|
274
|
+ $('#head_form_subtrade').val(customerBase.F_SubTrade);//所属行业
|
|
|
275
|
+ //获取对应的联系人信息
|
|
|
276
|
+ getCustomerLists(1, customerBase.F_CustomerId);
|
|
|
277
|
+ }
|
|
|
278
|
+ }
|
|
|
279
|
+ },
|
|
|
280
|
+ });
|
|
|
281
|
+}
|
|
|
282
|
+
|
|
254
|
283
|
/**
|
|
255
|
284
|
* 根据电话获取 客户信息
|
|
|
285
|
+ * */
|
|
|
286
|
+ function getCustomer(){
|
|
|
287
|
+ $.ajax({
|
|
|
288
|
+ url: huayi.config.callcenter_url + 'CustomerNew/GetCustomerByTel',
|
|
|
289
|
+ type: 'get',
|
|
|
290
|
+ data: {
|
|
|
291
|
+ tel: phoneNumber, //否 string 来电电话 例如:13663801989
|
|
|
292
|
+ token: $.cookie("token")
|
|
|
293
|
+ },
|
|
|
294
|
+ dataType: "json",
|
|
|
295
|
+ async: true,
|
|
|
296
|
+ success: function(data) {
|
|
|
297
|
+ if(data.state.toLowerCase() === 'success') {
|
|
|
298
|
+ var customerBase = data.data.CustomerBase;
|
|
|
299
|
+ if(customerBase){
|
|
|
300
|
+ $('#head_form_customer_id').val(customerBase.F_CustomerId); //客户id
|
|
|
301
|
+ $('#head_form_cmpname').val(customerBase.F_CompanyName);//公司名称
|
|
|
302
|
+ $('#head_form_cmpaddress').val(customerBase.F_CompanyAddress);//公司地址
|
|
|
303
|
+ $('#head_form_legname').val(customerBase.F_LegalName);//法人姓名
|
|
|
304
|
+ $('#head_form_legtel').val(helper.filter.cutTel(customerBase.F_LegalTel));//法人电话
|
|
|
305
|
+ $('#head_form_subtrade').val(customerBase.F_SubTrade);//所属行业
|
|
|
306
|
+ //获取对应的联系人信息
|
|
|
307
|
+ getCustomerLists(1, customerBase.F_CustomerId);
|
|
|
308
|
+ }
|
|
|
309
|
+ }
|
|
|
310
|
+ },
|
|
|
311
|
+ });
|
|
|
312
|
+ }
|
|
|
313
|
+
|
|
|
314
|
+/**
|
|
|
315
|
+ * 根据电话获取 客户联系人列表
|
|
256
|
316
|
* paramPage: 页数请求的是第几页
|
|
|
317
|
+ * cid: 客户的id
|
|
257
|
318
|
* */
|
|
258
|
|
-function getCustomerLists(paramPage) {
|
|
|
319
|
+function getCustomerLists(paramPage, cid) {
|
|
259
|
320
|
$('#head_customer_info').html('');
|
|
260
|
321
|
$.ajax({
|
|
261
|
|
- url: huayi.config.callcenter_url + 'Customer/GetCustomerListByTel',
|
|
|
322
|
+ url: huayi.config.callcenter_url + 'CustomerNew/GetConList',
|
|
262
|
323
|
type: 'get',
|
|
263
|
324
|
data: {
|
|
264
|
|
- page: paramPage, //第几页
|
|
|
325
|
+ cusid: cid, //客户id
|
|
|
326
|
+ pageindex: paramPage, //第几页
|
|
265
|
327
|
pagesize: 2,
|
|
266
|
328
|
tel: phoneNumber, //否 string 来电电话 例如:13663801989
|
|
267
|
|
- //areaid: , //否 int 区域id
|
|
268
|
|
- //categoryid ,//否 int 所购项目id
|
|
269
|
|
- //buldingid ,//否 int 期号
|
|
270
|
329
|
token: $.cookie("token")
|
|
271
|
330
|
},
|
|
272
|
331
|
dataType: "json",
|
|
|
@@ -282,39 +341,38 @@ function getCustomerLists(paramPage) {
|
|
282
|
341
|
'<div class="head_customer_info_item_l pull-left">' +
|
|
283
|
342
|
'<p class="clearfix">' +
|
|
284
|
343
|
'<span>姓名</span>' +
|
|
285
|
|
- '<span>' + tableDatas[i].F_CustomerName + '</span>' +
|
|
286
|
|
- '<span class="pull-right">' + tableDatas[i].F_Mobile + '</span>' +
|
|
|
344
|
+ '<span>' + tableDatas[i].F_Name + '</span>' +
|
|
287
|
345
|
'</p>' +
|
|
288
|
346
|
'<p>' +
|
|
289
|
|
- '<span>项目</span>' +
|
|
290
|
|
- //tableDatas[i].areaname 区域
|
|
291
|
|
- '<span>' + tableDatas[i].regionname + ' ' + tableDatas[i].buldingname + '</span>' +
|
|
|
347
|
+ '<span>电话</span>' +
|
|
|
348
|
+ '<span>' + helper.filter.cutTel(tableDatas[i].F_Telephone) + '</span>' +
|
|
292
|
349
|
'</p>' +
|
|
293
|
350
|
'<p>' +
|
|
294
|
|
- '<span>房间</span>' +
|
|
295
|
|
- '<span>' + tableDatas[i].F_BusinessLicenseID + '</span>' +
|
|
|
351
|
+ '<span>是否主要联系人</span>' +
|
|
|
352
|
+ '<span>' + (tableDatas[i].F_IsMain === true ? '是' : '否') + '</span>' +
|
|
296
|
353
|
'</p>' +
|
|
297
|
354
|
'</div>' +
|
|
298
|
|
- '<div class="head_customer_info_item_r pull-left" id="customerBtn_' + i + '">选择' +
|
|
|
355
|
+ '<div class="head_customer_info_item_r pull-left" id="customerBtn_' + i + '">'+
|
|
|
356
|
+ // '选择' +
|
|
299
|
357
|
'</div>' +
|
|
300
|
358
|
'</div>'
|
|
301
|
359
|
$('#head_customer_info').append(itmeHtml);
|
|
302
|
|
- $('#customerBtn_' + i).on('click', function() {
|
|
303
|
|
- if($(this).parent().hasClass('head_customer_info_item_active')) {
|
|
304
|
|
- //点击取消
|
|
305
|
|
- $(this).parent().removeClass('head_customer_info_item_active');
|
|
306
|
|
- $(this).text('选择');
|
|
307
|
|
- //清空 head_form
|
|
308
|
|
- headFormClean();
|
|
309
|
|
- } else {
|
|
310
|
|
- //点击选择
|
|
311
|
|
- $(this).parent().addClass('head_customer_info_item_active').siblings().removeClass('head_customer_info_item_active');
|
|
312
|
|
- $(this).text('取消');
|
|
313
|
|
- $(this).parent().siblings().find('.head_customer_info_item_r').text('选择');
|
|
314
|
|
- //给 head_form 赋值
|
|
315
|
|
- setHeadForm(tableDatas, $(this).attr('id').split('customerBtn_')[1]);
|
|
316
|
|
- }
|
|
317
|
|
- });
|
|
|
360
|
+// $('#customerBtn_' + i).on('click', function() {
|
|
|
361
|
+// if($(this).parent().hasClass('head_customer_info_item_active')) {
|
|
|
362
|
+// //点击取消
|
|
|
363
|
+// $(this).parent().removeClass('head_customer_info_item_active');
|
|
|
364
|
+// $(this).text('选择');
|
|
|
365
|
+// //清空 head_form
|
|
|
366
|
+// headFormClean();
|
|
|
367
|
+// } else {
|
|
|
368
|
+// //点击选择
|
|
|
369
|
+// $(this).parent().addClass('head_customer_info_item_active').siblings().removeClass('head_customer_info_item_active');
|
|
|
370
|
+// $(this).text('取消');
|
|
|
371
|
+// $(this).parent().siblings().find('.head_customer_info_item_r').text('选择');
|
|
|
372
|
+// //给 head_form 赋值
|
|
|
373
|
+// setHeadForm(tableDatas, $(this).attr('id').split('customerBtn_')[1]);
|
|
|
374
|
+// }
|
|
|
375
|
+// });
|
|
318
|
376
|
}
|
|
319
|
377
|
if(tableDatasLength > 0) {
|
|
320
|
378
|
$.jqPaginator('#pagination', {
|
|
|
@@ -333,7 +391,7 @@ function getCustomerLists(paramPage) {
|
|
333
|
391
|
}
|
|
334
|
392
|
}
|
|
335
|
393
|
});
|
|
336
|
|
- $('#customerBtn_0').trigger('click');
|
|
|
394
|
+ // $('#customerBtn_0').trigger('click');
|
|
337
|
395
|
} else {
|
|
338
|
396
|
$('.head_customer_info_title').hide();
|
|
339
|
397
|
}
|
|
|
@@ -401,7 +459,6 @@ function headFormClean() {
|
|
401
|
459
|
|
|
402
|
460
|
//保存来电客户信息
|
|
403
|
461
|
function headFormSave() {
|
|
404
|
|
- var roomNum;
|
|
405
|
462
|
if(!$.trim($('#head_form_name').val())) {
|
|
406
|
463
|
layer.confirm('请输入姓名!', {
|
|
407
|
464
|
icon: 2,
|
|
|
@@ -409,61 +466,22 @@ function headFormSave() {
|
|
409
|
466
|
});
|
|
410
|
467
|
return;
|
|
411
|
468
|
}
|
|
412
|
|
- if(!regexs.phone.test($.trim($('#head_form_tel').val()))) {
|
|
413
|
|
- layer.confirm('请输入正确的电话!', {
|
|
414
|
|
- icon: 2,
|
|
415
|
|
- btn: ['确定']
|
|
416
|
|
- });
|
|
417
|
|
- return;
|
|
418
|
|
- }
|
|
419
|
|
-
|
|
420
|
|
- if($('#head_form_pro').val() === '0') {
|
|
421
|
|
- layer.confirm('请选择项目!', {
|
|
422
|
|
- icon: 2,
|
|
423
|
|
- btn: ['确定']
|
|
424
|
|
- });
|
|
425
|
|
- return;
|
|
426
|
|
- }
|
|
|
469
|
+// if(!regexs.phone.test($.trim($('#head_form_tel').val()))) {
|
|
|
470
|
+// layer.confirm('请输入正确的电话!', {
|
|
|
471
|
+// icon: 2,
|
|
|
472
|
+// btn: ['确定']
|
|
|
473
|
+// });
|
|
|
474
|
+// return;
|
|
|
475
|
+// }
|
|
427
|
476
|
|
|
428
|
|
- if($('#head_form_room_input').is(':visible')) {
|
|
429
|
|
- roomNum = $('#head_form_room_input').val();
|
|
430
|
|
- } else {
|
|
431
|
|
- roomNum = $('#head_form_room_select').val();
|
|
432
|
|
- }
|
|
433
|
|
- $.post(huayi.config.callcenter_url + 'Customer/AddCustomer', {
|
|
434
|
|
- F_CustomerId: $('#head_form_customer_id').val(), //是 string id
|
|
435
|
|
- F_CustomerName: $('#head_form_name').val(), // 是 string 姓名/联系人
|
|
436
|
|
- F_Mobile: $('#head_form_tel').val(), //否 string 手机号码
|
|
437
|
|
- F_Layer: $('#head_form_rengin').val(), //否 string 区域id
|
|
438
|
|
- F_CategoryId: $('#head_form_pro').val(), //否 string 所购项目id
|
|
439
|
|
- F_CustomerType: $('#head_form_floor').val(), //否 string 期号id
|
|
440
|
|
- F_CustomerNature: $('#head_form_buildingnum').val(), //楼号
|
|
441
|
|
- F_CustomerClass: $('#head_form_unitnum').val(), //单元号
|
|
442
|
|
- F_BusinessLicenseID: roomNum, //否 string 所购楼层信息 (房间号)
|
|
|
477
|
+ $.post(huayi.config.callcenter_url + 'CustomerNew/AddContact', {
|
|
|
478
|
+ F_CustomerId: $('#head_form_customer_id').val(),// int客户id
|
|
|
479
|
+ F_Name: $('#head_form_name').val(),//string 联系人姓名
|
|
|
480
|
+ F_Telephone: phoneNumber,// string电话
|
|
443
|
481
|
token: $.cookie("token")
|
|
444
|
482
|
}, function(result) {
|
|
445
|
483
|
result = $.parseJSON(result);
|
|
446
|
|
- if(result.state.toLowerCase() == "success") {
|
|
447
|
|
- $('#head_form_customer_id').val(result.data.F_CustomerId); //客户id
|
|
448
|
|
- //进入历史工单 新增工单页面
|
|
449
|
|
- //$('.ld-service').find('li.KF').trigger('click');
|
|
450
|
|
- //赋值
|
|
451
|
|
- $('#order_name').val($('#head_form_name').val()); //客户姓名
|
|
452
|
|
- $('#order_tel').val($('#head_form_tel').val()); //电话
|
|
453
|
|
- $('#order_rengin').selectpicker('val', $('#head_form_rengin').val()).trigger('change'); //区域
|
|
454
|
|
- $('#order_pro').selectpicker('val', $('#head_form_pro').val()).trigger('change'); //项目
|
|
455
|
|
- $('#order_floor').selectpicker('val', $('#head_form_floor').val()).trigger('change'); //期号
|
|
456
|
|
- $('#order_buildingnum').val($('#head_form_buildingnum').val()); //楼号
|
|
457
|
|
- $('#order_unitnum').val($('#head_form_unitnum').val()); //单元号
|
|
458
|
|
-
|
|
459
|
|
- if($("#head_form_room_select").is(":hidden")) {
|
|
460
|
|
- $('#order_room').val($('#head_form_room_input').val()); //房间号
|
|
461
|
|
- } else {
|
|
462
|
|
- $('#order_room').val($('#head_form_room_select').val()); //房间号
|
|
463
|
|
- }
|
|
464
|
|
- //获取业主信息
|
|
465
|
|
- getOwnerInformation();
|
|
466
|
|
-
|
|
|
484
|
+ if(result.state.toLowerCase() === "success") {
|
|
467
|
485
|
layer.msg("保存成功");
|
|
468
|
486
|
}
|
|
469
|
487
|
})
|