var typeSmall; var id = helper.request.queryString("id"); $(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(); $(".complainDiv2").hide(); $(".dkRmove").remove(); $(".ns-2").remove(); } } } }); var groupcode = $('#groupcode', top.document).val(); if (groupcode == 'SCZ') { $("#usedate").text("饮用日期:"); $("#vipid").text("对接人:"); $("#vipphone").text("对接人电话:"); } laydate.render({ elem: '.userDate', theme: '#1ab394', calendar: 'true' }); laydate.render({ elem: '.buyDate', theme: '#1ab394', calendar: 'true' }); laydate.render({ elem: '#productDate', theme: '#1ab394', calendar: 'true' }); $.ajaxSettings.async = false; //工单来源 getOrderSource(); //工单类型 getOrderType(); //投诉类型 complaintType(); //咨询类型 consultType(); //产品类别 getProductType(); //区域 getAreaType(); //客诉专员 ComplaintVip(); //保存 $('.customerSubmit').click(function() { saveCustomer(); }); $.ajaxSettings.async = true; var id = helper.request.queryString("id"); $.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); //购买日期 $('.orderType').val(data.F_Type + ''); //工单类型ID $('.orderType').trigger("change"); $('.complaintType').val(data.F_SmallType); $('.complaintType1').val(data.F_SmallType); $('.complaintType2').val(data.F_SmallType); $('#productname').val(data.F_ProductName); //产品名称 $('#buyAddress').val(data.F_BuyAddress); //购买地址 data. $('#productType').val(data.F_ProductType + ''); //产品类别ID $('#batchNumber').val(data.F_BatchNumber); //生产批号 $('.userDate').val(data.F_UserDate); //使用日期 $('#DicValueList').val(data.F_Source + ''); //工单来源 $("#areaInps").val(data.F_Area); $('#typeclass').val(data.F_Province + "/" + data.F_City); //区域 $('.inps2').val(data.F_Province); //省 $('.inps3').val(data.F_City); //市 $('#county').val(data.F_County); //区县 $('#content').val(data.F_Content); //事件描述 $('#remark').val(data.F_Remark); //备注 $('#vipName').val(data.F_VIPId); //专员姓名 $('#vipNameDK').val(data.F_VIPName); $('#vipTel').val(data.F_VIPPhone); //专员号码 if (data.F_State=="1") { $(".deal").show(); } else{ $(".deal").remove(); } $("input[name='sendBack'][value='" + data.F_IsBack+"']").attr("checked", true); if ($(".orderType option:selected").text() != "投诉") { $(".complainDiv2").show(); $(".complainDiv").hide(); typeSmall =$(".complaintType2").val(); } else { $(".complainDiv2").hide(); $(".complainDiv").show(); typeSmall =$(".complaintType1").val(); } if (data.F_DealCost=="0") { $("#dealCost").val(""); //处理费用 }else{ $("#dealCost").val(data.F_DealCost); //处理费用 } //$("input[type=radio][value='']").prop("checked",true); $("input[type=radio][name=response][value="+data.F_DealTimely+"]").attr("checked",'checked')//响应状态 $("input[type=radio][name=ltype][value="+data.F_DealState+"]").attr("checked",'checked')//响应状态 $("#disposeST").text(data.DealStateName); //处理状态 $("#dealCont").text(data.F_DealResult); //处理结果 $("#cont").text(data.F_DealDes); //客诉进展详述 } } }); $(".complaintType2").change(function () { typeSmall=$(".complaintType2").val(); }); $(".complaintType1").change(function () { typeSmall=$(".complaintType1").val(); }); $('.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') }) //获取专员手机号 $("#vipName").change(function() { $("#vipTel").val($("#vipName option:selected").attr("index")); //$("#areaInps").val($("#vipName option:selected").attr("areaText")); $("#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")); }); }) //处理状态 dealState(); function dealState() { $.get(huayi.config.callcenter_url + 'Dictionary/GetDicValueListByFlag', { "token": $.cookie("token"), flag: "CLZT" }, function(result) { result = $.parseJSON(result); var Count = result.data; $(Count).each(function(i, n) { $('').appendTo($(".disposeST")); }) $('.disposeST input:radio:first').attr('checked', 'checked'); }); } //响应状态 responseState(); function responseState() { $.get(huayi.config.callcenter_url + 'Dictionary/GetDicValueListByFlag', { "token": $.cookie("token"), flag: "XYZT" }, function(result) { result = $.parseJSON(result); var Count = result.data; $(Count).each(function(i, n) { $('').appendTo($(".responseST")); }) $('.responseST input:radio:first').attr('checked', 'checked'); }); } //工单类型 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")); }) }); } //咨询类型 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() { var val = $("input[name='ltype']:checked").val(); var valRes = $("input[name='response']:checked").val(); var dealCost; if (isNaN($("#dealCost").val())) { dealCost=""; }else{ dealCost=$("#dealCost").val(); } 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/EditWorkOrder", dataType: 'json', async: true, beforeSend: function() { //触发ajax请求开始时执行 $('.customerSubmit').attr("disabled", true); $('.customerSubmit').text('保存中...'); }, data: { token: $.cookie("token"), workid: id, 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(), //事件描述 remark: $('#remark').val(), //备注 vipid: $('#vipName').val(), //专员id vipname:$('#vipNameDK').val(), vipphone: $('#vipTel').val(), //专员号码 isback: $('input[name="sendBack"]:checked').val(), dealcost: dealCost*1, //处理费用 dealresult:$("#dealCont").val(),//处理结果 dealdes: $("#cont").val(), //客诉进展详述 dealstate:val, //处理状态 dealtimely:valRes, //及时响应 callid: $("#CallID").val() }, success: function(data) { if (data.state.toLowerCase() == 'success') { $('.customerSubmit').attr("disabled", false); $('.customerSubmit').text('保存'); var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引 parent.layer.close(index); //再执行关闭 parent.layer.msg("保存成功!"); parent.$('#workorderlist').bootstrapTable('refresh'); parent.$('#workorderlist_').bootstrapTable('refresh'); parent.$('#orderlist').bootstrapTable('refresh'); } } }); }