var custelid = helper.request.queryString("custelid"); //随访记录id var name = decodeURI(helper.request.queryString("name")); //姓名 var phone = helper.request.queryString("phone"); //联系人电话 var address = decodeURI(helper.request.queryString("address")); //地址 var ans = []; //问题答案 $(document).ready(function() { $("#order_details ul li").click(function() { $(this).addClass("Active").siblings().removeClass("Active"); var tabindex = $(this).index(); $(".gdxq").hide(); $(".gdxq").eq(tabindex).show(); if(tabindex === 0) { } else if(tabindex > 0 && tabindex < 4) { } else if(tabindex === 4) { } }); // 随访结果id getAccessResult(); $(".search-questionnaire-detail").on("click", function(){ getQuestionnaireDetail(); }) getQuestionnaireInformation(); // XQ(); // if(wid != null && wid != undefined && wid != "") { // XQ(); // } }) // 获取问卷信息 function getQuestionnaireInformation(){ $.ajax({ type: "get", dataType: "json", url: huayi.config.callcenter_url + "Questionnaire/GetPagerInfoList", data: { PageIndex: 1, PageSize: 300, }, asnyc: true, success: function(result) { var data = result.rows; $(data).each(function(i, n) { $("#selectQuesInformation").append("") }) } }) } // 获取问卷详情 function getQuestionnaireDetail() { $(".questionnaire-detail").show(); $(".Qus_box").empty(); // $(".tbody").empty(); $.ajax({ type: "get", url: huayi.config.callcenter_url + "/Questionnaire/GetPagerInfoQ", async: true, dataType: "json", data: { pid: $("#selectQuesInformation").val(), token: $.cookie("token"), }, success: function(data) { if(data.state.toLowerCase() == 'success') { $('.Title').text(data.data.F_Title); $("#F_Remark").text(data.data.F_Remark); $("#startText").text(data.data.F_StartText); $("#endText").text(data.data.F_EndText); var Questions = data.data.F_Questions; var html = ''; for(var i = 0; i < Questions.length; i++) { var questype = Questions[i].questype; var Quesid = Questions[i].quesid; var quesremark = Questions[i].quesremark; //试题说明 if(quesremark) { quesremark = ' 【' + quesremark + '】'; } else { quesremark = ""; } html += '
  • '; html += '
    '; html += '

    ' + Questions[i].questitle + quesremark + '

    '; html += '
    '; //判断类型 if(questype == 2) { //选项 if(Questions[i].quesitems.length > 0) { //单选 html += '
    '; var quesitems = Questions[i].quesitems; html += '' html += '
    ' html += '
  • ' } } else if(questype == 1) { //问答题 html += '
    '; html += '' html += '
    ' } else { if(Questions[i].quesitems.length > 0) { //多选 html += '
    '; html += ''; html += '
    ' html += ''; } } } $(html).appendTo(".Qus_box"); // autosize($('textarea')); } } }); } // 获取问卷详情 // function getQuestionnaireDetail() { // $(".questionnaire-detail").show(); // $(".Qus_box").empty(); // $.ajax({ // type: "get", // url: huayi.config.callcenter_url + "/Questionnaire/GetPagerInfoQ", // async: true, // dataType: "json", // data: { // pid: $("#selectQuesInformation").val(), // token: $.cookie("token"), // }, // success: function(data) { // if(data.state.toLowerCase() == 'success') { // $('.Title').text(data.data.F_Title); // $("#F_Remark").text(data.data.F_Remark); // $("#startText").text(data.data.F_StartText); // $("#endText").text(data.data.F_EndText); // var Questions = data.data.F_Questions; // var html = ''; // for(var i = 0; i < Questions.length; i++) { // var questype = Questions[i].questype; // var Quesid = Questions[i].quesid; // var quesremark = Questions[i].quesremark;//试题说明 // if(quesremark){ // quesremark = ' 【' + quesremark +'】'; // }else{ // quesremark = ""; // } // html += '
  • '; // html += '
    '; // html += '

    ' + Questions[i].questitle + quesremark + '

    '; // html += '
    '; // //判断类型 // if(questype == 2) { //问答题 // //选项 // if(Questions[i].quesitems.length > 0) { // html += '
    '; // var quesitems = Questions[i].quesitems; // for(var j = 0; j < quesitems.length; j++) { // html += '' // } // html += '
    ' // html += '
  • ' // } // } else if(questype == 1) { // html += '
    '; // html += '' // html += '
    ' // } else { // if(Questions[i].quesitems.length > 0) { // html += '
    '; // var quesitems = Questions[i].quesitems; // for(var j = 0; j < quesitems.length; j++) { // html += '' // } // html += '
    ' // html += ''; // } // } // } // $(html).appendTo(".Qus_box"); // } // } // }); // } // 提交 $(".access-complete").click(function() { $(".radio").each(function(j, k) { str = ''; var nameRadio = $(k).attr("name"); var index = $(k).attr("indexs"); var val = $('input[name="' + nameRadio + '"]:checked').val(); var valText = $('input[name="' + nameRadio + '"]:checked').next().text(); if(val != null) { str = index + '_' + val + '_' + valText; ans.push(str); } }) $(".checkbox").each(function(j, k) { strs = ''; var nameCheckbox = $(k).attr("name"); var index = $(k).attr("indexs"); var check = ""; var text = ""; var VAl = $('input[name="' + nameCheckbox + '"]:checked'); $(VAl).each(function(i, n) { text += $(this).next().text() + "|"; check += $(this).val() + "|"; }) if(check != "") { str = index + '_' + check + '_' + text; ans.push(str); } }) $(".Wd").each(function(j, k) { strs = ''; var nameWd = $(k).attr("name"); var index = $(k).attr("indexs"); var val = $(k).find(".Wds").val(); if(val) { str = index + '_0_' + val; ans.push(str); } }) addSatisfactionAnswer() }) //添加满意度答案 function addSatisfactionAnswer() { console.log("ans",ans); console.log("name", name); console.log("ans",ans); $.ajax({ type: "post", url: huayi.config.callcenter_url + "FollowUp/Answers", async: true, dataType: "json", data: { token: $.cookie("token"), custelid: custelid, //随访记录id ans: ans, //问题答案 hjjgid: $("#selectQuesInformation").val(), //随访结果id name: name, //姓名 phone: phone, //联系人电话 address: address, //地址 advise: $("#satisfactionAdvise").val(), //建议 satisfied: $("#selectSatisfaction").val(), //满意度 praise: $("#satisfactionPraise").val(), //表扬 criticism: $("#satisfactionCriticism").val(), //批评 }, success: function(result){ layer.msg("添加成功") } }) } //获取随访结果id function getAccessResult(){ $.ajax({ type: "get", url: huayi.config.callcenter_url + "Questionnaire/GetPagerList", async: true, dataType: "json", data: { token: $.cookie("token"), }, success: function(result) { } }) }