|
@@ -29,6 +29,7 @@ var data = {
|
|
|
|
|
|
var buyCount = data.data.buyset.buyerclasscount;//已购买的行业数量 -1是全部行业,正数为购买的行业数量
|
|
|
var array = data.data.industry;//已选择的行业(数组)
|
|
|
+var otherBuyClass = 0
|
|
|
var result = [];//声明一个空数组为选择结果
|
|
|
// 初始化行业数据,渲染到页面
|
|
|
function initData() {
|
|
@@ -37,6 +38,7 @@ function initData() {
|
|
|
}
|
|
|
buyCount = data.data.buyset.buyerclasscount;//已购买的行业数量 -1是全部行业,正数为购买的行业数量
|
|
|
array = data.data.industry;//已选择的行业(数组)
|
|
|
+ otherBuyClass = data.data.otherbuyerclass
|
|
|
/* 已购买过的行业 */
|
|
|
if (buyCount == -1) {
|
|
|
$('.result_name').html('全部行业')
|
|
@@ -48,6 +50,7 @@ function initData() {
|
|
|
if (array.length == 0) {
|
|
|
$('.result_count').html('全部行业');
|
|
|
$('.industry_item.whole').addClass('active')
|
|
|
+ $('.industry_item.switch_other').addClass('active')
|
|
|
} else {
|
|
|
$('.result_count').html(array.length + '个行业');
|
|
|
$('.industry_item:not(.whole)').each(function () {
|
|
@@ -59,6 +62,11 @@ function initData() {
|
|
|
}
|
|
|
}
|
|
|
})
|
|
|
+ if(otherBuyClass == 1) {
|
|
|
+ $('.switch_other').addClass('active')
|
|
|
+ }else{
|
|
|
+ $('.switch_other').removeClass('active')
|
|
|
+ }
|
|
|
}
|
|
|
resultCount();
|
|
|
}
|
|
@@ -80,7 +88,11 @@ function resultCount() {
|
|
|
var canChangeArr = [];
|
|
|
buttons.each(function () {
|
|
|
if ($(this).hasClass('active')) {
|
|
|
- canChangeArr.push($(this).text())
|
|
|
+ if($(this).text() !== '匹配未分类行业') {
|
|
|
+ canChangeArr.push($(this).text())
|
|
|
+ } else {
|
|
|
+ count = count - 1
|
|
|
+ }
|
|
|
}
|
|
|
})
|
|
|
if (count > buyCount && buyCount != -1) {
|
|
@@ -88,10 +100,27 @@ function resultCount() {
|
|
|
} else {
|
|
|
$('.update_tips').hide();
|
|
|
}
|
|
|
+ let switch_other = $('.switch_other').hasClass('active')
|
|
|
if(count>0){
|
|
|
- $('.result_count').html(count + '个行业' + '(' + canChangeArr.join(',') + ')');
|
|
|
+ if(canChangeArr.length > 15) {
|
|
|
+ if(switch_other) {
|
|
|
+ $('.result_count').html(count + '个行业' + '(' + canChangeArr.slice(0, 15).join('、') + '等' + ')' + ',未分类行业');
|
|
|
+ } else {
|
|
|
+ $('.result_count').html(count + '个行业' + '(' + canChangeArr.slice(0, 15).join('、') + '等' + ')');
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if(switch_other) {
|
|
|
+ $('.result_count').html(count + '个行业' + '(' + canChangeArr.slice(0, 15).join('、') + ')' + ',未分类行业');
|
|
|
+ } else {
|
|
|
+ $('.result_count').html(count + '个行业' + '(' + canChangeArr.slice(0, 15).join('、') + ')');
|
|
|
+ }
|
|
|
+ }
|
|
|
}else {
|
|
|
+ if(switch_other) {
|
|
|
+ $('.result_count').html('未分类行业');
|
|
|
+ } else {
|
|
|
$('.result_count').html("");
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
if ($('.list').find('.industry_item.active:not(.whole)').length === 0) {
|
|
@@ -135,6 +164,7 @@ $(function () {
|
|
|
// 选择全部行业
|
|
|
$('.industry_item.whole').on('click', function () {
|
|
|
$(this).addClass('active').parents('.list').find('.industry_item:not(.whole)').removeClass('active');
|
|
|
+ $(this).siblings('.switch_other').addClass('active')
|
|
|
resultCount();
|
|
|
showNeedPopver(false)
|
|
|
})
|
|
@@ -149,14 +179,17 @@ $(function () {
|
|
|
resultCount();
|
|
|
})
|
|
|
// 匹配未分类行业
|
|
|
- $('.switch_other').on('click', function (e) {
|
|
|
- $(this).toggleClass('active');
|
|
|
- if ($(this).hasClass('active')) {
|
|
|
- setotherbuyerclass(0)
|
|
|
- } else {
|
|
|
- setotherbuyerclass(1)
|
|
|
- }
|
|
|
- })
|
|
|
+ // $('.switch_other').on('click', function (e) {
|
|
|
+ // console.log($(this))
|
|
|
+ // // $(this).toggleClass('active');
|
|
|
+ // if ($(this).hasClass('active')) {
|
|
|
+ // $(this).removeClass('active');
|
|
|
+ // // setotherbuyerclass(0)
|
|
|
+ // } else {
|
|
|
+ // $(this).addClass('active');
|
|
|
+ // // setotherbuyerclass(1)
|
|
|
+ // }
|
|
|
+ // })
|
|
|
function setotherbuyerclass(index) {
|
|
|
$.post("/subscribepay/afterPay/setUserInfo", {pageType: "other_buyerclass", other: index}, function (r) {
|
|
|
console.log(r)
|
|
@@ -287,10 +320,17 @@ $(function () {
|
|
|
$('.save-btn').on('click', function () {
|
|
|
data.data.industry = result
|
|
|
console.log(data.data)
|
|
|
+ let switch_other = $('.switch_other').hasClass('active')
|
|
|
var params = {
|
|
|
area: JSON.stringify(data.data.area),
|
|
|
industry: data.data.industry.join(',')
|
|
|
}
|
|
|
+ console.log(switch_other)
|
|
|
+ if(switch_other) {
|
|
|
+ setotherbuyerclass(1)
|
|
|
+ } else {
|
|
|
+ setotherbuyerclass(0)
|
|
|
+ }
|
|
|
// 超级订阅新套餐 修改订阅条件需要提交后台保存, 因是共用页面,为不影响其他页面逻辑,url加上参数进行判断
|
|
|
if (getParam('header') === 'save') {
|
|
|
let url = ''
|