|
@@ -466,7 +466,7 @@
|
|
|
getResult:function(){ /* 选中结果 */
|
|
|
//如果选中所有,则转为全国
|
|
|
if($(".city").length==$(".city.active").length){
|
|
|
- $(".checkbox.other").trigger("click");
|
|
|
+ $(".checkbox.other").trigger("click");
|
|
|
return
|
|
|
}
|
|
|
this.selectObj = {};
|
|
@@ -477,14 +477,14 @@
|
|
|
if ($('.other').is(':checked')) {
|
|
|
// data.push(val)
|
|
|
data =[{name:val,children:[]}] //全国
|
|
|
+ $(".tips_d_text").slideUp();
|
|
|
}
|
|
|
$(".tab_content").find(".city.active:not('[disabled]')").each(function () {
|
|
|
var length = $(this).parent('.tab_content').find('.city').length; //省份下城市的length
|
|
|
var activeLeng = $(this).parent('.tab_content').find('.city.active').length; //省份下选中城市的length
|
|
|
let arr =[];
|
|
|
// 判断省份下的城市是否等于选中的城市长度,相等就是全部选中
|
|
|
- if (length == activeLeng) {
|
|
|
- $('.tips_btn .tips_d_text').hide()
|
|
|
+ if (length == activeLeng) {
|
|
|
// data.push($(this).parent('.tab_content').siblings('.tab:not(.whole)').children('.province').text().trim())
|
|
|
let province = $(this).parent('.tab_content').siblings('.tab:not(.whole)').children('.province').text().trim();
|
|
|
data.push({
|
|
@@ -524,14 +524,16 @@
|
|
|
}
|
|
|
})
|
|
|
var html = '';
|
|
|
+ var selectProvince = 0;
|
|
|
+ var selectCityMax = 0;
|
|
|
for (var i = 0; i < result.length; i++) {
|
|
|
let children = result[i].children;
|
|
|
if( children.length >0){
|
|
|
// 判断每个省份下选中的城市长度,当大于等于4的时候 弹出"选择全省更划算的弹窗"
|
|
|
let childrenArr=[];
|
|
|
- if (children.length >= 4 && !this.vipSubisTrial) {
|
|
|
- $('.tips_btn .tips_d_text').show()
|
|
|
- }
|
|
|
+ if(children.length>selectCityMax){
|
|
|
+ selectCityMax = children.length;
|
|
|
+ }
|
|
|
html += `${result[i].name}(`
|
|
|
for(var j = 0;j < children.length;j++){
|
|
|
childrenArr.push(children[j].name)
|
|
@@ -548,6 +550,8 @@
|
|
|
}
|
|
|
this.selectObj[result[i].name]=childrenArr;//
|
|
|
}else{
|
|
|
+ selectProvince++
|
|
|
+
|
|
|
if(i !=result.length -1){
|
|
|
html += `${result[i].name}、`
|
|
|
}else{
|
|
@@ -556,6 +560,22 @@
|
|
|
this.selectObj[result[i].name]=[];//
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ //提示
|
|
|
+ if(!this.vipSubisTrial){
|
|
|
+ if(selectProvince>9){
|
|
|
+ $('.tips_btn .tips_d_text').text("已选择"+selectProvince+"个省,建议购买“全国”更划算哦~").slideDown()
|
|
|
+ }else{
|
|
|
+ if (selectCityMax > 3) {
|
|
|
+ $('.tips_btn .tips_d_text').text("已选择"+selectCityMax+"个市,建议购买“全省”更划算哦~").slideDown();
|
|
|
+ }else{
|
|
|
+ $(".tips_d_text").slideUp();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
console.log("this.selectObj:",this.selectObj)
|
|
|
$('.result_name').append(html)
|
|
|
AreaChoose.isOpen()
|