1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792 |
- /**
- *TDS 城市加载
- *问题回复选择
- *加载三个文本域
- *定义全局变量以及监听事件和初始化
- * 客诉提交
- */
- /*===============================TDS 城市加载 -- start -- =============================== */
- $(function(){
- $("#province").ProvinceCity();
- $('.skin-minimal input').iCheck({
- checkboxClass: 'icheckbox-blue',
- radioClass: 'iradio-blue',
- increaseArea: '20%'
- });
- $("#arrcity").suggest(citys,{hot_list:commoncitys,dataContainer:'#arrcity_3word',onSelect:function(result){
- console.log($(this)[0].value);
- $("#city2").click()
- },
- attachObject:'#suggest'
- });
- $("#city2").suggest(citys,{hot_list:commoncitys,attachObject:"#suggest2"})
- });
- /*===============================TDS 城市加载 -- start -- =============================== */
- /*===============================问题回复选择 -- start -- =============================== */
- $(document).on('click', '.dalog-ask .answer', function() {
- var QA_complaintId = $(this).find(".QA_complaintId").val();
- var QA_smallClassId = $(this).find(".QA_smallClassId").val();
- $("select[name='complaintId']").val(QA_complaintId);
- initComplaintSmallClassInfo(QA_complaintId,QA_smallClassId); //初始化小类
- var questionId = $(this).find(".quesId").val();
- var title = $(this).find("span").html();
- var desc = $(this).find("#questionProfile").html();
- $("#questionId").val(questionId);
- $("#describeTitle").val(title);
- UE.getEditor('describeContentText').setContent(desc);
- //$("#answer-textarea").text();
- $(".dalog-ask").hide(); //隐藏qa
- });
- /*===============================问题回复选择 -- end -- =============================== */
- /*===============================加载三个文本域 -- start -- =============================== */
- /**
- * 百度富文本编辑器的 tool
- * 用于客诉的添加/修改 页面的配置
- */
- var tool = [
- 'anchor', //锚点
- 'undo', //撤销
- 'redo', //重做
- 'bold', //加粗
- 'indent', //首行缩进
- 'snapscreen', //截图
- 'italic', //斜体
- 'underline', //下划线
- 'strikethrough', //删除线
- 'subscript', //下标
- 'fontborder', //字符边框
- 'superscript', //上标
- 'formatmatch', //格式刷
- // 'source', //源代码 --
- 'blockquote', //引用
- 'pasteplain', //纯文本粘贴模式
- 'selectall', //全选
- 'print', //打印
- 'preview', //预览
- 'horizontal', //分隔线
- 'removeformat', //清除格式
- 'time', //时间
- 'date', //日期
- 'unlink', //取消链接
- 'insertrow', //前插入行
- 'insertcol', //前插入列
- 'mergeright', //右合并单元格
- 'mergedown', //下合并单元格
- 'deleterow', //删除行
- 'deletecol', //删除列
- 'splittorows', //拆分成行
- 'splittocols', //拆分成列
- 'splittocells', //完全拆分单元格
- 'deletecaption', //删除表格标题
- 'inserttitle', //插入标题
- 'mergecells', //合并多个单元格
- 'deletetable', //删除表格
- 'cleardoc', //清空文档
- 'insertparagraphbeforetable', //"表格前插入行"
- //'insertcode', //代码语言
- 'fontfamily', //字体
- 'fontsize', //字号
- 'paragraph', //段落格式
- 'simpleupload', //单图上传
- 'insertimage', //多图上传
- 'edittable', //表格属性
- 'edittd', //单元格属性
- 'link', //超链接
- 'emotion', //表情
- 'spechars', //特殊字符
- 'searchreplace', //查询替换
- // 'map', //Baidu地图
- // 'gmap', //Google地图
- 'insertvideo', //视频
- 'help', //帮助
- 'justifyleft', //居左对齐
- 'justifyright', //居右对齐
- 'justifycenter', //居中对齐
- 'justifyjustify', //两端对齐
- 'forecolor', //字体颜色
- 'backcolor', //背景色
- 'insertorderedlist', //有序列表
- 'insertunorderedlist', //无序列表
- 'fullscreen', //全屏
- 'directionalityltr', //从左向右输入
- 'directionalityrtl', //从右向左输入
- 'rowspacingtop', //段前距
- 'rowspacingbottom', //段后距
- 'pagebreak', //分页
- 'insertframe', //插入Iframe
- 'imagenone', //默认
- 'imageleft', //左浮动
- 'imageright', //右浮动
- 'attachment', //附件
- 'imagecenter', //居中
- 'wordimage', //图片转存
- 'lineheight', //行间距
- 'edittip ', //编辑提示
- 'customstyle', //自定义标题
- 'autotypeset', //自动排版
- // 'webapp', //百度应用
- 'touppercase', //字母大写
- 'tolowercase', //字母小写
- 'background', //背景
- 'template', //模板
- // 'scrawl', //涂鸦
- 'music', //音乐
- 'inserttable', //插入表格
- 'drafts', // 从草稿箱加载
- 'charts' // 图表
- ];
- /*问题描述*/
- var describeContentText = UE.getEditor('describeContentText', {
- toolbars: [tool],
- autoHeightEnabled: true,
- autoFloatEnabled: true,
- elementPathEnabled : false,/*去掉元素路径*/
- zIndex : 5
- });
- /*处理描述*/
- var describeHandleDescText = UE.getEditor('describeHandleDescText', {
- toolbars: [tool],
- autoHeightEnabled: true,
- autoFloatEnabled: true,
- elementPathEnabled : false, /*去掉元素路径*/
- zIndex : 5
- });
- /*邮寄地址*/
- // var sendAddressSms = UE.getEditor('sendAddressSms', {
- // toolbars: [tool],
- // autoHeightEnabled: true,
- // autoFloatEnabled: true,
- // elementPathEnabled : false /*去掉元素路径*/
- // });
- var isInitSendAddressSms = false;
- // sendAddressSms.ready(function() {
- // sendAddressSms.setHeight(130); //固定高度
- // });
- /*===============================加载三个文本域 -- end -- =============================== */
- /*===============================定义全局变量以及监听事件和初始化 -- start -- =============================== */
- /*处理结果的执行状态*/
- var isSolve = {
- solved : [],
- noSolved : [],
- renewed : ["录入客诉","督促用户寄回","录入快递单号","仓库收货","换新发货","发货通知用户","收货后回访"],
- maintain : ["录入客诉","督促用户寄回","录入快递单号","仓库收货","品质检测","产线维修","换新发货","发货通知用户","收货后回访"],
- reissue : ["录入客诉","生成E订单","督促仓库发货","仓库发货","发货通知用户","收货后回访"],
- backGoods : ["录入客诉","督促用户寄回","录入快递单号","仓库收货","品质检测","退款","退货完成"],
- noReasonBack : ["录入客诉","督促用户寄回","录入快递单号","仓库收货","品质检测","退款","退货完成"]
- }
- /*处理结果的变更状态 产品列表表头信息*/
- var isSolveTitleMsg = {
- solved : [[],[]],
- noSolved : [[],[]],
- renewed : [["退回产品","退回产品颜色","退回产品配件"],["更换产品","更换产品颜色","更换产品配件"]],
- maintain : [["需要维修的产品","需要维修的产品颜色","需要维修的产品配件"],["维修产品","维修产品颜色","维修产品配件"]],
- reissue : [["补发产品","补发产品颜色","补发产品配件"],[]],
- backGoods : [["退回产品","退回产品颜色","退回产品配件"],[]],
- noReasonBack : [["退回产品","退回产品颜色","退回产品配件"],[]]
- }
- /*===============================定义全局变量以及监听事件和初始化 -- end -- =============================== */
- /*===============================正则表达式 -- start -- =============================== */
- var phoneReg = /^[1][3,4,5,7,8][0-9]{9}$/;
- /*===============================正则表达式 -- end -- =============================== */
- /*=============================== 页面加载完成启动事件 -- start -- =============================== */
- $(function (){
- /* 所有trim_input 样式,input框都需要去除前后空格*/
- $(".trim_input").change(function(){
- var value = $.trim($(this).val());
- $(this).val(value);
- })
- /*监听销售公司选择事件*/
- $("#selectCompany").change(function (){
- var companyId = $(this).val();
- $("#companyId").val(companyId);
- setStore(companyId,$("#selectStore")); //获取店铺
- })
- /*监听店铺选择事件*/
- $("#selectStore").change(function (){
- var storeId = $(this).val();
- $("#storeId").val(storeId);
- })
- })
- /*===============================页面加载完成启动事件 -- end -- =============================== */
- /*用于初始化监听回访信息的展示*/
- function initVisitEvent(){
- $("input[name='customerIsVisit']").change(function (){
- if($(this).val() == 2){
- $("#needToVisit").css("display","block");
- }else{
- $("#needToVisit").css("display","none");
- }
- })
- }
- /*关闭qa*/
- function closeQA(){
- $(".dalog-ask").hide(); //隐藏qa
- }
- /*初始化单选框样式*/
- function initCheck(){
- $('.skin-minimal input').iCheck({
- checkboxClass: 'icheckbox-blue',
- radioClass: 'iradio-blue',
- increaseArea: '20%'
- });
- }
- /*初始化单选框样式*/
- function initCheckByNode(node){
- node.iCheck({
- checkboxClass: 'icheckbox-blue',
- radioClass: 'iradio-blue',
- increaseArea: '20%'
- });
- }
- /*
- * type 1:不需要回访 2:需要回访
- * */
- function visitByType(type){
- if(isUpdate && customerIsVisit){
- customerIsVisit = false;
- return false;
- }
- if(1 == type){ //不需要回访
- $("#customer-visit-2").iCheck('check'); //设置不需要回访
- $("#needToVisit").css("display","none");
- }else{
- $("#customer-visit-1").iCheck('check'); //设置需要回访
- $("#needToVisit").css("display","block");
- }
- initVisitEvent();
- }
- function initSysAdmin() {
- sysAminList = getSysAdmin();
- var html = "";
- for(var i=0;i<sysAminList.length;i++){
- var adminList = sysAminList[i];
- if(adminId != null && adminId != "" && adminId != 0 && adminId == adminList.adminId ){
- html += '<option value="'+ adminList.adminId +'" selected>'+ adminList.adminName +'(我)</option>';
- }else{
- html += '<option value="'+ adminList.adminId +'">'+ adminList.adminName +'</option>';
- }
- }
- $("#adminId").html(html);
- }
- /*初始化回访客服的选择*/
- function initVisitSysAdmin(){
- var html = "";
- var flag = false;
- for(var i=0;i<sysAminList.length;i++){
- var adminList = sysAminList[i];
- if(adminId != null && adminId != "" && adminId != 0 && adminId == adminList.adminId ){
- html += '<option value="'+ adminList.adminId +'" selected>'+ adminList.adminName +'(我)</option>';
- flag = true;
- }else{
- html += '<option value="'+ adminList.adminId +'">'+ adminList.adminName +'</option>';
- }
- }
- $("#visitAdminId").html(html);
- if(flag){
- showVisitMsg(1);
- }
- }
- /**
- * 用于显示回访指派任务提示信息
- * 1 :自己
- * 2 :其他人
- */
- function showVisitMsg(type,adminName) {
- if(type == 1){
- $("#visitAdminIdMsg").html("您将为自己指定一个回访任务");
- }else{
- $("#visitAdminIdMsg").html("您将为"+ adminName +"指定一个回访任务");
- }
- }
- function getSysAdmin(){
- if(sysAminList != null && sysAminList.length > 0){
- return sysAminList
- }
- $.ajax({
- type: "POST",
- data: {
- },
- url: url_path + "/admin/customer/select_sys_admin",
- async: false,
- success: function(data){
- if (data.returnCode == 200) {
- sysAminList = data.returnMsg.adminList;
- adminId = data.returnMsg.adminId;
- }
- },
- error: function(XmlHttpRequest, textStatus, errorThrown){
- }
- });
- return sysAminList;
- }
- /*初始化产品类型 -- 客诉头部的产品类型单选*/
- function initProduceType(){
- var html = "";
- $.ajax({
- type: "POST",
- data: {
- },
- url: url_path + "/admin/customer/select_produce_type",
- async: false,
- success: function(data){
- if (data.returnCode == 200) {
- var check = "checked";
- for(var i=0;i<data.returnMsg.productTypeList.length;i++){
- var produce = data.returnMsg.productTypeList[i];
- html += ' <div class="radio-box">' +
- '<input type="radio" id="produce-type-'+ i +'" name="typeId" typeCompany="'+ produce.typeCompany +'" datatype="*" value="'+ produce.typeId +'" '+ check +' nullmsg="请选择产品类型!" >' +
- ' <label for="produce-type-'+ i +'">'+ produce.typeName +'</label>' +
- ' </div>';
- check = "";
- }
- }else{
- html = '';
- }
- },
- error: function(XmlHttpRequest, textStatus, errorThrown){
- }
- });
- $("#produceTypeHtml").html(html);
- initCheck();
- }
- /**
- * 选择处理结果-- 默认选择已解决
- * type : 1 :已解决 2:未解决 3:换新 4:维修 5:补发 6:退货 7:无理由退货
- */
- function initProcessResult(type){
- if(type == null || type == ""){
- type = 1;
- }
- allCustomerType = type;
- if(allCustomerInfoType == null || allCustomerInfoType == ""){
- allCustomerInfoType = $("input[name='customerCounselType']:checked").val();
- }
- var statusHtml = '<li><span class="arrow"></span><div class="number">status_index</div><div>status_html</div></li>';
- var resultHtml = '';
- var result = {};
- var resultProductTableTitle = {};
- $("#solved").show(); //已解决
- $("#noSolved").show();//未解决
- if(allCustomerInfoType == 1){ //售前
- $("#renewed").hide();
- $("#maintain").hide();
- $("#reissue").hide();
- $("#backGoods").hide();
- $("#noReasonBack").hide();
- switch(type)
- {
- case 1:
- otherHied();
- visitByType(1);
- getCompany();
- break;
- case 2:
- otherHied();
- visitByType(2);
- getCompany();
- break;
- default:
- break;
- }
- }else if(allCustomerInfoType == 2){ //售后
- if(!isInitSendAddressSms){
- initComplaintQuestionInfo("m");
- isInitSendAddressSms = true;
- }
- if(isUpdate){ //修改页面加载省市区
- setAddressInfo(); //修改页面才会调用
- }else{
- /* 在选择售后类型是,直接初始化省市区,使用isInitAddress 变量来判断 */
- if(isInitAddress == 0){
- var proId = setPro(null,2);
- var cityId = setCity(null,proId,2);
- setDistrict(null,cityId,2);
- isInitAddress = 1;
- }
- }
- $("#renewed").show();
- $("#maintain").show();
- $("#reissue").show();
- $("#backGoods").show();
- $("#noReasonBack").show();
- switch(type)
- {
- case 1:
- otherHied();
- visitByType(1);
- getCompany();
- break;
- case 2:
- otherHied();
- visitByType(2); //需要回访
- getCompany();
- break;
- case 3: //换新
- result = isSolve.renewed;
- resultProductTableTitle = isSolveTitleMsg.renewed;
- $("#relationProduct").html("换新产品");
- $("#processResultStatus").show();
- $("#orderHead").show();
- $("#order").show();
- //$("#recipientInfo").show();
- //$("#recipientInfoTitle").show();
- //$("#recipientAddress").show();
- //$("#recipientAddressText").show();
- //$("#renewedProduct").show();
- $("#TDScollect").show();
- $("#TDScollectShow").show();
- $("#sendAddressInfo").show();
- $("#sendAddressByPhone").show();
- $("#updateProduct").hide(); //换新产品
- $("#postageAccount").show(); //邮费转账账户
- visitByType(2); //需要回访
- $("#salesChannelsSelect").hide(); //屏蔽销售公司
- break;
- case 4: //维修
- result = isSolve.maintain;
- resultProductTableTitle = isSolveTitleMsg.maintain;
- $("#relationProduct").html("维修产品");
- $("#processResultStatus").show();
- $("#orderHead").show();
- $("#order").show();
- //$("#recipientInfo").show();
- //$("#recipientInfoTitle").show();
- //$("#recipientAddress").show();
- //$("#recipientAddressText").show();
- //$("#renewedProduct").show();
- $("#TDScollect").show();
- $("#TDScollectShow").show();
- $("#sendAddressInfo").show();
- $("#sendAddressByPhone").show();
- $("#updateProduct").hide();//维修产品
- $("#postageAccount").show(); //邮费转账账户
- visitByType(2); //需要回访
- $("#salesChannelsSelect").hide(); //屏蔽销售公司
- break;
- case 5://补发
- result = isSolve.reissue;
- resultProductTableTitle = isSolveTitleMsg.reissue;
- $("#relationProduct").html("补发产品");
- $("#processResultStatus").show();
- $("#orderHead").show();
- $("#order").show();
- //$("#recipientInfo").show();
- //$("#recipientInfoTitle").show();
- // $("#recipientAddress").show();
- // $("#recipientAddressText").show();
- //$("#renewedProduct").show();
- $("#TDScollect").show();
- $("#TDScollectShow").show();
- $("#sendAddressInfo").hide();
- $("#sendAddressByPhone").hide();
- $("#updateProduct").hide();
- $("#postageAccount").hide(); //邮费转账账户 -- 隐藏
- visitByType(2); //需要回访
- $("#salesChannelsSelect").hide(); //屏蔽销售公司
- break;
- case 6: //退货
- result = isSolve.backGoods;
- resultProductTableTitle = isSolveTitleMsg.backGoods;
- $("#relationProduct").html("退货产品");
- $("#processResultStatus").show();
- $("#orderHead").show();
- $("#order").show();
- // $("#recipientInfo").show();
- //$("#recipientInfoTitle").show();
- //$("#recipientAddress").show();
- //$("#recipientAddressText").show();
- //$("#renewedProduct").show();
- $("#TDScollect").show();
- $("#TDScollectShow").show();
- $("#sendAddressInfo").show();
- $("#sendAddressByPhone").show();
- $("#updateProduct").hide();
- $("#postageAccount").show(); //邮费转账账户
- visitByType(2); //需要回访
- $("#salesChannelsSelect").hide(); //屏蔽销售公司
- break;
- case 7://无理由退货
- result = isSolve.noReasonBack;
- resultProductTableTitle = isSolveTitleMsg.noReasonBack;
- $("#relationProduct").html("退货产品");
- $("#processResultStatus").show();
- $("#orderHead").show();
- $("#order").show();
- //$("#recipientInfo").show();
- //$("#recipientInfoTitle").show();
- //$("#recipientAddress").show();
- //$("#recipientAddressText").show();
- //$("#renewedProduct").show();
- $("#TDScollect").show();
- $("#TDScollectShow").show();
- $("#sendAddressInfo").show();
- $("#sendAddressByPhone").show();
- $("#updateProduct").hide();
- $("#postageAccount").show(); //邮费转账账户
- visitByType(2); //需要回访
- $("#salesChannelsSelect").hide(); //屏蔽销售公司
- break;
- default:
- break;
- }
- }
- for(var i=0;i< result.length;i++){
- var html = statusHtml.replace("status_index",i+1);
- html = html.replace("status_html",result[i]);
- resultHtml += html;
- }
- if(resultProductTableTitle != null && resultProductTableTitle.length > 0){
- /* 根据处理类型来切换 产品列表的列名称 */
- for(var i=0;i<resultProductTableTitle[0].length;i++){
- $("#table1").find("th").eq(i).html(resultProductTableTitle[0][i]);
- }
- for(var i=0;i<resultProductTableTitle[1].length;i++){
- $("#table2").find("th").eq(i).html(resultProductTableTitle[1][i]);
- }
- }
- $("#processResultStatus").html(resultHtml);
- }
- /*已解决|未解决 */
- function otherHied(){
- $("#salesChannelsSelect").show(); //展示销售公司
- $("#processResultStatus").hide(); //处理结果的执行状态 已解决未解决没有该信息
- $("#orderHead").hide();
- $("#order").hide();
- $("#recipientInfo").hide();
- $("#recipientInfoTitle").hide();
- $("#recipientAddress").hide();
- $("#recipientAddressText").hide();
- $("#renewedProduct").hide();
- $("#TDScollect").hide();
- $("#TDScollectShow").hide();
- $("#sendAddressInfo").hide();
- $("#sendAddressByPhone").hide();
- $("#updateProduct").hide();
- }
- /*初始化问题大类*/
- function initComplaintTypeInfo() {
- //默认为售前咨询
- //var customerCounselTypeOverall = allCustomerInfoType;
- var customerCounselTypeOverall = null;
- $.ajax({
- type: "POST",
- data: {
- complaintConsultingType : customerCounselTypeOverall
- },
- url: url_path + "/admin/complaintQuestion/list_complaintType",
- async: true,
- success: function(data){
- var html = '<option value="">请选择问题分类</option>';
- var id;
- if (data.returnCode == 200) {
- for(var i=0;i<data.returnMsg.complaintTypeInfoList.length;i++){
- var complaintTypeInfo = data.returnMsg.complaintTypeInfoList[i];
- if(i == 0 ){
- id = complaintTypeInfo.complaintId;
- }
- html += '<option value="'+ complaintTypeInfo.complaintId +'">'+ complaintTypeInfo.complaintClassName +'</option>';
- }
- }else{
- html = '';
- }
- $("[name='complaintId']").html(html);
- },
- error: function(XmlHttpRequest, textStatus, errorThrown){
- }
- });
- }
- /*显示小类*/
- function initComplaintSmallClassInfo(complaintId,smallId){
- if(complaintId == null || complaintId == ""){
- var html = '<option value="">请选择问题小类</option>';
- $("[name='smallClassId']").html(html);
- }else{
- $.ajax({
- type: "POST",
- data: {
- complaintId : complaintId
- },
- url: url_path + "/admin/complaintQuestion/list_complaintSmallClass",
- async: true,
- success: function(data){
- var html = '<option value="">请选择问题小类</option>';
- if (data.returnCode == 200) {
- for(var i=0;i<data.returnMsg.complaintSmallClassInfoList.length;i++){
- var ComplaintSmallClassInfo = data.returnMsg.complaintSmallClassInfoList[i];
- html += '<option value="'+ ComplaintSmallClassInfo.smallClassId +'">'+ ComplaintSmallClassInfo.smallClassName +'</option>';
- }
- }else{
- html = '';
- }
- $("[name='smallClassId']").html(html);
- if(smallId != null && smallId != "" && typeof(smallId)!="undefined" ){
- $("select[name='smallClassId']").val(smallId);
- }
- },
- error: function(XmlHttpRequest, textStatus, errorThrown){
- }
- });
- }
- }
- /**
- * 搜索QA 显示
- * type p:问题qa; m:邮寄qa
- */
- function initComplaintQuestionInfo(type){
- var complaintId;
- var smallClassId;
- var questionName;
- var customerCounselType;
- var questionId;
- if(type == "p"){
- complaintId = $("[name='complaintId']").val();
- smallClassId = $("[name='smallClassId']").val();
- questionName = $("[name='questionIdMsg']").val();
- customerCounselType = $("[name='customerCounselType']:checked").val();
- }else if(type == "m"){
- questionId = complaint_questionId;
- }
- $.ajax({
- type: "POST",
- data: {
- complaintId : complaintId,
- smallClassId : smallClassId,
- questionName : questionName,
- /*complaintType : customerCounselType,*/
- questionId : questionId
- },
- url: url_path + "/admin/complaintQuestion/list_complaintQuestion",
- async: false,
- success: function(data){
- if(type == "p"){
- var html = "";
- if (data.returnCode == 200) {
- for(var i=0;i<data.returnMsg.complaintQuestionInfoList.length;i++){
- var complaintQuestion= data.returnMsg.complaintQuestionInfoList[i];
- //html += '<li class="ask">'+ complaintQuestion.questionName +'' +
- // '</li>' +
- // '<li class="answer" style="height: 65px;overflow: hidden;">答:<span>'+ complaintQuestion.questionProfile +'</span><input class="quesId" type="hidden" value="'+ complaintQuestion.questionId +'"></li>';
- html += '' +
- '<li class="answer" style="height: 20px;overflow: hidden;border-bottom: 1px solid #ddd;"><span>'+ complaintQuestion.questionName +'</span>' +
- '<input class="QA_complaintId" type="hidden" value="'+ complaintQuestion.complaintId +'">' +
- '<input class="QA_smallClassId" type="hidden" value="'+ complaintQuestion.smallClassId +'">' +
- '<input class="quesId" type="hidden" value="'+ complaintQuestion.questionId +'">' +
- '<div id="questionProfile" style="display: block">'+ complaintQuestion.questionProfile +'</div>' +
- '</li>';
- }
- }else{
- html = '<span style="font-size: 12px; margin-top: 10px; display: block;">未搜索到QA信息,请更换关键字或者直接录入到系统!</span>';
- }
- $("#question").html(html);
- $(".dalog-ask").show();
- }else if(type == "m"){
- var msg = "";
- if (data.returnCode == 200) {
- msg = data.returnMsg.complaintQuestionInfoList[0].questionProfile;
- }
- addSmsMsg(msg);
- }
- },
- error: function(XmlHttpRequest, textStatus, errorThrown){
- }
- });
- }
- /*添加邮寄信息*/
- function addSmsMsg(msg){
- /*sendAddressSms.addListener("ready", function () {
- // editor准备好之后才可以使用
- sendAddressSms.setContent(msg);
- });*/
- /*邮寄信息*/
- $("#sendAddressSmsHtml").html(msg);
- }
- /**
- * 发送短信
- * @param type 类型: "problem" 问题处理; mailAddress:邮寄地址;
- * @param node 返回结果显示节点
- */
- function sendPhone(type,node){
- var index = layer.load(1, {
- shade: [0.5,'#fff'] //0.1透明度的白色背景
- });
- var desc = "";
- var phone = "";
- var questionId = "";
- var describeTitle = "";
- var smallClassId = ""; /* 客诉问题类型小类id */
- var typeCompany = parseInt($("input:radio[name='typeId']:checked").attr("typeCompany"));
- if(type == "p"){
- phone = $("#p-phone").val();
- questionId = $("#questionId").val();
- describeTitle = $("#describeTitle").val();
- desc = UE.getEditor('describeContentText').getContent();
- smallClassId = $("#smallClassId").val();
- if(smallClassId == null || smallClassId == "" ){
- layer.close(index);
- layer.msg("请选择问题分类!", {icon: 5, time: 3000});
- return false;
- }
- if(describeTitle==null || describeTitle == ""){
- layer.close(index);
- layer.msg("请填写问题标题!", {icon: 5, time: 3000});
- return false;
- }
- if(describeTitle.length > 50){
- layer.close(index);
- layer.msg("问题标题长度不能高于50个字符!", {icon: 5, time: 3000});
- return false;
- }
- if(desc == null || desc == ""){
- layer.close(index);
- layer.msg("请填写问题回复!", {icon: 5, time: 3000});
- return false;
- }
- }else if(type == "m"){
- phone = $("#m-phone").val();
- questionId = complaint_questionId;
- //desc = UE.getEditor('sendAddressSms').getContent();
- //desc = $("#sendAddressSmsHtml").html(); //取值从html填写 -- 邮寄地址不用传过去,直接后台取
- // if(desc == null || desc == ""){
- // layer.close(index);
- // layer.msg("请填写邮寄信息内容!", {icon: 5, time: 3000});
- // return false;
- // }
- }else{
- layer.close(index);
- layer.msg("发送报错!", {icon: 5, time: 3000});
- return false;
- }
- var reg = /^(((13[0-9]{1})|(15[0-9]{1})|(18[0-9]{1}))+\d{8})$/;
- if(!reg.test(phone)){
- layer.close(index);
- layer.msg("请填写正确的手机号码!", {icon: 5, time: 3000});
- return false;
- }
- $.ajax({
- type: "POST",
- data: {
- type : type,
- typeCompany : typeCompany,
- phone : phone,
- questionId : questionId,
- smallClassId : smallClassId,
- questionName : describeTitle,
- questionProfile : desc //回复内容
- },
- url: url_path + "/admin/customer/send_phone_sms",
- async: true,
- success: function(data){
- if (data.returnCode == 200) {
- if(type == "p"){
- $("#p-msg").html(data.resultMsg);
- }else if(type == "m"){
- $("#m-msg").html(data.resultMsg);
- }
- }else{
- if(type == "p"){
- $("#p-msg").html(data.resultMsg);
- }else if(type == "m"){
- $("#m-msg").html(data.resultMsg);
- }
- }
- layer.close(index);
- },
- error: function(XmlHttpRequest, textStatus, errorThrown){
- if(type == "p"){
- $("#p-msg").html("发送短信失败!");
- }else if(type == "m"){
- $("#m-msg").html("发送短信失败!");
- }
- layer.close(index);
- }
- });
- }
- /*保存QA问题 type=1 表示为用户点击 type=2表示自动触发*/
- function saveQuestion(type){
- var index = layer.load(1, {
- shade: [0.5,'#fff'] //0.1透明度的白色背景
- });
- var desc = "";
- var questionId = "";
- var describeTitle = "";
- var smallClassId = ""; /* 客诉问题类型小类id */
- questionId = $("#questionId").val();
- describeTitle = $("#describeTitle").val();
- desc = UE.getEditor('describeContentText').getContent();
- smallClassId = $("#smallClassId").val();
- if((smallClassId == null || smallClassId == "") && (questionId == null || questionId == "") ){
- layer.close(index);
- layer.msg("请选择问题分类!", {icon: 5, time: 3000});
- return false;
- }
- if(describeTitle==null || describeTitle == ""){
- layer.close(index);
- layer.msg("请填写问题标题!", {icon: 5, time: 3000});
- return false;
- }
- if(desc == null || desc == ""){
- layer.close(index);
- layer.msg("请填写问题回复!", {icon: 5, time: 3000});
- return false;
- }
- $.ajax({
- type: "POST",
- data: {
- questionId : questionId,
- smallClassId : smallClassId,
- questionName : describeTitle,
- questionProfile : desc //回复内容
- },
- url: url_path + "/admin/complaintQuestion/save_question",
- async: false,
- success: function(data){
- if (data.returnCode == 200) {
- $("#questionId").val(data.returnMsg.questionId);
- if(type == 1){
- layer.msg(data.resultMsg, {icon: 1, time: 3000});
- }
- }else{
- if(type == 1) {
- layer.msg(data.resultMsg, {icon: 5, time: 3000});
- }
- }
- layer.close(index);
- },
- error: function(XmlHttpRequest, textStatus, errorThrown){
- layer.close(index);
- }
- });
- }
- /***
- * 打开搜索订单框
- */
- function selectOrder(){
- layer_show("搜索订单",url_path + "/admin/customer/select_order","1000","500");
- }
- /**
- * 显示选择的订单
- */
- function setSelectOrder(orderId){
- if(orderId == null || orderId == "" || typeof (orderId)=="undefined"){
- layer.msg("未选中订单", {icon: 5, time: 3000});
- return false
- }
- var html = '';
- var addresHtml = '';
- var address = ''; //地址
- var orderItemList = {};
- var companyId = ''; //销售公司
- var storeId = ''; //店铺
- $.ajax({
- type: "POST",
- data: {
- salesId : orderId
- },
- url: url_path + "/admin/customer/select_salesOrder",
- async: false,
- success: function(data){
- if (data.returnCode == 200) {
- for(var i=0;i<data.returnMsg.salesOrderList.length;i++){
- var salesOrder = data.returnMsg.salesOrderList[i];
- companyId = salesOrder.salesCompanyId;
- storeId = salesOrder.salesStoreId;
- var productsHtml = '';
- var salesOrderItem = salesOrder.salesOrderItemList;
- orderItemList = salesOrder.salesOrderItemList;
- for(var j=0;j<salesOrderItem.length;j++){
- var item = salesOrderItem[j].itemProductName + "*" + salesOrderItem[j].itemNum;
- if(j==0){
- productsHtml += item
- }else{
- productsHtml += '<br>'+ item
- }
- }
- var time = formatDate(new Date(salesOrder.salesCreateTime),"yyyy-MM-dd");
- html += '' +
- ' <td style="text-align: center;">'+ convertUndefinedToEmpty(salesOrder.companyName) +'</td>' +
- ' <td style="text-align: center;">'+ convertUndefinedToEmpty(salesOrder.storeName) +'</td>' +
- ' <td style="text-align: center;">'+ salesOrder.salesId +'</td>' +
- ' <td style="text-align: center;">'+ salesOrder.salesAddressName +'</td>' +
- ' <td style="text-align: center;">'+ salesOrder.salesAddressTel +'</td>' +
- ' <td style="text-align: center;">'+ salesOrder.salesAmount/100 +'</td>' +
- ' <td style="text-align: center;">'+ productsHtml +'</td>' +
- ' <td style="text-align: center;">'+ time +'</td>' +
- '';
- addresHtml = '<td colspan="1" style="text-align: center;">收货地址</td><td colspan="7" class="td-manage text-c" >'+ salesOrder.salesAddressInfo +'</td>' ;
- address = salesOrder.salesAddressInfo;
- $("#sendName").val(salesOrder.salesAddressName); //收件人名称
- $("#sendTel").val(salesOrder.salesAddressTel); //收件人电话号码
- var name = $("#customerName").val();
- var tel = $("#customerTel").val();
- if(name == "" || name == null){
- $("#customerName").val(salesOrder.salesAddressName); //收件人名称
- }
- if(tel == "" || tel == null){
- $("#customerTel").val(salesOrder.salesAddressTel); //收件人电话号码
- }
- }
- // $("#showOrderAddress").html(address);
- }else{
- html = '';
- addresHtml = '';
- }
- $("#showOrder").html(html); //显示订单
- $("#showOrderAddress").html(addresHtml); //显示订单地址
- $("#showOrderAddress").show();
- },
- error: function(XmlHttpRequest, textStatus, errorThrown){
- }
- });
- $("#addressInfo").val(address);
- setAdress(); //显示地址
- setProduce(orderItemList); //显示产品
- $("#companyId").val(companyId);
- $("#storeId").val(storeId);
- $("#orderId").val(orderId);
- }
- /**
- * 设置地址
- */
- function setAdress(){
- var addres = $("#addressInfo").val();
- $("#addrssMsg").html("");
- if(addres == null){
- $("#addrssMsg").html("*未能获取到地址,请手动选择地址");
- return;
- }
- var addresList = addres.split("-");
- if(addresList[0] == null || addresList[1]==null || addresList[2]==null || addresList[3]==null){
- $("#addrssMsg").html("*未能获取到地址,请手动选择地址");
- return;
- }
- var proId = setPro(getAddress(addresList[0],0),1);
- var cityId = setCity(getAddress(addresList[1],1),proId,1);
- setDistrict(getAddress(addresList[2],2),cityId,1);
- var sendAddress = addresList[3];
- if(addresList.length > 4){
- for(var k = 4;k< addresList.length;k++){
- sendAddress += addresList[k];
- }
- }
- $("#sendAddress").val(sendAddress);
- }
- /***
- * 删除 “省”,“市”,“区”关键字
- * type : 0:省 2:市 3:区
- */
- function getAddress(addrss,type) {
- var abbreviation = "";
- if(addrss == ""){
- abbreviation = "";
- }else{
- switch(type)
- {
- case 0:
- //var proReg = new RegExp("省","g");
- //abbreviation = addrss.replace(proReg,"");
- abbreviation = addrss.substring(0,2);
- break;
- case 1:
- var cityReg = new RegExp("市","g");
- abbreviation = addrss.replace(cityReg,"");
- cityReg = new RegExp("区","g");
- abbreviation = addrss.replace(cityReg,"");
- break;
- case 2:
- var districtReg = new RegExp("区","g");
- abbreviation = addrss.replace(districtReg,"");
- districtReg = new RegExp("市","g");
- abbreviation = abbreviation.replace(districtReg,"");
- break;
- default:
- break;
- }
- }
- return abbreviation
- }
- /**
- * 设置省
- * type 1:搜索订单赋值 2:只查询全部,默认第一个
- */
- function setPro(provinceName,type) {
- var proId = '';
- var province = listProvince();
- var selectPro = new Array();
- if(type == 1){
- selectPro = listProvince("",provinceName);
- }
- if(province!=null){
- var provinceHtml = ''
- for(var i=0;i<province.length;i++){
- provinceHtml += '<option value="'+ province[i].provinceId +'">'+ province[i].province +'</option>';
- }
- $("#province").html(provinceHtml);
- if(selectPro != null && selectPro.length > 0 ){
- proId = selectPro[0].provinceId;
- }else{
- proId = province[0].provinceId;
- }
- $("#province option[value='" + proId + "']").attr("selected","true");
- }
- return proId;
- }
- /**
- * 设置市
- * type 1:搜索订单赋值 2:只查询全部,默认第一个
- */
- function setCity(cityName,proId,type) {
- var cityId = '';
- var city = listCity(proId,"");
- var selectCity = new Array();
- if(type == 1){
- selectCity = listCity(proId,cityName);
- }
- if(city!=null){
- var cityHtml = ''
- for(var i=0;i<city.length;i++){
- cityHtml += '<option value="'+ city[i].cityId +'">'+ city[i].city +'</option>';
- }
- $("#city").html(cityHtml);
- if(selectCity != null && selectCity.length > 0 ){
- cityId = selectCity[0].cityId;
- }else{
- cityId = city[0].cityId;
- }
- $("#city option[value='" + cityId + "']").attr("selected","true");
- }
- return cityId;
- }
- /**
- * 设置区
- * type 1:搜索订单赋值 2:只查询全部,默认第一个
- */
- function setDistrict(districtName,cityId,type) {
- var district = listDistrict(cityId,"");
- var selectDistrict = new Array();
- if(type == 1){
- selectDistrict = listDistrict(cityId,districtName);
- }
- if(district!=null){
- var districtHtml = ''
- for(var i=0;i<district.length;i++){
- districtHtml += '<option value="'+ district[i].districtId +'">'+ district[i].district +'</option>';
- }
- var disId = "";
- $("#district").html(districtHtml);
- if(selectDistrict != null && selectDistrict.length > 0 ){
- disId = selectDistrict[0].districtId;
- }else{
- disId = district[0].districtId;
- }
- $("#district option[value='" + disId + "']").attr("selected","true");
- }
- }
- /* TDS收集设置区 */
- var TDSCity = '';
- function linkageSetDistrict(){
- var arrcity_3word = $("#arrcity_3word").val();
- var cityName = '北京';
- for(var i = 0;i<citys.length;i++){
- for(var j=0;j<citys[i].length;j++){
- if(j == 0 && arrcity_3word == citys[i][j]){
- cityName = citys[i][1];
- }
- }
- }
- TDSCity = cityName;
- var selectCity = listCity(null,cityName);
- var cityId = selectCity[0].cityId;
- var selectDistrict = listDistrict(cityId,"");
- var html = '';
- for(var i=0;i<selectDistrict.length;i++){
- html += '<option value="'+ selectDistrict[i].districtId +'">'+ selectDistrict[i].district +'</option>';
- }
- $("#TDSArea").html(html);
- $("#TDSArea").find("option").eq(0).prop("selected",true);
- setTDSCollect();
- }
- /**
- * 展示产品
- * @param orderItemList
- */
- function setProduce(orderItemList) {
- var productList = getProduct() ; //所有产品
- var html = "";
- var productTypeNo = 0;
- for(var i=0;i<productList.length;i++) {
- var product = productList[i];
- var produceFittings = getProduceFittings(product.productId); //获取该产品的所有配件
- var colorList = product.colorList; //该产品的所有颜色
- var productType = product.productType;
- var colorHtml = '';
- if(colorList != null && colorList.length >0 ){
- colorHtml += '<table style="height: 100%;">';
- for(var j=0;j<colorList.length;j++){
- var number = "";
- var color = colorList[j];
- for(var k=0;k<orderItemList.length;k++){
- var item = orderItemList[k];
- if(item.itemColorId == color.colorId && item.itemIsSource == 1){
- number = item.itemNum;
- }
- }
- var fristInputStyle = "border-top: 1px solid #ddd;";
- if(color.colorProductId == product.productId) {
- colorHtml += '<tr >' +
- ' <td width="55" style="border-left: none;text-align: center;'+ fristInputStyle +'">' + color.colorName + '</td>' +
- ' <td width="45" style="'+ fristInputStyle +' padding: 0px;width: 25px;">' +
- ' <input type="hidden" class="input-produce-id" value="' + color.colorProductId + '">' +
- ' <input type="hidden" class="input-color-id" value="' + color.colorId + '">' +
- ' <input type="text" class="input-text input-color-number number-input" style="width: 100%;border: none;text-align: center;" value="'+ number +'" placeholder="产品数量" id="color-' + color.colorProductId + '-' + color.colorId + '" name="" onkeyup="keyFun($(this),999)" onpaste="keyFun($(this),999)" >' +
- ' </td>' +
- ' </tr>';
- fristInputStyle = "";
- }
- }
- colorHtml += '</table>';
- }else{
- colorHtml += '<span>暂无该产品的颜色!<span>';
- }
- var produceFittingsHtml = '';
- if(produceFittings != null && produceFittings.length > 0){
- produceFittingsHtml += '<table style="height: 100%;">';
- for(var m=0;m<produceFittings.length;m++){
- var number = "";
- var fitt = produceFittings[m];
- for(var k=0;k<orderItemList.length;k++){
- var item = orderItemList[k];
- if(item.itemColorId == fitt.fittingsId && item.itemIsSource == 2){
- number = item.itemNum;
- }
- }
- var produceFit = produceFittings[m];
- if(produceFit.productId == product.productId) {
- var fristInputStyle = "border-top: 1px solid #ddd;";
- produceFittingsHtml += '<tr >' +
- ' <td width="55" style="border-left: none;text-align: center; '+ fristInputStyle +'">' + produceFit.fittingsName +'</td>' +
- ' <td width="45" style="'+ fristInputStyle +'padding: 0px;width: 25px;">' +
- ' <input type="hidden" class="input-produce-id" value="' + produceFit.productId + '">' +
- ' <input type="hidden" class="input-fittings-id" value="' + produceFit.fittingsId +'">' +
- ' <input type="text" class="input-text input-fittings-number" style="width: 100%;border: none;text-align: center;" value="'+ number +'" placeholder="配件数量" id="fittings-' + produceFit.productId + '-' + produceFit.fittingsId +'" name="" onkeyup="keyFun($(this),999)" onpaste="keyFun($(this),999)" >' +
- ' </td>' +
- ' </tr>';
- fristInputStyle = "";
- }
- }
- produceFittingsHtml += '</table>';
- }else{
- produceFittingsHtml += '<span>暂无产品配件!<span>';
- }
- var produceHtml = '<input type="hidden" value="'+ product.productId +'">' +
- '<span>'+ product.productName +'</span>';
- html += ' <tr >' +
- ' <td width="80">'+ produceHtml +'</td>' +
- ' <td style="padding: 0px;text-align: center;">' +
- colorHtml +
- ' </td>' +
- ' <td style="padding: 0px;text-align: center;">' +
- produceFittingsHtml +
- ' </td>' +
- '</tr>';
- }
- $("#addProduct").html(html);
- setBackProduct(html); //设置寄回产品
- monitorProduct(); //监听产品变化
- }
- /*获取产品*/
- function getProduct(){
- var productList;
- $.ajax({
- type: "POST",
- data: {
- },
- url: url_path + "/admin/customer/select_produce",
- async: false,
- success: function(data){
- if (data.returnCode == 200) {
- productList = data.returnMsg.productList;
- }
- },
- error: function(XmlHttpRequest, textStatus, errorThrown){
- }
- });
- return productList;
- }
- /*获取产品配件*/
- function getProduceFittings(productId){
- var produceFittings;
- $.ajax({
- type: "get",
- data: {
- productId : productId
- },
- url: url_path + "/admin/customer/select_produce_fittings",
- async: false,
- success: function(data){
- if (data.returnCode == 200) {
- produceFittings = data.returnMsg.produceFittingsList;
- }
- },
- error: function(XmlHttpRequest, textStatus, errorThrown){
- }
- });
- return produceFittings;
- }
- /*监听产品变化*/
- function monitorProduct(){
- /*产品数量*/
- $("#addProduct").find(".input-color-number").blur(function (){
- setBackProduct();
- })
- /*产品配件*/
- $("#addProduct").find(".input-fittings-number").blur(function (){
- setBackProduct();
- })
- }
- /*设置寄回产品*/
- function setBackProduct(html) {
- if(html != null && html != "" && typeof(html) != "undefined"){
- $("#back-product").html(html);
- }else{
- $("#addProduct").find(".input-color-number").each(function(){
- var number = $(this).val();
- var colorNodeId = $(this).attr("id");
- $("#back-product").find("#"+colorNodeId).val(number);
- })
- $("#addProduct").find(".input-fittings-number").each(function(){
- var number = $(this).val();
- var fittingsNodeId = $(this).attr("id");
- $("#back-product").find("#"+fittingsNodeId).val(number);
- })
- }
- }
- /*设置TDS收集信息*/
- function setTDSCollect(){
- var TDSArea = $("#TDSArea").find("option:selected").text();
- var TDSAddress = TDSCity + '-' + TDSArea;
- if(TDSAddress != null && TDSAddress != ""){
- $("#DTS-address").html("地址:" + TDSAddress);
- }
- }
- /*TDS联动处理*/
- function TDSLinkage(node,maxNumber,minNumber){
- setTDSCollect();
- var number = 0;
- var c=$(node);
- if(c.val() == ""){
- $(node).val("");
- }else{
- var temp_amount=c.val().replace(/[^\d]/g,'');
- number = Number(temp_amount)
- if(maxNumber!= null && maxNumber!= "" && number > maxNumber){
- number = maxNumber;
- }
- if(minNumber!= null && minNumber!= "" && number < minNumber){
- number = minNumber;
- }
- $(node).val(number);
- }
- var nodeName = $(node).attr("id");
- if(nodeName == "customerInTDS" ){
- $("#DTS-in").html("进水:" + number + " PPM");
- }else if(nodeName == "customerOutTDS" ){
- $("#DTS-out").html("出水:" + number + " PPM");
- }
- }
- /**
- * 获取销售公司
- */
- function getCompany(companyId){
- var currentlyCompanyId = $("#companyId").val();
- if(currentlyCompanyId != null && currentlyCompanyId != ""){
- companyId = currentlyCompanyId;
- }
- $.ajax({
- type: "get",
- data: {
- },
- url: url_path + "/admin/customer/select_company",
- success: function(data){
- if (data.returnCode == 200) {
- var html = '<option value="">销售公司</option>';
- for(var i=0;i<data.returnMsg.companyInfoList.length;i++){
- var company = data.returnMsg.companyInfoList[i];
- html += '<option value="'+ company.companyId +'">'+ company.companyName +'</option>';
- }
- $("#selectCompany").html(html);
- if(typeof(companyId) != "undefined"){
- $("#selectCompany option[value='" + companyId + "']").attr("selected","true");
- if(isUpdate){ //修改页面需要自动获取店铺
- setStore(companyId,$("#selectStore")); //获取店铺
- }
- }
- }
- },
- error: function(XmlHttpRequest, textStatus, errorThrown){
- }
- });
- }
- /**
- * 展示销售公司
- */
- function setStore(companyId,node){
- var html = '<option value="">店铺</option>';
- $.ajax({
- type: "POST",
- data: {
- companyId : companyId
- },
- url: url_path + "/admin/customer/select_storeInfo",
- success: function(data){
- var id;
- if (data.returnCode == 200) {
- for(var i=0;i<data.returnMsg.storeInfoList.length;i++){
- var storeInfo = data.returnMsg.storeInfoList[i];
- html += '<option value="'+ storeInfo.storeId +'">'+ storeInfo.storeName +'</option>';
- }
- }else{
- html = '';
- }
- $(node).html(html);
- var currentlyStoreId = $("#storeId").val();
- if(currentlyStoreId != null && currentlyStoreId != ""){
- $("#selectStore option[value='" + currentlyStoreId + "']").attr("selected","true");
- }
- },
- error: function(XmlHttpRequest, textStatus, errorThrown){
- }
- });
- }
- /*===============================客诉提交 -- start -- =============================== */
- $(function(){
- $("#form-customer-add").Validform({
- tiptype: function (msg, o, cssctl) {
- if (o.type == 3) {//失败
- layer.msg(msg, {icon: 5, time: 3000});
- $(window).scrollTop(o.obj.offset().top - 40);
- }
- },
- datatype: {//自定义验证类型
- },
- ignoreHidden: true,
- tipSweep: true, //若为true,则只在表单提交时验证
- ajaxPost: true, //异步提交
- beforeCheck: function (curform) { //验证通过之前执行的函数
- },
- beforeSubmit: function (curform) { //验证通过之后执行的函数
- var flag = addCustomerReady();
- if(!flag){
- return false;
- }
- },
- callback: function (data) {//异步回调函数
- if (data) {
- var index = layer.alert(data.resultMsg, function (index) {
- if (data.resultCode == 200) {
- location.href = url_path + "/admin/customer/select_customer_list";
- } else if(data.resultCode == 505){
- location.href = url_path + "/admin/customer/select_customer_list";
- }else {
- layer.close(index);
- }
- });
- }
- }
- });
- })
- /* 添加客诉的准备 */
- function addCustomerReady(){
- //保存AQ
- saveQuestion(2);
- /* 录入电话号码和姓名到客诉基本信息里面 */
- /*if(allCustomerType == 3 || allCustomerType == 4 || allCustomerType == 5 || allCustomerType == 6 || allCustomerType == 7){
- $("#customerName").val($("#sendName").val());
- $("#customerTel").val($("#sendTel").val());
- }*/
- var phoneFlag = true;
- $(".associated-phone").each(function () {
- var phone = $(this).val();
- if(phone != null && phone != "" && typeof (phone) != "undefined"){
- if(phone.length != 11){
- vailErrorMsg($(this),"手机号码格式不正确");
- phoneFlag = false;
- }
- if (!phoneReg.test(phone)) {
- vailErrorMsg($(this),"手机号码格式不正确");
- phoneFlag = false;
- }
- }
- })
- if(!phoneFlag){
- return false;
- }
- /*验证来源入口*/
- var customerSourceType = $("input:radio[name='customerSourceType']:checked").val();
- if(customerSourceType == 3){
- var customerSourceOld = $("#customerSourceOld").val();
- if(customerSourceOld == null || customerSourceOld == "" || typeof(customerSourceOld)=="undefined"){
- vailErrorMsg($("#customerSourceOld"),"未填写来源入口");
- return false;
- }else{
- $("#customerSource").val(customerSourceOld);
- }
- }
- /*根据产品类型,获取来源商城*/
- var typeCompany = parseInt($("input:radio[name='typeId']:checked").attr("typeCompany"));
- $("#typeCompany").val(typeCompany);
- /*----TDS收集模块--start-----*/
- var valicity = $(".ac_result_tip").html();
- if(valicity == null || valicity == "" || typeof(valicity)=="undefined"){
- $("#TDSArea").html("");
- }else if(valicity.indexOf("对不起,找不到") > 0 ){
- $("#TDSArea").html("");
- $("#customerArea").val("");
- }else{
- var TDSArea = $("#TDSArea").find("option:selected").text();
- if(TDSArea != null && TDSArea != ""){
- var area = TDSCity + "-" + TDSArea
- $("#customerArea").val(area);
- }
- }
- /*----TDS收集模块--end-----*/
- /* 地址拼接 */
- var province = $("#province").find("option:selected").text();
- var city = $("#city").find("option:selected").text();
- var district = $("#district").find("option:selected").text();
- var relationSendMergeAddress = province + "-" + city + "-" + district;
- $("#relationSendMergeAddress").val(relationSendMergeAddress);
- /* 地址拼接 */
- /*----问题描述- start --*/
- var quId = $("#questionId").val();
- if(quId == null || quId == ""){
- vailErrorMsg($("#questionId"),"未保存QA!");
- return false;
- }
- var describeContentText = UE.getEditor('describeContentText').getContent();
- if(describeContentText == null || describeContentText == ""){
- //layer.msg("未填写问题描述", {icon: 5, time: 3000});
- vailErrorMsg($("#describeTitle"),"未填写问题描述");
- return false;
- }
- if(describeContentText.length > 3000){
- vailErrorMsg($("#describeContent"),"问题回复最大支持3000个字符");
- return false;
- }
- $("#describeContent").val(describeContentText);
- /*----问题描述--end-----*/
- /*----处理描述- start --*/
- var describeHandleDescText = UE.getEditor('describeHandleDescText').getContent();
- if(describeHandleDescText.length > 3000){
- vailErrorMsg($("#describeHandleDesc"),"问题描述最大支持3000个字符");
- return false;
- }
- $("#describeHandleDesc").val(describeHandleDescText);
- /*----处理描述--end-----*/
- /* --- 类型:售后 处理结果:维修/换新/补发/退货/无理由退货 -- 处理产品 start---- */
- var sendProdcues = new Array(); //寄出产品表
- var sendFittings = new Array();
- var closedProdcues = new Array();
- var closedFittings = new Array();
- $("#addProduct").find(".input-color-number").each(function(){
- var number = $(this).val();
- if(number != null && number != "" && number != 0){
- var product = new Object();
- product.productId = $(this).parent().find(".input-produce-id").val();
- product.colorId = $(this).parent().find(".input-color-id").val();
- //换新、维修,退货,无理由退货,
- if(allCustomerType == 3 || allCustomerType == 4 || allCustomerType == 6 || allCustomerType == 7){
- product.closedProdcueNumber = number;
- closedProdcues.push(product);
- }else if(allCustomerType == 5){
- product.sendProdcueNumber = number;
- sendProdcues.push(product);
- }
- }
- })
- $("#addProduct").find(".input-fittings-number").each(function(){
- var number = $(this).val();
- if(number != null && number != "" && number != 0){
- var fittings = new Object();
- fittings.productId = $(this).parent().find(".input-produce-id").val();
- fittings.fittingsId = $(this).parent().find(".input-fittings-id").val();
- //换新、维修,退货,无理由退货,
- if(allCustomerType == 3 || allCustomerType == 4 || allCustomerType == 6 || allCustomerType == 7){
- fittings.closedFittingNumber = number;
- closedFittings.push(fittings);
- }else if(allCustomerType == 5){
- fittings.sendFittingNumber = number;
- sendFittings.push(fittings);
- }
- }
- })
- $("#back-product").find(".input-color-number").each(function(){
- var number = $(this).val();
- if(number != null && number != "" && number != 0){
- //换新、维修,
- if(allCustomerType == 3 || allCustomerType == 4){
- var fittings = new Object();
- fittings.productId = $(this).parent().find(".input-produce-id").val();
- fittings.colorId = $(this).parent().find(".input-color-id").val();
- fittings.sendProdcueNumber = number;
- sendProdcues.push(fittings);
- }
- }
- })
- $("#back-product").find(".input-fittings-number").each(function(){
- var number = $(this).val();
- if(number != null && number != "" && number != 0){
- //换新、维修
- if(allCustomerType == 3 || allCustomerType == 4){
- var fittings = new Object();
- fittings.productId = $(this).parent().find(".input-produce-id").val();
- fittings.fittingsId = $(this).parent().find(".input-fittings-id").val();
- fittings.sendFittingNumber = number;
- sendFittings.push(fittings);
- }
- }
- })
- var backErrorMsg = "请选择一个replace_error_msg寄回的产品或配件并填写一个以上的数量!"
- var sendErrorMsg = "请选择一个replace_error_msg寄送的产品或配件并填写一个以上的数量!"
- var process = true;
- switch (allCustomerType){
- case 3:
- process = processIsEmpty([closedProdcues,closedFittings]);
- if(!process){
- var msg = backErrorMsg.replace("replace_error_msg","换新");
- layer.msg(msg, {icon: 5, time: 3000});
- return false;
- }
- process = processIsEmpty([sendProdcues,sendFittings]);
- if(!process){
- var msg = sendErrorMsg.replace("replace_error_msg","换新");
- layer.msg(msg, {icon: 5, time: 3000});
- return false;
- }
- break;
- case 4:
- process = processIsEmpty([closedProdcues,closedFittings]);
- if(!process){
- var msg = backErrorMsg.replace("replace_error_msg","维修");
- layer.msg(msg, {icon: 5, time: 3000});
- return false;
- }
- process = processIsEmpty([sendProdcues,sendFittings]);
- if(!process){
- var msg = sendErrorMsg.replace("replace_error_msg","维修");
- layer.msg(msg, {icon: 5, time: 3000});
- return false;
- }
- break;
- case 5:
- process = processIsEmpty([sendProdcues,sendFittings]);
- if(!process){
- var msg = sendErrorMsg.replace("replace_error_msg","补发");
- layer.msg(msg, {icon: 5, time: 3000});
- return false;
- }
- break;
- case 6:
- process = processIsEmpty([closedProdcues,closedFittings]);
- if(!process){
- var msg = backErrorMsg.replace("replace_error_msg","退货");
- layer.msg(msg, {icon: 5, time: 3000});
- return false;
- }
- break;
- case 7:
- process = processIsEmpty([closedProdcues,closedFittings]);
- if(!process){
- var msg = backErrorMsg.replace("replace_error_msg","退货");
- layer.msg(msg, {icon: 5, time: 3000});
- return false;
- }
- break;
- default:
- break;
- }
- $("#sendProdcues").val(JSON.stringify(sendProdcues));
- $("#sendFittings").val(JSON.stringify(sendFittings));
- $("#closedProdcues").val(JSON.stringify(closedProdcues));
- $("#closedFittings").val(JSON.stringify(closedFittings));
- var visitTimeSelect = $("input[name='visitTimeSelect']:checked").val();
- var visit_date = $('#datemin').val();
- var myDate = new Date();
- var date = myDate.getFullYear()+"-"+(myDate.getMonth()+1)+"-"+myDate.getDate();
- var hours = myDate.getHours();
- //如果两个时间相等,则判断可选的回访时间
- if(Date.parse(visit_date) == Date.parse(date)){
- var msg = "该时间已超过当前时间,请重新选择回访时间!";
- if (hours > 12 && visitTimeSelect == 1) {
- vailErrorMsg($("#datemin"),msg);
- return false;
- } else if (hours > 14 && visitTimeSelect == 2) {
- vailErrorMsg($("#datemin"),msg);
- return false;
- } else if (hours > 18 && visitTimeSelect == 3) {
- vailErrorMsg($("#datemin"),msg);
- return false;
- }
- }
- return true;
- }
- /* 判断产品与配件是否填入值 */
- function processIsEmpty(process){
- if(process != null && process != "" && process.length > 0){
- var flag = 2;
- var num = 0;
- if(process[0] == null || process[0].length < 1 ){
- flag -- ;
- }
- if(process[1] == null || process[1].length < 1 ){
- flag -- ;
- }
- for(var j=0; j<process.length;j++){
- for(var i=0;i<process[j].length;i++){
- if(process[j][i].sendProdcueNumber !== undefined){
- num += process[j][i].sendProdcueNumber;
- }
- if(process[j][i].sendFittingNumber !== undefined){
- num += process[j][i].sendFittingNumber;
- }
- if(process[j][i].closedProdcueNumber !== undefined){
- num += process[j][i].closedProdcueNumber ;
- }
- if(process[j][i].closedFittingNumber !== undefined){
- num += process[j][i].closedFittingNumber;
- }
- }
- }
- if(flag == 0){
- return false;
- }
- if(num == 0){
- return false;
- }
- }
- return true;
- }
- /*===============================客诉提交 -- end -- =============================== */
|