| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718 |
- 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;
- // 产品代码
- getProductType();
- // 问题代码
- getProblemCode();
- // 重要级别
- getDealTimely();
- // 重要级别原因
- getReason();
- //大区
- getArea($("#customer_area"));
- // 省 办事处
- LAISHENG($("#source"));//省
- CHOUDQ($("#customer_comaddress")); //办事处
-
- //客诉专员
- ComplaintVip();
- //保存
- $('.customerSubmit').click(function() {
-
-
- saveCustomer();
- });
- $.ajaxSettings.async = true;
- var id = helper.request.queryString("id");
- $.ajax({
- type: "get",
- url: huayi.config.callcenter_url + "WorkOrder/GetDetails",
- dataType: 'json',
- async: true,
- cache: false,
- data: {
- id: id,
- token: $.cookie("token")
- },
- success: function(result) {
- if (result.rows.length > 0) {
- var data = result.rows[0];
- $("#workOrderId").val(data.F_WorkOrderId); //工单编号
- // $("#order_isover").val(data.F_Type); // 工单类别
- $("#customer_area option:selected").text(data.F_AreaName); // 大区名称
- $("#customer_area option:selected").val(data.F_Area); // 大区
- $("#customer_office option:selected").text(data.F_OfficName); //办事处名称
- $("#customer_office option:selected").val(data.F_Office); //办事处
- // $("#detailCreateTime").text(data.F_CreateTime); // 投诉时间
- $("#name").val(data.F_CusName); // 姓名
- $("#tel").val(data.F_CusPhone); // 电话
- $("#productName").val(data.F_ProductName); // 产品名称
- $('#specification').val(data.F_Specifications); // 规格
- $("#productDate").val(data.F_ProductDate); // 生产日期
- $("#productNumber").val(data.F_BatchNumber); // 产品编码
- $("#productFactory").val(data.F_Manufacturer); // 产品厂家
- $("#problemCode").find("option:selected").text(data.F_ProblemCode); // 问题代码
- $("#productType").find("option:selected").text(data.F_ProductType); // 产品代码
- $("#qualityProblem").val(data.F_QualityProblem); // 质量问题
- $("#duplicate").val(data.F_Duplicate); // 重复工单
- $("#remark").val(data.F_Content); // 备注
- //工单类型
- $("#order_isover input[type=radio][name=type][value="+data.F_Type+"]").attr("checked",'checked');
- //重复工单
- $("#duplicate input[type=radio][name=duplicate][value="+data.duplicate+"]").attr("checked",'checked');
- // 工单来源
- workOrderSourceDisplay(data);
- // 重要级别
- dealTimelyDisplay(data);
- // 重要级别原因
- dealTimelyReasonDisplay(data);
- // 省市县
- provinceCity(data)
- }
- }
- });
- $(".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"));
- });
- })
- // 工单来源显示
- function workOrderSourceDisplay(data) {
- if (data.F_Source === 1) {
- $("#workOrderSource").val("PC")
- } else if (data.F_Source === 2){
- $("#workOrderSource").val("APP")
- } else if (data.F_Source === 3) {
- $("#workOrderSource").val("微信")
- } else {
- $("#workOrderSource").val("")
- }
- }
- // 重要级别显示
- function dealTimelyDisplay(data) {
- if (data.F_DealTimely === 506) {
- $("#dealTimely option:selected").text("Ⅰ级");
- $("#dealTimely option:selected").val(506);
- } else if (data.F_DealTimely === 507) {
- $("#dealTimely option:selected").text("Ⅱ级");
- $("#dealTimely option:selected").val(507);
- } else if (data.F_DealTimely === 508) {
- $("#dealTimely option:selected").text("普通工单");
- $("#dealTimely option:selected").val(508);
- }
- }
- // 重要级别原因显示
- function dealTimelyReasonDisplay(data) {
- if (data.F_DealTimely === 506) {
- if (data.F_Reason === "509") {
- $("#reason option:selected").text("涉媒");
- $("#reason option:selected").val(509);
- } else if (data.F_Reason === "510") {
- $('#reason').attr("disabled", "disabled");
- $("#reason option:selected").text("政府");
- $("#reason option:selected").val(510);
- } else if (data.F_Reason === "511") {
- $('#reason').attr("disabled", "disabled");
- $("#reason option:selected").text("恶性杂志");
- $("#reason option:selected").val(511);
- }
- } else {
- $('#reason').attr("disabled", "disabled");
- $("#reason option:selected").text("请选择");
- $("#reason option:selected").val("");
- }
- }
- //省市县回显
- function provinceCity(data){
- var provinceCityArr = data.F_AddRess.split("-");
- $("#source option:selected").text(provinceCityArr[0]);
- $("#type option:selected").text(provinceCityArr[1]);
- $("#keyid option:selected").text(provinceCityArr[2]);
- }
- // 大区
- function getArea(obj) {
- obj.empty();
- obj.append('<option selected="selected" value="">请选择</option>');
- $.getJSON(huayi.config.callcenter_url + "Department/GetCusAreaList", {
- "token": $.cookie("token"),
- pid: 1,
- F_Layer: 1,
- }, function (data) {
- if (data.state.toLowerCase() == "success") {
- var content = data.data;
- $(content).each(function (i, n) {
- $("<option value='" + n.F_DeptId + "'>" + n.F_DeptName + "</option>").appendTo(obj);
- })
- }
- })
- }
- //办事处
- function getOffice(obj) {
- obj.empty();
- obj.append('<option selected="selected" value="">请选择</option>');
- $.getJSON(huayi.config.callcenter_url + "Department/GetCusAreaList", {
- "token": $.cookie("token"),
- F_Layer:2,
- pid:$("#customer_area").val(),
- }, function (data) {
- if (data.state.toLowerCase() == "success") {
- var content = data.data;
- $(content).each(function (i, n) {
- $("<option value='" + n.F_DeptId + "'>" + n.F_DeptName + "</option>").appendTo(obj);
- })
- }
- })
- }
- // 获取所在大区办事处
- $("#customer_area").on("change", function() {
- getOffice($("#customer_office"))
- })
- //省 市 区/县
- //省
- function LAISHENG(obj) {
- obj.empty();
- obj.append('<option selected="selected" value="">请选择</option>');
- $.getJSON(huayi.config.callcenter_url + "RegionCategory/GetCountyList", {
- "token": $.cookie("token"),
- pid: 0,
- }, function (data) {
- if (data.state.toLowerCase() == "success") {
- var content = data.data;
- $(content).each(function (i, n) {
- $("<option value='" + n.F_RegionId + "'>" + n.F_RegionName + "</option>").appendTo(obj);
- })
- }
- })
- }
- //市
- function LAISHI(obj) {
- obj.empty();
- obj.append('<option selected="selected" value="">请选择</option>');
- $.getJSON(huayi.config.callcenter_url + "RegionCategory/GetCountyList", {
- "token": $.cookie("token"),
- pid:$('#source').val(),
- }, function (data) {
- if (data.state.toLowerCase() == "success") {
- var content = data.data;
- $(content).each(function (i, n) {
- $("<option value='" + n.F_RegionId + "'>" + n.F_RegionName + "</option>").appendTo(obj);
- })
- }
-
- })
- }
- // 区/县
- function LAIQU(obj) {
- obj.empty();
- obj.append('<option selected="selected" value="">请选择</option>');
- $.getJSON(huayi.config.callcenter_url + "RegionCategory/GetCountyList", {
- "token": $.cookie("token"),
- pid:$('#type').val(),
- }, function (data) {
- if (data.state.toLowerCase() == "success") {
- var content = data.data;
- $(content).each(function (i, n) {
- $("<option value='" + n.F_RegionId + "'>" + n.F_RegionName + "</option>").appendTo(obj);
- })
- }
- })
- }
- $('#source').on('change',function(){
- $.getJSON(huayi.config.callcenter_url + "RegionCategory/GetCountyList", {
- "token": $.cookie("token"),
- F_Layer: 2,
- F_RegionName:$('#source').val(),
- }, function (data) {
- if (data.state.toLowerCase() == "success") {
- var content = data.data;
- $(content).each(function (i, n) {
- $("<option value='" + n.F_RegionId + "'>" + n.F_RegionName + "</option>").appendTo("#type");
- })
- LAISHI($("#type"));
- }
- })
- });
- $('#type').on('change',function(){
- $.getJSON(huayi.config.callcenter_url + "RegionCategory/GetCountyList", {
- "token": $.cookie("token"),
- F_Layer: 3,
- F_RegionName:$('#type').val()
- }, function (data) {
- if (data.state.toLowerCase() == "success") {
- var content = data.data;
- $(content).each(function (i, n) {
- $("<option value='" + n.F_RegionId + "'>" + n.F_RegionName + "</option>").appendTo("#keyid");
- })
- LAIQU($("#keyid"));
- }
- })
- });
- $('#keyid').on('change',function(){
- $.getJSON(huayi.config.callcenter_url + "RegionCategory/GetCountyList", {
- "token": $.cookie("token"),
- F_Layer: 4,
- F_RegionName:$('#keyid').val()
- }, function (data) {
- if (data.state.toLowerCase() == "success") {
- var content = data.data;
- $(content).each(function (i, n) {
- $("<option value='" + n.F_RegionId + "'>" + n.F_RegionName + "</option>").appendTo("#input_area");
- })
- LAIXIANG($('#input_area'));
- }
- })
- });
- //办事处 提交人
- function CHOUDQ(obj) {
- obj.empty();
- obj.append('<option selected="selected" value="">请选择</option>');
- $.getJSON(huayi.config.callcenter_url + "Department/GetCusAreaList", {
- "token": $.cookie("token"),
- pid: 1,
- F_Layer: 1,
- }, function (data) {
- if (data.state.toLowerCase() == "success") {
- var content = data.data;
- $(content).each(function (i, n) {
- $("<option value='" + n.F_DeptId + "'>" + n.F_DeptName + "</option>").appendTo(obj);
- })
- }
- })
- }
- //办事处
- function CHOUFEN(obj) {
- obj.empty();
- obj.append('<option selected="selected" value="">请选择</option>');
- $.getJSON(huayi.config.callcenter_url + "Department/GetCusAreaList", {
- "token": $.cookie("token"),
- F_Layer:2,
- pid:$("#customer_comaddress").val(),
- }, function (data) {
- if (data.state.toLowerCase() == "success") {
- var content = data.data;
- $(content).each(function (i, n) {
- $("<option value='" + n.F_DeptId + "'>" + n.F_DeptName + "</option>").appendTo(obj);
- })
- }
- })
- }
- // 提交人
- function getSubmitter(obj) {
- obj.empty();
- obj.append('<option selected="selected" value="" deptId="">请选择</option>');
- $.getJSON(huayi.config.callcenter_url + "UserAccount/GetList", {
- "token": $.cookie("token"),
- type: 1,
- dptid: $("#customer_comaddress").val(),
- }, function (data) {
- console.log('123123123')
- var content = data.rows;
- $(content).each(function (i, n) {
- $("<option value='" + n.F_UserId + "'deptId='" + n.F_DeptId + "'>" + n.F_UserName + "</option>").appendTo(obj);
- })
- })
- }
- // 获取提交人
- $('#customer_comaddress').on('change',function(){
- getSubmitter($('#customer_submitter'));
- });
- //产品代码
- function getProductType() {
- $.ajax({
- type: "get",
- url: huayi.config.callcenter_url + "Dictionary/GetDicValueListByFlag",
- dataType: 'json',
- async: true,
- data: {
- token: $.cookie("token"),
- flag: "CPDM"
- },
- success: function(data) {
- var Count = data.data;
- $(Count).each(function(i, n) {
- $('<option value="' + n.F_DictionaryValueId + '">' + n.F_Name + '</option>').appendTo($("#productType"));
- })
- }
- });
- }
- // 问题代码
- function getProblemCode() {
- $.ajax({
- type: "get",
- url: huayi.config.callcenter_url + "Dictionary/GetDicValueListByFlag",
- dataType: 'json',
- async: true,
- data: {
- token: $.cookie("token"),
- flag: "WTDM"
- },
- success: function(data) {
- var Count = data.data;
- $(Count).each(function(i, n) {
- $('<option value="' + n.F_DictionaryValueId + '">' + n.F_Name + '</option>').appendTo($("#problemCode"));
- })
- }
- });
- }
- // 重要级别
- function getDealTimely() {
- $.ajax({
- type: "get",
- url: huayi.config.callcenter_url + "Dictionary/GetDicValueListByFlag",
- dataType: 'json',
- async: true,
- data: {
- token: $.cookie("token"),
- flag: "GDDJ"
- },
- success: function(data) {
- var Count = data.data;
- $(Count).each(function(i, n) {
- $('<option value="' + n.F_DictionaryValueId + '">' + n.F_Name + '</option>').appendTo($("#dealTimely"));
- })
- }
- });
- }
- // 重要级别原因
- function getReason() {
- $.ajax({
- type: "get",
- url: huayi.config.callcenter_url + "Dictionary/GetDicValueListByFlag",
- dataType: 'json',
- async: true,
- data: {
- token: $.cookie("token"),
- flag: "YJYY"
- },
- success: function(data) {
- var Count = data.data;
- $(Count).each(function(i, n) {
- $('<option value="' + n.F_DictionaryValueId + '">' + n.F_Name + '</option>').appendTo($("#reason"));
- })
- }
- });
- }
- // 重要级别为一级时显示原因
- $('#dealTimely').on('change',function(){
- console.log('1111',$('#dealTimely').val());
- if ($('#dealTimely').val() !== '506'){
- $('#reason').val('');
- $('#reason').attr("disabled", "disabled");
- } else {
- $('#reason').removeAttr("disabled");
- }
- })
- // 指派事件
- $('#isAssign').on('change', function(){
- if($('#isAssign input[name="isAssign"]:checked').val() === '1'){
- $('.comaddressTitle').show();
- $('.comaddressSelect').show();
- $('.submitterTitle').show();
- $('.submitterSelect').show();
- } else if ($('#isAssign input[name="isAssign"]:checked').val() === '2'){
- $('.comaddressTitle').hide();
- $('.comaddressSelect').hide();
- $('.submitterTitle').hide();
- $('.submitterSelect').hide();
- }
- })
- // 地址(省+市+区/县)
- function detailedAddress() {
- if($('#source').val() === ""){
- var province = '';
- } else {
- var province = $('#source').find("option:selected").text()
- }
- if($('#type').val() === ""){
- var city = '';
- } else {
- var city = $('#type').find("option:selected").text()
- }
- if($('#keyid').val() === ""){
- var county = '';
- } else {
- var county = $('#keyid').find("option:selected").text()
- }
- var address = province + '-' + city + '-' + county;
- return address;
- }
- //处理状态
- 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');
- });
- }
- 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 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(!$('#qualityProblem').val()) {
- layer.confirm('请输入质量问题!', {
- icon: 2,
- btn: ['确定']
- });
- return;
- }
- $.ajax({
- type: "post",
- url: huayi.config.callcenter_url + "WorkOrder/UpdateWorkOrder",
- dataType: 'json',
- async: true,
- beforeSend: function() { //触发ajax请求开始时执行
- $('.customerSubmit').attr("disabled", true);
- $('.customerSubmit').text('保存中...');
- },
- data: {
- token: $.cookie("token"),
- F_Id: id,
- F_Type: $('#order_isover input[name="type"]:checked').val(), //工单类型
- F_Area: $('#customer_area').val(), //大区
- F_Office: $('#customer_office').val(), //办事处
- F_DealTimely: $('#dealTimely').val(), //重要级别
- F_Reason: $('#reason').val(), //原因
- F_CusName: $('#name').val(), //姓名
- F_CusPhone: $('#tel').val(), //号码
- F_AddRess: detailedAddress(),//地址
- F_ProductType: $('#productType').find("option:selected").text() === '请选择' ? '' : $('#productType').find("option:selected").text(), //产品代码
- F_ProductName: $('#productName').val(), //产品名称
- F_Specifications: $('#specification').val(), //规格
- F_ProductDate: $('#productDate').val(), //生产日期
- F_BatchNumber: $('#productNumber').val(), //产品编码
- F_Manufacturer: $('#productFactory').val(), //产品厂家
- F_ProblemCode: $('#problemCode').find("option:selected").text() === '请选择' ? '' : $('#problemCode').find("option:selected").text(), //问题代码
- F_QualityProblem: $('#qualityProblem').val(), //质量问题
- F_Content: $('#remark').val(), //备注
- F_Duplicate: $('#duplicate input[name="duplicate"]:checked').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.$('#orderlist').bootstrapTable('refresh');
- } else {
- $('.customerSubmit').attr("disabled", false);
- $('.customerSubmit').text('保存');
- }
- }
- });
- }
|