| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441 |
- 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); //号码
- $('#typeclass').val(data.F_Definition)//营业厅名称
- $('.orderType').text(data.F_Typeof)//工单类型
- $('#dealing').val(data.F_Dealing)//处理人姓名
- $('.orderType').val(data.F_Type + ''); //工单类型ID
- $('.orderType').trigger("change");
- $('#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 + ''); //工单来源
- $('#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) {
- $('<label style="font-weight: normal; margin-right: 15px;">'+
- '<input type="radio" value="' + n.F_DictionaryValueId
- + '" name="ltype"/>' + n.F_Name
- + '</label>').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) {
- $('<label style="font-weight: normal; margin-right: 15px;">'+
- '<input type="radio" value="' + n.F_DictionaryValueId
- + '" name="response"/>' + n.F_Name
- + '</label>').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) {
- $('<option value="' + n.F_DictionaryValueId + '">' + n.F_Name + '</option>').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) {
- $('<option value="' + n.F_DictionaryValueId + '">' + n.F_Name + '</option>').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) {
- $('<option value="' + n.F_DictionaryValueId + '">' + n.F_Name + '</option>').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) {
- $('<option value="' + n.F_DictionaryValueId + '">' + n.F_Name + '</option>').appendTo($(".productType"));
- })
- });
- }
- //区域
- function getAreaType() {
- $.get(huayi.config.callcenter_url + 'Area/GetAreaList', {
- "token": $.cookie("token"),
- type:1,
- }, function(result) {
- result = $.parseJSON(result);
- $.fn.zTree.init($("#TreeDemo1"), setting, result.rows); //实例化树形图
- });
- }
- var setting = {
- data: {
- key: {
- name: "F_Definition"
- },
- simpleData: {
- enable: true,
- idKey: "F_Id",
- pIdKey: "F_ParentId",
- rootPId: 0
- }
- },
- callback: {
- onClick: changeTreeClick
- }
- }
- function changeTreeClick(event, treeId, treeNode) {
- $('#typeclass').val(treeNode.F_Definition);
- $('#dealing').val(treeNode.F_Name);
- $('#dealingtel').val(treeNode.F_Phone);
- $('.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) {
- $('<option value="' + n.F_DictionaryValueId + '">' + n.F_Name + '</option>').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;
- $('<option value="">请选择专员</option>').appendTo($("#vipName"));
- $(Count).each(function(i, n) {
- $('<option value="' + n.F_Id
- + '" index="' + n.F_Phone
- + '" areaText="' + n.F_Area
- + '" province="' + n.F_Province
- + '" city="' + n.F_City + '">' + n.F_Name
- + '</option>').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');
- }
- }
- });
- }
|