Selaa lähdekoodia

Merge branch 'dev4.6.2.1' of http://192.168.3.207:8080/qmx/jy into dev4.6.2.1

yangfeng 3 vuotta sitten
vanhempi
commit
17263cf720

+ 12 - 20
src/jfw/modules/app/src/web/staticres/jyapp/vipsubscribe/js/vip_index_new.js

@@ -38,9 +38,6 @@ var subNode = new Vue({
         this.$nextTick(function () {
             $(".app-layout-content-b").removeAttr('v-cloak')
         })
-        // this.userAreaNum = 0
-        // this.userType = true
-        // this.userAreaAllNum = 1
     },
     methods: {
         // 省份订阅包续费
@@ -62,7 +59,6 @@ var subNode = new Vue({
                     _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
                 }
@@ -147,11 +143,6 @@ var subNode = new Vue({
                     if(res.data) {
                         _this.vSwitch = res.data.vt || 'f'
                         // f 免费 m 大会员 v 超级订阅
-                        if (_this.vSwitch === 'f') {
-                            // 判断是否购买省份订阅包
-                            _this.getUserSubscribe()
-                            $('.update_renew').hide()
-                        }
                         if(res.data.vt == 'm') {
                             _this.vipLink = 'javascript:;'
                             _this.arrowShow = false
@@ -173,6 +164,17 @@ var subNode = new Vue({
                         if(bms) {
                             _this.memberStatus = bms
                         }
+                        if (_this.vSwitch === 'f') {
+                            // 判断是否购买省份订阅包
+                            _this.getUserSubscribe()
+                            $('.update_renew').hide()
+                        } else {
+                            $DoPost('/subscribepay/vipsubscribe/getSubBuyMsg', {}, function(sum) {
+                                if(sum.success) {
+                                    getDataWitXHR(sum)
+                                }
+                            })
+                        }
                     }
                 }
             })
@@ -304,9 +306,8 @@ $(function () {
       }
       $(".list-content").html(returnHtml);
   }
-  function getDataWitXHR() {
+  window.getDataWitXHR = function (res) {
       $DoPost(subNode.subInfoAjax, {}, function (r) {
-          let res  = resObj
           let switchProduct = sessionStorage.getItem('switch-product')
           if(switchProduct) {
               if(switchProduct == 'bigmember') {
@@ -360,15 +361,6 @@ $(function () {
           init(res.data)
       })
   }
-  var resObj = {}
-  // 每次请求接口
-    let subUrl = '/subscribepay/vipsubscribe/getSubBuyMsg'
-    $DoPost(subUrl, {}, function(sum) {
-        if(sum.success) {
-            resObj = sum
-            getDataWitXHR()
-        }
-    })
 
   // 设置已选择的区域和行业
   function setSelectedAreaAndInd(selected) {

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

@@ -291,7 +291,7 @@
               </li>
             </ul>
           </li>
-          <sub-component :linkobj="linkObj" :initdata="initData" :v-switch="vSwitch"></sub-component>
+          <sub-component ref="subComponent" :linkobj="linkObj" :initdata="initData" :v-switch="vSwitch"></sub-component>
           <div class="provincePayWarp" v-show="userType">
             <span class="provincePayTips">省份订阅包</span>
             <div class="provincePay">
@@ -363,8 +363,6 @@
     <script src='{{Cdns .Host "seo" "cdn"|SafeUrl}}/jyapp/vipsubscribe/js/common.js?v={{Msg "seo" "version"}}'></script>
     <script src='{{Cdns .Host "seo" "cdn"|SafeUrl}}/jyapp/js/common.js?v={{Msg "seo" "mod_version"}}'></script>
     <script src='{{Cdns .Host "seo" "cdn"|SafeUrl}}/jyapp/big-member/js/utils.js?v={{Msg "seo" "mod_version"}}'></script>
-    <!--<script src='{{Cdns .Host "seo" "cdn"|SafeUrl}}/jyapp/js/check-bind-phone.js?v={{Msg "seo" "version"}}'></script>-->
-    <!-- <script src='{{Cdns .Host "seo" "cdn"|SafeUrl}}/common-module/coupon/js/pay-order-template.js?v={{Msg "seo" "version"}}'></script> -->
     <script>
       $(window).on("pageshow", function (event) {
         if (event.originalEvent.persisted) {

+ 9 - 3
src/jfw/modules/app/src/web/templates/vipsubscribe/vip_purchase.html

@@ -783,6 +783,8 @@
       data: function () {
         return {
           sessKey: '$data-vipsubscribe_new_goods_order',
+          // 返回提示标志,为true则返回时不弹出提示
+          iDoNotNeedConfirmed: true,
           dialog: {
             backTip: false,
             backTipShowCount: 0
@@ -812,6 +814,11 @@
         this.init(this.$data)
         this.restoreState()
         this.getBuyInfo()
+        // 解决ios从上个页面返回触发popstate的问题
+        // 基本逻辑:刚进入页面100ms内不允许触发popstate请求
+        setTimeout(function () {
+          this.iDoNotNeedConfirmed = false
+        }.bind(this), 100)
       },
       methods: {
         // 获取已购买信息
@@ -832,9 +839,7 @@
         toBuyAreaPack: function () {
           this.dialog.backTip = false
           this.saveState()
-          setTimeout(function () {
-            location.href = '/jyapp/areaPack/page/buy'
-          }, 20)
+          location.href = '/jyapp/areaPack/page/buy'
         },
         restoreState: function () {
           var k = sessionStorage.getItem(this.sessKey)
@@ -858,6 +863,7 @@
             history.pushState(pushContent, null, pushContent.url);
           }
           $(window).on('popstate', function () {
+            if (_this.iDoNotNeedConfirmed) return
             _this.dialog.backTip = true
             _this.dialog.backTipShowCount++
           })

+ 1 - 1
src/jfw/modules/publicapply/src/subscribe/entity/entity.go

@@ -184,7 +184,7 @@ func (pi *ParamInfo) GetSubMsg() UserSubMsg {
 				//已调整地区次数(月)
 				ppnum := redis.GetInt(jy.PowerCacheDb, fmt.Sprintf(jy.UserUpdateAreaKey, pi.UserId, ym))
 				//可调整次数(月)
-				res.Areanum = res.Provincenum + jy.BaseAreaNum - fpnum - ppnum
+				res.Areanum = res.Provincenum + jy.BaseAreaNum - ppnum //- fpnum
 			}
 			res.Ppstarttime = qutil.Int64All(o_jy["l_areaStart_p"])
 			res.Ppendtime = qutil.Int64All(o_jy["l_areaEnd_p"])

+ 5 - 3
src/jfw/modules/publicapply/src/subscribePush/entity/setting.go

@@ -62,7 +62,7 @@ func freeSet(area map[string]interface{}, industry []string, userId string) *Fun
 			return &FuncResult{false, errors.New("超出地区可设置范围"), nil}
 		}
 		//地区调整次数判断
-		if areacount+jy.BaseAreaNum <= ppnum+fpnum {
+		if areacount+jy.BaseAreaNum <= ppnum { //+fpnum
 			return &FuncResult{false, errors.New(fmt.Sprintf("订阅地区调整次数(%d)已用完", areacount+jy.BaseAreaNum)), nil}
 		}
 	}
@@ -74,8 +74,10 @@ func freeSet(area map[string]interface{}, industry []string, userId string) *Fun
 		//优先使用省份订阅包次数
 		// log.Println(areacount, "---", ppnum)
 		// log.Println(jy.BaseAreaNum, "---", fpnum)
-		if ppb && areacount > ppnum {
-			redis.Put(jy.PowerCacheDb, fmt.Sprintf(jy.UserUpdateAreaKey, userId, ym), ppnum+1, 31*24*60*60)
+		if ppb {
+			if areacount > ppnum {
+				redis.Put(jy.PowerCacheDb, fmt.Sprintf(jy.UserUpdateAreaKey, userId, ym), ppnum+1, 31*24*60*60)
+			}
 		} else if jy.BaseAreaNum > fpnum {
 			redis.Put(jy.PowerCacheDb, fmt.Sprintf(jy.UserUpdateAreaKey, userId, year), fpnum+1, 365*24*60*60)
 		} else {

+ 26 - 43
src/web/staticres/common-module/vipsubscribe/js/vip-subscribe-set-template.js

@@ -747,7 +747,11 @@ var subComponent = {
         },
         success:function(res){
           if(res.flag) {
-            location.reload()
+            if (_this.infoTypeData.length) {
+              _this.info.infoType = _this.infoTypeData.join('、')
+            } else {
+              _this.info.infoType = '全部类型'
+            }
           } else {
             _this.$toast(res.data.error_msg)
           }
@@ -783,52 +787,31 @@ var subComponent = {
     getUserSubscribe: function () {
       let _this = this
       $.ajax({
-          url: '/publicapply/free/subscribe',
-          type: 'POST',
-          success: function (res) {
-              let freeArea = JSON.stringify(res.data)
-              sessionStorage.setItem('sub_free_state', freeArea)
-              _this.UserSubscribe = res
-              _this.info.area = res.data.area
-              _this.userAreaNum = res.data.areanum
-              _this.userType = res.data.provincenum === 0 ? false : true
-              _this.userAreaAllNum = res.data.provincenum
-              _this.initdata.infotype = res.data.infotype || []
-              _this.infoTypeData = res.data.infotype || []
-              _this.info.infoType = _this.infoTypeData.length === 0 ? '全部类型' : _this.infoTypeData.join('、')
-
-              // let proStr = ''
-              // Object.keys(res.data.area).forEach(function(item,index) {
-              //   if(res.data.area[item].length == 0) {
-              //     proStr += item + '、'
-              //   } else {
-              //     let cityStr = ''
-              //     res.data.area[item].forEach(function(data, i) {
-              //       cityStr += data + '、'
-              //     })
-              //     if (cityStr.length > 0) {
-              //       cityStr = cityStr.substr(0,cityStr.length - 1);
-              //     }
-              //     proStr += item+ '(' + cityStr + ')' + '、'
-              //   }
-              // })
-              // if(proStr[proStr.length - 1] == '、') {
-              //   proStr = proStr.substr(0,proStr.length - 1);
-              // }
-              // _this.info.area = '已选:' + proStr
+        url: '/publicapply/free/subscribe',
+        type: 'POST',
+        success: function (res) {
+          _this.UserSubscribe = res
+          if (res.data) {
+            _this.info.area = res.data.area
+            _this.userAreaNum = res.data.areanum
+            _this.userType = res.data.provincenum === 0 ? false : true
+            _this.userAreaAllNum = res.data.provincenum
+            _this.initdata.infotype = res.data.infotype || []
+            _this.infoTypeData = res.data.infotype || []
 
-              let areaArr = []
-              if (res.data) {
-                if (!res.data.area) {
-                  _this.noAreaFreeType = true
-                } else {
-                  for (const key in res.data.area) {
+            _this.info.infoType = _this.infoTypeData.length === 0 ? '全部类型' : _this.infoTypeData.join('、')
+            let areaArr = []
+            if (!res.data.area) {
+                _this.noAreaFreeType = true
+                _this.info.area = '请选择区域'
+            } else {
+                for (const key in res.data.area) {
                     areaArr.push(key)
-                  }
                 }
-              }
-              $('#menuArea').text('已选:'+ areaArr.join('、'))
+                _this.info.area = '已选:' + (areaArr.length === 0 ? '全国': areaArr.join('、'))
+            }
           }
+        }
       })
     },
     // 关闭未选择地区提示

+ 9 - 3
src/web/templates/weixin/vipsubscribe/vip_purchase.html

@@ -761,6 +761,8 @@
               data: function () {
                 return {
                   sessKey: '$data-vipsubscribe_new_goods_order',
+                  // 返回提示标志,为true则返回时不弹出提示
+                  iDoNotNeedConfirmed: true,
                   dialog: {
                     backTip: false,
                     backTipShowCount: 0
@@ -790,6 +792,11 @@
                 this.init(this.$data)
                 this.restoreState()
                 this.getBuyInfo()
+                // 解决ios从上个页面返回触发popstate的问题
+                // 基本逻辑:刚进入页面100ms内不允许触发popstate请求
+                setTimeout(function () {
+                  this.iDoNotNeedConfirmed = false
+                }.bind(this), 100)
               },
               methods: {
                 // 获取已购买信息
@@ -810,9 +817,7 @@
                 toBuyAreaPack: function () {
                   this.dialog.backTip = false
                   this.saveState()
-                  setTimeout(function () {
-                    location.href = '/areaPack/wx/page/buy'
-                  }, 20)
+                  location.href = '/areaPack/wx/page/buy'
                 },
                 restoreState: function () {
                   var k = sessionStorage.getItem(this.sessKey)
@@ -836,6 +841,7 @@
                     history.pushState(pushContent, null, pushContent.url);
                   }
                   $(window).on('popstate', function () {
+                    if (_this.iDoNotNeedConfirmed) return
                     _this.dialog.backTip = true
                     _this.dialog.backTipShowCount++
                   })