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();
}
}
}
});
$.ajax({
type: "get",
url: huayi.config.callcenter_url + "UserAccount/GetNowUser",
dataType: 'json',
async: true,
data: {
token: $.cookie("token")
},
success: function(data) {
if(data.state.toLowerCase() == 'success') {
if(data.data.user.F_SeartGroup == '楼下组') {
$('.up_floor').css('display','none')
}
}
}
});
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)//营业厅名称
$('#productType').val(data.F_Customertype)//客户类别
$('.orderType').val(data.F_Typeof)//工单类型
$('#complaintType1').val(data.F_Fixduty)//定责
$('#complaintType2').val(data.F_Pietype)//派单类型
$('#dealing').val(data.F_Dealing)//处理人姓名
$('#dealingtel').val(data.F_Dealingtel)//处理人姓名
$('#DicValueList').val(data.F_Source + ''); //工单来源
$('#content').val(data.F_Content); //事件描述
$('#replycontent').val(data.F_Replycontent); //事件描述
$('#remark').val(data.F_Remark); //备注
$("#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: "DYZE"
}, 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: "PDLX"
}, 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: "KHLX"
}, function(result) {
result = $.parseJSON(result);
var Count = result.data;
$(Count).each(function(i, n) {
$('').appendTo($("#productType"));
})
});
}
//区域
function getAreaType() {
$.get(huayi.config.callcenter_url + 'Customer/GetList', {
"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) {
$('').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 (!$('.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(), //号码
dealing:$('#dealing').val(),//处理人姓名
dealingtel:$('#dealingtel').val(),//处理人电话
definition: $('#typeclass').val(), //营业厅名称
customertype: $('#productType').val(), //客户类型
fixduty: $('.complaintType1').val(), //定责
pietype: $('#complaintType2').val(), //派单类型
Typeof: $('.orderType').val(), //工单类型id
content:$('#content').val(), //事件描述
remark:$('#remark').val(),
replycontent:$('#replycontent').val(),
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');
}
}
});
}