12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559 |
- /**
- * 初始化销售渠道
- */
- /*getCompany();*/
- /**
- *TDS 城市加载
- *问题回复选择
- *加载三个文本域
- *定义全局变量以及监听事件和初始化
- * 客诉提交
- */
- /*===============================TDS 城市加载 -- start -- =============================== */
- $(function(){
- $('.skin-minimal input').iCheck({
- checkboxClass: 'icheckbox-blue',
- radioClass: 'iradio-blue',
- increaseArea: '20%'
- });
- });
- /*===============================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;
- //产品类型id对应客诉问题分类id
- var productTypeArray = [[1,6],[6,1],[7,1],[9,1],[10,7],[11,8],[12,9],[13,1],[14,1],[15,10],[16,1],[17,1]];
- var customerTypeId=6; //因为产品类型初始化为上朵牙刷,所以初值为6
- // 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}$/;
- var phoneReg2 = /(^[0-9]{3,4}\-[0-9]{3,8}$)|(^[0-9]{3,8}$)|(^\([0-9]{3,4}\)[0-9]{3,8}$)|(^0{0,1}13[0-9]{9}$)/;
- /*===============================正则表达式 -- end -- =============================== */
- /*=============================== 页面加载完成启动事件 -- start -- =============================== */
- $(function (){
- })
- /*===============================页面加载完成启动事件 -- end -- =============================== */
- /*用于初始化监听回访信息的展示*/
- function initVisitEvent(){
- $("input[name='customerIsVisit']").change(function (){
- if($(this).val() == 2){
- /*$("#needToVisit").css("display","block");*/
- $("#needToVisit").css("display","none");
- }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","none");
- /*$("#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(){
- $.ajax({
- type: "POST",
- data: {
- },
- url: url_path + "/admin/customer/select_produce_type",
- success: function(data){
- var html = "";
- 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" style="width: 180px;">' +
- '<input type="radio" class="single_loading" 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 = '';
- }
- $("#produceTypeHtml").html(html);
- initCheckByNode(".produce_type_html input");
- /*绑定产品类型选择事件*/
- $("input[name='typeId']").change(function (){
- var typeId = parseInt($(this).val());
- var typeCompany = parseInt($("input:radio[name='typeId']:checked").attr("typeCompany"));
- $("#selectCompany").val(typeCompany);
- $("#companyId").val(typeCompany);
- var isOrder = 1;
- var isShowTDS = 2;//是否展示tds 1是 2否
- switch (typeId){ //1:Soodo电动牙刷 6:WaterO净水机 7:Aiberle净水机 9 :YULIA净水机
- case 1:
- setStore(typeCompany,null);
- isOrder = 2;
- break;
- case 6:
- setStore(typeCompany,null);
- isOrder = 1;
- isShowTDS = 1;
- break;
- case 7:
- setStore(typeCompany,null);
- isOrder = 1;
- isShowTDS = 1;
- break;
- case 9:
- setStore(typeCompany,null);
- isOrder = 1;
- isShowTDS = 1;
- break;
- case 16://诺米克净水机
- isOrder = 1;
- isShowTDS = 1;
- setStore(typeCompany,"73");
- break;
- case 17://花作净水机
- isOrder = 1;
- isShowTDS = 1;
- setStore(typeCompany,"75");
- break;
- default:
- setStore(typeCompany,null);
- break;
- }
- isNeedSelectOrder = isOrder ;
- initProcessResult(allProcMethodIsBack,allProcMethodIsSend);
- if(isShowTDS == 1){
- $("#tdsId").show();
- }else{
- $("#tdsId").hide();
- }
- for(var i=0;i<productTypeArray.length;i++){
- var array = productTypeArray[i];
- if(typeId == array[0]){
- customerTypeId = array[1];
- }
- }
- $("#complaintId").val(customerTypeId);
- initComplaintSmallClassInfo(customerTypeId);
- });
- /*当前第一个默认选中上朵电动牙刷 isNeedSelectOrder = 2 默认不需要选择订单*/
- // isNeedSelectOrder = 2 ;
- // initProcessResult(allProcMethodIsBack,allProcMethodIsSend);
- },
- error: function(XmlHttpRequest, textStatus, errorThrown){
- }
- });
- }
- /**
- *
- */
- function ulcProcessResult(data){
- initProcessResult(data[1].procMethodIsBack,data[1].procMethodIsSend);
- $("#procMethodDesc").html("补充说明:"+data[1].procMethodDesc);
- }
- /**
- * 选择处理结果-- 默认选择已解决
- * type : 1 :已解决 2:未解决 3:换新 4:维修 5:补发 6:退货 7:无理由退货 -- 删除
- * procMethodIsBack : 是否需要寄回 1:需要寄回 2:不需要寄回
- * procMethodIsSend : 是否需要寄出 1:需要寄出 2:不需要寄出
- */
- function initProcessResult(procMethodIsBack,procMethodIsSend){
- if(procMethodIsBack == null || procMethodIsBack == ""){
- procMethodIsBack = 1;
- }
- if(procMethodIsSend == null || procMethodIsSend == ""){
- procMethodIsSend = 1;
- }
- allProcMethodIsBack=procMethodIsBack;
- allProcMethodIsSend=procMethodIsSend;
- var customerInfoType = allCustomerInfoType; //售前售后
- if(allCustomerInfoType == null || allCustomerInfoType == ""){
- allCustomerInfoType = $("input[name='customerCounselType']:checked").val();
- }
- otherHied(); //全部隐藏
- if(allCustomerInfoType == 1){ //售前
- $("#customerCostsDiv").hide();
- }else if(allCustomerInfoType == 2){ //售后
- $("#customerCostsDiv").hide();
- 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;
- // }
- }
- $("#salesChannelsSelect").show(); //展示销售公司
- $("#TDScollect").show();
- if((procMethodIsBack == 2 && procMethodIsSend == 2)){ //不需要寄回,不需要寄出就是 已解决,未解决
- visitByType(1);
- isNeedSelectOrder = 2;
- }else{
- isNeedSelectOrder = 1;
- }
- if(procMethodIsBack == 1 || procMethodIsSend == 1){
- var produceType = $("input[name='typeId']:checked").val();
- if(produceType == 1){
- isNeedSelectOrder = 2;
- }
- }
- var promType = $("#procTypeId").val() //查看是否为维修
- if(promType == 3){
- $("#customerCostsDiv").show(); //工厂报价
- }
- if((procMethodIsBack == 1 || procMethodIsSend == 1) && isNeedSelectOrder == 1){ //是否有订单
- if(procMethodIsBack == 1 ){ //需要寄回
- $(".renewedProduct").show();
- }
- if(procMethodIsSend == 1){ //需要寄出
- $(".updateProduct").show();
- }
- //订单信息
- $(".orderHead").show();
- $(".sendAddressInfo").show();
- $("#postageAccount").show(); //邮费转账账户
- //地址信息
- $(".recipientInfo").show();
- $(".recipientAddress").show();
- visitByType(2); //需要回访
- if(customerInfoType == 1){
- $("#salesChannelsSelect").hide(); //展示销售公司
- $("#TDScollect").hide();
- }else{
- $("#salesChannelsSelect").show(); //展示销售公司
- $("#TDScollect").show();
- }
- }
- }
- }
- /*已解决|未解决 */
- function otherHied(customerInfoType){
- $(".orderHead").hide();
- $(".recipientInfo").hide();
- $(".recipientAddress").hide();
- $(".sendAddressInfo").hide();
- $(".renewedProduct").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);
- if(isEmpty(customerTypeId) ){
- $("[name='complaintId']").val(customerTypeId);
- }
- initComplaintSmallClassInfo(customerTypeId);
- },
- 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){
- }
- });
- }
- }
- var pageNo = 0;//当前页数
- var pages = 1;//总页数
- /*var previousPage = 0;//上一页
- var nextPage = 0;//下一页*/
- /**
- * 搜索QA 显示
- * type p:问题qa; m:邮寄qa
- */
- function initComplaintQuestionInfo(type){
- var complaintId;
- var smallClassId;
- var questionName;
- var customerCounselType;
- var questionId;
- if(type == "p"){
- pageNo = 0;//当前页数
- pages = 1;//总页数
- complaintId = $("[name='complaintId']").val();
- smallClassId = $("[name='smallClassId']").val();
- questionName = $("[name='questionIdMsg']").val();
- customerCounselType = $("[name='customerCounselType']:checked").val();
- }else if(type == "m"){
- pageNo = 0;//当前页数
- pages = 1;//总页数
- questionId = complaint_questionId;
- }else if(type == "pr"){
- if(pageNo - 1 < 1){
- layer.alert("已经到第一页了");
- return;
- }
- complaintId = $("[name='complaintId']").val();
- smallClassId = $("[name='smallClassId']").val();
- questionName = $("[name='questionIdMsg']").val();
- customerCounselType = $("[name='customerCounselType']:checked").val();
- pageNo = pageNo - 1;
- }else if(type == "ne"){
- if(pageNo + 1 > pages){
- layer.alert("已经是最后一页了");
- return;
- }
- complaintId = $("[name='complaintId']").val();
- smallClassId = $("[name='smallClassId']").val();
- questionName = $("[name='questionIdMsg']").val();
- customerCounselType = $("[name='customerCounselType']:checked").val();
- pageNo = pageNo + 1;
- }
- $.ajax({
- type: "POST",
- data: {
- complaintId : complaintId,
- smallClassId : smallClassId,
- questionName : questionName,
- /*complaintType : customerCounselType,*/
- questionId : questionId,
- pageNo : pageNo
- },
- url: url_path + "/admin/complaintQuestion/list_complaintQuestion",
- async: false,
- success: function(data){
- if(type == "p" || type == "pr" || type == "ne"){
- 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>';
- }
- pages = data.returnMsg.pagedResult.pages;
- pageNo = data.returnMsg.pagedResult.pageNo;
- $("#question").find("li").remove();
- $("#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;
- }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){
- var index = layer.load(1, {
- shade: [0.5,'#fff'] //0.1透明度的白色背景
- });
- if(orderId == null || orderId == "" || typeof (orderId)=="undefined"){
- layer.msg("未选中订单", {icon: 5, time: 3000});
- return false
- }
- $.ajax({
- type: "POST",
- data: {
- ids : orderId
- },
- url: url_path + "/admin/customer/select_salesOrder",
- async: true,
- success: function(data){
- var html = '';
- var addresHtml = '';
- var address = ''; //地址
- var orderItemList = {};
- var companyId = ''; //销售公司
- var storeId = ''; //店铺
- var salesAddressName,salesAddressTel; //名称赋值
- 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;
- if(orderItemList.length > 0){
- $(salesOrder.salesOrderItemList).each(function(index,element){
- orderItemList.push(this);
- })
- }else{
- orderItemList = salesOrder.salesOrderItemList;
- }
- for(var j=0;j<salesOrderItem.length;j++){
- var item = salesOrderItem[j].itemProductName+ "("+ salesOrderItem[j].itemProductColor +")" + "*" + salesOrderItem[j].itemNum;
- if(j==0){
- productsHtml += item
- }else{
- productsHtml += '<br>'+ item
- }
- }
- var time = formatDate(new Date(salesOrder.salesPayTime),"yyyy-MM-dd");
- html += '<tr>' +
- ' <td style="text-align: center;">'+ convertUndefinedToEmpty(salesOrder.companyName) +'</td>' +
- ' <td style="text-align: center;">'+ convertUndefinedToEmpty(salesOrder.storeName) +'</td>' +
- ' <td style="text-align: center;">'+ salesOrder.salesOrderId +'</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>' +
- ' <td style="text-align: center;">'+ salesOrder.salesAddressInfo +'</td>' +
- '</tr>';
- address = salesOrder.salesAddressInfo;
- salesAddressName = salesOrder.salesAddressName;
- salesAddressTel = salesOrder.salesAddressTel;
- }
- }else{
- html = '';
- }
- $("#sendName").val(salesAddressName); //收件人名称
- $("#sendTel").val(salesAddressTel); //收件人电话号码
- var name = $("#customerName").val();
- var tel = $("#customerTel").val();
- if(name == "" || name == null){
- $("#customerName").val(salesAddressName); //收件人名称
- }
- if(tel == "" || tel == null){
- $("#customerTel").val(salesAddressTel); //收件人电话号码
- }
- $("#showSalesOrderId").html(html); //显示订单
- $("#addressInfo").val(address);
- setAdress(address); //显示地址
- setProduce(orderItemList); //显示产品
- $("#companyId").val(companyId);
- $("#storeId").val(storeId);
- $("#ids").val(orderId);
- /*getCompany();*/
- layer.close(index);
- },
- error: function(XmlHttpRequest, textStatus, errorThrown){
- layer.close(index);
- }
- });
- }
- /**
- * 设置地址
- */
- function setAdress(addres){
- $("#addrssMsg").html("");
- if(addres == null){
- $("#addrssMsg").html("*未能获取到地址,请手动选择地址");
- return;
- }
- var addresList = addres.split("-");
- if(addresList == null || addresList.length < 3){
- addresList = addres.split(" ");
- if(addresList == null || addresList.length < 3){
- addresList = addres.split("_");
- if(addresList == null || addresList.length < 3){
- addresList = addres.split("@");
- if(addresList == null || addresList.length < 3){
- $("#addrssMsg").html("*未能获取到地址,请手动选择地址:"+addres);
- return;
- }
- }
- }
- }
- ulcRelationAddress.setUlcByName(0,addresList[0],addresList[1],addresList[2]);
- var addressInfo = addres.substring(addres.lastIndexOf(addresList[2])+addresList[2].length,addres.length);
- $("#sendAddress").val(addressInfo);
- }
- /**
- * 展示产品 -
- * todo 20180417
- * @param orderItemList
- */
- function setProduce(orderItemList) {
- var productList = getProduct() ; //所有产品
- var html = "";
- var productTypeNo = 0;
- var colorHtml = '';
- for(var k=0;k<orderItemList.length;k++){
- var item = orderItemList[k];
- var fiHtml = "-";
- colorHtml += '<tr >'
- + '<td style="text-align: center;" >' + item.itemProductName + '</td>'
- + '<td style="text-align: center;" >' + item.itemProductColor + '</td>'
- + '<td style="text-align: center;"><input type="text" style="width: 100%;border: none;text-align: center;" class="input-text input-number input-itemNum" value="' + (item.itemNum-item.itemReturnNum) + '" placeholder="产品数量" onkeyup="keyFun($(this),999,0)" onpaste="keyFun($(this),999,0)"></td>'
- + '<td style="text-align: center;" >'
- + '<input type="hidden" class="input-item-id" value="' + item.itemId + '">'
- + '<input type="hidden" class="input-produce-id" value="' + item.itemProductId + '">'
- + '<input type="hidden" class="input-fc-id" value="' + item.itemColorId +'">'
- + '<input type="hidden" class="input-69code" value="' + item.itemColorBar +'">'
- + '<input type="" class="input-text input-number input-code" style="width: 100%;border: none;text-align: center;" value="" placeholder="机器编号" name="" id="item-' + item.itemProductId + '-' + item.itemColorId +'" number="'+ (item.itemNum-item.itemReturnNum) +'" " onkeyup="keyFunString($(this),30)" onpaste="keyFunString($(this),30)" >'
- + '</td>'
- + '<td style="text-align: center;" ><a href="javascript:void(0)" onclick="delColor(this)" >删除</a></td>'
- + '</tr>';
- }
- if(allProcMethodIsBack == 1 ){ //需要寄回
- $("#addBackProduct").html(colorHtml);
- }
- if(allProcMethodIsSend == 1){ //需要寄出
- $("#addSendProduct").html(colorHtml);
- }
- }
- /**
- * 删除颜色
- */
- function delColor(node) {
- $(node).parent().parent().remove();
- }
- /*获取产品*/
- 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;
- }
- /*设置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 setStore(companyId,storeId){
- $.ajax({
- type: "POST",
- data: {
- companyId : companyId
- },
- url: url_path + "/admin/customer/select_storeInfo",
- success: function(data){
- $("#datalist_1").empty(); //清空下拉框
- if (data.returnCode == 200) {
- for(var i=0;i<data.returnMsg.storeInfoList.length;i++){
- var storeInfo = data.returnMsg.storeInfoList[i];
- if(storeId == null){
- if(i == 0){
- $("#store_1").val(storeInfo.storeName);
- $("#storeId").val(storeInfo.storeId);
- }
- }
- if(storeId == storeInfo.storeId) {
- if (storeInfo.storeId == storeId) {
- $("#store_1").val(storeInfo.storeName);
- $("#storeId").val(storeInfo.storeId);
- }
- }
- $("#datalist_1").append("<option data-id='"+storeInfo.storeId+"' value='"+ storeInfo.storeName +"'>"+ storeInfo.storeName +"</option>");
- }
- }
- },
- error: function(XmlHttpRequest, textStatus, errorThrown){
- }
- });
- }
- /**
- * 控制展示订单
- * 1:需要有订单 2:不需要有订单
- */
- function opentionSelectOrder(){
- // opentionSelectOrderDiv();
- }
- /*===============================客诉提交 -- 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(){
- $("#customerIsSolve").val($("#procMethodId").val());
- /* 是否需要添加订单,赋值 */
- $("#isNeedSelectOrder").val(isNeedSelectOrder);
- if(isNeedSelectOrder == 1){
- var post_ids = $("#ids").val();
- if(post_ids == null || post_ids == ""){
- layer.msg("请重新选择订单", {icon: 5, time: 3000});
- return false;
- }
- }
- /*验证手机号码*/
- 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(!phoneFlag){
- return false;
- }
- /*验证手机号码*/
- /*根据产品类型,获取来源商城*/
- 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 != ""){
- if(TDSArea == "请搜索城市"){
- 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();
- if(district != null && district != "请选择区/县"){
- 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---- */
- if(isNeedSelectOrder == 1 && (allProcMethodIsBack == 1 || allProcMethodIsSend == 1 ) ) { //需要订单
- // 寄回
- var closedProdcues = new Array(); //获取寄回,寄出直接复制寄回
- $("#addBackProduct").find(".input-code").each(function () {
- var machineNo = $(this).val(); //机器编号
- var number = $(this).parents("tr").find(".input-itemNum").eq(0).val(); //数量
- var itemId = $(this).parents("tr").find(".input-item-id").val(); //数量
- if (number != null && number != "" && number != 0) {
- var product = new Object();
- product.colorBar = $(this).parent().find(".input-69code").val();
- product.sendProdcueNumber = number;
- product.closedProdcueNumber = number;
- product.closedProdcueMachineNo = machineNo;
- product.itemId = itemId;
- closedProdcues.push(product);
- }
- });
- //寄出
- var sendProdcues = new Array(); //寄出产品表
- $("#addSendProduct").find(".input-code").each(function () {
- var machineNo = $(this).val(); //机器编号
- var number = $(this).parents("tr").find(".input-itemNum").eq(0).val(); //数量
- if (number != null && number != "" && number != 0) {
- var product = new Object();
- product.colorBar = $(this).parent().find(".input-69code").val();
- product.sendProdcueNumber = number;
- product.closedProdcueNumber = number;
- product.closedProdcueMachineNo = machineNo;
- sendProdcues.push(product);
- }
- });
- $("#sendProdcues").val(JSON.stringify(sendProdcues));
- $("#closedProdcues").val(JSON.stringify(closedProdcues));
- }
- 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;
- }
- /*===============================客诉提交 -- end -- =============================== */
- $("#customerWechatName").blur(function(){
- selectOnCustomer();
- });
- $("#customerName").blur(function(){
- selectOnCustomer();
- });
- $("#customerTel").blur(function(){
- selectOnCustomer();
- });
- /*根据客户信息查询老的客诉---start--*/
- function selectOnCustomer() {
- var customerWechatName = $("#customerWechatName").val();
- var customerName = $("#customerName").val();
- var customerTel = $("#customerTel").val();
- if((customerWechatName == null || customerWechatName == "") &&
- (customerName == null || customerName == "") &&
- (customerTel == null || customerTel == "")){
- $("#onCustomerTable").hide();
- return;
- }
- $.ajax({
- type: "POST",
- data: {"customerWechatName" :customerWechatName,
- "customerName":customerName,
- "customerTel":customerTel},
- url: url_path + "/admin/customer/selectOnCustomer",
- async: false,
- success: function(data){
- if (data.returnCode == 200) {
- var onCustomerList = data.returnMsg.onCustomerList;
- if(onCustomerList != null && onCustomerList.length >0 ){
- $("#onCustomerTable").show();
- var onCustomerTd = "";
- for(var i = 0;i < onCustomerList.length; i++){
- var onCustomer = onCustomerList[i];
- //客诉时间
- var time = formatDate(new Date(onCustomer.customerCreateTime),"yyyy-MM-dd");
- //处理方式
- var customerIsSolve = "";
- switch (onCustomer.customerIsSolve){
- case 1:
- customerIsSolve = "已解决";
- break;
- case 2:
- customerIsSolve = "未解决";
- break;
- case 3:
- customerIsSolve = "换新"+ backStatus(onCustomer.backStatus)+sendStatus(onCustomer.sendStatus);
- break;
- case 4:
- customerIsSolve = "维修"+ backStatus(onCustomer.backStatus)+sendStatus(onCustomer.sendStatus);
- break;
- case 5:
- customerIsSolve = "补发"+ sendStatus(onCustomer.sendStatus);
- break;
- case 6:
- customerIsSolve = "退货"+ backStatus(onCustomer.backStatus);
- break;
- case 7:
- customerIsSolve = "无理由退货"+ backStatus(onCustomer.backStatus);
- break;
- }
- var customerWechatName = onCustomer.customerWechatName;
- //微信昵称
- if(typeof(onCustomer.customerWechatName)=="undefined"){
- customerWechatName = "";
- }
- var customerName = onCustomer.customerName;
- //姓名
- if(typeof(onCustomer.customerName)=="undefined"){
- customerName = "";
- }
- onCustomerTd += '' +
- ' <tr>' +
- ' <td style="text-align: center;">'+ time+'</td>' +
- ' <td style="text-align: center;">'+onCustomer.adminName +'</td>' +
- ' <td style="text-align: center;">'+customerName +'</td>' +
- ' <td style="text-align: center;">'+customerWechatName +'</td>' +
- ' <td style="text-align: center;">'+onCustomer.customerTel +'</td>' +
- ' <td style="text-align: center;">'+customerIsSolve +'</td>' +
- ' <td style="text-align: center;">'+onCustomer.describeTitle +'</td>' +
- ' <td style="text-align: center;"><span class="txt2" style="display: inline-block;padding: 2px 4px;font-size: 11.844px;" title="'+onCustomer.describeContent +'" >'+onCustomer.describeContent +'</span></td>' +
- ' <td style="text-align: center;"><a onclick="admin_update_customer('+onCustomer.customerId +')">继续跟进</a>' +
- '<br><a onclick="markedSecondary('+onCustomer.customerId +','+onCustomer.customerInitialId +',this)">标记为二次售后</a>' +
- '<a style="display: none;" onclick="cancelMarkedSecondary('+onCustomer.customerId+','+onCustomer.customerInitialId +',this)">取消二次售后标记</a></td>' +
- ' </tr>' +
- '';
- }
- $("#onCustomer").html(onCustomerTd);
- }
- }
- },
- error: function(XmlHttpRequest, textStatus, errorThrown){
- }
- });
- function backStatus(status) {
- if(status == 1){
- return "(未寄回)";
- }
- if(status == 2){
- return "(已寄回)";
- }
- if(status == 3){
- return "(已收货)";
- }
- }
- function sendStatus(status) {
- if(status == 1){
- return "(未寄送)";
- }
- if(status == 2){
- return "(已寄送)";
- }
- if(status == 3){
- return "(已收货)";
- }
- }
- }
- /*根据客户信息查询老的客诉---end--*/
- /**
- * 添加产品
- */
- function addProduct(type) {
- productAddType = type;
- layer_show("商品列表",url_path + "/admin/salesOrder/to_add_product","1000","500");
- }
- /**
- * 选择商品回调
- * @param colorIds
- */
- function setSelectProduct(colorIds){
- var index = layer.load(1, {
- shade: [0.5,'#fff'] //0.1透明度的白色背景
- });
- var colorIdArray = colorIds.split("_");
- for(var i=0;i<colorIdArray.length;i++){
- var colorId = colorIdArray[i];
- if(colorId == ""){
- break;
- }
- var flag = true;
- $("#add_product").find("tr").each(function (){
- var colId = $(this).find(".color_id").eq(0).val();
- if(colId == colorId){
- flag = false;
- }
- });
- if(!flag){
- continue;
- }
- $.ajax({
- type: "POST",
- data: { colorId : colorId},
- url: url_path +"/admin/product/get_product",
- success: function(data){
- var html = "";
- if (data.returnCode == 200 && data.returnMsg.productColorList.length > 0 ) {
- for(var i=0;i<data.returnMsg.productColorList.length;i++){
- var productColor = data.returnMsg.productColorList[i];
- html += '<tr >'
- + '<td width="80" style="text-align: center;" >' + cufte(productColor.productName) + '</td>'
- + '<td width="40" style="text-align: center;" >' + cufte(productColor.colorName) + '</td>'
- + '<td width="20" style="text-align: center;"><input type="text" style="width: 100%;border: none;text-align: center;" class="input-text input-number input-itemNum" value="1" placeholder="产品数量" onkeyup="keyFun($(this),999,1)" onpaste="keyFun($(this),999,1)"></td>'
- + '<td width="100" style="text-align: center;" >'
- + '<input type="hidden" class="input-produce-id" value="' + productColor.colorProductId + '">'
- + '<input type="hidden" class="input-fc-id" value="' + productColor.colorId +'">'
- + '<input type="hidden" class="input-69code" value="' + productColor.colorBar +'">'
- + '<input type="" class="input-text input-number input-code" style="width: 100%;border: none;text-align: center;" value="" placeholder="机器编号" name="" id="item-' + productColor.colorProductId + '-' + productColor.colorId +'" number="1" " onkeyup="keyFunString($(this),30)" onpaste="keyFunString($(this),30)" >'
- + '</td>'
- + '<td width="20" style="text-align: center;" ><a href="javascript:void(0)" onclick="delColor(this)" >删除</a></td>'
- + '</tr>';
- }
- }else{
- layer.msg("添加产品失败!", {icon: 5, time: 3000});
- }
- var notSelectOrderHtml = $("#addSendProduct").find(".notSelectOrder").html();
- if(!isEmpty(notSelectOrderHtml)){
- if(productAddType == 2){
- $("#addSendProduct").append(html);
- }else if(productAddType == 1){
- $("#addBackProduct").append(html);
- }
- }else{
- if(productAddType == 2){
- $("#addSendProduct").html(html);
- }else if(productAddType == 1){
- $("#addBackProduct").html(html);
- }
- }
- }
- });
- }
- layer.close(index);
- }
|