Files
xdd-uniapp-new/pkg_product/views/healthSanctum.vue
T

177 lines
4.7 KiB
Vue

<template>
<view class="sanctum-wrap">
<view class="v12-justify-center">
<view class="v12-mr-3 v12-radius-100 v12-primary v12-white-text v12-px-5 v12-py-2 v12-font-28 v12-font-bold">养生圣地</view>
<view class="v12-radius-100 v12-grey v12-dark-text v12-px-5 v12-py-2 v12-font-28 v12-font-bold" @click="toFoods">养生食材</view>
</view>
<view class="v12-justify-between v12-align-center v12-mt-5">
<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" @search="search"></u-search>
</view>
</view>
<view class="v12-justify-between swap">
<view v-for="(item, index) in traveItems" :key="index" class="trave-item-wrap v12-mr-3 v12-mt-3">
<view class="trave-item"></view>
<view class="trave-btn">旅居预约</view>
</view>
</view>
<view class="v12-justify-between v12-align-center v12-px-3 v12-mt-3">
<view
class="tab v12-font-bold v12-font-34 v12-dark-text "
v-for="(tab, index) in tabs"
@click="handleTab(index,tab)"
:key="index">
<text>{{ tab.name }}</text>
<view :class="{'slider': index === actived}"></view>
</view>
</view>
<view class="v12-justify-between sanctup-items v12-mt-3">
<view v-for="(item, index) in items" :key="index" class="v12-pa-1">
<view class="img">
<image class="img" :src="item.cover"></image>
<view class="v12-white-text v12-font-weight-300 address">{{ item.areaName }}</view>
</view>
<view class="v12-font-bold v12-font-28 more-t">{{ item.address }}</view>
<view class="v12-justify-start v12-align-center v12-my-2">
<view class="atr">
<image class="atr" :src="item.logo"></image>
</view>
<view class="v12-font-26 v12-ml-2 v12-dark-text one-t">{{ item.hotelName }}</view>
</view>
</view>
</view>
</view>
</template>
<script>
import { getCategory,getWellnessPlace } from '@/api/health'
export default {
data() {
return {
tabs: [],
items: [],
traveItems: [
{img: '', value: ''},
{img: '', value: ''},
{img: '', value: ''},
{img: '', value: ''},
{img: '', value: ''},
{img: '', value: ''},
{img: '', value: ''},
{img: '', value: ''},
],
actived: 0,
cityId: '',
cityName: '',
categoryId: null,
keyword: ''
}
},
onLoad(opts) {
this.cityId = opts.city
this.cityName = opts.cityName
getCategory().then(res => {
this.tabs = res.data
this.categoryId = res.data[0].id
this.getList()
})
},
methods: {
handleTab(index, tab) {
this.actived = index
this.categoryId = tab.id
this.getList()
},
toFoods() {
uni.navigateTo({
url: '/pkg_product/views/healthFoods?city=' + this.cityId + '&cityName=' + this.cityName
})
},
getList() {
const params = {
goodCityId: this.cityId,
categoryId: this.categoryId,
keyword: this.keyword,
page: 1,
limit: 9999
}
getWellnessPlace(params).then(res => {
// console.log(res);
this.items = res.data.records
})
},
search() {
this.getList()
}
}
}
</script>
<style lang="less" scoped>
.flex-1{
flex: 1;
}
.swap{
overflow: auto;
}
.trave-item-wrap{
position: relative;
}
.trave-btn{
position: absolute;
left: 0;
right: 0;
margin: auto;
bottom: 30rpx;
text-align: center;
width: 212rpx;
background: rgba(255,255,255,0.9);
border-radius: 60rpx;
font-size: 28rpx;
font-weight: bold;
padding: 10rpx 20rpx;
}
.trave-item{
width: 382rpx;
height: 272rpx;
background: rgba(230,178,178,0.39);
border-radius: 20rpx;
}
.address{
position: absolute;
left: 30rpx;
bottom: 30rpx;
}
.sanctup-items{
display: grid;
grid-template-columns: 50% 50%;
}
.atr{
width: 52rpx;
height: 52rpx;
border-radius: 50%;
}
.img{
width: 320rpx;
height: 320rpx;
// background: #707070;
border-radius: 16rpx;
position: relative;
}
.sanctum-wrap{
height: 100vh;
background-color: #fff;
padding: 20rpx ;
}
.tab{
position: relative;
}
.slider{
position: absolute;
width: 100%;
height: 6rpx;
background: linear-gradient(to right, #C52733 0%, rgba(255,255,255,0) 100%);
border-radius: 6rpx;
bottom: 5rpx;
}
</style>