品类推荐

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 { export {
mall, mall,
goods goods,
meals
} }

View File

@@ -17,7 +17,7 @@
"path": "pages/store/index", "path": "pages/store/index",
"name": "Store", "name": "Store",
"style": { "style": {
"navigationBarTitleText": "健康生活", "navigationBarTitleText": "健康生活",
"enablePullDownRefresh": true, "enablePullDownRefresh": true,
"app-plus": { "app-plus": {
"titleNView": { "titleNView": {
@@ -38,22 +38,22 @@
"name": "User", "name": "User",
"style": { "style": {
"navigationBarTitleText": "我的", "navigationBarTitleText": "我的",
"navigationBarTextStyle":"white", "navigationBarTextStyle": "white",
"app-plus": { "app-plus": {
"titleNView": { "titleNView": {
"backgroundImage": "linear-gradient(to right, #34ce98, #22aa98)", "backgroundImage": "linear-gradient(to right, #34ce98, #22aa98)",
"type": "transparent" "type": "transparent"
} }
} }
} }
}, { }, {
"path": "pages/auth/auth", "path": "pages/auth/auth",
"name": "Auth", "name": "Auth",
"style": { "style": {
"navigationBarTitleText": "登录", "navigationBarTitleText": "登录",
"navigationStyle":"custom", "navigationStyle": "custom",
"app-plus":{ "app-plus": {
"animationType":"slide-in-bottom" "animationType": "slide-in-bottom"
} }
} }
}, { }, {
@@ -75,7 +75,7 @@
"style": { "style": {
"navigationBarTitleText": "确认订单", "navigationBarTitleText": "确认订单",
"enablePullDownRefresh": false "enablePullDownRefresh": false
} }
}, { }, {
"path": "pages/order/index", "path": "pages/order/index",
"name": "Order", "name": "Order",
@@ -105,11 +105,20 @@
"enablePullDownRefresh": false "enablePullDownRefresh": false
} }
}, { }, {
"path": "pages/pay/pay", "path": "pages/pay/pay",
"name": "Pay",
"style": { "style": {
"navigationBarTitleText": "收银台", "navigationBarTitleText": "收银台",
"navigationBarBackgroundColor": "#FFFFFF" "navigationBarBackgroundColor": "#FFFFFF"
} }
}, {
"path": "pages/store/list",
"name": "StoreList",
"style": {
"navigationBarTitleText": "列表",
"navigationBarBackgroundColor": "#FFFFFF",
"enablePullDownRefresh": true
}
}], }],
"tabBar": { "tabBar": {
"borderStyle": "white", "borderStyle": "white",

View File

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