Browse Source

采购单位行业修改

TANGSHIZHE 4 năm trước cách đây
mục cha
commit
befbe7a3e5

+ 17 - 3
src/jfw/modules/app/src/web/staticres/jyapp/vipsubscribe/js/change_area.js

@@ -78,7 +78,8 @@ $(function () {
             isAnimating = false
         }, 500)
     }
-
+    // dev4.5.5选中区域文案修改
+    var new_selected
     // 新增求值 ---- 统计数量,不做视图操作
     function getResult() {
         var selectedCount = {
@@ -123,9 +124,9 @@ $(function () {
                         pCount: 0
                     }
                 }
+                new_selected = selected
                 return setDataInResult('.result-selected .result-info .info-overview', getBuySet(selected, []));
             }
-
             if (selected[p].length === 0) {
                 selectedCount.province++
             } else {
@@ -139,6 +140,7 @@ $(function () {
         //    1. 隐藏提示,并清空已选择
             $('.result .info-tip').hide().siblings('.info-overview').text('');
         } else {
+            new_selected = selected
             setDataInResult('.result-selected .result-info .info-overview', getBuySet(selected, []));
         }
     }
@@ -170,7 +172,19 @@ $(function () {
             if (citySum === 0 || citySum === 1) {
                 text.s = ''
             }
-            $(selector).text(text.p + dunhao + text.c + text.s);
+            let proStr = ''
+            Object.keys(new_selected).forEach(function(item,index) {
+                if(new_selected[item].length == 0) {
+                    proStr += item + '、'
+                } else {
+                    proStr += item+ '(' + new_selected[item].length+ '个市' + ')' + '、'
+                }
+            })
+            if(proStr[proStr.length - 1] == '、') {
+                proStr = proStr.substr(0,proStr.length - 1);
+            }
+            // $(selector).text(text.p + dunhao + text.c + text.s);
+            $(selector).text(Object.keys(new_selected).length+'个省:'+proStr + ',');
         }
     }
 

+ 50 - 10
src/jfw/modules/app/src/web/staticres/jyapp/vipsubscribe/js/change_industry.js

@@ -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 = ''

+ 1 - 1
src/jfw/modules/app/src/web/templates/vipsubscribe/change_area.html

@@ -40,7 +40,7 @@
     <div id="choose_area">
         <div class="result">
             <div class="result-purchased result-item">
-                <span class="result-label">区域</span>
+                <span class="result-label">已购买</span>
                 <span class="result-info">
                     <p class="buy-set-info ellipsis"></p>
                 </span>

+ 8 - 4
src/web/staticres/common-module/vipsubscribe/js/vip-subscribe-set-template.js

@@ -96,7 +96,7 @@ var subScribeTemplate = `
             <span class="leading_ jy-icon-resultpreview-match"></span>
             <span class="item-label-other">
               <span class="label-text">推送结果预览<span class="threeInfo">{{resultTime}}</span></span>
-              <span class="info-little">当前匹配信息过少,请适当修改订阅条件</span>
+              <span v-if="littleShow" class="info-little">当前匹配信息过少,请适当修改订阅条件</span>
             </span>
           </span>
           <span class="item-r media_switch">
@@ -107,7 +107,7 @@ var subScribeTemplate = `
       </a>
     </li>
     <li class="body-item push-set" v-if="pushsetShow">
-      <a class="item-container" href="linkobj.pushsetting">
+      <a class="item-container" :href="linkobj.pushsetting">
         <div class="item">
           <span class="item-l">
             <span class="leading_ jy-icon-push-set"></span>
@@ -183,11 +183,13 @@ var subComponent = {
       active: 1,
       pushsetShow: true,
       resultTime: '(近3个月内共条信息)',
-      checkedflag: false
+      checkedflag: false,
+      littleShow: false
     }
   },
   mounted () {
     this.getData()
+    this.getResultView()
   },
   watch: {
     initdata: function(newVal, oldVal) {
@@ -204,7 +206,6 @@ var subComponent = {
       this.getActionDefault()
       this.getIndustryType()
       this.getProjectMatch()
-      this.getResultView()
     },
     // 设置区域
     setArea: function() {
@@ -417,6 +418,9 @@ var subComponent = {
             _this.pushsetShow = false
             _this.resultTime = '(近三个月)'
           } else {
+            if(res.count < 30) {
+              _this.littleShow = true
+            }
             _this.resultTime = '(近3个月内共' + res.count + '条信息)'
           }
         }

+ 17 - 2
src/web/staticres/vipsubscribe/js/change_area.js

@@ -78,7 +78,8 @@ $(function () {
             isAnimating = false
         }, 500)
     }
-
+    // dev4.5.5选中区域文案修改
+    var new_selected
     // 新增求值 ---- 统计数量,不做视图操作
     function getResult() {
         var selectedCount = {
@@ -123,6 +124,7 @@ $(function () {
                         pCount: 0
                     }
                 }
+                new_selected = selected
                 return setDataInResult('.result-selected .result-info .info-overview', getBuySet(selected, []));
             }
 
@@ -139,6 +141,7 @@ $(function () {
         //    1. 隐藏提示,并清空已选择
             $('.result .info-tip').hide().siblings('.info-overview').text('');
         } else {
+            new_selected = selected
             setDataInResult('.result-selected .result-info .info-overview', getBuySet(selected, []));
         }
     }
@@ -170,7 +173,19 @@ $(function () {
             if (citySum === 0 || citySum === 1) {
                 text.s = ''
             }
-            $(selector).text(text.p + dunhao + text.c + text.s);
+            let proStr = ''
+            Object.keys(new_selected).forEach(function(item,index) {
+                if(new_selected[item].length == 0) {
+                    proStr += item + '、'
+                } else {
+                    proStr += item+ '(' + new_selected[item].length+ '个市' + ')' + '、'
+                }
+            })
+            if(proStr[proStr.length - 1] == '、') {
+                proStr = proStr.substr(0,proStr.length - 1);
+            }
+            // $(selector).text(text.p + dunhao + text.c + text.s);
+            $(selector).text(Object.keys(new_selected).length+'个省:'+proStr + ',');
         }
     }
 

+ 38 - 3
src/web/staticres/vipsubscribe/js/change_industry.js

@@ -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')) {
+              if($(this).text() !== '匹配未分类行业') {
                 canChangeArr.push($(this).text())
+              } else {
+                count = count - 1
+              }
             }
         })
         if (count > buyCount && buyCount != -1) {
@@ -89,7 +101,20 @@ function resultCount() {
             $('.update_tips').hide();
         }
         if(count>0){
-            $('.result_count').html(count + '个行业');
+          let switch_other = $('.switch_other').hasClass('active')
+            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 {
             $('.result_count').html("");
         }
@@ -132,6 +157,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)
     })
