var typeSmall; $(document).ready(function () { $.ajax({ type: "get", url: huayi.config.callcenter_url + "CallInScreen/GetCurrUserDep", dataType: 'json', async: false, data: { token: $.cookie("token") }, success: function(data) { if(data.state.toLowerCase() == 'success') { if(data.data.groname == '思念组') { $(".snRmove").remove(); $(".dkRmove").show(); } else { $(".snRmove").show(); $(".dkRmove").remove(); } } } }); var groupcode = $('#groupcode', top.document).val(); if (groupcode == 'SCZ') { $("#usedate").text("饮用日期:"); $("#vipid").text("对接人:"); $("#vipphone").text("对接人电话:"); } var id = helper.request.queryString("id"); var phone = helper.request.queryString("phone"); var name = helper.request.queryString("name"); laydate.render({ elem: '.userDate', theme: '#1ab394', calendar: 'true' }); laydate.render({ elem: '.buyDate', theme: '#1ab394', calendar: 'true' }); laydate.render({ elem: '#productDate', theme: '#1ab394', calendar: 'true' }); //工单来源 getOrderSource(); //工单类型 getOrderType(); //投诉类型 complaintType(); //咨询类型 consultType(); //产品类别 getProductType(); //区域 getAreaType(); //客诉专员 ComplaintVip(); ////编辑器配置 客服部 //KindEditor.ready(function(K) { // window.changeEditor = K.create('#feedBackCon'); //修改弹出框编辑器 //}) ////编辑器配置 市场部 备注 //KindEditor.ready(function(K) { // window.marketEditor = K.create('#remark_market'); //}) //保存 $('.customerSubmit').click(function() { //alert(typeSmall); saveCustomer(); }) if(id) { $("#CallID").val(id); $("#tel").val(phone); $("#tel_market").val(phone); if(unescape(decodeURI(name)) != 'null' && unescape(decodeURI(name)) != 'undefined') { $("#name_market").val(unescape(decodeURI(name))); $("#name").val(unescape(decodeURI(name))); } } $('.areaDown').click(function () { if ($('.treeList1').css('display') == 'block') { $('.treeList1').css('display', 'none') } else { $('.treeList1').css('display', 'block') } }) $('#typeclass').click(function () { $('.treeList1').css('display', 'block') }) $('.treeList1').mouseleave(function () { $(this).css('display', 'none') }) $(".orderType").change(function () { if ($(".orderType option:selected").text() != "投诉") { $(".complainDiv2").show(); typeSmall =$(".complaintType2").val(); $(".complainDiv").hide(); } else { $(".complainDiv2").hide(); $(".complainDiv").show(); typeSmall =$(".complaintType1").val(); } }); $(".complaintType2").change(function () { typeSmall=$(".complaintType2").val(); }); $(".complaintType1").change(function () { typeSmall=$(".complaintType1").val(); }); //获取专员手机号 $("#vipName").change(function () { $("#vipTel").val($("#vipName option:selected").attr("index")); if ($("#vipName option:selected").attr("province")==undefined) { $("#typeclass").val(""); }else{ $("#typeclass").val($("#vipName option:selected").attr("province") + "/" + $("#vipName option:selected").attr("city")); $(".inps2").val($("#vipName option:selected").attr("province")); $(".inps3").val($("#vipName option:selected").attr("city")); } }); }) //工单类型 function getOrderType() { $.get(huayi.config.callcenter_url + 'Dictionary/GetDicValueListByFlag', { "token": $.cookie("token"), flag: "GDLX" }, function(result) { result = $.parseJSON(result); var Count = result.data; $(Count).each(function(i, n) { $('').appendTo($(".orderType")); }) }); } //投诉类型 function complaintType() { $.get(huayi.config.callcenter_url + 'Dictionary/GetDicValueListByFlag', { "token": $.cookie("token"), flag: "TSLX" }, function(result) { result = $.parseJSON(result); var Count = result.data; $(Count).each(function(i, n) { $('').appendTo($(".complaintType1")); }) typeSmall=$(".complaintType1").val(); }); } //咨询类型 function consultType() { $.get(huayi.config.callcenter_url + 'Dictionary/GetDicValueListByFlag', { "token": $.cookie("token"), flag: "ZXLX" }, function(result) { result = $.parseJSON(result); var Count = result.data; $(Count).each(function(i, n) { $('').appendTo($(".complaintType2")); }) }); } //产品类别 function getProductType() { $.get(huayi.config.callcenter_url + 'Dictionary/GetDicValueListByFlag', { "token": $.cookie("token"), flag: "CPLB" }, function(result) { result = $.parseJSON(result); var Count = result.data; $(Count).each(function(i, n) { $('').appendTo($(".productType")); }) }); } //区域 function getAreaType() { $.get(huayi.config.callcenter_url + 'Area/GetAreaList', { "token": $.cookie("token"), }, function(result) { result = $.parseJSON(result); $.fn.zTree.init($("#TreeDemo1"), setting, result.data); //实例化树形图 }); } var setting = { data: { key: { name: "F_AreaName" }, simpleData: { enable: true, idKey: "F_Id", pIdKey: "F_ParentId", rootPId: 0 } }, callback: { onClick: changeTreeClick } } function changeTreeClick(event, treeId, treeNode) { var areaParent = treeNode.getPath(); if (areaParent[1]) { areaParent1=areaParent[0].F_AreaName areaParent2=areaParent[1].F_AreaName $('#typeclass').val(areaParent1+"/"+areaParent2); $('.inps2').val(areaParent1); $('.inps3').val(areaParent2); ComplaintVip(); }else{ layer.msg("请选择最下级菜单"); } $('.addTree1').hide(); }; //工单来源 function getOrderSource(obj) { $.ajax({ type: "get", url: huayi.config.callcenter_url + "Dictionary/GetDicValueListByFlag", dataType: 'json', async: true, data: { token: $.cookie("token"), flag: "GDLY" }, success: function(data) { var Count = data.data; $(Count).each(function(i, n) { $('').appendTo($("#DicValueList")); }) } }); } //客诉专员 function ComplaintVip() { $.ajax({ type: "get", url: huayi.config.callcenter_url + "Customer/GetAllList", dataType: 'json', async: true, data: { token: $.cookie("token"), type: 2, province: $('.inps2').val(), //省 city: $('.inps3').val() //市 }, success: function(data) { $("#vipName").empty(); var Count = data.data; $('').appendTo($("#vipName")); $(Count).each(function (i, n) { $('').appendTo($("#vipName")); }) } }); } //保存 function saveCustomer() { if(!$('#name').val()) { layer.confirm('请输入姓名!', { icon: 2, btn: ['确定'] }); return; } if(!$('#tel').val()) { layer.confirm('请输入电话!', { icon: 2, btn: ['确定'] }); return; } if(!$('#DicValueList').val()) { layer.confirm('请选择工单来源!', { icon: 2, btn: ['确定'] }); return; } if (!$('.orderType').val()) { layer.confirm('请选择工单类型!', { icon: 2, btn: ['确定'] }); return; } $.ajax({ type: "post", url: huayi.config.callcenter_url + "WorkOrder/AddWorkOrder", dataType: 'json', async: true, beforeSend: function() { //触发ajax请求开始时执行 $('.customerSubmit').attr("disabled", true); $('.customerSubmit').text('保存中...'); }, data: { token: $.cookie("token"), cusname: $('#name').val(), //姓名 cusphone: $('#tel').val(), //号码 productdate: $('#productDate').val(), //生产日期 buydate: $('.buyDate').val(), //购买日期 productname: $('#productname').val(), //产品名称 buyaddress: $('#buyAddress').val(), //购买地址 producttype: $('#productType').val(), //产品类别 batchnumber: $('#batchNumber').val(), //生产批号 userdate: $('.userDate').val(), //使用日期 userDate source: $('#DicValueList').val(), //工单来源 type: $('.orderType').val(), //工单类型id smalltype:typeSmall, //投诉类型 area: $('#areaInps').val(), //区域 province: $('.inps2').val(), //省 city: $('.inps3').val(), //市 county:$('#county').val(), //区县 content:$('#content').val(), //事件描述 vipid: $('#vipName').val(), //专员id vipname:$('#vipNameDK').val(), vipphone: $('#vipTel').val(), //专员号码 isback: $('input[name="sendBack"]:checked').val(), remark:$('#remark').val(), callid: $("#CallID").val() }, success: function(data) { if(data.state.toLowerCase() == 'success') { layer.msg("保存成功!"); debugger window.location.reload() $('.customerSubmit').attr("disabled", false); $('.customerSubmit').text('保存'); } } }); } function clear() { $('#name').val(''); $('#tel').val(''); //号码 $('#orderSource').val(''); //工单来源 $('#typeclassId').val(''); //工单类型id $('.orderType').val(''); //工单状态id $('.DicValueList').val(''); //反馈内容 $('.buyDate').val(''); //快递信息 $('#productDate').val(''); //快递信息 $('#productname').val(''); //备注一 $('#buyAddress').val(''); //备注二 $('#productType').val(''); //备注三 $('#batchNumber').val(''); $('.userDate').val(''); $('.smalltype').val(''); $('.inps2').val(''); $('.inps3').val(''); $('#content').val(''); $('#vipName').val(''); $('#vipTel').val(''); $('#CallID').val(''); }