'
].join('');
// 点击显示地区分类
$('#showSearchModal').off().on('click', function() {
var titleValue = $(this).data('title');
var multipleValue = eval($(this).data('multiple'));
var maxNumValue = eval($(this).data('maxnum'));
var widthValue = eval($(this).data('width'));
var isSpell = app_spell;
var htmlCity = '';
var isSubsite = eval(qscms.is_subsite); // 是否是分站
var subsiteLevelNum = eval(qscms.subsite_level);
var subsiteLevel1 = true; // 是否是一级分站
if (!isSubsite) { // 如果不是分站 一级分站始终为false
subsiteLevel1 = false;
} else {
if (subsiteLevelNum > 1) { // 如果是分站,分站级数大于1 则为false
subsiteLevel1 = false;
}
}
var subsiteLevel1Width = 372;
if (isSubsite) {
if (isSpell) { // 拼音
if (!subsiteLevel1) { // 分站是二级
if (QS_city_spell_parent) {
htmlCity += '
';
htmlCity += '
';
htmlCity += '
';
for (var i = 0; i < QS_city_spell_parent.length; i++) {
if (QS_city_spell_parent[i].split(',')) {
var iArray = QS_city_spell_parent[i].split(',');
htmlCity += [
'
',
'',
'
'
].join('');
};
};
htmlCity += '
';
htmlCity += '
';
htmlCity += '
';
if (QS_city_spell_parent) {
for (var i = 0; i < QS_city_spell_parent.length; i++) {
if (QS_city_spell_parent[i].split(',')) {
var city1Array = QS_city_spell_parent[i].split(',');
if (QS_city_spell[city1Array[0]]) {
if (QS_city_spell[city1Array[0]].split('`')) {
var city11Array = QS_city_spell[city1Array[0]].split('`');
htmlCity += '
';
htmlCity += [
'
',
'',
'
'
].join('');
for (var j = 0; j < city11Array.length; j++) {
if (city11Array[j].split(',')) {
var jArray = city11Array[j].split(',');
htmlCity += [
'
';
for (var i = 0; i < QS_city_spell_parent.length; i++) {
if (QS_city_spell_parent[i].split(',')) {
var iArray = QS_city_spell_parent[i].split(',');
htmlCity += [
'
',
'',
'
'
].join('');
};
};
htmlCity += '
';
htmlCity += '
';
}
}
} else {
if (!subsiteLevel1) { // 分站是二级
if (QS_city_parent) {
htmlCity += '
';
htmlCity += '
';
htmlCity += '
';
for (var i = 0; i < QS_city_parent.length; i++) {
if (QS_city_parent[i].split(',')) {
var iArray = QS_city_parent[i].split(',');
htmlCity += [
'
',
'',
'
'
].join('');
};
};
htmlCity += '
';
htmlCity += '
';
htmlCity += '
';
if (QS_city_parent) {
for (var i = 0; i < QS_city_parent.length; i++) {
if (QS_city_parent[i].split(',')) {
var city1Array = QS_city_parent[i].split(',');
if (QS_city[city1Array[0]]) {
if (QS_city[city1Array[0]].split('`')) {
var city11Array = QS_city[city1Array[0]].split('`');
htmlCity += '
';
htmlCity += [
'
',
'',
'
'
].join('');
for (var j = 0; j < city11Array.length; j++) {
if (city11Array[j].split(',')) {
var jArray = city11Array[j].split(',');
htmlCity += [
'
';
for (var i = 0; i < QS_city_parent.length; i++) {
if (QS_city_parent[i].split(',')) {
var iArray = QS_city_parent[i].split(',');
htmlCity += [
'
',
'',
'
'
].join('');
};
};
htmlCity += '
';
htmlCity += '
';
}
}
}
} else {
if (isSpell) { // 拼音
if (QS_city_spell_parent) {
htmlCity += '
';
htmlCity += '
';
htmlCity += '
';
for (var i = 0; i < QS_city_spell_parent.length; i++) {
if (QS_city_spell_parent[i].split(',')) {
var iArray = QS_city_spell_parent[i].split(',');
htmlCity += [
'
',
'',
'
'
].join('');
};
};
htmlCity += '
';
htmlCity += '
';
htmlCity += '
';
if (QS_city_spell_parent) {
for (var i = 0; i < QS_city_spell_parent.length; i++) {
if (QS_city_spell_parent[i].split(',')) {
var city1Array = QS_city_spell_parent[i].split(',');
if (QS_city_spell[city1Array[0]]) {
if (QS_city_spell[city1Array[0]].split('`')) {
var city11Array = QS_city_spell[city1Array[0]].split('`');
htmlCity += '
';
htmlCity += [
'
',
'',
'
'
].join('');
for (var j = 0; j < city11Array.length; j++) {
if (city11Array[j].split(',')) {
var jArray = city11Array[j].split(',');
htmlCity += [
'
',
'',
'
'
].join('');
};
};
htmlCity += '
';
}
} else {
htmlCity += '
';
htmlCity += [
'
',
'',
'
'
].join('');
htmlCity += '
';
}
};
}
};
htmlCity += '
';
htmlCity += '';
htmlCity += '
';
}
} else {
if (QS_city_parent) {
htmlCity += '
';
htmlCity += '
';
htmlCity += '
';
for (var i = 0; i < QS_city_parent.length; i++) {
if (QS_city_parent[i].split(',')) {
var iArray = QS_city_parent[i].split(',');
htmlCity += [
'
',
'',
'
'
].join('');
};
};
htmlCity += '
';
htmlCity += '
';
htmlCity += '
';
if (QS_city_parent) {
for (var i = 0; i < QS_city_parent.length; i++) {
if (QS_city_parent[i].split(',')) {
var city1Array = QS_city_parent[i].split(',');
if (QS_city[city1Array[0]]) {
if (QS_city[city1Array[0]].split('`')) {
var city11Array = QS_city[city1Array[0]].split('`');
htmlCity += '
';
htmlCity += [
'
',
'',
'
'
].join('');
for (var j = 0; j < city11Array.length; j++) {
if (city11Array[j].split(',')) {
var jArray = city11Array[j].split(',');
htmlCity += [
'
',
'',
'
'
].join('');
};
};
htmlCity += '
';
}
} else {
htmlCity += '
';
htmlCity += [
'
',
'',
'
'
].join('');
htmlCity += '
';
}
};
}
};
htmlCity += '
';
htmlCity += '';
htmlCity += '
';
}
}
}
prepareModal(titleValue, multipleValue, maxNumValue);
$('.J_modal_content').html(htmlCity);
$('.J_btnyes').attr('id', 'J_btnyes_city');
$('.J_modal_content .right_box .list_nav').eq(0).show();
$('.J_list_city_parent').eq(0).addClass('current');
var msWidthValue = widthValue;
if (subsiteLevel1) { // 一级分站宽度
msWidthValue = subsiteLevel1Width;
}
$('.modal_dialog').css({
width: msWidthValue + 'px',
left: ($(window).width() - msWidthValue)/2,
top: ($(window).height() - $('.modal_dialog').outerHeight())/2 + $(document).scrollTop()
});
$('.modal_backdrop').addClass('in');
// 恢复选中
var recoverValue = $('#recoverSearchCityModalCode').val();
if (recoverValue.length) {
if (multipleValue) {
var recoverValueArray = recoverValue.split(',');
if (subsiteLevel1) { // 一级分站
for (var i = 0; i < recoverValueArray.length; i++) {
$('.J_list_city_parent').each(function(index, el) {
if ($(this).data('code') == recoverValueArray[i]) {
$(this).addClass('current');
};
});
};
} else {
for (var i = 0; i < recoverValueArray.length; i++) {
$('.J_list_city').each(function(index, el) {
if ($(this).data('code') == recoverValueArray[i]) {
$(this).addClass('seledted');
};
});
};
}
copyCitySelectedSecond();
} else {
if (subsiteLevel1) { // 一级分站
$('.J_list_city_parent').removeClass('seledted current');
$('.J_list_city_parent').each(function(index, el) {
if ($(this).data('code') == recoverValue) {
$(this).addClass('current');
};
});
} else {
$('.J_list_city').each(function(index, el) {
if ($(this).data('code') == recoverValue) {
$(this).addClass('seledted');
};
});
}
}
// 不是一级分站才需要进行下一步
if (!subsiteLevel1) {
$('.J_list_city_parent').removeClass('seledted current');
var subscriptValue = 0;
$('.J_list_city.seledted').each(function(index, el) {
var thisGroup = $(this).closest('.J_list_city_group');
subscriptValue = $('.J_list_city_group').index(thisGroup);
$('.J_list_city_parent').eq(subscriptValue).addClass('seledted');
});
$('.J_list_city_group').eq(subscriptValue).show().siblings('.J_list_city_group').hide();
}
}
// 一级地区点击
$('.J_list_city_parent').on('click', function() {
$(this).addClass('current').siblings('.J_list_city_parent').removeClass('current');
var subscriptValue = $('.J_list_city_parent').index(this);
$('.J_list_city_group').eq(subscriptValue).show().siblings('.J_list_city_group').hide();
});
// 不限
$('.J_list_city_nolimit').off().on('click', function() {
var thisGroup = $(this).closest('.J_list_city_group');
thisGroup.find('.J_list_city').not('.J_list_city_nolimit').removeClass('seledted');
});
// 二级地区点击
$('.J_list_city').off().on('click', function() {
if ($(this).hasClass('seledted')) {
$(this).removeClass('seledted');
if (multipleValue) {
copyCitySelectedSecond();
};
var thisGroup = $(this).closest('.J_list_city_group');
var subscriptValue = $('.J_list_city_group').index(thisGroup);
if (!thisGroup.find('.seledted').length) {
$('.J_list_city_parent').eq(subscriptValue).removeClass('seledted').addClass('current');
};
} else {
$(this).addClass('seledted');
if (multipleValue) {
if (!$(this).is('.J_list_city_nolimit')) {
var thisGroup = $(this).closest('.J_list_city_group');
thisGroup.find('.J_list_city_nolimit').removeClass('seledted');
};
if ($('.J_list_city.seledted').length > maxNumValue) {
$(this).removeClass('seledted');
disapperTooltip("remind", '最多选择'+ maxNumValue +'个');
return false;
} else {
copyCitySelectedSecond();
}
var thisGroup = $(this).closest('.J_list_city_group');
var subscriptValue = $('.J_list_city_group').index(thisGroup);
$('.J_list_city_parent').eq(subscriptValue).addClass('seledted');
} else {
var code = $(this).data('code');
var title = $(this).data('title');
$('#searchCityModalCode').val(code);
$('#recoverSearchCityModalCode').val(code);
$('#showSearchModal').text(title);
$('#showSearchModal').attr('title', title);
$('.modal_backdrop').remove();
$('.modal').remove();
}
}
});
function copyCitySelectedSecond() {
var htmlListed = '';
$('.J_list_city.seledted').each(function(index, el) {
var listedCode = $(this).data('code');
var listedTitle = $(this).data('title');
htmlListed += [
'