|
@@ -22,12 +22,12 @@
|
|
|
<div class="form">
|
|
|
<div class="select-area-box">
|
|
|
<ul class="list">
|
|
|
- <!-- <li class="list_item" id="all">
|
|
|
+ <li class="list_item" id="all" style="display:none">
|
|
|
<div class="item_label"></div>
|
|
|
<div class="item_industry_list">
|
|
|
<button class="industry_item">全部行业</button>
|
|
|
</div>
|
|
|
- </li> -->
|
|
|
+ </li>
|
|
|
<li class="list_item" id="A">
|
|
|
<div class="item_label">A</div>
|
|
|
<div class="item_industry_list">
|
|
@@ -44,240 +44,163 @@
|
|
|
<div class="item_label">C</div>
|
|
|
<div class="item_industry_list">
|
|
|
<button class="industry_item">财政</button>
|
|
|
- <button class="industry_item">出版广电</button>
|
|
|
<button class="industry_item">传媒</button>
|
|
|
<button class="industry_item">城管</button>
|
|
|
<button class="industry_item">采矿业</button>
|
|
|
+ <button class="industry_item">出版广电</button>
|
|
|
</div>
|
|
|
</li>
|
|
|
<li class="list_item" id="D">
|
|
|
<div class="item_label">D</div>
|
|
|
<div class="item_industry_list">
|
|
|
- <button class="industry_item">电力</button>
|
|
|
- <button class="industry_item">广电</button>
|
|
|
- <button class="industry_item">传媒</button>
|
|
|
- <button class="industry_item">城管</button>
|
|
|
- <button class="industry_item">采矿业</button>
|
|
|
- </div>
|
|
|
- </li>
|
|
|
- <li class="list_item" id="E">
|
|
|
- <div class="item_label">E</div>
|
|
|
- <div class="item_industry_list">
|
|
|
- <button class="industry_item">电力</button>
|
|
|
- <button class="industry_item">广电</button>
|
|
|
- <button class="industry_item">传媒</button>
|
|
|
- <button class="industry_item">城管</button>
|
|
|
- <button class="industry_item">采矿业</button>
|
|
|
+ <button class="industry_item">档案</button>
|
|
|
+ <button class="industry_item">地震</button>
|
|
|
+ <button class="industry_item">党委办</button>
|
|
|
+ <button class="industry_item">电信行业</button>
|
|
|
</div>
|
|
|
</li>
|
|
|
<li class="list_item" id="F">
|
|
|
<div class="item_label">F</div>
|
|
|
<div class="item_industry_list">
|
|
|
- <button class="industry_item">电力</button>
|
|
|
- <button class="industry_item">广电</button>
|
|
|
- <button class="industry_item">传媒</button>
|
|
|
- <button class="industry_item">城管</button>
|
|
|
- <button class="industry_item">采矿业</button>
|
|
|
+ <button class="industry_item">法院</button>
|
|
|
+ <button class="industry_item">发改</button>
|
|
|
</div>
|
|
|
</li>
|
|
|
<li class="list_item" id="G">
|
|
|
<div class="item_label">G</div>
|
|
|
<div class="item_industry_list">
|
|
|
- <button class="industry_item">电力</button>
|
|
|
- <button class="industry_item">广电</button>
|
|
|
- <button class="industry_item">传媒</button>
|
|
|
- <button class="industry_item">城管</button>
|
|
|
- <button class="industry_item">采矿业</button>
|
|
|
+ <button class="industry_item">工商</button>
|
|
|
+ <button class="industry_item">工信</button>
|
|
|
+ <button class="industry_item">国土</button>
|
|
|
+ <button class="industry_item">公安</button>
|
|
|
+ <button class="industry_item">国资委</button>
|
|
|
+ <button class="industry_item">公共资源交易</button>
|
|
|
</div>
|
|
|
</li>
|
|
|
<li class="list_item" id="H">
|
|
|
<div class="item_label">H</div>
|
|
|
<div class="item_industry_list">
|
|
|
- <button class="industry_item">电力</button>
|
|
|
- <button class="industry_item">广电</button>
|
|
|
- <button class="industry_item">传媒</button>
|
|
|
- <button class="industry_item">城管</button>
|
|
|
- <button class="industry_item">采矿业</button>
|
|
|
- </div>
|
|
|
- </li>
|
|
|
- <li class="list_item" id="I">
|
|
|
- <div class="item_label">I</div>
|
|
|
- <div class="item_industry_list">
|
|
|
- <button class="industry_item">电力</button>
|
|
|
- <button class="industry_item">广电</button>
|
|
|
- <button class="industry_item">传媒</button>
|
|
|
- <button class="industry_item">城管</button>
|
|
|
- <button class="industry_item">采矿业</button>
|
|
|
+ <button class="industry_item">环保</button>
|
|
|
+ <button class="industry_item">海关</button>
|
|
|
</div>
|
|
|
</li>
|
|
|
<li class="list_item" id="J">
|
|
|
<div class="item_label">J</div>
|
|
|
<div class="item_industry_list">
|
|
|
- <button class="industry_item">电力</button>
|
|
|
- <button class="industry_item">广电</button>
|
|
|
- <button class="industry_item">传媒</button>
|
|
|
- <button class="industry_item">城管</button>
|
|
|
- <button class="industry_item">采矿业</button>
|
|
|
+ <button class="industry_item">教育</button>
|
|
|
+ <button class="industry_item">军队</button>
|
|
|
+ <button class="industry_item">交通</button>
|
|
|
+ <button class="industry_item">纪委</button>
|
|
|
+ <button class="industry_item">金融业</button>
|
|
|
+ <button class="industry_item">建筑业</button>
|
|
|
+ <button class="industry_item">检察院</button>
|
|
|
+ <button class="industry_item">机关事务</button>
|
|
|
</div>
|
|
|
</li>
|
|
|
<li class="list_item" id="K">
|
|
|
<div class="item_label">K</div>
|
|
|
<div class="item_industry_list">
|
|
|
- <button class="industry_item">电力</button>
|
|
|
- <button class="industry_item">广电</button>
|
|
|
- <button class="industry_item">传媒</button>
|
|
|
- <button class="industry_item">城管</button>
|
|
|
- <button class="industry_item">采矿业</button>
|
|
|
+ <button class="industry_item">科技</button>
|
|
|
</div>
|
|
|
</li>
|
|
|
<li class="list_item" id="L">
|
|
|
<div class="item_label">L</div>
|
|
|
<div class="item_industry_list">
|
|
|
- <button class="industry_item">电力</button>
|
|
|
- <button class="industry_item">广电</button>
|
|
|
- <button class="industry_item">传媒</button>
|
|
|
- <button class="industry_item">城管</button>
|
|
|
- <button class="industry_item">采矿业</button>
|
|
|
+ <button class="industry_item">林业</button>
|
|
|
+ <button class="industry_item">旅游</button>
|
|
|
</div>
|
|
|
</li>
|
|
|
<li class="list_item" id="M">
|
|
|
<div class="item_label">M</div>
|
|
|
<div class="item_industry_list">
|
|
|
- <button class="industry_item">电力</button>
|
|
|
- <button class="industry_item">广电</button>
|
|
|
- <button class="industry_item">传媒</button>
|
|
|
- <button class="industry_item">城管</button>
|
|
|
- <button class="industry_item">采矿业</button>
|
|
|
+ <button class="industry_item">民政</button>
|
|
|
+ <button class="industry_item">民宗</button>
|
|
|
</div>
|
|
|
</li>
|
|
|
<li class="list_item" id="N">
|
|
|
<div class="item_label">N</div>
|
|
|
<div class="item_industry_list">
|
|
|
- <button class="industry_item">电力</button>
|
|
|
- <button class="industry_item">广电</button>
|
|
|
- <button class="industry_item">传媒</button>
|
|
|
- <button class="industry_item">城管</button>
|
|
|
- <button class="industry_item">采矿业</button>
|
|
|
- </div>
|
|
|
- </li>
|
|
|
- <li class="list_item" id="O">
|
|
|
- <div class="item_label">O</div>
|
|
|
- <div class="item_industry_list">
|
|
|
- <button class="industry_item">电力</button>
|
|
|
- <button class="industry_item">广电</button>
|
|
|
- <button class="industry_item">传媒</button>
|
|
|
- <button class="industry_item">城管</button>
|
|
|
- <button class="industry_item">采矿业</button>
|
|
|
+ <button class="industry_item">农业</button>
|
|
|
+ <button class="industry_item">能源化工</button>
|
|
|
+ <button class="industry_item">农林牧渔</button>
|
|
|
</div>
|
|
|
</li>
|
|
|
<li class="list_item" id="P">
|
|
|
<div class="item_label">P</div>
|
|
|
<div class="item_industry_list">
|
|
|
- <button class="industry_item">电力</button>
|
|
|
- <button class="industry_item">广电</button>
|
|
|
- <button class="industry_item">传媒</button>
|
|
|
- <button class="industry_item">城管</button>
|
|
|
- <button class="industry_item">采矿业</button>
|
|
|
+ <button class="industry_item">批发零售</button>
|
|
|
</div>
|
|
|
</li>
|
|
|
<li class="list_item" id="Q">
|
|
|
<div class="item_label">Q</div>
|
|
|
<div class="item_industry_list">
|
|
|
- <button class="industry_item">电力</button>
|
|
|
- <button class="industry_item">广电</button>
|
|
|
- <button class="industry_item">传媒</button>
|
|
|
- <button class="industry_item">城管</button>
|
|
|
- <button class="industry_item">采矿业</button>
|
|
|
+ <button class="industry_item">气象</button>
|
|
|
</div>
|
|
|
</li>
|
|
|
<li class="list_item" id="R">
|
|
|
<div class="item_label">R</div>
|
|
|
<div class="item_industry_list">
|
|
|
- <button class="industry_item">电力</button>
|
|
|
- <button class="industry_item">广电</button>
|
|
|
- <button class="industry_item">传媒</button>
|
|
|
- <button class="industry_item">城管</button>
|
|
|
- <button class="industry_item">采矿业</button>
|
|
|
+ <button class="industry_item">人行</button>
|
|
|
+ <button class="industry_item">人社</button>
|
|
|
+ <button class="industry_item">人大</button>
|
|
|
</div>
|
|
|
</li>
|
|
|
<li class="list_item" id="S">
|
|
|
<div class="item_label">S</div>
|
|
|
<div class="item_industry_list">
|
|
|
- <button class="industry_item">电力</button>
|
|
|
- <button class="industry_item">广电</button>
|
|
|
- <button class="industry_item">传媒</button>
|
|
|
- <button class="industry_item">城管</button>
|
|
|
- <button class="industry_item">采矿业</button>
|
|
|
+ <button class="industry_item">食药</button>
|
|
|
+ <button class="industry_item">税务</button>
|
|
|
+ <button class="industry_item">水利</button>
|
|
|
+ <button class="industry_item">市政</button>
|
|
|
+ <button class="industry_item">审计</button>
|
|
|
+ <button class="industry_item">商务</button>
|
|
|
+ <button class="industry_item">司法</button>
|
|
|
+ <button class="industry_item">社会团体</button>
|
|
|
</div>
|
|
|
</li>
|
|
|
<li class="list_item" id="T">
|
|
|
<div class="item_label">T</div>
|
|
|
<div class="item_industry_list">
|
|
|
- <button class="industry_item">电力</button>
|
|
|
- <button class="industry_item">广电</button>
|
|
|
- <button class="industry_item">传媒</button>
|
|
|
- <button class="industry_item">城管</button>
|
|
|
- <button class="industry_item">采矿业</button>
|
|
|
- </div>
|
|
|
- </li>
|
|
|
- <li class="list_item" id="U">
|
|
|
- <div class="item_label">U</div>
|
|
|
- <div class="item_industry_list">
|
|
|
- <button class="industry_item">电力</button>
|
|
|
- <button class="industry_item">广电</button>
|
|
|
- <button class="industry_item">传媒</button>
|
|
|
- <button class="industry_item">城管</button>
|
|
|
- <button class="industry_item">采矿业</button>
|
|
|
+ <button class="industry_item">统计</button>
|
|
|
+ <button class="industry_item">统战</button>
|
|
|
+ <button class="industry_item">体育</button>
|
|
|
</div>
|
|
|
- </li>
|
|
|
- <li class="list_item" id="V">
|
|
|
- <div class="item_label">V</div>
|
|
|
- <div class="item_industry_list">
|
|
|
- <button class="industry_item">电力</button>
|
|
|
- <button class="industry_item">广电</button>
|
|
|
- <button class="industry_item">传媒</button>
|
|
|
- <button class="industry_item">城管</button>
|
|
|
- <button class="industry_item">采矿业</button>
|
|
|
- </div>
|
|
|
- </li>
|
|
|
+ </li>
|
|
|
<li class="list_item" id="W">
|
|
|
<div class="item_label">W</div>
|
|
|
<div class="item_industry_list">
|
|
|
- <button class="industry_item">电力</button>
|
|
|
- <button class="industry_item">广电</button>
|
|
|
- <button class="industry_item">传媒</button>
|
|
|
- <button class="industry_item">城管</button>
|
|
|
- <button class="industry_item">采矿业</button>
|
|
|
+ <button class="industry_item">文化</button>
|
|
|
+ <button class="industry_item">卫生</button>
|
|
|
</div>
|
|
|
</li>
|
|
|
<li class="list_item" id="X">
|
|
|
<div class="item_label">X</div>
|
|
|
<div class="item_industry_list">
|
|
|
- <button class="industry_item">电力</button>
|
|
|
- <button class="industry_item">广电</button>
|
|
|
- <button class="industry_item">传媒</button>
|
|
|
- <button class="industry_item">城管</button>
|
|
|
- <button class="industry_item">采矿业</button>
|
|
|
+ <button class="industry_item">学校</button>
|
|
|
+ <button class="industry_item">宣传</button>
|
|
|
+ <button class="industry_item">信息技术</button>
|
|
|
</div>
|
|
|
</li>
|
|
|
<li class="list_item" id="Y">
|
|
|
<div class="item_label">Y</div>
|
|
|
<div class="item_industry_list">
|
|
|
- <button class="industry_item">电力</button>
|
|
|
- <button class="industry_item">广电</button>
|
|
|
- <button class="industry_item">传媒</button>
|
|
|
- <button class="industry_item">城管</button>
|
|
|
- <button class="industry_item">采矿业</button>
|
|
|
+ <button class="industry_item">医疗</button>
|
|
|
+ <button class="industry_item">银监</button>
|
|
|
+ <button class="industry_item">运输物流</button>
|
|
|
</div>
|
|
|
</li>
|
|
|
<li class="list_item" id="Z">
|
|
|
<div class="item_label">Z</div>
|
|
|
<div class="item_industry_list">
|
|
|
- <button class="industry_item">电力</button>
|
|
|
- <button class="industry_item">广电</button>
|
|
|
- <button class="industry_item">传媒</button>
|
|
|
- <button class="industry_item">城管</button>
|
|
|
- <button class="industry_item">采矿业</button>
|
|
|
+ <button class="industry_item">质监</button>
|
|
|
+ <button class="industry_item">组织</button>
|
|
|
+ <button class="industry_item">政协</button>
|
|
|
+ <button class="industry_item">住建</button>
|
|
|
+ <button class="industry_item">证监</button>
|
|
|
+ <button class="industry_item">政府办</button>
|
|
|
+ <button class="industry_item">制造业</button>
|
|
|
+ <button class="industry_item">政务中心</button>
|
|
|
+ <button class="industry_item">住宿餐饮</button>
|
|
|
</div>
|
|
|
</li>
|
|
|
</ul>
|
|
@@ -289,24 +212,19 @@
|
|
|
<a href="javascript:;">B</a>
|
|
|
<a href="javascript:;">C</a>
|
|
|
<a href="javascript:;">D</a>
|
|
|
- <a href="javascript:;">E</a>
|
|
|
<a href="javascript:;">F</a>
|
|
|
<a href="javascript:;">G</a>
|
|
|
<a href="javascript:;">H</a>
|
|
|
- <a href="javascript:;">I</a>
|
|
|
<a href="javascript:;">J</a>
|
|
|
<a href="javascript:;">K</a>
|
|
|
<a href="javascript:;">L</a>
|
|
|
<a href="javascript:;">M</a>
|
|
|
<a href="javascript:;">N</a>
|
|
|
- <a href="javascript:;">O</a>
|
|
|
<a href="javascript:;">P</a>
|
|
|
<a href="javascript:;">Q</a>
|
|
|
<a href="javascript:;">R</a>
|
|
|
<a href="javascript:;">S</a>
|
|
|
<a href="javascript:;">T</a>
|
|
|
- <a href="javascript:;">U</a>
|
|
|
- <a href="javascript:;">V</a>
|
|
|
<a href="javascript:;">W</a>
|
|
|
<a href="javascript:;">X</a>
|
|
|
<a href="javascript:;">Y</a>
|
|
@@ -326,81 +244,159 @@
|
|
|
<script src="/vipsubscribe/js/jquery-2.1.4.js?v={{Msg "seo" "version"}}"></script>
|
|
|
<script src="/vipsubscribe/js/fastclick.js?v={{Msg "seo" "version"}}"></script>
|
|
|
<script src="/vipsubscribe/js/weui.min.js?v={{Msg "seo" "version"}}"></script>
|
|
|
+ <script src="/vipsubscribe/js/common.js?v={{Msg "seo" "version"}}"></script>
|
|
|
<script>
|
|
|
- let oldIndustry = ["安监","保监"];
|
|
|
- $('.total').html(oldIndustry.length)
|
|
|
- $('.count').html(oldIndustry.length)
|
|
|
- $('.result .result_name').html(oldIndustry.join('、'))
|
|
|
- $('.list_item').each(function () {
|
|
|
- let text = $(this).find('.industry_item').text();
|
|
|
- oldIndustry.forEach(v =>{
|
|
|
- if(v == text){
|
|
|
- $(this).find('.industry_item').addClass('active')
|
|
|
+ //加载数据
|
|
|
+ var EditIndustry={
|
|
|
+ reqData:{},
|
|
|
+ selectlast:[],
|
|
|
+ init:function(){
|
|
|
+ this.getData();
|
|
|
+ this.showData();//初始化页面展示
|
|
|
+ this.initClick();//初始化点击事件
|
|
|
+ },
|
|
|
+ getData:function(){
|
|
|
+ //加载数据
|
|
|
+ //if(sessionStorage.getItem("EditVipSub")){
|
|
|
+ // this.reqData=JSON.parse(sessionStorage.getItem("EditVipSub"));
|
|
|
+ //}else{
|
|
|
+ $DoPost("/subscribepay/editSub/getSubBuyMsg",{},function(r){
|
|
|
+ if(r.success){
|
|
|
+ EditIndustry.reqData=r.data;
|
|
|
}
|
|
|
-
|
|
|
- })
|
|
|
- })
|
|
|
- $('.industry_item:not(.active)').attr('disabled',true)
|
|
|
- // 点击导航跳转
|
|
|
- $("body").on('click','.slide a',function(){
|
|
|
- var s = $(this).html()
|
|
|
- if(s == '#'){
|
|
|
- return;
|
|
|
+ },false)
|
|
|
+ if(EditIndustry.reqData.industry.length==0&&this.reqData.buyset[2]==-1){
|
|
|
+ EditIndustry.reqData.industry=["全部行业"];
|
|
|
+ }
|
|
|
+ if($.isEmptyObject(EditIndustry.reqData.area)&&this.reqData.buyset[0]==-1){
|
|
|
+ EditIndustry.reqData.area={"全国":[]};
|
|
|
+ }
|
|
|
+ //sessionStorage.setItem("EditVipSub",JSON.stringify(this.reqData));
|
|
|
+ //}
|
|
|
+ //if(!this.reqData.industrySelect){
|
|
|
+ EditIndustry.reqData.industrySelect=[];
|
|
|
+ //}
|
|
|
+ console.log(EditIndustry.reqData);
|
|
|
+ },
|
|
|
+ showData:function(){
|
|
|
+
|
|
|
+ var industry =this.reqData.industry;
|
|
|
+ this.selectlast=this.reqData.industry;
|
|
|
+ if(this.reqData.industrySelect.length!=0){
|
|
|
+ industry=this.reqData.industrySelect;
|
|
|
+ this.selectlast= [...this.reqData.industrySelect];
|
|
|
}
|
|
|
- document.querySelector('#' + s).scrollIntoView({block:'center'});
|
|
|
- })
|
|
|
- // 选中行业在已选择提示中显示
|
|
|
- var selectedIndustryArr = null
|
|
|
- function findSelectedIndustry () {
|
|
|
- var buttons = $('.select-area-box .list button')
|
|
|
- // 找到已选择的数组(有active类的数组)
|
|
|
- var selectedArr = []
|
|
|
- buttons.each(function(){
|
|
|
- if ($(this).hasClass('active')) {
|
|
|
- selectedArr.push($(this).text())
|
|
|
+ $('.result .result_name').html(industry.join('、'));
|
|
|
+
|
|
|
+ $('.industry_item').each(function () {
|
|
|
+ let text = $(this).text();
|
|
|
+ industry.forEach(v =>{
|
|
|
+ if(v.trim() == text.trim()){
|
|
|
+ $(this).addClass('active')
|
|
|
+ }
|
|
|
+ })
|
|
|
+ });
|
|
|
+
|
|
|
+ if(this.reqData.buyset[2]!=-1){
|
|
|
+ $('.total').html(this.reqData.buyset[2]);
|
|
|
+ $('.count').html(industry.length);
|
|
|
+ if(this.reqData.industrySelect.length>=this.reqData.buyset[2]){
|
|
|
+ $('.industry_item:not(.active)').attr('disabled',true);
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ $("#all").css("display","");
|
|
|
+ $(".optional_count").css("display","none");
|
|
|
+ }
|
|
|
+ },
|
|
|
+ initClick:function(){
|
|
|
+ // 点击导航跳转
|
|
|
+ $("body").on('click','.slide a',function(){
|
|
|
+ var s = $(this).html()
|
|
|
+ if(s == '#'){
|
|
|
+ return;
|
|
|
}
|
|
|
+ document.querySelector('#' + s).scrollIntoView({block:'center'});
|
|
|
})
|
|
|
- $('.count').html(selectedArr.length)
|
|
|
- // 显示隐藏优惠tips
|
|
|
- if (selectedArr.length >= 2) {
|
|
|
- weui.toast(`<p>只可选择${oldIndustry.length}个行业<br/><span style="white-space: nowrap;">您只购买了${oldIndustry.length}个行业,如需更多请升级<span></p>`,{
|
|
|
- duration: 1000,
|
|
|
- className: 'custom-toast',
|
|
|
- })
|
|
|
- $('.industry_item:not(.active)').attr('disabled','disabled')
|
|
|
- for(let i in oldIndustry){
|
|
|
- console.log(oldIndustry[i],selectedArr[i])
|
|
|
- if(oldIndustry[i] != selectedArr[i]){
|
|
|
- $('#enter').removeAttr('disabled')
|
|
|
- }
|
|
|
+ // 每个button的点击事件
|
|
|
+ $('.select-area-box .list').on('click', 'button', function (e) {
|
|
|
+ if($(this).text()=="全部行业"){
|
|
|
+ if($(this).hasClass('active')){
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if(EditIndustry.reqData.buyset[2]!=-1){ //购买不是全部行业 不能点击
|
|
|
+ EditIndustry.showTip(`<p>只可选择${EditIndustry.reqData.buyset[2]}个行业<br/><span style="white-space: nowrap;">您只购买了${EditIndustry.reqData.buyset[2]}个行业,如需更多请升级<span></p>`);
|
|
|
+ return
|
|
|
+ }
|
|
|
+ $('.select-area-box .list button').removeClass('active');
|
|
|
+ $('#all button').addClass('active');
|
|
|
+ }else{
|
|
|
+ $('#all button').removeClass('active');
|
|
|
+ $(this).toggleClass('active')
|
|
|
}
|
|
|
- } else {
|
|
|
- $('.industry_item:not(.active)').removeAttr('disabled')
|
|
|
- $('#enter').attr('disabled', 'disabled')
|
|
|
- }
|
|
|
-
|
|
|
- selectedIndustryArr = selectedArr
|
|
|
-
|
|
|
- var selectedStr = selectedArr.join('、')
|
|
|
- $('.result .result_name').text(selectedStr)
|
|
|
+ EditIndustry.findSelectedIndustry();
|
|
|
+ })
|
|
|
+ // 取消按钮事件 返回上一页
|
|
|
+ $('#cancel').click(function(){
|
|
|
+ window.history.go(-1);
|
|
|
+ })
|
|
|
+ // 确定修改事件
|
|
|
+ $('#enter').click(function(){
|
|
|
+ $("#enter").attr("disabled","disabled");
|
|
|
+ //更新对象
|
|
|
+ if(EditIndustry.reqData.buyset[2]==-1&&EditIndustry.reqData.industrySelect[0]=="全部行业"){
|
|
|
+ EditIndustry.reqData.industrySelect=[];
|
|
|
+ }
|
|
|
+ console.log("final select ",EditIndustry.reqData)
|
|
|
+ $DoPost("/subscribepay/editSub/submit",{"type":"industry","value":JSON.stringify(EditIndustry.reqData.industrySelect)},function(r){
|
|
|
+ if(r.success){
|
|
|
+ window.history.go(-1);
|
|
|
+ }
|
|
|
+ },false)
|
|
|
+ $("#enter").removeAttr("disabled");
|
|
|
+ })
|
|
|
+ },
|
|
|
+ showTip:function(msg){
|
|
|
+ weui.toast(msg,{
|
|
|
+ duration: 2000,
|
|
|
+ className: 'custom-toast',
|
|
|
+ });
|
|
|
+ },
|
|
|
+ findSelectedIndustry:function() {
|
|
|
+ var buttons = $('.select-area-box .list button')
|
|
|
+ // 找到已选择的数组(有active类的数组)
|
|
|
+ var selectedArr = []
|
|
|
+ buttons.each(function(){
|
|
|
+ if ($(this).hasClass('active')) {
|
|
|
+ selectedArr.push($(this).text())
|
|
|
+ }
|
|
|
+ })
|
|
|
+ if(selectedArr.length==$('.select-area-box .list button').length-1){//选中了全部行业
|
|
|
+ $('#all button').trigger('click');
|
|
|
+ return
|
|
|
+ }
|
|
|
+ var selectCount= selectedArr.length
|
|
|
+ $('.count').html(selectCount);
|
|
|
+ // 显示隐藏优惠tips
|
|
|
+ if (selectedArr.length >= EditIndustry.reqData.buyset[2]&& EditIndustry.reqData.buyset[2]!=-1) {
|
|
|
+ EditIndustry.showTip(`<p>只可选择${EditIndustry.reqData.buyset[2]}个行业<br/><span style="white-space: nowrap;">您只购买了${EditIndustry.reqData.buyset[2]}个行业,如需更多请升级<span></p>`);
|
|
|
+ $('.industry_item:not(.active)').attr('disabled','disabled')
|
|
|
+ } else {
|
|
|
+ $('.industry_item:not(.active)').removeAttr('disabled')
|
|
|
+ }
|
|
|
+ this.reqData.industrySelect = selectedArr;
|
|
|
+ var selectedStr = selectedArr.join('、')
|
|
|
+ $('.result .result_name').text(selectedStr)
|
|
|
+ if(this.noChange(this.reqData.industrySelect,EditIndustry.selectlast)||this.reqData.industrySelect.length==0){
|
|
|
+ $('#enter').attr('disabled', 'disabled');
|
|
|
+ }else{
|
|
|
+ $('#enter').removeAttr('disabled');
|
|
|
+ }
|
|
|
+ },
|
|
|
+ noChange:function(arr1,arr2){
|
|
|
+ return JSON.stringify(arr1.sort()) === JSON.stringify(arr2.sort());
|
|
|
+ }
|
|
|
}
|
|
|
-
|
|
|
- // 每个button的点击事件
|
|
|
- $('.select-area-box .list').on('click', 'button', function (e) {
|
|
|
- $(this).toggleClass('active')
|
|
|
- findSelectedIndustry()
|
|
|
- })
|
|
|
-
|
|
|
- // 取消按钮事件 返回上一页
|
|
|
- $('#cancel').click(function(){
|
|
|
- window.history.go(-1)
|
|
|
- })
|
|
|
- // 确定修改事件
|
|
|
- $('#enter').click(function(){
|
|
|
- // $.ajax({
|
|
|
- window.location.href='/front/vipsubscribe/submitEditSub'
|
|
|
- // })
|
|
|
- })
|
|
|
+ EditIndustry.init();
|
|
|
</script>
|
|
|
</body>
|
|
|
</html>
|