shish 15 часов назад
Родитель
Сommit
72a95ed028
1 измененных файлов с 8 добавлено и 14 удалено
  1. 8 14
      mallApp/src/components/shop-tab-bar/index.vue

+ 8 - 14
mallApp/src/components/shop-tab-bar/index.vue

@@ -1,7 +1,7 @@
 <!--
 <!--
   店铺底部导航栏(通用组件)
   店铺底部导航栏(通用组件)
-  用途:店铺首页/分类/购物车/订单四个入口,供店铺相关页面复用
-  说明:首页跳转暂未实现;购物车跳转 pages/home/cart
+  用途:店铺首页/分类/购物车个入口,供店铺相关页面复用
+  说明:互切用 redirectTo 原页替换,避免栈上新开一层
 -->
 -->
 <template>
 <template>
   <view class="shop-tab-bar">
   <view class="shop-tab-bar">
@@ -35,7 +35,7 @@
 export default {
 export default {
   name: 'ShopTabBar',
   name: 'ShopTabBar',
   props: {
   props: {
-    /** 当前选中项:home | category | cart | order */
+    /** 当前选中项:home | category | cart */
     current: {
     current: {
       type: String,
       type: String,
       default: 'category'
       default: 'category'
@@ -56,14 +56,13 @@ export default {
       tabList: [
       tabList: [
         { key: 'home', label: '首页', icon: 'icon-home', activeIcon: 'icon-home-active' },
         { key: 'home', label: '首页', icon: 'icon-home', activeIcon: 'icon-home-active' },
         { key: 'category', label: '分类', icon: 'icon-category', activeIcon: 'icon-category-active' },
         { key: 'category', label: '分类', icon: 'icon-category', activeIcon: 'icon-category-active' },
-        { key: 'cart', label: '购物车', icon: 'icon-cart', activeIcon: 'icon-cart-active' },
-        { key: 'order', label: '订单', icon: 'icon-order', activeIcon: 'icon-order-active' }
+        { key: 'cart', label: '购物车', icon: 'icon-cart', activeIcon: 'icon-cart-active' }
       ]
       ]
     }
     }
   },
   },
   methods: {
   methods: {
     /**
     /**
-     * 底部 Tab 点击:首页/购物车保留占位,分类刷新当前页,订单跳转订单页
+     * 底部 Tab 点击:店铺内页互切用 redirectTo,避免 navigateTo 叠一层「新页面」
      */
      */
     onTabTap(item) {
     onTabTap(item) {
       if (item.key === this.current) {
       if (item.key === this.current) {
@@ -81,6 +80,7 @@ export default {
       if (item.key === 'home') {
       if (item.key === 'home') {
         this.$util.pageTo({
         this.$util.pageTo({
           url: '/pages/home/index',
           url: '/pages/home/index',
+          type: 2,
           query: shopQuery
           query: shopQuery
         })
         })
         return
         return
@@ -88,6 +88,7 @@ export default {
       if (item.key === 'category') {
       if (item.key === 'category') {
         this.$util.pageTo({
         this.$util.pageTo({
           url: '/pages/home/shop-category',
           url: '/pages/home/shop-category',
+          type: 2,
           query: shopQuery
           query: shopQuery
         })
         })
         return
         return
@@ -95,16 +96,9 @@ export default {
       if (item.key === 'cart') {
       if (item.key === 'cart') {
         this.$util.pageTo({
         this.$util.pageTo({
           url: '/pages/home/cart',
           url: '/pages/home/cart',
+          type: 2,
           query: shopQuery
           query: shopQuery
         })
         })
-        return
-      }
-      if (item.key === 'order') {
-        this.$util.pageTo({
-          url: '/pages/home/order',
-          type: 4,
-          query: Object.assign({}, shopQuery, { shopNav: 1 })
-        })
       }
       }
     }
     }
   }
   }