Feat:康养接口对接,细节调优
This commit is contained in:
@@ -1,18 +1,24 @@
|
||||
<template>
|
||||
<view class="health-foods">
|
||||
<view class="v12-justify-center">
|
||||
<view class="v12-mr-3 v12-radius-100 v12-dark1 v12-dark-text v12-px-5 v12-py-2 v12-font-28 v12-font-bold" @click="toSanctun">养生圣地</view>
|
||||
<view class="ys-btn v12-mr-3 v12-radius-100 v12-dark-text v12-px-5 v12-py-2 v12-font-28 v12-font-bold" @click="toSanctun">养生圣地</view>
|
||||
<view class="v12-radius-100 v12-primary v12-white-text v12-px-5 v12-py-2 v12-font-28 v12-font-bold" >养生食材</view>
|
||||
</view>
|
||||
<view class="v12-justify-between v12-align-center v12-mt-5">
|
||||
<!-- <image
|
||||
:src="webUrl + '/home/icon-location.png'"
|
||||
class="icon"
|
||||
/> -->
|
||||
<view class="v12-font-28 v12-secondary-dark-text v12-mr-3">{{ cityName }}</view>
|
||||
<view class="flex-1">
|
||||
<u-search :showAction="false" v-model="keyword"></u-search>
|
||||
<u-search :showAction="false" v-model="keyword" @search="search"></u-search>
|
||||
</view>
|
||||
</view>
|
||||
<view class="v12-justify-between swap">
|
||||
<view v-for="(item, index) in foodItems" :key="index" class="trave-item-wrap v12-mr-3 v12-mt-3" @click="toDetails">
|
||||
<view class="trave-item"></view>
|
||||
<view v-for="(item, index) in foodItems" :key="index" class="trave-item-wrap v12-mr-3 v12-mt-3" @click="toDetails(item.id)">
|
||||
<view class="trave-item">
|
||||
<image class="trave-item" mode="widthFix" :src="item.indexImage"></image>
|
||||
</view>
|
||||
<view class="trave-btn">{{ item.name }}</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -28,10 +34,17 @@
|
||||
<view
|
||||
class="rank-item v12-justify-start v12-align-center v12-mb-4"
|
||||
v-for="(item, index) in rank[0].products"
|
||||
@click="toGoods(item.productId)"
|
||||
:key="index">
|
||||
<view class="rank-tag">{{ index + 1 }}</view>
|
||||
<view class="rank-tag" :class="{'rank2-bg' : index === 1, 'rank3-bg' : index === 2 }">
|
||||
<view class="rank-2" :class="{'rank2-2-bg' : index === 1, 'rank3-3-bg' : index === 2 }">
|
||||
<view class="rank-3" :class="{'rank2-4-bg' : index === 1, 'rank3-4-bg' : index === 2 }">
|
||||
<view class="rank-4" :class="{'rank2-bg' : index === 1, 'rank3-bg' : index === 2 }">{{ index + 1 }}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="rank-img">
|
||||
<image :src="item.productImage" class="rank-img"></image>
|
||||
<image :src="item.productImage" mode="widthFix" class="rank-img"></image>
|
||||
</view>
|
||||
<view class="v12-ml-2">
|
||||
<view class="v12-font-bold v12-font-24 one-t" style="width: 160rpx">{{ item.productTitle }}</view>
|
||||
@@ -46,10 +59,20 @@
|
||||
<view class="rank-title v12-font-34 v12-font-bold">{{ rank[1].title }}</view>
|
||||
</view>
|
||||
<view class="v12-px-2">
|
||||
<view class="rank-item v12-justify-start v12-align-center v12-mb-4" v-for="(item, index) in rank[1].products" :key="index">
|
||||
<view class="rank-tag">{{ index + 1 }}</view>
|
||||
<view
|
||||
class="rank-item v12-justify-start v12-align-center v12-mb-4"
|
||||
v-for="(item, index) in rank[1].products"
|
||||
@click="toGoods(item.productId)"
|
||||
:key="index">
|
||||
<view class="rank-tag" :class="{'rank2-bg' : index === 1, 'rank3-bg' : index === 2 }">
|
||||
<view class="rank-2" :class="{'rank2-2-bg' : index === 1, 'rank3-3-bg' : index === 2 }">
|
||||
<view class="rank-3" :class="{'rank2-4-bg' : index === 1, 'rank3-4-bg' : index === 2 }">
|
||||
<view class="rank-4" :class="{'rank2-bg' : index === 1, 'rank3-bg' : index === 2 }">{{ index + 1 }}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="rank-img">
|
||||
<image :src="item.productImage" class="rank-img"></image>
|
||||
<image :src="item.productImage" mode="widthFix" class="rank-img"></image>
|
||||
</view>
|
||||
<view class="v12-ml-2">
|
||||
<view class="v12-font-bold v12-font-24 one-t" style="width: 160rpx">{{ item.productTitle }}</view>
|
||||
@@ -66,19 +89,18 @@
|
||||
<view class="slider"></view>
|
||||
</view>
|
||||
<view class="recommends v12-mt-3">
|
||||
<view class="recommend-item" v-for="(item, index) in recommendItems" :key="index">
|
||||
<view class="recommend-item" v-for="(item, index) in recommendItems" :key="index" @click="toGoods(item.productId)">
|
||||
<view class="recommend-img">
|
||||
<view class="name-wrap v12-white-text v12-text-center">{{ item.name }}</view>
|
||||
<image :src="item.image"></image>
|
||||
<view class="name-wrap v12-white-text v12-text-center">{{ item.title }}</view>
|
||||
</view>
|
||||
<view class="v12-pa-2 v12-font-bold v12-font-28 more-t">{{ item.title }}</view>
|
||||
<view class="v12-justify-between v12-primary-text v12-font-bold">
|
||||
<view>
|
||||
<view class="v12-pa-2 v12-font-bold v12-font-28 more-t">{{ item.productName }}</view>
|
||||
<view class="v12-justify-between v12-primary-text v12-font-bold v12-px-2 v12-pb-2">
|
||||
<view class="">
|
||||
<text class="v12-font-32">¥</text>
|
||||
<text class="v12-font-36">{{ item.price }}</text>
|
||||
</view>
|
||||
<view>
|
||||
gouwuche
|
||||
<text class="v12-font-36 ">{{ item.price }}</text>
|
||||
</view>
|
||||
<view class="cart-img"></view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -86,31 +108,18 @@
|
||||
</view>
|
||||
</template>
|
||||
<script>
|
||||
import { getRank } from '@/api/health'
|
||||
import { getRank,getFoods,getRecipe } from '@/api/health'
|
||||
export default{
|
||||
data() {
|
||||
return {
|
||||
foodItems: [
|
||||
{img: '', value: '', name: '淮山党参鹌鹑汤'},
|
||||
{img: '', value: '', name: '淮山党参鹌鹑汤'},
|
||||
{img: '', value: '', name: '淮山党参鹌鹑汤'},
|
||||
{img: '', value: '', name: '淮山党参鹌鹑汤'},
|
||||
],
|
||||
webUrl: this.$VUE_APP_RESOURCES_URL,
|
||||
foodItems: [],
|
||||
rankItems: [
|
||||
{label: '原始森林野生蜂蜜', intro: '自然野生云南蜂蜜气味香甜可口,口感...', rank: 1, img: ''},
|
||||
{label: '原始森林野生蜂蜜', intro: '自然野生云南蜂蜜气味香甜可口,口感...', rank: 2, img: ''},
|
||||
{label: '原始森林野生蜂蜜', intro: '自然野生云南蜂蜜气味香甜可口,口感...', rank: 3, img: ''},
|
||||
],
|
||||
recommendItems: [
|
||||
{img: '', title: '阿胶糕 手工补品气血固原膏营养礼盒', name: '阿胶糕', price: '39.8'},
|
||||
{img: '', title: '阿胶糕 手工补品气血固原膏营养礼盒', name: '阿胶糕', price: '39.8'},
|
||||
{img: '', title: '阿胶糕 手工补品气血固原膏营养礼盒', name: '阿胶糕', price: '39.8'},
|
||||
{img: '', title: '阿胶糕 手工补品气血固原膏营养礼盒', name: '阿胶糕', price: '39.8'},
|
||||
{img: '', title: '阿胶糕 手工补品气血固原膏营养礼盒', name: '阿胶糕', price: '39.8'},
|
||||
{img: '', title: '阿胶糕 手工补品气血固原膏营养礼盒', name: '阿胶糕', price: '39.8'},
|
||||
{img: '', title: '阿胶糕 手工补品气血固原膏营养礼盒', name: '阿胶糕', price: '39.8'},
|
||||
{img: '', title: '阿胶糕 手工补品气血固原膏营养礼盒', name: '阿胶糕', price: '39.8'},
|
||||
],
|
||||
recommendItems: [],
|
||||
cityId: '',
|
||||
cityName: '',
|
||||
keyword: '',
|
||||
@@ -119,18 +128,34 @@ export default{
|
||||
},
|
||||
onLoad(opts) {
|
||||
this.cityId = opts.city
|
||||
this.cityName = opts.cityName
|
||||
this.cityName = decodeURIComponent(opts.cityName)
|
||||
this.getRank()
|
||||
this.getList()
|
||||
this.getRecipeList()
|
||||
},
|
||||
methods: {
|
||||
toGoods(id) {
|
||||
this.$yrouter.push({
|
||||
path: '/pages/shop/GoodsCon/index',
|
||||
query: {
|
||||
id: id
|
||||
}
|
||||
})
|
||||
},
|
||||
toSanctun() {
|
||||
uni.navigateTo({
|
||||
url: '/pkg_product/views/healthSanctum?city=' + this.cityId + '&cityName=' + this.cityName
|
||||
})
|
||||
},
|
||||
toDetails() {
|
||||
getRecipeList() {
|
||||
getRecipe().then(res => {
|
||||
// console.log(res);
|
||||
this.foodItems = res.data.records
|
||||
})
|
||||
},
|
||||
toDetails(id) {
|
||||
uni.navigateTo({
|
||||
url: '/pkg_product/views/healthFoodDetails'
|
||||
url: '/pkg_product/views/healthFoodDetails?id=' + id
|
||||
})
|
||||
},
|
||||
getRank() {
|
||||
@@ -141,11 +166,83 @@ export default{
|
||||
console.log(res);
|
||||
this.rank = res.data
|
||||
})
|
||||
},
|
||||
getList() {
|
||||
const params = {
|
||||
goodCityId: this.cityId,
|
||||
keyword: this.keyword,
|
||||
page: 1,
|
||||
limit: 9999
|
||||
}
|
||||
getFoods(params).then(res => {
|
||||
this.recommendItems = res.data.records
|
||||
})
|
||||
},
|
||||
search() {
|
||||
this.getList()
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style lang="less" scoped>
|
||||
.rank2-bg{
|
||||
background-color: #ECDAD6 !important;
|
||||
}
|
||||
.rank3-bg{
|
||||
background-color: #DAE3F3 !important;
|
||||
}
|
||||
.rank3-3-bg{
|
||||
background-color: #DAE3F4 !important;
|
||||
}
|
||||
.rank2-2-bg{
|
||||
background-color: #D3B9B2 !important;
|
||||
}
|
||||
.rank2-4-bg{
|
||||
background-color: #AD8578 !important;
|
||||
}
|
||||
.rank3-4-bg{
|
||||
background-color: #A5A5A5 !important;
|
||||
}
|
||||
.rank-2{
|
||||
width: 40rpx; /* 宽度 */
|
||||
height: 45rpx; /* 高度,根据正六边形的几何特性计算 */
|
||||
background-color: #DDC76F; /* 背景颜色 */
|
||||
clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
.rank-3 {
|
||||
width: 30rpx; /* 宽度 */
|
||||
height: 35rpx; /* 高度,根据正六边形的几何特性计算 */
|
||||
background-color: #AD9161; /* 背景颜色 */
|
||||
clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-weight: bold;
|
||||
color: #333;
|
||||
}
|
||||
.rank-4{
|
||||
width: 25rpx; /* 宽度 */
|
||||
height: 28rpx; /* 高度,根据正六边形的几何特性计算 */
|
||||
background-color: #FFF3C2; /* 背景颜色 */
|
||||
clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-weight: bold;
|
||||
color: #333;
|
||||
}
|
||||
.ys-btn{
|
||||
background: #E2D7C3;
|
||||
}
|
||||
.cart-img{
|
||||
width: 48rpx;
|
||||
height: 48rpx;
|
||||
border-radius: 50%;
|
||||
background: #999;
|
||||
}
|
||||
.bg-img{
|
||||
position: absolute;
|
||||
height: 100%;
|
||||
@@ -172,7 +269,6 @@ export default{
|
||||
bottom: 0;
|
||||
}
|
||||
.recommend-item{
|
||||
height: 500rpx;
|
||||
background: #FFFFFF;
|
||||
border-radius: 20rpx;
|
||||
}
|
||||
@@ -191,7 +287,7 @@ export default{
|
||||
.rank-tag{
|
||||
width: 50rpx; /* 宽度 */
|
||||
height: 55rpx; /* 高度,根据正六边形的几何特性计算 */
|
||||
background-color: #3498db; /* 背景颜色 */
|
||||
background-color: #FBEEB7; /* 背景颜色 */
|
||||
clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
|
||||
position: absolute;
|
||||
text-align: center;
|
||||
@@ -199,6 +295,9 @@ export default{
|
||||
font-size: 20rpx;
|
||||
line-height: 55rpx;
|
||||
top: -22.5rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
.rank-img{
|
||||
min-width: 104rpx;
|
||||
@@ -281,5 +380,6 @@ export default{
|
||||
height: 272rpx;
|
||||
background: rgba(230,178,178,0.39);
|
||||
border-radius: 20rpx;
|
||||
overflow: hidden;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user