品类推荐

This commit is contained in:
唐明明
2022-01-06 17:09:07 +08:00
parent 178fdb4b46
commit 6d4971bc5e
4 changed files with 80 additions and 29 deletions

View File

@@ -21,7 +21,15 @@ const goods = (id) => {
})
}
// 套餐列表
const meals = (id) => {
return request({
url: 'mall/meals/' + id
})
}
export {
mall,
goods
goods,
meals
}

View File

@@ -106,10 +106,19 @@
}
}, {
"path": "pages/pay/pay",
"name": "Pay",
"style": {
"navigationBarTitleText": "收银台",
"navigationBarBackgroundColor": "#FFFFFF"
}
}, {
"path": "pages/store/list",
"name": "StoreList",
"style": {
"navigationBarTitleText": "列表",
"navigationBarBackgroundColor": "#FFFFFF",
"enablePullDownRefresh": true
}
}],
"tabBar": {
"borderStyle": "white",

View File

@@ -39,16 +39,13 @@
</view>
<!-- 推荐品类 -->
<view class="card-box">
<view class="card-box-item" style="backgrond: #fef2ae">
<view class="card-title">宝贝爱吃</view>
<view class="card-subtitle">精选食谱 三餐美味</view>
<image class="card-cover" src="@/static/store/store_icon_00.png" mode="aspectFill"></image>
</view>
<view class="card-box-item" style="backgrond: #c9ead9">
<view class="card-title">轻卡小食</view>
<view class="card-subtitle">火热商品 一目了然</view>
<image class="card-cover" src="@/static/store/store_icon_01.png" mode="aspectFill"></image>
<block v-for="(item, index) in meals" :key="index">
<view class="card-box-item" :style="{'backgrond': item.color}" @click="$Router.push({name: 'StoreList', params: {id: item.meal_id}})">
<view class="card-title">{{item.title}}</view>
<view class="card-subtitle">{{item.subtitle}}</view>
<image class="card-cover" :src="item.cover" mode="aspectFill"></image>
</view>
</block>
</view>
<!-- goods -->
<view class="goods-box">
@@ -71,7 +68,8 @@
banners : [],
goodTabs : [],
newGood : [],
goodsArr : []
goodsArr : [],
meals : []
};
},
mounted(){
@@ -80,11 +78,15 @@
methods:{
getMall(){
mall().then(res => {
console.log(res)
this.banners = res.banners
this.goodsArr = res.goods
this.newGood = res.news
this.goodTabs = res.categories
this.meals = res.meals
uni.stopPullDownRefresh()
}).catch(err => {
console.log(err)
})
}
},

32
pages/store/list.vue Normal file
View File

@@ -0,0 +1,32 @@
<template>
<view>
<oct-goods
:lists="goodsArr"
color="#e6576b"
@onGoods="$Router.push({ name: 'StoreGoods', params: {id: $event.goods_id}})"
/>
</view>
</template>
<script>
import { meals } from "@/apis/interfaces/store"
export default {
data() {
return {
goodsArr: []
};
},
mounted(){
meals(this.$Route.query.id).then(res => {
uni.setNavigationBarTitle({
title: res.title
})
this.goodsArr = res.items
})
}
}
</script>
<style lang="scss">
</style>