Forráskód Böngészése

feat: 修复免费用户/超级订阅 订阅管理页面问题

zhangyuhan 3 éve
szülő
commit
e3f0bc258a

+ 19 - 8
src/jfw/modules/app/src/web/staticres/jyapp/vipsubscribe/js/vip_index_new.js

@@ -52,17 +52,26 @@ var subNode = new Vue({
         // 得到用户是否购买省份包
         getUserSubscribe: function () {
             let _this = this
+            _this.$refs.subComponent.getUserSubscribe(function (res) {
+                    if (res && res.data) {
+                        _this.freeUserArea = res.data.area
+                        _this.userType = res.data.provincenum === 0 ? false : true
+                        _this.userAreaAllNum = res.data.provincenum === -1 ? '全国' : res.data.provincenum
+                        _this.subscribeTime = new Date(res.data.ppstart * 1000).pattern('yyyy年MM月dd日') + "-" + new Date(res.data.ppend * 1000).pattern('yyyy年MM月dd日')
+                        _this.initdata = res.data
+                        _this.linkObj.pushsetting = _this.linkObj.freepush
+
+                    }
+            })
+
+
             $.ajax({
-                url: '/publicapply/free/subscribe',
+                url: '/publicapply/free/pushcount',
                 type: 'POST',
                 success: function (res) {
-                    _this.freeUserArea = res.data.area
-                    _this.userAreaNum = res.data.areanum
-                    _this.userType = res.data.provincenum === 0 ? false : true
-                    _this.userAreaAllNum = res.data.provincenum === -1 ? '全国' : res.data.provincenum
-                    _this.subscribeTime = new Date(res.data.ppstart * 1000).pattern('yyyy年MM月dd日') + "-" + new Date(res.data.ppend * 1000).pattern('yyyy年MM月dd日')
-                    _this.initdata = res.data
-                    _this.linkObj.pushsetting = _this.linkObj.freepush
+                    if (res && res.count) {
+                        _this.$refs.subComponent.$data.resultTime = '(近3个月内共' + res.count + '条信息)'
+                    }
                 }
             })
         },
@@ -153,6 +162,8 @@ var subNode = new Vue({
                             _this.vipLink = '/jyapp/vipsubscribe/vipsubscribe_renew'
                             _this.arrowShow = true
                             sessionStorage.setItem('switch-product','supervip')
+                            $('.update_renew').show()
+                            $('.super-title').show();
                             _this.subInfoAjax = '/subscribepay/vipsubscribe/getSubBuyMsg?t=' + new Date().getTime()
                         } else {
                             _this.vipLink = 'javascript:;'

+ 10 - 7
src/web/staticres/common-module/vipsubscribe/js/vip-subscribe-set-template.js

@@ -247,7 +247,7 @@ var subComponent = {
       // 匹配方式
       active: 1,
       pushsetShow: true,
-      resultTime: '(近3个月内共条信息)',
+      resultTime: '',
       checkedflag: false,
       littleShow: false,
       accStatus: 0,
@@ -286,11 +286,11 @@ var subComponent = {
         }
       }
     },
-    vSwitch: function (val) {
-      if (val === 'f') {
-        this.getUserSubscribe()
-      }
-    }
+    // vSwitch: function (val) {
+    //   if (val === 'f') {
+    //     this.getUserSubscribe()
+    //   }
+    // }
   },
   methods: {
     getData: function() {
@@ -775,12 +775,15 @@ var subComponent = {
       }
     },
     // 获取用户权限
-    getUserSubscribe: function () {
+    getUserSubscribe: function (callback) {
       let _this = this
       $.ajax({
         url: '/publicapply/free/subscribe',
         type: 'POST',
         success: function (res) {
+          if (typeof callback === 'function') {
+            callback(res)
+          }
           _this.UserSubscribe = res
           if (res.data) {
             _this.info.area = res.data.area

+ 23 - 12
src/web/staticres/vipsubscribe/js/vip_index_new.js

@@ -25,10 +25,10 @@ var subNode = new Vue({
         }
     },
     created () {
-        this.getUserSubscribe()
-        this.getUserType()
+
     },
     mounted () {
+        this.getUserType()
         this.$nextTick(function () {
             $(".app-layout-content-b").removeAttr('v-cloak')
         })
@@ -48,17 +48,26 @@ var subNode = new Vue({
         // 得到用户是否购买省份包
         getUserSubscribe: function () {
             let _this = this
+            _this.$refs.subComponent.getUserSubscribe(function (res) {
+                    if (res && res.data) {
+                        _this.freeUserArea = res.data.area
+                        _this.userType = res.data.provincenum === 0 ? false : true
+                        _this.userAreaAllNum = res.data.provincenum === -1 ? '全国' : res.data.provincenum
+                        _this.subscribeTime = new Date(res.data.ppstart * 1000).pattern('yyyy年MM月dd日') + "-" + new Date(res.data.ppend * 1000).pattern('yyyy年MM月dd日')
+                        _this.initdata = res.data
+                        _this.linkObj.pushsetting = _this.linkObj.freepush
+
+                    }
+            })
+
+
             $.ajax({
-                url: '/publicapply/free/subscribe',
+                url: '/publicapply/free/pushcount',
                 type: 'POST',
                 success: function (res) {
-                    _this.freeUserArea = res.data.area
-                    _this.userAreaNum = res.data.areanum
-                    _this.userType = res.data.provincenum === 0 ? false : true
-                    _this.userAreaAllNum = res.data.provincenum === -1 ? '全国' : res.data.provincenum
-                    // _this.$emit('UserSubscribe',res)
-                    _this.subscribeTime = new Date(res.data.ppstart * 1000).pattern('yyyy年MM月dd日') + "-" + new Date(res.data.ppend * 1000).pattern('yyyy年MM月dd日')
-                    _this.initdata = res.data
+                    if (res && res.count) {
+                        _this.$refs.subComponent.$data.resultTime = '(近3个月内共' + res.count + '条信息)'
+                    }
                 }
             })
         },
@@ -84,11 +93,13 @@ var subNode = new Vue({
                         $('.update_renew').hide()
                         $('.super-title').text('订阅管理-免费订阅');
                         $('.super-title').css('background', 'none')
+                        _this.getUserSubscribe()
                     } else {
                         _this.vSwitch = 'v'
                         document.title = '订阅管理-超级订阅'
                         $('.update_renew').show()
                         $('.super-title').show();
+                        window.getDataWitXHR()
                     }
                 }
             })
@@ -345,7 +356,7 @@ $(function () {
         $(".list-content").html(returnHtml);
     }
 
-    function getDataWitXHR() {
+    window.getDataWitXHR = function () {
         $DoPost('/subscribepay/vipsubscribe/getSubBuyMsg', {}, function (res) {
             if (!res.success) return;
             if(!res.data.industry) {
@@ -1020,7 +1031,7 @@ $(function () {
     // } else {
 
     // }
-    getDataWitXHR()
+    // getDataWitXHR()
     //返回提示使用
     function pushHistory() {
         var state = {

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

@@ -187,7 +187,7 @@
             </li>
           </ul>
         </li>
-        <sub-component :linkobj="linkObj" :initdata="initData" @mounted="superOrderTemplateMounted" :v-switch="vSwitch"></sub-component>
+        <sub-component ref="subComponent" :linkobj="linkObj" :initdata="initData" @mounted="superOrderTemplateMounted" :v-switch="vSwitch"></sub-component>
         <div class="provincePayWarp" v-show="userType">
             <span class="provincePayTips">省份订阅包</span>
             <div class="provincePay">