`)
} else {
$('.loup').remove()
}
})
//点击勾选、 选值
$(".fSelect_box").delegate('.fSelect_body ul li', 'click',function(){
$('.loup').remove()
var select = $(this).attr('data-select'); //勾选凭证
var checkId = $(this).attr('id'); //数据标识
var textok = $(this).find('div').html(); //内容
$(this).find('span').toggleClass('backurl') //勾选状态
if (select == 'no') {
$(this).attr('data-select', 'yes')
pointer++;
//console.log(pointer)
if (pointer > 0) {
$('.fSelect_input p').hide()
$('.fSelect_input').append('
' + textok + '×');
if (pointer > 3) {
$('.fSelect_input span').hide();
$('.fSelect_input p').show().html('已選' + pointer + '個樓盤').addClass('colored')
}
}
} else if (select == 'yes') {
$(this).attr('data-select', 'no')
pointer--
//console.log(pointer)
for (let i = 0; i < $('.fSelect_input span').length; i++) {
if ($('.fSelect_input span').eq(i).find('i').attr('data-id') === checkId) {
$('.fSelect_input span').eq(i).remove()
}
}
if (pointer > 3) {
$('.fSelect_input p').show().html('已選' + pointer + '個樓盤').addClass('colored')
} else {
$('.fSelect_input span').show();
$('.fSelect_input p').hide();
if (pointer == 0) {
$('.fSelect_input p').show().html('請選擇約睇樓盤地區').removeClass('colored');
}
}
}
//console.log(pointer)
})
//點×刪除 -- 交互刪除
$('.fSelect_input').on('click', 'i', function (event) {
event.stopImmediatePropagation();
pointer--;
$(this).parent('span').remove();
let i_id = $(this).attr('data-id'); //标识
$('.fSelect_body ul li').each(function (i) {
if ($('.fSelect_body ul li').eq(i).attr('id') === i_id) {
$('.fSelect_body ul li').eq(i).attr('data-select', 'no')
$('.fSelect_body ul li').eq(i).find('span').removeClass('backurl')
}
})
if (pointer == 0) {
$('.fSelect_input p').show().html('請選擇約睇樓盤地區').removeClass('colored');
$('.fSelect_input').append(`
請選擇樓盤
`)
}
addjson();
})
// 遍歷 勾選的項 ,取值 、 赋值
function addjson() {
val = '';
let code = '';
$('.fSelect_input span').each(function (i) {
if (i < $('.fSelect_input span').length - 1) {
val += $(this).find('text').html() + ',';
code += $(this).find('i').attr('data-id') + ',';
} else {
val += $(this).find('text').html();
code += $(this).find('i').attr('data-id');
}
//console.log($(this).find('text').html())
})
$('input.region').val(val);
$('.code_hid').val(code)
}
//完成按鈕
//$('.box-signup-body').click(function () {
// addjson()
// $('.fSelect_box').hide()
//})
addjson();
// 限制滚动条
function scrollnext() {
if ($('.fSelect_box').css('display') == 'none') {
$('html').css('overflow', 'visible')
} else {
$('html').css('overflow', 'hidden')
}
}
//楼盘列表
function listData() {
$.post(hUrl+'/Api/Article/GetAllFocusOneHand', function (data) {
var strHtml = '';
jQuery.each(data.InnerList, function (i, val) {
strHtml += '
'
strHtml += '
' + val.Region+'
'
strHtml += '
'
jQuery.each(val.ArticleList, function (j, item) {
strHtml += '- '
strHtml += ''
strHtml += '
' + item.EstateName + '
'
strHtml += ' '
});
strHtml += '
'
strHtml += '
'
});
$(".border-bottom-dashed").html(strHtml);
jkl();
});
}
})