panyong 3 лет назад
Родитель
Сommit
78602803a0

+ 2 - 1
htmldev/cps/src/views/marketing/save/index.vue

@@ -30,6 +30,7 @@
       </ul>
     </div>
     <Mall
+      :goods="shops"
       ref="myMall"/>
   </div>
 </template>
@@ -67,7 +68,7 @@ export default {
       })
     },
     handleJump (shop) {
-      console.log(shop)
+      top.location.href = shop.link_url
     },
     handleShowMall () {
       this.$refs.myMall.show()

+ 15 - 34
htmldev/cps/src/views/marketing/save/mall/index.vue

@@ -18,7 +18,7 @@
             :class="{'current':currentIndex === index}"
             class="menu-item"
             @click="selectMenu(index, $event)">
-            <span class="text">{{ item.name }}</span>
+            <span class="text">{{ item.category_type_name }}</span>
           </li>
         </ul>
       </div>
@@ -31,21 +31,21 @@
             :key="index"
             ref="foodList"
             class="food-list">
-            <h1 class="title">{{ item.name }}</h1>
+            <h1 class="title">{{ item.category_type_name }}</h1>
             <ul class="food-item-wrap">
               <li
-                v-for="(food, idx) in item.foods"
+                v-for="(food, idx) in item.category_data"
                 :key="idx"
                 class="food-item"
                 @click="selectFood(food, $event)">
                 <div class="icon">
                   <img
-                    :src="food.image"
+                    :src="food.category_img_url"
                     alt=""
                     height="48"
                     width="48">
                 </div>
-                <h2 class="name">{{ food.name }}</h2>
+                <h2 class="name">{{ food.category_name }}</h2>
               </li>
             </ul>
           </li>
@@ -57,16 +57,21 @@
 
 <script type="text/ecmascript-6">
 import BScroll from 'better-scroll'
-import { Toast, Popup } from 'vant'
-import { mockGoods } from './mock'
+import { Popup } from 'vant'
 
 export default {
+  props: {
+    goods: {
+      type: Array,
+      default: function () {
+        return []
+      }
+    }
+  },
   data () {
     return {
-      goods: [],
       listHeight: [],
       scrollY: 0,
-      selectedFood: {},
       showFlag: false
     }
   },
@@ -83,11 +88,6 @@ export default {
       return 0
     }
   },
-  async activated () {
-    if (!this.$route.meta.isUseCache) {
-      this.fetchProductList()
-    }
-  },
   methods: {
     selectMenu (index, event) {
       if (!event._constructed) {
@@ -104,9 +104,7 @@ export default {
       // if (!event._constructed) {
       //   return
       // }
-    },
-    addFood (target) {
-      this._drop(target)
+      top.location.href = food.link_url
     },
     show () {
       this.showFlag = true
@@ -155,23 +153,6 @@ export default {
       const menuList = this.$refs.menuList
       const el = menuList[index]
       this.meunScroll.scrollToElement(el, 300, 0, -100)
-    },
-    // 获取商品列表
-    async fetchProductList () {
-      try {
-        const { data, status, msg } = mockGoods
-        if (status) {
-          if (Array.isArray(data) && data.length) {
-            this.goods = data
-            setTimeout(() => {
-              // this._initScroll()
-              // this._calculateHeight()
-            }, 500)
-          }
-        } else {
-          Toast(msg)
-        }
-      } catch (err) {}
     }
   },
   components: {