@@ -255,7 +281,11 @@ $(function () {
       $('.add_toast').fadeOut()
         }, 1500)
     })
-
+    function setotherbuyerclass(index) {
+      $.post("/subscribepay/afterPay/setUserInfo", {pageType: "other_buyerclass", other: index}, function (r) {
+        console.log(r)
+      })
+    }
   /* ---E 行业推荐弹窗 @date 2021/4/1 ---*/
 
 
@@ -269,11 +299,16 @@ $(function () {
     // 确认按钮事件
     $('.save-btn').on('click', function () {
         data.data.industry = result
-
+        let switch_other = $('.switch_other').hasClass('active')
         var params = {
           area: JSON.stringify(data.data.area),
           industry: data.data.industry.join(',')
         }
+        if(switch_other) {
+          setotherbuyerclass(1)
+        } else {
+          setotherbuyerclass(0)
+        }
         // 超级订阅新套餐 修改订阅条件需要提交后台保存, 因是共用页面,为不影响其他页面逻辑,url加上参数进行判断
         if (getParam('header') === 'save') {
           let url = ''

+ 1 - 1
src/web/templates/weixin/vipsubscribe/change_industry.html

@@ -59,7 +59,7 @@
                     <!-- <div class="item_label"></div> -->
                     <div class="item_industry_list">
                         <button class="industry_item whole">全部行业</button>
-                        <button class="industry_item">匹配未分类行业</button>
+                        <button class="industry_item switch_other">匹配未分类行业</button>
                         <span class="wenhao">
                             <i id="matchTips" class="iconfont icon-wenhao show_tips"></i>
                         </span>