| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305 |
- 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("<option value='"+ n.F_PagerId +"'>"+ n.F_Title +"</option>")
- })
- }
- })
- }
- // 获取问卷详情
- 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 += '<li class="" name="ltype' + Quesid + '" >';
- html += '<div class="Back ">';
- html += '<h3 class="size-14 QuesTitle" indexs="' + Questions[i].quesid + '">' + Questions[i].questitle + quesremark + ' </h3>';
- html += '</div>';
- //判断类型
- if(questype == 2) {
- //选项
- if(Questions[i].quesitems.length > 0) { //单选
- html += '<div class="radio clearfix" name="ltype' + Quesid + '" indexs="' + Questions[i].quesid + '">';
- var quesitems = Questions[i].quesitems;
- html += '<ul class="Ul">'
- for(var j = 0; j < quesitems.length; j++) {
- html += '<li>'
- html += '<label style="font-weight: normal;">'
- html += '' + (j + 1) + '.';
- html += '<input type="radio" index_="' + quesitems[j].itemid + '" value="' + quesitems[j].itemid + '" name="ltype' + Quesid + '" style="margin-left:5px;"> <span>' + quesitems[j].itemname + '</span></label>'
- html += '</li>'
- }
- html += '</ul>'
- html += '</div>'
- html += '</li>'
- }
- } else if(questype == 1) {
- //问答题
- html += '<div class="Wd" indexs="' + Questions[i].quesid + '">';
- html += '<textarea class="Wds" index="' + Questions[i].quesid + '"name="" rows="" cols="" style="width: 100%;"></textarea>'
- html += '</div>'
- } else {
- if(Questions[i].quesitems.length > 0) { //多选
- html += '<div class="checkbox clearfix" name="ltype' + Quesid + '" indexs="' + Questions[i].quesid + '">';
- html += '<ul class="Ul">'
- var quesitems = Questions[i].quesitems;
- for(var j = 0; j < quesitems.length; j++) {
- html += '<li>'
- html += '<label style="font-weight: normal;">'
- html += '' + (j + 1) + '.';
- html += '<input type="checkbox" index_="' + quesitems[j].itemid + '" value="' + quesitems[j].itemid + '" name="ltype' + Quesid + '" ><span> ' + quesitems[j].itemname + '</span></label>'
- //html += '<input type="checkbox" index_="' + quesitems[j].itemid + '" value="' + quesitems[j].itemid + '" name="ltype' + Quesid + '" > ' + quesitems[j].itemname + '</label>'
- html += '</li>'
- }
- html += '</ul>';
- html += '</div>'
- html += '</li >';
- }
- }
- }
- $(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 += '<li >';
- // html += '<div class="Back">';
- // html += '<h3 class="size-14 QuesTitle" indexs="' + Questions[i].quesid + '">' + Questions[i].questitle + quesremark + ' </h3>';
- // html += '</div>';
- // //判断类型
- // if(questype == 2) { //问答题
- // //选项
- // if(Questions[i].quesitems.length > 0) {
- // html += '<div>';
- // var quesitems = Questions[i].quesitems;
- // for(var j = 0; j < quesitems.length; j++) {
- // html += '<label style="font-weight: normal;">'
- // html += '' + (j + 1) + '.';
- // html += '<input type="radio" index_="' + quesitems[j].itemid + '" value="' + quesitems[j].itemname + '" name="ltype' + Quesid + '" style="margin-left:5px;"> ' + quesitems[j].itemname + '</label>'
- // }
- // html += '</div>'
- // html += '</li>'
- // }
- // } else if(questype == 1) {
- // html += '<div>';
- // html += '<textarea index="' + Questions[i].quesid + '"name="" rows="" cols="" style="width: 100%;"></textarea>'
- // html += '</div>'
- // } else {
- // if(Questions[i].quesitems.length > 0) {
- // html += '<div>';
- // var quesitems = Questions[i].quesitems;
- // for(var j = 0; j < quesitems.length; j++) {
- // html += '<label style="font-weight: normal;">'
- // html += '' + (j + 1) + '.';
- // html += '<input type="checkbox" value="' + quesitems[j].itemname + '" name="checks" > ' + quesitems[j].itemname + '</label>'
- // }
- // html += '</div>'
- // html += '</li >';
- // }
- // }
- // }
- // $(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) {
-
- }
- })
- }
|