| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464 |
- var ns;
- var id = helper.request.queryString("id");
- var phone = helper.request.queryString("phone");
- var depName = helper.request.queryString("depName");
- var name = helper.request.queryString("name");
- var objs = {};
- $.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 == '思念组') {
- //console.log(data.data.groname)
- $('.customerService').show();
- $('.market').remove();
- ns = 1;
- } else {
- $('.market').show();
- $('.customerService').remove();
- ns = 2;
- }
-
- }
- }
- });
- $(document).ready(function() {
-
- laydate.render({
- elem: '.userDate',
- theme: '#1ab394',
- calendar: 'true'
- });
- laydate.render({
- elem: '.buyDate',
- theme: '#1ab394',
- calendar: 'true'
- //type: 'datetime',
- //max : 31,
- //min: 0,
- });
- laydate.render({
- elem: '#proDuctdate',
- theme: '#1ab394',
- calendar: 'true'
- //type: 'datetime',
- //max : 31,
- //min: 0,
- });
-
- //工单来源
- getOrderSource();
- //工单类型
- getOrderType();
- //工单类型
- getOrderType1();
- //工单状态
- getOrderState();
- //客诉专员
- ComplaintVip();
- //来电单位
- $('#testInput1').comboSelect();
- $('#testInput2').comboSelect();
- $('#testInput3').comboSelect();
- $('#testInput4').comboSelect();
- //编辑器配置 客服部
- KindEditor.ready(function(K) {
- window.changeEditor = K.create('#feedBackCon'); //修改弹出框编辑器
- })
- //编辑器配置 市场部 备注
- KindEditor.ready(function(K) {
- window.marketEditor = K.create('#remark_market');
- })
- //保存
- $('.customerSubmit').click(function() {
- saveCustomer();
- })
- $('.marketSubmit').click(function() {
- saveMarket();
- })
- 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)));
- }
-
- if(unescape(decodeURI(depName)) != 'null' && unescape(decodeURI(depName)) != 'undefined') {
- $("#testInput1_input").val(unescape(decodeURI(depName)));
- $("#testInput3_input").val(unescape(decodeURI(depName)));
- }
-
- }
- })
- //工单类型
- 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") {
- $('<option value="' + n.F_DictionaryValueId + '" selected="selected">' + n.F_Name + '</option>').appendTo($(".orderType1"));
- } else {
- $('<option value="' + n.F_DictionaryValueId + '">' + n.F_Name + '</option>').appendTo($(".orderType1"));
- }
- }else if(ns==2){
-
- if(n.F_DictionaryValueId == "468") {
- $('<option value="' + n.F_DictionaryValueId + '" selected="selected">' + n.F_Name + '</option>').appendTo($(".orderType2"));
- } else {
- $('<option value="' + n.F_DictionaryValueId + '">' + n.F_Name + '</option>').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: changeTreeClick
- }
- }
- function changeTreeClick(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 getOrderState() {
- $.ajax({
- url: huayi.config.callcenter_url + "Dictionary/GetDicValueListByFlag",
- type: 'get',
- async: true,
- data: {
- flag: 'GDZT',
- token: $.cookie("token")
- },
- dataType: "json",
- success: function(res) {
- if(res.state == "success") {
- //console.log(res.data);
- $('<option value="">全部</option>').appendTo($("#State"));
- $(res.data).each(function(i, n) {
- if(n.F_DictionaryValueId == '472') {
- $('<option value="' + n.F_DictionaryValueId + '" selected="selected">' + n.F_Name + '</option>').appendTo($("#State"));
- } else {
- $('<option value="' + n.F_DictionaryValueId + '">' + n.F_Name + '</option>').appendTo($("#State"));
- }
- })
- //
- }
- }
- })
- }
- //工单来源
- 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;
- $('<option value="">全部</option>').appendTo($("#DicValueList"));
- $(Count).each(function(i, n) {
- if(n.F_DictionaryValueId == "468") {
- $('<option value="' + n.F_DictionaryValueId + '" selected="selected">' + n.F_Name + '</option>').appendTo($("#DicValueList"));
- $('<option value="' + n.F_DictionaryValueId + '" selected="selected">' + n.F_Name + '</option>').appendTo($("#DicValueList_market"));
- } else {
- $('<option value="' + n.F_DictionaryValueId + '">' + n.F_Name + '</option>').appendTo($("#DicValueList"));
- $('<option value="' + n.F_DictionaryValueId + '">' + n.F_Name + '</option>').appendTo($("#DicValueList_market"));
- }
- })
- }
- });
- }
- //客诉专员
- function ComplaintVip() {
- var customerType;
- $.ajax({
- type: "get",
- url: huayi.config.callcenter_url + "Customer/GetAllList",
- dataType: 'json',
- async: true,
- data: {
- token: $.cookie("token"),
- type: 2
- },
- success: function(data) {
-
- var Count = data.data;
- if (ns==1) {
- $('<option value="">全部</option>').appendTo($("#vipName"));
- $(Count).each(function(i, n) {
- $('<option value="' + n.F_Id
- + '" index="'+n.F_Phone+'">' + n.F_Name
- + '</option>').appendTo($("#vipName"));
- })
- } else if(ns==2){
- $('<option value="">全部</option>').appendTo($("#customerName"));
- $(Count).each(function(i, n) {
- $('<option value="' + n.F_Id
- + '" index="'+n.F_Phone+'">' + n.F_Name
- + '</option>').appendTo($("#customerName"));
- })
- }
-
- }
- });
- }
- //获取专员手机号
- $("#vipName").change(function() {
- $("#vipTel").val($("#vipName option:selected").attr("index"));
- });
- $("#customerName").change(function() {
- $("#customerTel").val($("#customerName option:selected").attr("index"));
- });
- var orderType
- var staffId
- var stafftel
- //思念组保存
- 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($('#typeclassId').val() == '') {
- layer.confirm('请选择工单类型!', {
- icon: 2,
- btn: ['确定']
- });
- return;
- }
- if (ns==1) {
- orderType=$('.orderType1').val();
- staffId=$('#vipName').val();
- stafftel=$('#vipTel').val();
- } else if(ns==2){
- orderType=$('.orderType2').val();
- staffId=$('#customerName').val();
- stafftel=$('#customerTel').val();
- }
- $.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(), //号码
- buydate: $('.buyDate').val(), //购买日期
- productname: $('#productname').val(), //产品名称
- buyaddress: $('#buyAddress').val(), //购买地址
- producttype: $('#productType').val(), //产品类别
- batchnumber: $('#batchNumber').val(), //生产批号
- userdate: $('.userDate').val(), //使用日期 userDate
- source: $('#DicValueList').val(), //工单来源
- type: orderType, //工单类型id
- area: $('.inps2').val(), //区域
- province: $('.inps3').val(), //省
- city: $('.inps4').val(), //市
- content:$('#content').val(), //事件描述
- vipid: staffId, //专员id
- vipphone: stafftel, //专员号码
- callid: $("#CallID").val()
- },
- success: function(data) {
- if(data.state.toLowerCase() == 'success') {
-
- layer.msg("保存成功!");
- window.location.reload()
- // $('.customerSubmit').attr("disabled", false);
- // $('.customerSubmit').text('保存');
- }
- }
- });
- }
- // 市场部保存
- function saveMarket() {
- if (ns==1) {
- orderType=$('.orderType1').val();
- staffId=$('#vipName').val();
- stafftel=$('#vipTel').val();
- } else if(ns==2){
- orderType=$('.orderType2').val();
- staffId=$('#customerName').val();
- stafftel=$('#customerTel').val();
- }
- $.ajax({
- type: "post",
- url: huayi.config.callcenter_url + "WorkOrder/AddWorkOrder",
- dataType: 'json',
- async: true,
- // beforeSend: function() { //触发ajax请求开始时执行
- // $('.marketSubmit').attr("disabled", true);
- // $('.marketSubmit').text('保存中...');
- // },
- data: {
- token: $.cookie("token"),
- cusname: $('#name').val(), //姓名
- cusphone: $('#tel').val(), //号码
- area: $('.inps2').val(), //区域
- vipid: staffId, //专员id
- vipphone: stafftel, //专员号码
- source: $('#DicValueList').val(), //工单来源
- productname: $('#productname').val(), //产品名称
- batchnumber: $('#batchNumber').val(), //生产批号
- buyaddress: $('#buyAddress').val(), //购买地址
- productdate: $('#proDuctdate').val(),
- buydate: $('.buyDate').val(), //购买日期
- userdate: $('.userDate').val(), //使用日期 userDate
- type: orderType, //工单类型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("保存成功!");
- debugger
- window.location.reload()
- // clear();
- $('.marketSubmit').attr("disabled", false);
- $('.marketSubmit').text('保存');
- }
- }
- });
- }
- function clear() {
- if(ns == 1) {
- $('#name').val('');
- $('#tel').val(''); //号码
- $('#testInput1_input').val(''); //来电单位
- $('#testInput2_input').val(''); //反馈单位
- $('#orderSource').val(''); //工单来源
- $('#typeclassId').val(''); //工单类型id
- $('#State').val(''); //工单状态id
- $('#feedBackCon').val(''); //反馈内容
- $('#express').val(''); //快递信息
- $('#remark1').val(''); //备注一
- $('#remark2').val(''); //备注二
- $('#remark3').val(''); //备注三
- $('#typeclass').val('');
- } else {
- $('#name_market').val('');
- $('#tel_market').val(''); //号码
- $('#testInput3_input').val(''); //来电单位
- $('#testInput4_input').val(''); //反馈单位
- $('#remark_market').val(''); //备注内容
- }
- }
|