Procházet zdrojové kódy

零售端-商品分类广告bug处理

ouyang před 2 dny
rodič
revize
150a7a0596
1 změnil soubory, kde provedl 34 přidání a 3 odebrání
  1. 34 3
      mallApp/src/pages/home/shop-category.vue

+ 34 - 3
mallApp/src/pages/home/shop-category.vue

@@ -362,6 +362,7 @@ import { shopNoticeShowList } from '@/api/shop-notice'
 import { getInfo } from '@/api/shop'
 import { getInfo } from '@/api/shop'
 import { getLimitBuyInfo } from '@/api/order'
 import { getLimitBuyInfo } from '@/api/order'
 import { list, share } from '@/mixins'
 import { list, share } from '@/mixins'
+import { parseFilterIds, encodeFilterValue, stashGoodsListFilter } from '@/utils/goodsListFilter'
 
 
 /** 公告展示位置:分类菜单 */
 /** 公告展示位置:分类菜单 */
 const NOTICE_POSITION_CATEGORY = 2
 const NOTICE_POSITION_CATEGORY = 2
@@ -816,13 +817,43 @@ export default {
     onAdChange(e) {
     onAdChange(e) {
       this.currentAdIndex = e.detail.current || 0
       this.currentAdIndex = e.detail.current || 0
     },
     },
-    /** 广告点击:图文跳详情,商品/分类跳转暂未实现 */
+    /**
+     * 分类广告点击(与首页轮播一致)
+     * type=1 图文详情;type=2 单商品详情 / 多商品列表;type=3|4 分类/场景 → goods/list
+     */
     onAdTap(ad) {
     onAdTap(ad) {
       if (!ad) return
       if (!ad) return
-      if (Number(ad.type) === 1 && ad.value) {
+      const ids = parseFilterIds(ad.value)
+      if (!ids.length) return
+      const type = Number(ad.type)
+      const account = this.shopAccount || uni.getStorageSync('account') || ''
+      const hdId = this.hdId || uni.getStorageSync('hdId') || 0
+      if (type === 1) {
         this.$util.pageTo({
         this.$util.pageTo({
           url: '/pages/home/pic-text-detail',
           url: '/pages/home/pic-text-detail',
-          query: { id: ad.value, account: this.shopAccount }
+          query: { id: ids[0], account }
+        })
+        return
+      }
+      if (type === 2) {
+        if (ids.length === 1) {
+          this.$util.pageTo({
+            url: '/pages/goods/detail',
+            query: { id: ids[0], account, hdId }
+          })
+          return
+        }
+        stashGoodsListFilter(2, ids)
+        this.$util.pageTo({
+          url: `/pages/goods/list?account=${account}&hdId=${hdId}&filterType=2&filterValue=${encodeFilterValue(ids)}`
+        })
+        return
+      }
+      // 分类 / 场景:进商品列表并带筛选
+      if (type === 3 || type === 4) {
+        stashGoodsListFilter(type, ids)
+        this.$util.pageTo({
+          url: `/pages/goods/list?account=${account}&hdId=${hdId}&filterType=${type}&filterValue=${encodeFilterValue(ids)}`
         })
         })
       }
       }
     },
     },