| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336 |
- var id = helper.request.queryString("id");
- $(document).ready(function () {
- 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();
- //产品类别
- 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 + '');
- $('#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); //市
- $('#content').val(data.F_Content); //事件描述
- $('#vipName').val(data.F_VIPId+''); //专员姓名
- $('#vipTel').val(data.F_VIPPhone); //专员号码
- $("input[name='sendBack'][value='" + data.F_IsBack+"']").attr("checked", true);
- }
- }
- });
- $('.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')
- })
- $(".orderType").change(function() {
- if ($(".orderType option:selected").text() != "投诉") {
- $(".complainDiv").hide();
- } else {
- $(".complainDiv").show();
- }
- });
- //获取专员手机号
- $("#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 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($(".complaintType"));
- })
- });
- }
- //产品类别
- 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"),
- }, 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) {
- $('<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() {
- 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: $(".complaintType").val(), //投诉类型
- area: $('#areaInps').val(), //区域
- province: $('.inps2').val(), //省
- city: $('.inps3').val(), //市
- content: $('#content').val(), //事件描述
- vipid: $('#vipName').val(), //专员id
- vipphone: $('#vipTel').val(), //专员号码
- isback: $('input[name="sendBack"]:checked').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');
-
- }
- }
- });
- }
|