<pre name="code" class="javascript">require(['jquery',
'global',
'module/util',
'niceScroll',
'scrollHelper2',
'jquery.pnotify',
'requirejs/domready!',
'jquery.maskedinput',
'validate-methods'],
function($, global, util, niceScroll,scrollHelper2){
var ticketCategory = {
"p": "纸票",
"e": "电票",
"s": "小票",
"b": "商票"
};
var detailCategory = {
"gg": "国股",
"sh": "商行",
"sn": "三农",
"busPaper": "纸质",
"busEle": "电子"
};
var init = function init(){
//定制滚动条
$("#left-wrap, .ticket-block.show, .quote-form").niceScroll({
cursorwidth: 0,
cursorcolor: "#4C93EB",
cursorborder: "none",
background: "#E7E7E7",
autohidemode: true
});
//快速回复,默认5颗星
$(".safe-level, .speed, .attitude").raty({
half : true,
score : 5
});
//额度为”不限“时,具体额度可不填
if($(".amount").val() === "0"){
$(".speAmount").attr("disabled", true).val("");
}
$(".amount").change(function(){
if($(this).val() === "0"){
$(".speAmount").attr("disabled", true).val("");
}else{
$(".speAmount").attr("disabled", false);
}
});
//左侧无项目时,显示文字提示
tips();
//表单验证
$('#p-form').validate({
rules: {
gg: {
numFormat: true
},
sh: {
numFormat: true
},
sn: {
numFormat: true
},
speAmount: {
required: true
}
},
submitHandler: function (form) {
publishQuote();
}
});
$('#s-form').validate({
rules: {
gg: {
numFormat2: true
},
sh: {
numFormat2: true
},
sn: {
numFormat2: true
},
speAmount: {
required: true
}
},
submitHandler: function (form) {
publishQuote();
}
});
$('#e-form').validate({
rules: {
gg: {
numFormat: true
},
sh: {
numFormat: true
},
sn: {
numFormat: true
},
speAmount: {
required: true
}
},
submitHandler: function (form) {
publishQuote();
}
});
$('#b-form').validate({
rules: {
busPaper: {
numFormat: true
},
busEle: {
numFormat: true
},
speAmount: {
required: true
}
},
submitHandler: function (form) {
publishQuote();
}
});
};//init结束
//发布
var publishQuote=function publishQuote(){
var contactArr = [];
var nodes = $(".ticket-block.show .info-floor");
for(var i = 0; i < nodes.length; i++){
if(nodes.eq(i).find(".checkboxes").hasClass("selected")){
contactArr.push({
managerId: nodes.eq(i).attr("data-managerId")
});
}
}
var datas = {
quoteType: "",
gg: $(".quote-now .ticket-block.show .gg").val(),
sh: $(".quote-now .ticket-block.show .sh").val(),
sn: $(".quote-now .ticket-block.show .sn").val(),
dateLimit: $(".quote-now .ticket-block.show .dateLimit").val(),
amount: $(".quote-now .ticket-block.show .amount").val(),
speAmount: $(".quote-now .ticket-block.show .speAmount").val().replace(/,/g, ""),
busType: $(".quote-now .ticket-block.show .busType").val(),
queType: $(".quote-now .ticket-block.show .queType").val(),
remarks: $(".quote-now .ticket-block.show .remarks").val(),
accountManagerList: contactArr
};
switch($(".ticket-block.show").index(".ticket-block")){
case 0:
datas.quoteType = "p";
break;
case 1:
datas.quoteType = "e";
break;
case 2:
datas.quoteType = "s";
break;
case 3:
datas = {
quoteType: "b",
busEle: $(".quote-now .ticket-block.show .busEle").val(),
busPaper: $(".quote-now .ticket-block.show .buspaper").val(),
dateLimit: $(".quote-now .ticket-block.show .dateLimit").val(),
amount: $(".quote-now .ticket-block.show .amount").val(),
speAmount: $(".quote-now .ticket-block.show .speAmount").val().replace(/,/g, ""),
busType: $(".quote-now .ticket-block.show .busType").val(),
queType: $(".quote-now .ticket-block.show .queType").val(),
remarks: $(".quote-now .ticket-block.show .remarks").val(),
accountManagerList: contactArr
};
break;
}
$.ajax({
type: "post",
url: global.context+"/web/mobuser/quotePrice/publish",
dataType: "html",
async: false,
contentType: "application/json;charset=UTF-8",
data: JSON.stringify(datas),
success: function(xhr){
//报价是否成功
var result = $.parseJSON(xhr);
if( result.code === 'ACK'){
//提示框
$.pnotify({
text: result.message,
type: 'success'
});
//刷新报价
$.ajax({
type: "POST",
url: global.context+"/web/mobuser/quotePrice/show" ,
contentType: "application/json;charset=UTF-8",
dataType: "json",
success: function(msg){
insertInfo(msg);
// changeColor(msg);
tips();
}
});
}else if(result.code === 'REDIRECT'){
util.redirect(result.data);
}else{
$.pnotify({
text: result.message,
type: 'error'
});
}
}
});
}
var bindEvent=function bindEvent(){
//业务类型为”查询回复打款“时,不显示”无需查询“枚举值
$("#p_busType").change(function(){
if($(this).val() === "0"){//查询回复打款
$("#p_queType option[value = '0'], #p_queType option[value = '1']").removeClass("hide");
$("#p_queType option[value = '2']").remove();
}else if($("#p_queType option[value = '2']").val() == undefined){
$("#p_queType option[value = '0'], #p_queType option[value = '1']").addClass("hide");
$("#p_queType").append("<option value='2' selected>无需查询</option>");
}
});
$("#s_busType").change(function(){
if($(this).val() === "0"){//查询回复打款
$("#s_queType option[value = '0'], #s_queType option[value = '1']").removeClass("hide");
$("#s_queType option[value = '2']").remove();
}else if($("#s_queType option[value = '2']").val() == undefined){
$("#s_queType option[value = '0'], #s_queType option[value = '1']").addClass("hide");
$("#s_queType").append("<option value='2' selected>无需查询</option>");
}
});
//选择需要添加的票的类型
$(".right-nav li").click(function(){
$(".not-select").addClass("hide").removeClass("show");
$(".opt-link").addClass("show").removeClass("hide");
var index = $(this).index();
$(".ticket-block").removeClass("show").addClass("hide").eq(index).addClass("show").removeClass("hide");
$(".right-nav li").removeClass("active");
$(this).addClass("active");
$.ajax({
type: "POST",
url: global.context+"/web/mobuser/manager/show" ,
contentType: "application/json;charset=UTF-8",
dataType: "json",
data: JSON.stringify({ifAll: false}),
success: function(msg){
// console.log(msg);
//获取联系方式
$(".ticket-block.show").find(".contact .info-floor").remove();
for(var i = 0; i< msg.data.length; i++){
infoFloor = "<div class='info-floor' data-managerId="+msg.data[i].managerId+">" +
"<span class='checkboxes not-selected'></span><span class='text'>" +
"<span>"+msg.data[i].name+"</span> " +
"<span>"+msg.data[i].mobPhone+"</span> " +
"<span>"+msg.data[i].telephone+"</span> " +
"<span><a href='javascript:;' class='getmap' id='"+msg.data[i].managerId+"'>"+msg.data[i].address+"</a></span></span><a class='right change' data-toggle='modal' data-target='#change-contact'>></a></div>";
$(".ticket-block.show").find(".contact").prepend(infoFloor);
}
//业务类型为“查询回复打款”时,不显示“无需查询”
if($(".ticket-block.show").find(".busType").val() === "0"){
// $(".ticket-block.show").find(".queType option[value='2']").remove();
$(".ticket-block.show").find(".queType option[value='2']").addClass("hide");
$(".ticket-block.show").find(".queType option[value='1']").attr("selected","selected");
}
}
});
//绑定上次有效报价
var ticketCategory;
switch($(".right-nav li.active").text()){
case "纸票":
ticketCategory = "p";
break;
case "电票":
ticketCategory = "e";
break;
case "小票":
ticketCategory = "s";
break;
case "商票":
ticketCategory = "b";
break;
}
$.ajax({
type: "POST",
url: global.context+"/web/mobuser/quotePrice/lastQuote" ,
contentType: "application/json;charset=UTF-8",
dataType: "json",
data: JSON.stringify({quoteType: ticketCategory}),
success: function(msg){
if(msg.data.quoteType && msg.data.quoteType === "p"){
var len = msg.data.quotePriceDetailList.length;
for(var i = 0; i < len; i++){
if(msg.data.quotePriceDetailList[i].detailType === "gg"){
$(".ticket-block").eq(0).find(".gg").val(formatNumber(msg.data.quotePriceDetailList[i].price, 2));
}
if(msg.data.quotePriceDetailList[i].detailType === "sh"){
$(".ticket-block").eq(0).find(".sh").val(formatNumber(msg.data.quotePriceDetailList[i].price, 2));
}
if(msg.data.quotePriceDetailList[i].detailType === "sn"){
$(".ticket-block").eq(0).find(".sn").val(formatNumber(msg.data.quotePriceDetailList[i].price, 2));
}
}
$(".ticket-block").eq(0).find(".dateLimit").val(msg.data.dateLimit);
$(".ticket-block").eq(0).find(".amount").val(msg.data.amount);
$(".ticket-block").eq(0).find(".speAmount").val(msg.data.speAmount);
$(".ticket-block").eq(0).find(".busType").val(msg.data.busType);
$(".ticket-block").eq(0).find(".queType").val(msg.data.queType);
$(".ticket-block").eq(0).find(".remarks").val(msg.data.remarks);
if(!($(".ticket-block.show").find(".amount").val() == "0")){
$(".ticket-block.show").find(".speAmount").attr("disabled", false);
}
}else if(msg.data.quoteType && msg.data.quoteType === "e"){
var len = msg.data.quotePriceDetailList.length;
for(var i = 0; i < len; i++){
if(msg.data.quotePriceDetailList[i].detailType === "gg"){
$(".ticket-block").eq(1).find(".gg").val(formatNumber(msg.data.quotePriceDetailList[i].price, 2));
}
if(msg.data.quotePriceDetailList[i].detailType === "sh"){
$(".ticket-block").eq(1).find(".sh").val(formatNumber(msg.data.quotePriceDetailList[i].price, 2));
}
if(msg.data.quotePriceDetailList[i].detailType === "sn"){
$(".ticket-block").eq(1).find(".sh").val(formatNumber(msg.data.quotePriceDetailList[i].price, 2));
}
}
$(".ticket-block").eq(1).find(".dateLimit").val(msg.data.dateLimit);
$(".ticket-block").eq(1).find(".amount").val(msg.data.amount);
$(".ticket-block").eq(1).find(".speAmount").val(msg.data.speAmount);
$(".ticket-block").eq(1).find(".busType").val(msg.data.busType);
// $(".ticket-block").eq(1).find(".queType").val(msg.data.queType);
$(".ticket-block").eq(1).find(".remarks").val(msg.data.remarks);
if(!($(".ticket-block.show").find(".amount").val() == "0")){
$(".ticket-block.show").find(".speAmount").attr("disabled", false);
}
}else if(msg.data.quoteType && msg.data.quoteType === "s"){
var len = msg.data.quotePriceDetailList.length;
for(var i = 0; i < len; i++){
if(msg.data.quotePriceDetailList[i].detailType === "gg"){
$(".ticket-block").eq(2).find(".gg").val(formatNumber(msg.data.quotePriceDetailList[i].price, 2));
}
if(msg.data.quotePriceDetailList[i].detailType === "sh"){
$(".ticket-block").eq(2).find(".sh").val(formatNumber(msg.data.quotePriceDetailList[i].price, 2));
}
if(msg.data.quotePriceDetailList[i].detailType === "sn"){
$(".ticket-block").eq(2).find(".sh").val(formatNumber(msg.data.quotePriceDetailList[i].price, 2));
}
}
$(".ticket-block").eq(2).find(".dateLimit").val(msg.data.dateLimit);
$(".ticket-block").eq(2).find(".amount").val(msg.data.amount);
$(".ticket-block").eq(2).find(".speAmount").val(msg.data.speAmount);
$(".ticket-block").eq(2).find(".busType").val(msg.data.busType);
$(".ticket-block").eq(2).find(".queType").val(msg.data.queType);
$(".ticket-block").eq(2).find(".remarks").val(msg.data.remarks);
if(!($(".ticket-block.show").find(".amount").val() == "0")){
$(".ticket-block.show").find(".speAmount").attr("disabled", false);
}
}else if(msg.data.quoteType && msg.data.quoteType === "b"){//商票
var len = msg.data.quotePriceDetailList.length;
for(var i = 0; i < len; i++){
if(msg.data.quotePriceDetailList[i].detailType === "busPaper"){
$(".ticket-block").eq(3).find(".busPaper").val(formatNumber(msg.data.quotePriceDetailList[i].price, 2));
}
if(msg.data.quotePriceDetailList[i].detailType === "busEle"){
$(".ticket-block").eq(3).find(".busEle").val(formatNumber(msg.data.quotePriceDetailList[i].price, 2));
}
}
$(".ticket-block").eq(3).find(".dateLimit").val(msg.data.dateLimit);
$(".ticket-block").eq(3).find(".amount").val(msg.data.amount);
$(".ticket-block").eq(3).find(".speAmount").val(msg.data.speAmount);
$(".ticket-block").eq(3).find(".busType").val(msg.data.busType);
// $(".ticket-block").eq(3).find(".queType").val(msg.data.queType);
$(".ticket-block").eq(3).find(".remarks").val(msg.data.remarks);
if(!($(".ticket-block.show").find(".amount").val() == "0")){
$(".ticket-block.show").find(".speAmount").attr("disabled", false);
}
}else{
alert("错误");
}
}
});
$(".quote-form").getNiceScroll().resize();
});
//提交表单
$("#submit").click(function(){
//验证是否勾选联系方式
var contactArr = [];
var nodes = $(".ticket-block.show .info-floor");
for(var i = 0; i < nodes.length; i++){
if(nodes.eq(i).find(".checkboxes").hasClass("selected")){
contactArr.push({
managerId: nodes.eq(i).attr("data-managerId")
});
}
}
//额度为”不限“时,具体额度可不填
if($(".amount").val() === "0"){
$(".speAmount").attr("disabled", true).removeClass("require");
}else{
$(".speAmount").addClass("require");
}
if(contactArr.length === 0){
alert("未选择联系方式");
return false;
}else{
switch($(".ticket-block.show").index(".ticket-block")){
case 0:
$('#p-form').submit();
break;
case 1:
$('#e-form').submit();
break;
case 2:
$('#s-form').submit();
break;
case 3:
$('#b-form').submit();
break;
}
}
});
//进入报价详情
$("body").on("click", ".price-floor", function(){
//高亮选中的行
$("a.price-floor").removeClass("active");
$(this).addClass("active");
$(".quote-comments").addClass("hide").removeClass("show");
var category = $(this).find("span").eq(0).text();
var subCategory = $(this).find("span").eq(1).text();
$(".right-title > h5").text(category+"("+subCategory+")");
//初始化
$(".price-info .gg, .price-info .sh, .price-info .sn, .price-info .busPaper, .price-info .busEle").text("");
var data;
switch(category){
case ticketCategory.p:
data = {quoteType: "p"};
break;
case ticketCategory.e:
data = {quoteType: "e"};
break;
case ticketCategory.s:
data = {quoteType: "s"};
break;
case ticketCategory.b:
data = {quoteType: "b"};
break;
}
$.ajax({
type: "POST",
url: global.context+"/web/mobuser/quotePrice/detail",
data: JSON.stringify(data),
contentType: "application/json;charset=UTF-8",
success: function(msg){
$(".quote-now, .comments").addClass("hide").removeClass("show");
$(".quote-details-block").addClass("show").removeClass("hide");
$(".box-1, .box-2").empty();
var jsonObj = JSON.parse(msg);
var limit;
var amount;
var busType;
var queType;
switch(jsonObj.data.dateLimit){
case "0":
limit = "不限";
break;
case "1":
limit = "180天以上";
break;
case "2":
limit = "170天以上";
break;
}
switch(jsonObj.data.amount){
case 0:
amount = "不限";
break;
case 1:
amount = "较多";
break;
case 2:
amount = "较少";
break;
case 3:
amount = "紧张";
break;
}
switch(jsonObj.data.busType){
case "0":
busType = "查询回复打款";
break;
case "1":
busType = "买断";
break;
case "2":
busType = "直贴";
break;
}
switch(jsonObj.data.queType){
case "0":
queType = "实查";
break;
case "1":
queType = "电查";
break;
case "2":
queType = "无需查询";
break;
}
if(jsonObj.data.quoteType === "b"){
$(".two-part").addClass("show").removeClass("hide");
$(".three-part").removeClass("show").addClass("hide");
$(".price-info .limit").text(limit);
$(".price-info .amount").text(amount);
if(jsonObj.data.speAmount === null){
$("#speAmount").text("");
}else{
$("#speAmount").text(jsonObj.data.speAmount);
}
for(var i = 0; i < jsonObj.data.quotePriceDetailList.length; i++){
switch(jsonObj.data.quotePriceDetailList[i].quoteStatus){
case 0:
break;
case 1:
if(jsonObj.data.quotePriceDetailList[i].detailType === "busPaper"){
$(".price-info .busPaper").text(jsonObj.data.quotePriceDetailList[i].price.toFixed(2));
}else if(jsonObj.data.quotePriceDetailList[i].detailType === "busEle"){
$(".price-info .busEle").text(jsonObj.data.quotePriceDetailList[i].price.toFixed(2));
}
break;
case 2:
if(jsonObj.data.quotePriceDetailList[i].detailType === "busPaper"){
$(".price-info .busPaper").text(jsonObj.data.quotePriceDetailList[i].price.toFixed(2));
}else if(jsonObj.data.quotePriceDetailList[i].detailType === "busEle"){
$(".price-info .busEle").text(jsonObj.data.quotePriceDetailList[i].price.toFixed(2));
}
break;
case 3:
if(jsonObj.data.quotePriceDetailList[i].detailType === "busPaper"){
$(".price-info .busPaper").text("--").attr("data-type", -3);
}else if(jsonObj.data.quotePriceDetailList[i].detailType === "busEle"){
$(".price-info .busEle").text("--").attr("data-type", -3);
}
break;
case 4:
if(jsonObj.data.quotePriceDetailList[i].detailType === "busPaper"){
$(".price-info .busPaper").text("--").attr("data-type", -4);
}else if(jsonObj.data.quotePriceDetailList[i].detailType === "busEle"){
$(".price-info .busEle").text("--").attr("data-type", -4);
}
break;
case 5:
if(jsonObj.data.quotePriceDetailList[i].detailType === "busPaper"){
$(".price-info .busPaper").text("--").attr("data-type", -5);
}else if(jsonObj.data.quotePriceDetailList[i].detailType === "busEle"){
$(".price-info .busEle").text("--").attr("data-type", -5);
}
break;
}
}
$(".business-info .busType").text(busType).parent().addClass("hide").removeClass("show");
$(".business-info .queType").text(queType).parent().addClass("hide").removeClass("show");
$(".business-info .remarks").text(jsonObj.data.remarks);
}else{
$(".business-info .busType").text(busType).parent().addClass("show").removeClass("hide");
$(".business-info .queType").text(queType).parent().addClass("show").removeClass("hide");
if(jsonObj.data.quoteType === "e"){
$(".business-info .queType").text(queType).parent().addClass("hide").removeClass("show");
}
$(".three-part").addClass("show").removeClass("hide");
$(".two-part").removeClass("show").addClass("hide");
for(var i = 0; i < jsonObj.data.quotePriceDetailList.length; i++){
switch(jsonObj.data.quotePriceDetailList[i].quoteStatus){
case 0:
break;
case 1:
if(jsonObj.data.quotePriceDetailList[i].detailType === "gg"){
$(".price-info .gg").text(jsonObj.data.quotePriceDetailList[i].price.toFixed(2));
}else if(jsonObj.data.quotePriceDetailList[i].detailType === "sh"){
$(".price-info .sh").text(jsonObj.data.quotePriceDetailList[i].price.toFixed(2));
}else if(jsonObj.data.quotePriceDetailList[i].detailType === "sn"){
$(".price-info .sn").text(jsonObj.data.quotePriceDetailList[i].price.toFixed(2));
}
break;
case 2:
if(jsonObj.data.quotePriceDetailList[i].detailType === "gg"){
$(".price-info .gg").text(jsonObj.data.quotePriceDetailList[i].price.toFixed(2));
}else if(jsonObj.data.quotePriceDetailList[i].detailType === "sh"){
$(".price-info .sh").text(jsonObj.data.quotePriceDetailList[i].price.toFixed(2));
}else if(jsonObj.data.quotePriceDetailList[i].detailType === "sn"){
$(".price-info .sn").text(jsonObj.data.quotePriceDetailList[i].price.toFixed(2));
}
break;
case 3:
if(jsonObj.data.quotePriceDetailList[i].detailType === "gg"){
$(".price-info .gg").text("--").attr("data-type", -3);
}else if(jsonObj.data.quotePriceDetailList[i].detailType === "sh"){
$(".price-info .sh").text("--").attr("data-type", -3);
}else if(jsonObj.data.quotePriceDetailList[i].detailType === "sn"){
$(".price-info .sn").text("--").attr("data-type", -3);
}
break;
case 4:
if(jsonObj.data.quotePriceDetailList[i].detailType === "gg"){
$(".price-info .gg").text("--").attr("data-type", -4);
}else if(jsonObj.data.quotePriceDetailList[i].detailType === "sh"){
$(".price-info .sh").text("--").attr("data-type", -4);
}else if(jsonObj.data.quotePriceDetailList[i].detailType === "sn"){
$(".price-info .sn").text("--").attr("data-type", -4);
}
break;
case 5:
if(jsonObj.data.quotePriceDetailList[i].detailType === "gg"){
$(".price-info .gg").text("额度已满").attr("data-type", -5);
}else if(jsonObj.data.quotePriceDetailList[i].detailType === "sh"){
$(".price-info .sh").text("额度已满").attr("data-type", -5);
}else if(jsonObj.data.quotePriceDetailList[i].detailType === "sn"){
$(".price-info .sn").text("额度已满").attr("data-type", -5);
}
break;
}
}
$(".price-info .limit").text(limit);
$(".price-info .amount").text(amount);
if(jsonObj.data.speAmount === null){
$("#speAmount").text("");
}else{
$("#speAmount").text(jsonObj.data.speAmount);
}
$(".business-info .busType").text(busType);
if(jsonObj.data.quoteType != "e"){
$(".business-info .queType").text(queType);
}
$(".business-info .remarks").text(jsonObj.data.remarks);
}
//客户经理联系方式
for(var i=0; i<jsonObj.data.accountManagerList.length; i++){
var temp = '<div class="contact-block">'+
'<h5><span class="manager-name" data-managerId='+jsonObj.data.accountManagerList[i].managerId+'>'+jsonObj.data.accountManagerList[i].name+'</span><span>客户经理</span></h5>'+
'<p><img class="cellphone" src="'+global.context+'/assets/img/front/40X40/cellphone.png"><span class="cellphone">'+jsonObj.data.accountManagerList[i].mobPhone+
'</span><img class="telephone" src="'+global.context+'/assets/img/front/40X40/telephone.png"><span class="telephone">'+jsonObj.data.accountManagerList[i].telephone+'</span></p>'+
'<p class="address">'+jsonObj.data.accountManagerList[i].address+'</p>'+
'</div>';
$(".box-1").append(temp);
}
//评价
// console.log(jsonObj);
for(var j=0; j<jsonObj.data.commentDtoList.length; j++){
var date = (new Date(jsonObj.data.commentDtoList[j].createTime)).toLocaleString( );
var temp = '<div class="comment-block" data-commentId = '+
jsonObj.data.commentDtoList[j].commentId+' data-commentUserId = '+
jsonObj.data.commentDtoList[j].commentUserId+' data-safeStar = '+
jsonObj.data.commentDtoList[j].safeStar+' data-outStar = '+
jsonObj.data.commentDtoList[j].outStar+' data-serviceStar = '+
jsonObj.data.commentDtoList[j].serviceStar+' data-discuss = '+
jsonObj.data.commentDtoList[j].discuss+' data-commentCity = '+
jsonObj.data.commentDtoList[j].commentCity+'><h4 class="banks">'+
jsonObj.data.commentDtoList[j].userName+'<span>上海普陀支行</span><span class="stars"></span></h4><p class="comments">'+
jsonObj.data.commentDtoList[j].discuss+'</p><span class="comment-time">'+
date+'</span><a href="javascript:;" class="quick-comment"><span class="feedback quick-reply" data-toggle="modal" data-target="#add-new-comment" title="回复"><i class="fa fa-comments"></i></span></a></div>'
$(".box-2").append(temp);
//评价分数
$(".stars").eq(j).raty({
half : true,
readOnly:true,
score : jsonObj.data.commentDtoList[j].commentScore
});
}
//显示查看更多
if($(".comment-block").length > 3){
$(".more-comments").remove();
$(".quote-details-block").append("<button class='more-comments show' style='float:none;'>查看更多</button>");
$(".opt-link").addClass("hide").removeClass("show");
}
//评价条数
$("#comments-amount").text("("+jsonObj.data.count+")");
$(".quote-outter-wrap").niceScroll({
cursorwidth: 0,
cursorcolor: "#4C93EB",
cursorborder: "none",
background: "#E7E7E7",
autohidemode: true
});
}
});//ajax结束
});
// init滚动加载参数 more
var obj = {
table: '.quote-comments .right-main', //要重新加数据的区域
scrollTarget: '.quote-comments .right-main', //设置滚动条的位置
userId: null, //发送Ajax数据的参数(除去page、rows)
diff: 458, //高度差调整,决定下拉滚动条时能否触发加载
loading: '.showMoreComment #loading' //下拉提示
}
//Ajax请求参数
var o = {
userId: null,
page: 1,
rows: 10};
//查看更多
$("body").on("click", ".more-comments", function(){
var target = $(".price-floor.active span:first-child").attr("data-user-id");
o.userId = target;
obj.userId = target;
scrollHelper2.doInitScroll(obj,o);
$.ajax({
type: "POST",
url: global.context+"/web/mobuser/comment/show" ,
contentType: "application/json;charset=UTF-8",
dataType: "json",
data: JSON.stringify({
page:1,
rows: 10,
userId: $(".price-floor.active span:first-child").attr("data-user-id")
}),
success: function(msg){
$(".quote-comments .right-main").empty();
for(var i = 0; i < msg.data.length; i++){
var time = new Date(msg.data[i].createTime).toLocaleString( );
var tempHtml = '<div class="comment-block"><h4 class="banks">'+
msg.data[i].userName+'<span>上海普陀支行</span><span class="stars-area"></span></h4><p class="comments">'+
msg.data[i].discuss+'</p><span class="comment-time">'+
time+'</span></div>';
$(".quote-comments .right-main").append(tempHtml);
//评价分数
$(".stars-area").eq(i).raty({
half : true,
readOnly:true,
score : msg.data[i].commentScore
});
}
$(".quote-comments .right-main").niceScroll({
cursorwidth: 0,
cursorcolor: "#4C93EB",
cursorborder: "none",
background: "#E7E7E7",
autohidemode: true
});
$(".right-content").addClass("hide").removeClass("show");
$(".right-content.quote-comments").addClass("show").removeClass("hide");
}
});
$(".right-content").addClass("hide").removeClass("show");
$(".right-content.quote-comments").addClass("show").removeClass("hide");
});
//收缩展开
$(".quote-wrap > h5").click(function(){
if($(this).next("div").hasClass("hide")){
$(this).removeClass("down").addClass("up").next("div").addClass("show").removeClass("hide");
}else{
$(this).removeClass("up").addClass("down").next("div").addClass("hide").removeClass("show");
}
$(".quote-outter-wrap").getNiceScroll().resize();
});
//联系方式及评价展示
$(".bottom-ul li").click(function(){
if($(this).index() === 0){
$(".bottom-ul li").eq(0).addClass("active");
$(".bottom-ul li").eq(1).removeClass("active");
$(".box-1").addClass("show").removeClass("hide");
$(".box-2").addClass("hide").removeClass("show");
}else{
$(".bottom-ul li").eq(0).removeClass("active");
$(".bottom-ul li").eq(1).addClass("active");
$(".box-1").addClass("hide").removeClass("show");
$(".box-2").addClass("show").removeClass("hide");
}
//重新计算
$(".quote-outter-wrap").getNiceScroll().resize();
});
//调整报价
$(".change-quote, .wantto-quote").click(function(){
$(".not-select").addClass("hide").removeClass("show");
$(".opt-link").addClass("show").removeClass("hide");
$(".more-comments").addClass("hide").removeClass("show");
$(".quote-comments").addClass("hide").removeClass("show");
$(".quote-now").addClass("show").removeClass("hide");
$(".quote-details-block").removeClass("show").addClass("hide");
$(".right-nav li").removeClass("active");
if($(".price-floor.active span").eq(0).text() === ticketCategory.p){
$(".ticket-block").removeClass("show").addClass("hide");
$(".right-nav li").eq(0).addClass("active");
$(".ticket-block").eq(0).addClass("show").removeClass("hide");
if($(".quote-details-block .gg").text() === "额度已满" || $(".quote-details-block .gg").text() === "--"){
$(".ticket-block").eq(0).find(".gg").val($(".quote-details-block .gg").attr("data-type"));
}else{
$(".ticket-block").eq(0).find(".gg").val($(".quote-details-block .gg").text());
}
if($(".quote-details-block .sh").text() === "额度已满" || $(".quote-details-block .sh").text() === "--"){
$(".ticket-block").eq(0).find(".sh").val($(".quote-details-block .sh").attr("data-type"));
}else{
$(".ticket-block").eq(0).find(".sh").val($(".quote-details-block .sh").text());
}
if($(".quote-details-block .sn").text() === "额度已满" || $(".quote-details-block .sn").text() === "--"){
$(".ticket-block").eq(0).find(".sn").val($(".quote-details-block .sn").attr("data-type"));
}else{
$(".ticket-block").eq(0).find(".sn").val($(".quote-details-block .sn").text());
}
$(".ticket-block").eq(0).find(".speAmount").val($(".quote-details-block #speAmount").text());
$(".ticket-block").eq(0).find(".remarks").val($(".quote-details-block .remarks").text());
var dateLimit = $(".quote-details-block .limit").text();
var limit;
switch(dateLimit){
case "不限":
limit = 0;
break;
case "180天以上":
limit = 1;
break;
case "170天以上":
limit = 2;
}
$(".ticket-block").eq(0).find(".dateLimit").val(limit);
var amountText = $(".quote-details-block .amount").text();
var amount;
switch(amountText){
case "不限":
amount = 0;
break;
case "较多":
amount = 1;
break;
case "较少":
amount = 2;
break;
case "紧张":
amount = 3;
break;
}
$(".ticket-block").eq(0).find(".amount").val(amount);
var busTypeText = $(".quote-details-block .busType").text();
var busType;
switch(busTypeText){
case "查询回复打款":
busType = "0";
break;
case "买断":
busType = "1";
break;
case "直贴":
busType = "2";
break;
}
$(".ticket-block").eq(0).find(".busType").val(busType);
var queTypeText = $(".quote-details-block .queType").text();
var queType;
switch(queTypeText){
case "实查":
queType = "0";
break;
case "电查":
queType = "1";
break;
case "无需查询":
queType = "2"
break;
}
$(".ticket-block").eq(0).find(".queType").val(queType);
//获取联系方式
// var node = $(".box-1 .contact-block");
// var len = node.length;
// var managerId = [];
// for(var i = 0; i < len; i++){
// var id = $(".box-1 .contact-block").eq(i).find("span:first").attr("data-managerId");
// managerId.push(id);
// }
// $(".ticket-block").eq(0).find(".contact").empty();
// for(var i = 0; i< len; i++){
// infoFloor = "<div class='info-floor' data-managerId="+managerId[i]+"><span class='checkboxes not-selected'></span><span class='text'><span>"+node.eq(i).find('.manager-name').text()+"</span> <span>"+node.eq(i).find("span.cellphone").text()+"</span> <span>"+node.eq(i).find("span.telephone").text()+"</span> <span>"+node.eq(i).find(".address").text()+"</span></span><a href='javascript:;' class='right change'></a></div>";
// $(".ticket-block").eq(0).find(".contact").append(infoFloor);
// }
//------------------------------------------------
$.ajax({
type: "POST",
url: global.context+"/web/mobuser/manager/show" ,
contentType: "application/json;charset=UTF-8",
dataType: "json",
data: JSON.stringify({ifAll: false}),
success: function(msg){
// console.log(msg);
//获取联系方式
$(".ticket-block").eq(0).find(".contact .info-floor").remove();
for(var i = 0; i< msg.data.length; i++){
infoFloor = "<div class='info-floor' data-managerId="+msg.data[i].managerId+"><span class='checkboxes not-selected'></span><span class='text'><span>"+msg.data[i].name+"</span> <span>"+msg.data[i].mobPhone+"</span> <span>"+msg.data[i].telephone+"</span> <span>"+msg.data[i].address+"</span></span><a href='javascript:;' class='right change' data-toggle='modal' data-target='#change-contact'></a></div>";
$(".ticket-block").eq(0).find(".contact").prepend(infoFloor);
}
//业务类型为“查询回复打款”时,不显示“无需查询”
if($(".ticket-block.show").find(".busType").val() === "0"){
$(".ticket-block.show").find(".queType option[value='2']").remove();
}
}
});
//-------------------------------------------------
}else if($(".price-floor.active span").eq(0).text() === ticketCategory.e){
// console.log($(".quote-details-block .limit").text()+"2");
$(".ticket-block").removeClass("show").addClass("hide");
$(".right-nav li").eq(1).addClass("active");
$(".ticket-block").eq(1).addClass("show").removeClass("hide");
if($(".quote-details-block .gg").text() === "额度已满" || $(".quote-details-block .gg").text() === "--"){
$(".ticket-block").eq(1).find(".gg").val($(".quote-details-block .gg").attr("data-type"));
}else{
$(".ticket-block").eq(1).find(".gg").val($(".quote-details-block .gg").text());
}
if($(".quote-details-block .sh").text() === "额度已满" || $(".quote-details-block .sh").text() === "--"){
$(".ticket-block").eq(1).find(".sh").val($(".quote-details-block .sh").attr("data-type"));
}else{
$(".ticket-block").eq(1).find(".sh").val($(".quote-details-block .sh").text());
}
if($(".quote-details-block .sn").text() === "额度已满" || $(".quote-details-block .sn").text() === "--"){
$(".ticket-block").eq(1).find(".sn").val($(".quote-details-block .sn").attr("data-type"));
}else{
$(".ticket-block").eq(1).find(".sn").val($(".quote-details-block .sn").text());
}
$(".ticket-block").eq(1).find(".speAmount").val($(".quote-details-block #speAmount").text());
$(".ticket-block").eq(1).find(".remarks").val($(".quote-details-block .remarks").text());
var dateLimit = $(".quote-details-block .limit").text();
var limit;
switch(dateLimit){
case "不限":
limit = 0;
break;
case "180天以上":
limit = 1;
break;
case "170天以上":
limit = 2;
}
$(".ticket-block").eq(1).find(".dateLimit").val(limit);
var amountText = $(".quote-details-block .amount").text();
var amount;
switch(amountText){
case "不限":
amount = 0;
break;
case "较多":
amount = 1;
break;
case "较少":
amount = 2;
break;
case "紧张":
amount = 3;
break;
}
$(".ticket-block").eq(1).find(".amount").val(amount);
var busTypeText = $(".quote-details-block .busType").text();
var busType;
switch(busTypeText){
case "查询回复打款":
busType = "0";
break;
case "买断":
busType = "1";
break;
case "直贴":
busType = "2";
break;
}
$(".ticket-block").eq(1).find(".busType").val(busType);
var queTypeText = $(".quote-details-block .queType").text();
var queType;
switch(queTypeText){
case "实查":
queType = "0";
break;
case "电查":
queType = "1";
break;
case "无需查询":
queType = "2"
break;
}
$(".ticket-block").eq(1).find(".queType").val(queType);
//获取联系方式
$.ajax({
type: "POST",
url: global.context+"/web/mobuser/manager/show" ,
contentType: "application/json;charset=UTF-8",
dataType: "json",
data: JSON.stringify({ifAll: false}),
success: function(msg){
// console.log(msg);
//获取联系方式
$(".ticket-block").eq(1).find(".contact .info-floor").remove();
for(var i = 0; i< msg.data.length; i++){
infoFloor = "<div class='info-floor' data-managerId="+msg.data[i].managerId+"><span class='checkboxes not-selected'></span><span class='text'><span>"+msg.data[i].name+"</span> <span>"+msg.data[i].mobPhone+"</span> <span>"+msg.data[i].telephone+"</span> <span>"+msg.data[i].address+"</span></span><a href='javascript:;' class='right change' data-toggle='modal' data-target='#change-contact'></a></div>";
$(".ticket-block").eq(1).find(".contact").prepend(infoFloor);
}
}
});
}else if($(".price-floor.active span").eq(0).text() === ticketCategory.s){
// console.log($(".quote-details-block .limit").text()+"3");
$(".ticket-block").removeClass("show").addClass("hide");
$(".right-nav li").eq(2).addClass("active");
$(".ticket-block").eq(2).addClass("show").removeClass("hide");
if($(".quote-details-block .gg").text() === "额度已满" || $(".quote-details-block .gg").text() === "--"){
$(".ticket-block").eq(2).find(".gg").val($(".quote-details-block .gg").attr("data-type"));
}else{
$(".ticket-block").eq(2).find(".gg").val($(".quote-details-block .gg").text());
}
if($(".quote-details-block .sh").text() === "额度已满" || $(".quote-details-block .sh").text() === "--"){
$(".ticket-block").eq(2).find(".sh").val($(".quote-details-block .sh").attr("data-type"));
}else{
$(".ticket-block").eq(2).find(".sh").val($(".quote-details-block .sh").text());
}
if($(".quote-details-block .sn").text() === "额度已满" || $(".quote-details-block .sn").text() === "--"){
$(".ticket-block").eq(2).find(".sn").val($(".quote-details-block .sn").attr("data-type"));
}else{
$(".ticket-block").eq(2).find(".sn").val($(".quote-details-block .sn").text());
}
$(".ticket-block").eq(2).find(".speAmount").val($(".quote-details-block #speAmount").text());
$(".ticket-block").eq(2).find(".remarks").val($(".quote-details-block .remarks").text());
var dateLimit = $(".quote-details-block .limit").text();
var limit;
switch(dateLimit){
case "不限":
limit = 0;
break;
case "180天以上":
limit = 1;
break;
case "170天以上":
limit = 2;
}
$(".ticket-block").eq(2).find(".dateLimit").val(limit);
var amountText = $(".quote-details-block .amount").text();
var amount;
switch(amountText){
case "不限":
amount = 0;
break;
case "较多":
amount = 1;
break;
case "较少":
amount = 2;
break;
case "紧张":
amount = 3;
break;
}
$(".ticket-block").eq(2).find(".amount").val(amount);
var busTypeText = $(".quote-details-block .busType").text();
var busType;
switch(busTypeText){
case "查询回复打款":
busType = "0";
break;
case "买断":
busType = "1";
break;
case "直贴":
busType = "2";
break;
}
$(".ticket-block").eq(2).find(".busType").val(busType);
var queTypeText = $(".quote-details-block .queType").text();
var queType;
switch(queTypeText){
case "实查":
queType = "0";
break;
case "电查":
queType = "1";
break;
case "无需查询":
queType = "2"
break;
}
$(".ticket-block").eq(2).find(".queType").val(queType);
//获取联系方式
$.ajax({
type: "POST",
url: global.context+"/web/mobuser/manager/show" ,
contentType: "application/json;charset=UTF-8",
dataType: "json",
data: JSON.stringify({ifAll: false}),
success: function(msg){
// console.log(msg);
//获取联系方式
$(".ticket-block").eq(2).find(".contact .info-floor").remove();
for(var i = 0; i< msg.data.length; i++){
infoFloor = "<div class='info-floor' data-managerId="+msg.data[i].managerId+"><span class='checkboxes not-selected'></span><span class='text'><span>"+msg.data[i].name+"</span> <span>"+msg.data[i].mobPhone+"</span> <span>"+msg.data[i].telephone+"</span> <span>"+msg.data[i].address+"</span></span><a href='javascript:;' class='right change' data-toggle='modal' data-target='#change-contact'></a></div>";
$(".ticket-block").eq(2).find(".contact").prepend(infoFloor);
}
//业务类型为“查询回复打款”时,不显示“无需查询”
if($(".ticket-block.show").find(".busType").val() === "0"){
//$(".ticket-block.show").find(".queType option[value='2']").remove();
$(".ticket-block.show").find(".queType option[value='2']").addClass("hide");
$(".ticket-block.show").find(".queType option[value='1']").attr("selected","selected");
}
}
});
}else if($(".price-floor.active span").eq(0).text() === ticketCategory.b){
// console.log($(".quote-details-block .limit").text()+"4");
$(".ticket-block").removeClass("show").addClass("hide");
$(".right-nav li").eq(3).addClass("active");
$(".ticket-block").eq(3).addClass("show").removeClass("hide");
if($(".quote-details-block .busPaper").text() === "额度已满" || $(".quote-details-block .busPaper").text() === "--"){
$(".ticket-block").eq(3).find(".busPaper").val($(".quote-details-block .busPaper").attr("data-type"));
}else{
$(".ticket-block").eq(3).find(".busPaper").val($(".quote-details-block .busPaper").text());
}
if($(".quote-details-block .busEle").text() === "额度已满" || $(".quote-details-block .busEle").text() === "--"){
$(".ticket-block").eq(3).find(".busEle").val($(".quote-details-block .busEle").attr("data-type"));
}else{
$(".ticket-block").eq(3).find(".busEle").val($(".quote-details-block .busEle").text());
}
$(".ticket-block").eq(3).find(".speAmount").val($(".quote-details-block #speAmount").text());
$(".ticket-block").eq(3).find(".remarks").val($(".quote-details-block .remarks").text());
var dateLimit = $(".quote-details-block .limit").text();
var limit;
switch(dateLimit){
case "不限":
limit = 0;
break;
case "180天以上":
limit = 1;
break;
case "170天以上":
limit = 2;
}
$(".ticket-block").eq(3).find(".dateLimit").val(limit);
var amountText = $(".quote-details-block .amount").text();
var amount;
switch(amountText){
case "不限":
amount = 0;
break;
case "较多":
amount = 1;
break;
case "较少":
amount = 2;
break;
case "紧张":
amount = 3;
break;
}
$(".ticket-block").eq(3).find(".amount").val(amount);
var busTypeText = $(".quote-details-block .busType").text();
var busType;
switch(busTypeText){
case "查询回复打款":
busType = "0";
break;
case "买断":
busType = "1";
break;
case "直贴":
busType = "2";
break;
}
$(".ticket-block").eq(3).find(".busType").val(busType);
var queTypeText = $(".quote-details-block .queType").text();
var queType;
switch(queTypeText){
case "实查":
queType = "0";
break;
case "电查":
queType = "1";
break;
case "无需查询":
queType = "2"
break;
}
$(".ticket-block").eq(3).find(".queType").val(queType);
//获取联系方式
$.ajax({
type: "POST",
url: global.context+"/web/mobuser/manager/show" ,
contentType: "application/json;charset=UTF-8",
dataType: "json",
data: JSON.stringify({ifAll: false}),
success: function(msg){
// console.log(msg);
//获取联系方式
$(".ticket-block").eq(3).find(".contact .info-floor").remove();
for(var i = 0; i< msg.data.length; i++){
infoFloor = "<div class='info-floor' data-managerId="+msg.data[i].managerId+"><span class='checkboxes not-selected'></span><span class='text'><span>"+msg.data[i].name+"</span> <span>"+msg.data[i].mobPhone+"</span> <span>"+msg.data[i].telephone+"</span> <span>"+msg.data[i].address+"</span></span><a href='javascript:;' class='right change' data-toggle='modal' data-target='#change-contact'></a></div>";
$(".ticket-block").eq(3).find(".contact").prepend(infoFloor);
}
//业务类型为“查询回复打款”时,不显示“无需查询”
if($(".ticket-block.show").find(".busType").val() === "0"){
$(".ticket-block.show").find(".queType option[value='2']").remove();
}
}
});
}else{
// console.log($(".quote-details-block .limit").text()+"0");
$(".ticket-block").removeClass("show").addClass("hide");
$(".right-nav li").eq(0).addClass("active");
$(".ticket-block").eq(0).addClass("show").removeClass("hide");
$(".ticket-block").eq(0).find(".gg").val($(".quote-details-block .gg").text());
$(".ticket-block").eq(0).find(".sh").val($(".quote-details-block .sh").text());
$(".ticket-block").eq(0).find(".sn").val($(".quote-details-block .sn").text());
$(".ticket-block").eq(0).find(".dateLimit").attr("selected", $(".quote-details-block .limit").text());
$(".ticket-block").eq(0).find(".amount").attr("selected", $(".quote-details-block .amount").text());
$(".ticket-block").eq(0).find(".busType").attr("selected", $(".quote-details-block .busType").text());
$(".ticket-block").eq(0).find(".queType").attr("selected", $(".quote-details-block .queType").text());
//获取联系方式
$.ajax({
type: "POST",
url: global.context+"/web/mobuser/manager/show" ,
contentType: "application/json;charset=UTF-8",
dataType: "json",
data: JSON.stringify({ifAll: false}),
success: function(msg){
// console.log(msg);
//获取联系方式
$(".ticket-block.show").find(".contact .info-floor").remove();
for(var i = 0; i< msg.data.length; i++){
infoFloor = "<div class='info-floor' data-managerId="+msg.data[i].managerId+"><span class='checkboxes not-selected'></span><span class='text'><span>"+msg.data[i].name+"</span> <span>"+msg.data[i].mobPhone+"</span> <span>"+msg.data[i].telephone+"</span> <span>"+msg.data[i].address+"</span></span><a href='javascript:;' class='right change' data-toggle='modal' data-target='#change-contact'></a></div>";
$(".ticket-block.show").find(".contact").prepend(infoFloor);
}
//业务类型为“查询回复打款”时,不显示“无需查询”
if($(".ticket-block.show").find(".busType").val() === "0"){
$(".ticket-block.show").find(".queType option[value='2']").remove();
}
}
});
}
$(".quote-form").getNiceScroll().resize();
});
//重置表单
$("#cancel").click(function(){
$(".gg").val("");
$(".sh").val("");
$(".sn").val("");
$(".dateLimit").val(0);
$(".amount").val(0);
$(".speAmount").val("");
$(".busType").val(0);
$(".queType").val(0);
$(".remarks").val("");
$(".busEle").val("");
$(".buspaper").val("");
$("p.tips").remove();
});
//复选框
$("body").on("click", ".checkboxes", function(event){
if($(this).hasClass("selected")){
$(this).removeClass("selected").addClass("not-selected");
}else{
$(this).removeClass("not-selected").addClass("selected");
}
event.stopPropagation();
});
//更改联系方式及地址模态框
$("#modal-middle").niceScroll({
cursorwidth: 0,
cursorcolor: "#4C93EB",
cursorborder: "none",
background: "#E7E7E7",
autohidemode: true
});
$("body").on("click", "a.right.change", function(){
//绑定数据
var parentNode = $(this).closest(".info-floor");
var name = parentNode.find(".text span").eq(0).text();
var cellphone = parentNode.find(".text span").eq(1).text();
var telephone = parentNode.find(".text span").eq(2).text();
var address = parentNode.find(".text span").eq(3).text();
var managerId = parentNode.attr("data-managerid");
$("#change-contact").find("#name").val(name).attr("data-managerId", managerId);
$("#change-contact").find("#cellphone").val(cellphone);
$("#change-contact").find("#telephone").val(telephone);
$("#change-contact").find("#address").val(address);
});
//确认修改联系方式
$("#modal-confirm").click(function(){
if($("#name").val() === "" ){
alert("姓名不能为空");
return false;
}else if($("#cellphone").val() === ""&&$("#telephone").val() === ""){
alert("电话和座机不能全为空");
return false;
}
var dataValue = {
name: $("#name").val(),
mobPhone: $("#cellphone").val(),
telephone: $("#telephone").val(),
address: $("#address").val(),
managerId: $("#name").attr("data-managerId")
};
$.ajax({
type: "POST",
url: global.context+"/web/mobuser/manager/modify" ,
contentType: "application/json;charset=UTF-8",
dataType: "json",
data: JSON.stringify(dataValue),
success: function(msg){
alert("修改成功");
$("#change-contact").modal('hide')
}
});
});
//顶部导航栏切换,左侧报价状态切换
$(".amount-full, .cancel-quote").click(function(){
var self = $(this);
var type = $("a.price-floor.active").closest("div").find(".category > span").text();
var detailCategory = $("a.price-floor.active span").eq(1).text();
var detailCode;
var typeCode;
var status = self.text();
var data;
var quoteStatus;
switch(detailCategory){
case "国股":
detailCode = "gg";
break;
case "商行":
detailCode = "sh";
break;
case "三农":
detailCode = "sn";
break;
case "纸质":
detailCode = "busPaper";
break;
case "电子":
detailCode = "busEle";
break;
}
switch(status){
case "失效":
quoteStatus = 0;
break;
case "正在报价":
quoteStatus = 1;
break;
case "预警中":
quoteStatus = 2;
break;
case "违规撤销":
quoteStatus = 3;
break;
case "撤销报价":
quoteStatus = 4;
break;
case "额度已满":
quoteStatus = 5;
break;
}
switch(type){
case "纸票":
typeCode = "p";
break;
case "电票":
typeCode = "e";
break;
case "小票":
typeCode = "s";
break;
case "商票":
typeCode = "b";
break;
}
data = {
quoteType: typeCode,
detailType: detailCode,
quoteStatus: quoteStatus
};
$.ajax({
type: "POST",
url: global.context+"/web/mobuser/quotePrice/change",
data: JSON.stringify(data),
contentType: "application/json;charset=UTF-8",
success: function(msg){
console.log(msg);
var url;
var tempCode;
switch(self.index()){
case 0:
break;
case 1:
url = "url("+global.context+"/assets/img/front/60X60/full.png)";
break;
case 2:
url = "url("+global.context+"/assets/img/front/60X60/revoke.png)";
break;
default:
break;
}
// if()
$("a.price-floor.active").css("background-image", url);
//获取状态
// console.log(getComputedStyle($("a.price-floor.active")[0], false)["background-image"]);
}
});
});
$("#add-cellphone").mask('99999999999');
$.mask.definitions['~']='[+-]';
//新增联系方式
$("#add-contact-confirm").click(function(){
var name = $("#add-name").val();
var mobPhone = $("#add-cellphone").val();
var telephone = $("#add-telephone").val();
var address = $("#add-address").val();
var userId = "";
var dataValue = {
name: name,
mobPhone: mobPhone,
telephone: telephone,
address: address
};
if(name === "" ){
alert("用户名不能为空");
return false;
}else if(mobPhone === ""&&telephone === ""){
alert("电话和座机不能全为空");
return false;
}
$.ajax({
type: "POST",
url: global.context+"/web/mobuser/manager/add" ,
contentType: "application/json;charset=UTF-8",
dataType: "json",
data: JSON.stringify(dataValue),
success: function(msg){
$.ajax({
type: "POST",
url: global.context+"/web/mobuser/manager/show" ,
contentType: "application/json;charset=UTF-8",
dataType: "json",
data: JSON.stringify({ifAll: false}),
success: function(msg){
alert("添加成功");
$(".ticket-block.show").eq(0).find(".contact").empty().append("<a href='javascript:;' class='add-contact'>添加联系方式</a>");
for(var i = 0; i < msg.data.length; i++){
infoFloor = "<div class='info-floor' data-managerId="+msg.data[i].managerId+">" +
"<span class='checkboxes not-selected'></span><span class='text'>" +
"<span>"+msg.data[i].name+"</span> " +
"<span>"+msg.data[i].mobPhone+"</span> " +
"<span>"+msg.data[i].telephone+"</span> " +
"<a href='javascript:;'>"+msg.data[i].address+"</a></span></span>" +
"<a href='javascript:;' class='right change' data-toggle='modal' data-target='#change-contact'>></a></div>";
$(".ticket-block.show").eq(0).find(".contact").prepend(infoFloor);
$("#add-contact").modal('hide');
}
}
});
}
});
});
//快速回复
$("body").on("click", ".quick-comment", function(){
$(this).closest(".comment-block").addClass("selected");
$("#add-comment-area").val("");
});
$("#little-window-confirm").click(function(){
var dataValue = {
feedbackUserId: $(".comment-block.selected").attr("data-commentUserId"),
feedback: $("#add-comment-area").val(),
commentId: $(".comment-block.selected").attr("data-commentId")
};
$.ajax({
type: "POST",
url: global.context+"/web/mobuser/comment/feedback",
contentType: "application/json;charset=UTF-8",
dataType: "json",
data: JSON.stringify(dataValue),
success: function(msg){
alert("评价成功");
$(".comment-block.selected").find(".quick-comment").remove();
$(".comment-block.selected").append("<p class='details'>[机构回复]:"+$("#add-comment-area").val()+"</p>");
$("#add-new-comment").modal('hide');
}
})
});
//评价页面快速回复--ok
$("body").on("click", ".reply", function(){
$("#reply-comments").val("");
$(this).closest(".contact-info").addClass("selected");
});
$("#reply-window-confirm").click(function(){
var dataValue = {
commentId: $(".contact-info.selected").attr("data-commentId"),
feedbackUserId: $(".contact-info.selected").attr("data-feedbackUserId"),
feedback: $("#reply-comments").val()
};
$.ajax({
type: "POST",
url: global.context+"/web/mobuser/comment/feedback",
contentType: "application/json;charset=UTF-8",
dataType: "json",
data: JSON.stringify(dataValue),
success: function(msg){
alert("评价成功");
$(".contact-info.selected").find(".reply").remove();
$(".contact-info.selected").append("<p class='orgFeedback'>[机构回复]:"+$("#reply-comments").val()+"</p>");//<span class='date time'>"+(new Date()).toLocaleString()+"</span>
$("#reply-comment").modal('hide');
}
})
});
//额度为”不限“时,具体额度可不填
$(".amount").change(function(){
if($(this).val() === "0"){
$(".speAmount").attr("disabled", true);
}
});
//添加千分符及表单的验证
//纸票
$("#p-form input.gg, #p-form input.sh, #p-form input.sn").blur(function(){
//数字格式化
var tempValue = $(this).val();
if(tempValue.length > 0){
var index = tempValue.indexOf(".");
var beforeTemp;
var afterTemp;
if(index > -1 ){
beforeTemp = tempValue.substring(0, index);
afterTemp = tempValue.substring(index+1, index+3);
if(afterTemp.length === 0){
afterTemp = afterTemp +"00";
}else if(afterTemp.length === 1){
afterTemp = afterTemp + "0";
}else{
afterTemp = afterTemp.substring(0, 2);
}
$(this).val(parseInt(beforeTemp) + "." + afterTemp);
}else{
afterTemp = "00";
$(this).val(String(parseInt(tempValue)) + "." + afterTemp);
}
}
});
//电票
$("#e-form input.gg, #e-form input.sh, #e-form input.sn").blur(function(){
//数字格式化
var tempValue = $(this).val();
if(tempValue.length > 0){
var index = tempValue.indexOf(".");
var beforeTemp;
var afterTemp;
if(index > -1 ){
beforeTemp = tempValue.substring(0, index);
afterTemp = tempValue.substring(index+1, index+3);
if(afterTemp.length === 0){
afterTemp = afterTemp +"00";
}else if(afterTemp.length === 1){
afterTemp = afterTemp + "0";
}else{
afterTemp = afterTemp.substring(0, 2);
}
$(this).val(parseInt(beforeTemp) + "." + afterTemp);
}else{
afterTemp = "00";
$(this).val(String(parseInt(tempValue)) + "." + afterTemp);
}
}
});
//小票
// $("#s-form input.gg, #s-form input.sh, #s-form input.sn").blur(function(){
// //数字格式化
// var tempValue = $(this).val();
// if(tempValue.length > 0){
// var index = tempValue.indexOf(".");
// var beforeTemp;
// var afterTemp;
// if(index > -1 ){
// beforeTemp = tempValue.substring(0, index);
// afterTemp = tempValue.substring(index+1, index+3);
// if(afterTemp.length === 0){
// afterTemp = afterTemp +"00";
// }else if(afterTemp.length === 1){
// afterTemp = afterTemp + "0";
// }else{
// afterTemp = afterTemp.substring(0, 2);
// }
// $(this).val(parseInt(beforeTemp) + "." + afterTemp);
// }else{
// afterTemp = "00";
// $(this).val(String(parseInt(tempValue)) + "." + afterTemp);
// }
// }
// });
//商票
$("#b-form input.busPaper, #b-form input.busEle").blur(function(){
//数字格式化
var tempValue = $(this).val();
if(tempValue.length > 0){
var index = tempValue.indexOf(".");
var beforeTemp;
var afterTemp;
if(index > -1 ){
beforeTemp = tempValue.substring(0, index);
afterTemp = tempValue.substring(index+1, index+3);
if(afterTemp.length === 0){
afterTemp = afterTemp +"00";
}else if(afterTemp.length === 1){
afterTemp = afterTemp + "0";
}else{
afterTemp = afterTemp.substring(0, 2);
}
$(this).val(parseInt(beforeTemp) + "." + afterTemp);
}else{
afterTemp = "00";
$(this).val(String(parseInt(tempValue)) + "." + afterTemp);
}
}
});
//具体额度添加千分符
$(".speAmount").blur(function(){
var tempValue = $(this).val();
var index = tempValue.indexOf(".");
if( index > 0){
var beforeValue = tempValue.substring(0, index).replace(/,/g, "");
var afterValue = tempValue.substring(index);
console.log(beforeValue, "-", afterValue);
var tempArr = beforeValue.split("");
for(var i = beforeValue.length-2; i > 0; i -= 3){
tempArr.splice(i-1, 0, ",");
}
var tempStr = tempArr.join("");
if(tempStr.charAt(0) === ","){
tempStr = tempStr.slice(1);
}
if(tempStr.charAt(tempStr.length) === ","){
tempStr = tempStr.slice(0, tempStr.length-1);
}
$(this).val(tempStr + afterValue);
}else{
var tempValue = tempValue.replace(/,/g, "");
var tempArr = tempValue.split("");
for(var i = tempValue.length-2; i > 0; i -= 3){
tempArr.splice(i-1, 0, ",");
}
var tempStr = tempArr.join("");
if(tempStr.charAt(0) === ","){
tempStr = tempStr.slice(1);
}
if(tempStr.charAt(tempStr.length) === ","){
tempStr = tempStr.slice(0, tempStr.length-1);
}
$(this).val(tempStr);
}
});
}//bindEvent结束
//插入数据
function insertInfo(msg){
$(".p-block").empty();
$(".e-block").empty();
$(".s-block").empty();
$(".b-block").empty();
var pType = "<p class='category'><span>"+ticketCategory.p+"</span></p>";
var eType = "<p class='category'><span>"+ticketCategory.e+"</span></p>";
var sType = "<p class='category'><span>"+ticketCategory.s+"</span></p>";
var bType = "<p class='category'><span>"+ticketCategory.b+"</span></p>";
var pText;
var eText;
var sText;
var bText;
var quoteStatus;
// console.log(msg);
for(var i = 0; i < msg.data.quotePriceDetailList.length; i++){
//判断升降
var riseClass;
if(msg.data.quotePriceDetailList[i].rise > 0){
riseClass = "up";
}else if(msg.data.quotePriceDetailList[i].rise < 0){
riseClass = "down";
}else{
riseClass = "zero";
}
if(msg.data.quotePriceDetailList[i].quoteType === "p"){
var detailType = msg.data.quotePriceDetailList[i].detailType;
if(detailType === "gg"){
detailType = detailCategory.gg;
}else if(detailType === "sh"){
detailType = detailCategory.sh;
}else{
detailType = detailCategory.sn;
}
switch(msg.data.quotePriceDetailList[i].quoteStatus){
case 0:
pText = "<a class='price-floor price-invalid' href='javascript:;'><span>"+ticketCategory.p+"</span><span class='"+
msg.data.quotePriceDetailList[i].detailType+"'>"+detailType+"</span><span class="+riseClass+">"+
msg.data.quotePriceDetailList[i].price.toFixed(2)+"</span></a>";
break;
case 1:
pText = "<a class='price-floor price-quoting' href='javascript:;'><span>"+ticketCategory.p+"</span><span class='"+
msg.data.quotePriceDetailList[i].detailType+"'>"+detailType+"</span><span class="+riseClass+">"+
msg.data.quotePriceDetailList[i].price.toFixed(2)+"</span></a>";
break;
case 2:
pText = "<a class='price-floor price-quoting' href='javascript:;'><span>"+ticketCategory.p+"</span><span class='"+
msg.data.quotePriceDetailList[i].detailType+"'>"+detailType+"</span><span class="+riseClass+">"+
msg.data.quotePriceDetailList[i].price.toFixed(2)+"</span></a>";
break;
case 3:
pText = "<a class='price-floor price-cancel' href='javascript:;'><span>"+ticketCategory.p+"</span><span class='"+
msg.data.quotePriceDetailList[i].detailType+"'>"+detailType+"</span><span class="+riseClass+">"+
msg.data.quotePriceDetailList[i].price.toFixed(2)+"</span></a>";
break;
case 4:
pText = "<a class='price-floor price-revoke' href='javascript:;'><span>"+ticketCategory.p+"</span><span class='"+
msg.data.quotePriceDetailList[i].detailType+"'>"+detailType+"</span><span class="+riseClass+">"+
msg.data.quotePriceDetailList[i].price.toFixed(2)+"</span></a>";
break;
case 5:
pText = "<a class='price-floor price-full' href='javascript:;'><span>"+ticketCategory.p+"</span><span class='"+
msg.data.quotePriceDetailList[i].detailType+"'>"+detailType+"</span><span class="+riseClass+">"+
msg.data.quotePriceDetailList[i].price.toFixed(2)+"</span></a>";
break;
}
$(".p-block").append(pText);
}else if(msg.data.quotePriceDetailList[i].quoteType === "e"){
var detailType = msg.data.quotePriceDetailList[i].detailType;
if(detailType === "gg"){
detailType = detailCategory.gg;
}else if(detailType === "sh"){
detailType = detailCategory.sh;
}else{
detailType = detailCategory.sn;
}
switch(msg.data.quotePriceDetailList[i].quoteStatus){
case 0:
eText = "<a class='price-floor price-invalid' href='javascript:;'><span>"+ticketCategory.e+"</span><span class='"+
msg.data.quotePriceDetailList[i].detailType+"'>"+detailType+"</span><span class="+riseClass+">"+
msg.data.quotePriceDetailList[i].price.toFixed(2)+"</span></a>";
break;
case 1:
eText = "<a class='price-floor price-quoting' href='javascript:;'><span>"+ticketCategory.e+"</span><span class='"+
msg.data.quotePriceDetailList[i].detailType+"'>"+detailType+"</span><span class="+riseClass+">"+
msg.data.quotePriceDetailList[i].price.toFixed(2)+"</span></a>";
break;
case 2:
eText = "<a class='price-floor price-quoting' href='javascript:;'><span>"+ticketCategory.e+"</span><span class='"+
msg.data.quotePriceDetailList[i].detailType+"'>"+detailType+"</span><span class="+riseClass+">"+
msg.data.quotePriceDetailList[i].price.toFixed(2)+"</span></a>";
break;
case 3:
eText = "<a class='price-floor price-cancel' href='javascript:;'><span>"+ticketCategory.e+"</span><span class='"+
msg.data.quotePriceDetailList[i].detailType+"'>"+detailType+"</span><span class="+riseClass+">"+
msg.data.quotePriceDetailList[i].price.toFixed(2)+"</span></a>";
break;
case 4:
eText = "<a class='price-floor price-revoke' href='javascript:;'><span>"+ticketCategory.e+"</span><span class='"+
msg.data.quotePriceDetailList[i].detailType+"'>"+detailType+"</span><span class="+riseClass+">"+
msg.data.quotePriceDetailList[i].price.toFixed(2)+"</span></a>";
break;
case 5:
eText = "<a class='price-floor price-full' href='javascript:;'><span>"+ticketCategory.e+"</span><span class='"+
msg.data.quotePriceDetailList[i].detailType+"'>"+detailType+"</span><span class="+riseClass+">"+
msg.data.quotePriceDetailList[i].price.toFixed(2)+"</span></a>";
break;
}
$(".e-block").append(eText);
}else if(msg.data.quotePriceDetailList[i].quoteType === "s"){
var detailType = msg.data.quotePriceDetailList[i].detailType;
if(detailType === "gg"){
detailType = detailCategory.gg;
}else if(detailType === "sh"){
detailType = detailCategory.sh;
}else{
detailType = detailCategory.sn;
}
switch(msg.data.quotePriceDetailList[i].quoteStatus){
case 0:
sText = "<a class='price-floor price-invalid' href='javascript:;'><span>"+ticketCategory.s+"</span><span class='"+
msg.data.quotePriceDetailList[i].detailType+"'>"+detailType+"</span><span class="+riseClass+">"+
msg.data.quotePriceDetailList[i].price.toFixed(2)+"</span></a>";
break;
case 1:
sText = "<a class='price-floor price-quoting' href='javascript:;'><span>"+ticketCategory.s+"</span><span class='"+
msg.data.quotePriceDetailList[i].detailType+"'>"+detailType+"</span><span class="+riseClass+">"+
msg.data.quotePriceDetailList[i].price.toFixed(2)+"</span></a>";
break;
case 2:
sText = "<a class='price-floor price-quoting' href='javascript:;'><span>"+ticketCategory.s+"</span><span class='"+
msg.data.quotePriceDetailList[i].detailType+"'>"+detailType+"</span><span class="+riseClass+">"+
msg.data.quotePriceDetailList[i].price.toFixed(2)+"</span></a>";
break;
case 3:
sText = "<a class='price-floor price-cancel' href='javascript:;'><span>"+ticketCategory.s+"</span><span class='"+
msg.data.quotePriceDetailList[i].detailType+"'>"+detailType+"</span><span class="+riseClass+">"+
msg.data.quotePriceDetailList[i].price.toFixed(2)+"</span></a>";
break;
case 4:
sText = "<a class='price-floor price-revoke' href='javascript:;'><span>"+ticketCategory.s+"</span><span class='"+
msg.data.quotePriceDetailList[i].detailType+"'>"+detailType+"</span><span class="+riseClass+">"+
msg.data.quotePriceDetailList[i].price.toFixed(2)+"</span></a>";
break;
case 5:
sText = "<a class='price-floor price-full' href='javascript:;'><span>"+ticketCategory.s+"</span><span class='"+
msg.data.quotePriceDetailList[i].detailType+"'>"+detailType+"</span><span class="+riseClass+">"+
msg.data.quotePriceDetailList[i].price.toFixed(2)+"</span></a>";
break;
}
$(".s-block").append(sText);
}else{
var detailType = msg.data.quotePriceDetailList[i].detailType;
if(detailType === "busPaper"){
detailType = detailCategory.busPaper;
}else{
detailType = detailCategory.busEle;
}
switch(msg.data.quotePriceDetailList[i].quoteStatus){
case 0:
bText = "<a class='price-floor price-invalid' href='javascript:;'><span>"+ticketCategory.b+"</span><span class='"+
msg.data.quotePriceDetailList[i].detailType+"'>"+detailType+"</span><span class="+riseClass+">"+
msg.data.quotePriceDetailList[i].price.toFixed(2)+"</span></a>";
break;
case 1:
bText = "<a class='price-floor price-quoting' href='javascript:;'><span>"+ticketCategory.b+"</span><span class='"+
msg.data.quotePriceDetailList[i].detailType+"'>"+detailType+"</span><span class="+riseClass+">"+
msg.data.quotePriceDetailList[i].price.toFixed(2)+"</span></a>";
break;
case 2:
bText = "<a class='price-floor price-quoting' href='javascript:;'><span>"+ticketCategory.b+"</span><span class='"+
msg.data.quotePriceDetailList[i].detailType+"'>"+detailType+"</span><span class="+riseClass+">"+
msg.data.quotePriceDetailList[i].price.toFixed(2)+"</span></a>";
break;
case 3:
bText = "<a class='price-floor price-cancel' href='javascript:;'><span>"+ticketCategory.b+"</span><span class='"+
msg.data.quotePriceDetailList[i].detailType+"'>"+detailType+"</span><span class="+riseClass+">"+
msg.data.quotePriceDetailList[i].price.toFixed(2)+"</span></a>";
break;
case 4:
bText = "<a class='price-floor price-revoke' href='javascript:;'><span>"+ticketCategory.b+"</span><span class='"+
msg.data.quotePriceDetailList[i].detailType+"'>"+detailType+"</span><span class="+riseClass+">"+
msg.data.quotePriceDetailList[i].price.toFixed(2)+"</span></a>";
break;
case 5:
bText = "<a class='price-floor price-full' href='javascript:;'><span>"+ticketCategory.b+"</span><span class='"+
msg.data.quotePriceDetailList[i].detailType+"'>"+detailType+"</span><span class="+riseClass+">"+
msg.data.quotePriceDetailList[i].price.toFixed(2)+"</span></a>";
break;
}
$(".b-block").append(bText);
}
}
if(pText){
$(".p-block").prepend(pType);
}
if(eText){
$(".e-block").prepend(eType);
}
if(sText){
$(".s-block").prepend(sType);
}
if(bText){
$(".b-block").prepend(bType);
}
}
//添加千分符
function formatNumber(input, number) {
if(input){
var n = parseFloat(input).toFixed(number);
var re = /(\d{1,3})(?=(\d{3})+(?:\.))/g;
return n.replace(re, "$1,");
}
}
//左侧无项目时,显示文字提示
function tips(){
var tempTips = "<p class='broadcast'>请点击下方按钮添加报价</p><p class='glyphicon glyphicon-arrow-down arrow-down'></p>";
if($("#left-wrap .showText").length === 0 &&
$("#left-wrap .p-block").children().length === 0 &&
$("#left-wrap .e-block").children().length === 0 &&
$("#left-wrap .s-block").children().length === 0 &&
$("#left-wrap .b-block").children().length === 0){
$("#left-wrap").append(tempTips);
}else{
$("#left-wrap > p").remove();
}
}
init();
bindEvent();
});
js验证集合
最新推荐文章于 2021-09-07 20:51:12 发布