var ns; var id = helper.request.queryString("id"); var phone = helper.request.queryString("phone"); var objs = {}; laydate.render({ elem: '#userDate', theme: '#1ab394', calendar: 'true' //type: 'datetime', //max : 31, //min: 0, }); laydate.render({ elem: '#buyAddress', theme: '#1ab394', calendar: 'true' //type: 'datetime', //max : 31, //min: 0, }); laydate.render({ elem: '#proDuctdate', theme: '#1ab394', calendar: 'true' //type: 'datetime', //max : 31, //min: 0, }); $.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 == '思念组') { $('.customerService').show(); $('.market').remove(); ns = 1; } else { $('.market').show(); $('.customerService').remove(); ns = 2; } } } }); if(id) { $("#tel").val(phone); $("#tel_market").val(phone); $("#CallID").val(id); } $('#testInput1').comboSelect(); $('#testInput2').comboSelect(); $('#testInput3').comboSelect(); $('#testInput4').comboSelect(); $(function() { GDLY(); //工单来源 State(); //工单状态 getOrderType(); //工单类型 getOrderType1(); ComplaintVip();//客诉专员 //保存 $('.customerSubmit').click(function() { saveCustomer(); }); $('.marketSubmit').click(function() { saveMarket(); }); }) //编辑器配置 KindEditor.ready(function(K) { XQ(); }) //编辑器配置 KindEditor.ready(function(K) { window.changeMarket = K.create('#remark_market'); //修改弹出框编辑器 }) // XQ(); // }) //工单状态 function State() { $.ajax({ url: huayi.config.callcenter_url + "Dictionary/GetDicValueListByFlag", type: 'get', async: false, data: { flag: 'GDZT', token: $.cookie("token") }, dataType: "json", success: function(res) { if(res.state == "success") { $(res.data).each(function(i, n) { $('').appendTo($("#State")); }) // } } }) } //客诉专员 function ComplaintVip() { var customerType; if(ns==1){ customerType=2 }else if(ns==2){ customerType=1 } $.ajax({ type: "get", url: huayi.config.callcenter_url + "Customer/GetAllList", dataType: 'json', async: true, data: { token: $.cookie("token"), type: customerType }, success: function(data) { var Count = data.data; if (ns==1) { $(Count).each(function(i, n) { $('').appendTo($("#vipName")); }) } else if(ns==2){ $(Count).each(function(i, n) { $('').appendTo($("#customerName")); }) } } }); } //获取专员手机号 $("#vipName").change(function() { $("#vipTel").val($("#vipName option:selected").attr("index")); }); $("#customerName").change(function() { $("#customerTel").val($("#customerName option:selected").attr("index")); }); //工单来源 function GDLY() { $.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; $('').appendTo($("#DicValueList")); $(Count).each(function(i, n) { if(n.F_DictionaryValueId == "468") { $('').appendTo($("#DicValueList")); $('').appendTo($("#DicValueList_market")); } else { $('').appendTo($("#DicValueList")); $('').appendTo($("#DicValueList_market")); } }) } }); } //获取详情 function XQ() { $.ajax({ type: "get", url: huayi.config.callcenter_url + "WorkOrder/GetWorkOrder", dataType: 'json', async: true, cache: false, data: { "workid": id, "token": $.cookie("token") }, success: function(result) { if(result.data.data.length > 0) { var data = result.data.data[0]; $('#name').val(data.F_CusName); //姓名 $('#tel').val(data.F_CusPhone); //号码 $('#proDuctdate').val(data.F_ProductDate); //购买日期 $('#buyDate').val(data.F_BuyDate); //购买日期 $('#productname').val(data.F_ProductName); //产品名称 $('#buyAddress').val(data.F_BuyAddress); //购买地址 data. $('#productType').val(data.F_ProductType); //产品类别 $('#batchNumber').val(data.F_BatchNumber); //生产批号 $('#userDate').val(data.F_UserDate); //使用日期 $('#DicValueList option:selected').text(data.SourceName); //工单来源 $('#typeclass').val(data.TypeName); //工单类型id $('#typeclass1').val(data.F_Area+"/"+data.F_Province+"/"+data.F_City); //区域 $('.inps2').val(data.F_Area); //区域 $('.inps3').val(data.F_Province); //省 $('.inps4').val(data.F_City); //市 $('#content').val(data.F_Content); //事件描述 $('#vipName option:selected').text(data.F_VIPName); //专员姓名 $('#vipTel').val(data.F_VIPPhone); //专员号码 $('#customerName option:selected').text(data.F_VIPName); //专员姓名 $('#customerTel').val(data.F_VIPPhone); //专员号码 } } }); } //工单类型 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) { if(ns==1){ if(n.F_DictionaryValueId == "468") { $('').appendTo($(".orderType1")); } else { $('').appendTo($(".orderType1")); } }else if(ns==2){ if(n.F_DictionaryValueId == "468") { $('').appendTo($(".orderType2")); } else { $('').appendTo($(".orderType2")); } } }) }); } //区域 function getOrderType1() { $.get(huayi.config.callcenter_url + 'Area/GetAreaList', { // $.get('http://192.168.4.18:4625/Area/GetAreaList', { "token": $.cookie("token"), }, function(result) { result = $.parseJSON(result); $.fn.zTree.init($("#TreeDemo1"), setting4, result.data); //实例化树形图 $.fn.zTree.init($("#TreeDemo_market1"), setting4, result.data); //实例化树形图 }); } var setting4 = { data: { key: { name: "F_AreaName" }, simpleData: { enable: true, idKey: "F_Id", pIdKey: "F_ParentId", rootPId: 0 } }, callback: { onClick: changeTreeClick1 } } function changeTreeClick1(event, treeId, treeNode) { chanId = treeNode.F_Id; changeName = treeNode.F_AreaName; areaParent = treeNode.getPath(); if(areaParent[2]) { areaParent1 = areaParent[0].F_AreaName areaParent2 = areaParent[1].F_AreaName areaParent3 = areaParent[2].F_AreaName $('#typeclass1').val(areaParent1 + "/" + areaParent2 + "/" + areaParent3); $('#typeclass_market1').val(areaParent1 + "/" + areaParent2 + "/" + areaParent3); $('.inps2').val(areaParent1); $('.inps3').val(areaParent2); $('.inps4').val(areaParent3); } else { layer.msg("请选择最下级菜单"); } $('.addTree1').hide(); }; $('.areaDown').click(function() { if($('.treeList1').css('display') == 'block') { $('.treeList1').css('display', 'none') } else { $('.treeList1').css('display', 'block') } }) $('#typeclass1').click(function() { $('.treeList1').css('display', 'block') }) $('.treeList1').mouseleave(function() { $(this).css('display', 'none') }) $('#typeclass_market1').click(function() { $('.treeList_market1').css('display', 'block') }) $('.treeList_market1').mouseleave(function() { $(this).css('display', 'none') }) //客服部保存 function saveCustomer() { $.ajax({ type: "post", url: huayi.config.callcenter_url + "WorkOrder/EditWorkOrder", dataType: 'json', async: true, data: { token: $.cookie("token"), workid: id, cusname: $('#name').val(), //姓名 cusphone: $('#tel').val(), //号码 buydate: $('#buyDate').val(), //购买日期 productname: $('#productname').val(), //产品名称 buyaddress: $('#buyAddress').val(), //购买地址 producttype: $('#productType').val(), //产品类别 batchnumber: $('#batchNumber').val(), //生产批号 userdate: $('#userDate').val(), //使用日期 userDate source: $('#DicValueList').val(), //工单来源 type: $('.orderType1').val(), //工单类型id area: $('.inps2').val(), //区域 province: $('.inps3').val(), //省 city: $('.inps4').val(), //市 content:$('#content').val(), //事件描述 vipid: $('#vipName').val(), //专员号码 vipphone: $('#vipTel').val(), //专员号码 callid: $("#CallID").val() }, success: function(data) { if(data.state.toLowerCase() == 'success') { layer.msg("保存成功!"); var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引 parent.layer.close(index); //再执行关闭 parent.$('#workorderlist').bootstrapTable('refresh'); parent.layer.msg("修改成功!"); //clear(); } } }); } //市场部保存 function saveMarket() { alert("dfd"); if($('#name_market').val() == '') { layer.confirm('请输入姓名!', { icon: 2, btn: ['确定'] }); return; } if($('#tel_market').val() == '') { layer.confirm('请输入电话!', { icon: 2, btn: ['确定'] }); return; } if($('#testInput3_input').val() == '') { layer.confirm('请选择来电单位!', { icon: 2, btn: ['确定'] }); return; } $.ajax({ type: "post", url: huayi.config.callcenter_url + "WorkOrder/EditWorkOrder", dataType: 'json', async: true, data: { token: $.cookie("token"), workid: id, cusname: $('#name').val(), //姓名 cusphone: $('#tel').val(), //号码 area: $('.inps2').val(), //区域 vipid: $("#customerName").val(), //专员id vipphone:$("#customerTel").val(), //专员号码 source: $('#DicValueList').val(), //工单来源 productname: $('#productname').val(), //产品名称 batchnumber: $('#batchNumber').val(), //生产批号 buyaddress: $('#buyAddress').val(), //购买地址 productdate: $('#proDuctdate').val(), buydate: $('.buyDate').val(), //购买日期 userdate: $('.userDate').val(), //使用日期 userDate type: $('.orderType2').val(), //工单类型id province: $('.inps3').val(), //省 city: $('.inps4').val(), //市 content:$('#content').val(), //事件描述 isback:$("#sendBack").val(), callid: $("#CallID").val() }, success: function(data) { if(data.state.toLowerCase() == 'success') { layer.msg("保存成功!"); var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引 parent.layer.close(index); //再执行关闭 parent.$('#workorderlist_').bootstrapTable('refresh'); parent.layer.msg("修改成功!"); //clear(); } } }); } function clear() { if(ns == 1) { $('#name').val(''); $('#tel').val(''); //号码 $('#testInput1_input').val(''); //来电单位 $('#testInput2_input').val(''); //反馈单位 $('#orderSource').val(''); //工单来源 $('#typeclassId').val(''); //工单类型id $('#State').val(''); //工单状态id $('#express').val(''); //快递信息 $('#remark1').val(''); //备注一 $('#remark2').val(''); //备注二 $('#remark3').val(''); //备注三 } else { $('#name_market').val(''); $('#tel_market').val(''); //号码 $('#testInput3_input').val(''); //来电单位 $('#testInput4_input').val(''); //反馈单位 $('#typeclassId_market').val(''); //工单类型id // $('#remark_market').val(''); //备注内容 } }