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

269 lines
7.4 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">
<image
:src="webUrl + '/orderIcon/map_dark.png'"
mode="widthFix"
class="icon"
/>
<view class="v12-font-28 v12-secondary-dark-text v12-mr-3">{{ cityName }}</view>
<view class="flex-1" @click="search">
<u-search searchIconColor="#C52733" :disabled="true" :showAction="false" v-model="keyword" ></u-search>
</view>
</view>
<swiper v-if="traveItems.length > 0" class="v12-justify-between swap" autoplay circular next-margin="300rpx" duration="10000" interval="3000" >
<swiper-item v-for="(item, index) in traveItems" :key="index" >
<view class="trave-item v12-mr-3 v12-mt-3" @click="toStore(item)">
<view class="trave-item">
<image class="trave-item" :src="item.cover"></image>
<!-- <video class="trave-item" :src="item.cover" :show-fullscreen-btn="false" :show-center-play-btn="flase" :show-play-btn="false" v-if="item.coverType === 2"></video> -->
</view>
<view class="trave-btn">
<text>旅居预约</text>
<image :src="webUrl + '/orderIcon/arrow.png'" class="arrow-icon v12-ml-1"></image>
</view>
</view>
</swiper-item>
</swiper>
<view class="v12-justify-between v12-align-center v12-px-3 v12-mt-3 tabs-wrap">
<view
class="tab v12-font-34 v12-dark-text v12-mr-5"
v-for="(tab, index) in tabs"
@click="handleTab(index,tab)"
:class="{'v12-font-bold' : index === actived}"
: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" @click="toStore(item)">
<view class="img">
<image class="img" :src="item.cover"></image>
<!-- <video
class="img"
:src="item.cover"
:play-btn-position="center"
:show-fullscreen-btn="false"
:show-center-play-btn="flase"
:show-play-btn="false"
:controls="false"
v-if="item.coverType === 2">
</video> -->
<view class="v12-white-text address">
<image
class="map-icon v12-mr-1"
:src="webUrl + '/orderIcon/map_white.png'"
></image>
<text class="v12-font-28">{{ item.areaName }}</text>
</view>
</view>
<view class="v12-font-bold v12-font-28 v12-mt-1 more-t desc-txt">{{ item.intro }}</view>
<view class="v12-justify-start v12-align-center v12-my-1">
<view class="atr">
<image class="atr" :src="item.avatar"></image>
</view>
<view class="v12-font-26 v12-ml-2 v12-dark-text one-t">{{ item.name }}</view>
</view>
</view>
</view>
<view v-if="items.length === 0" class="v12-justify-center v12-mt-6">
<view class="no-data-wrap">
<image :src="webUrl + '/orderIcon/微信图片_20241009220552.png'" mode="widthFix"></image>
</view>
</view>
</view>
</template>
<script>
import { getCategory,getWellnessPlace } from '@/api/health'
import { getJiaLouList } from '@/api/qianxian'
export default {
data() {
return {
webUrl: this.$VUE_APP_RESOURCES_URL,
tabs: [],
items: [],
traveItems: [],
actived: 0,
cityId: '',
cityName: '',
categoryId: null,
keyword: ''
}
},
onLoad(opts) {
console.log(opts);
this.cityId = opts.city
this.cityName = decodeURIComponent(decodeURIComponent(opts.cityName))
getCategory().then(res => {
this.tabs = res.data
this.categoryId = res.data[0].id
this.getList()
})
this.getTop()
},
onUnload() {
// uni.navigateBack({
// delta: 0
// })
},
methods: {
handleTab(index, tab) {
this.actived = index
this.categoryId = tab.id
this.getList()
},
toFoods() {
uni.redirectTo({
url: '/pkg_product/views/healthFoods?city=' + this.cityId + '&cityName=' + this.cityName
})
},
getList() {
const params = {
// countyId: this.cityId,
goodCityId: this.cityId,
wellnessPlaceCateId : this.categoryId,
shopType: 'wellnessCate',
page: 1,
limit: 9999
}
getJiaLouList(params).then(res => {
// console.log(res);
this.items = res.data.records
})
},
search() {
uni.navigateTo({
url: '/pkg_product/views/healthSearch?city=' + this.cityId + '&cityName=' + this.cityName
})
},
getTop() {
const params = {
goodCityId: this.cityId,
shopType: 'wellnessTop',
page: 1,
limit: 9999
}
getJiaLouList(params).then(res => {
// console.log(res);
this.traveItems = res.data.records
})
},
toStore(item) {
if(item.dataType === 'wellnessPlace'){
this.$yrouter.push({
path: '/pagesInn/inn/innHome',
query: {
id: item.hotelId
}
})
}else{
uni.navigateTo({ url: '/pkg_product/views/sojoumStore?id=' + item.id })
}
},
}
}
</script>
<style lang="less" scoped>
.tabs-wrap{
white-space: nowrap;
overflow: scroll;
.tab:last-child{
margin-right: 0 !important;
}
}
.map-icon{
width: 28rpx;
height: 28rpx;
}
.arrow-icon{
width: 25rpx;
height: 25rpx;
}
.icon{
width: 30rpx;
height: 30rpx;
}
.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.7);
border-radius: 60rpx;
font-size: 28rpx;
font-weight: bold;
display: flex;
align-items: center;
justify-content: center;
padding: 10rpx 20rpx;
}
.trave-item{
width: 382rpx;
height: 272rpx;
background: rgba(230,178,178,0.39);
border-radius: 20rpx;
position: relative;
}
.desc-txt {
height: 78rpx;
line-height: 40rpx;
}
.address{
position: absolute;
left: 30rpx;
bottom: 30rpx;
display: flex;
align-items: center;
justify-content: center;
}
.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{
min-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>