roamfuding-xcx/page_fenbao/remenxq.vue

710 lines
18 KiB
Vue
Raw Permalink Normal View History

2025-11-08 11:21:57 +08:00
<template>
<view class="page">
<u-navbar title="景区详情" :border-bottom="false" :background="bgc" back-icon-color="#262B37" title-color='#262B37'
title-size='36' height='40' id="navbar">
</u-navbar>
<!-- 轮播图 -->
2025-12-20 14:32:28 +08:00
<view class="" v-if="dongtaiflag == false">
<view class="wrap">
<u-swiper :height="462" bg-color="#fff" :list="list"></u-swiper>
<image class="sc" @click="btnscqx" v-if="xqobj.isCollected == true" src="https://api.ccttiot.com/smartmeter/img/static/uREVO9VLwercFEWbnurd" mode=""></image>
<image class="sc" @click="btnscqd" v-else src="https://api.ccttiot.com/smartmeter/img/static/ukfmNwl4GOF4v090KRqy" mode=""></image>
</view>
<view class="boxxx">
<view class="titlt">
<view class="">
{{xqobj.name == null ? '--' : xqobj.name}}
</view>
<view class="">
<!-- <image src="https://api.ccttiot.com/smartmeter/img/static/uIG8mJqVBzND0R3SPfSB" mode=""></image> -->
<!-- <image src="https://api.ccttiot.com/smartmeter/img/static/uSNNMPwNIgARSp6N5hM7" mode=""></image> -->
<image @click="btntel" src="https://api.ccttiot.com/smartmeter/img/static/uK3UOSMjP61UJbZCeTVd" mode=""></image>
<image @click="btndh" src="https://api.ccttiot.com/smartmeter/img/static/uIYgKFjLZQGnlf07TPhH" mode=""></image>
</view>
</view>
2026-03-16 10:00:58 +08:00
<!-- 标签 -->
<view class="tags-container" v-if="xqobj.tags && xqobj.tags.length > 0">
<view class="tag-item" v-for="(tag, index) in xqobj.tags" :key="index">{{tag}}</view>
</view>
2025-12-20 14:32:28 +08:00
<view class="kftime">
开放时间每日{{xqobj.startTime == null ? '--' : xqobj.startTime}}-{{xqobj.endTime == null ? '--' : xqobj.endTime}}
</view>
2026-03-16 10:00:58 +08:00
<view class="dizhi" @click="btndh">
2025-12-20 14:32:28 +08:00
{{xqobj.address == null ? '--' : xqobj.address}} <image src="https://api.ccttiot.com/smartmeter/img/static/u4wkK5Qag3jpDNatLVQi" mode=""></image>
</view>
<view class="liyou">
<view class="tit">
推荐理由
</view>
<view class="">
{{xqobj.reason == null ? '--' : xqobj.reason}}
</view>
</view>
<view class="titname" v-if="mplist.length > 0">
门票推荐
</view>
<view class="menpiao" v-if="mplist.length > 0">
2026-03-16 10:00:58 +08:00
<view class="piao" v-for="(item,index) in mplist" :key="index" @click="btnmp(item)">
2025-12-20 14:32:28 +08:00
<view class="jd">
<image src="https://api.ccttiot.com/smartmeter/img/static/ukVW3RAuL6lVONjQ1kB5" mode=""></image> 景点门票
</view>
<view class="dz">
<view class="qian">
{{item.name}}
</view>
<view class="hou">
2026-03-16 10:00:58 +08:00
<text class="price">{{item.price}}</text>
<text class="qi"></text>
2025-12-20 14:32:28 +08:00
</view>
</view>
</view>
</view>
<view class="titname" v-if="hxjdlist.length > 0">
核心景点
</view>
<view class="jdlist" v-if="hxjdlist.length > 0">
2026-01-15 14:44:11 +08:00
<view class="jditem" v-for="(item,index) in hxjdlist" :key="index" @click="goToScenicSpot(item.id)">
2026-03-16 10:00:58 +08:00
<image :src="getFirstImage(item.picture)" mode="aspectFill"></image>
2025-12-20 14:32:28 +08:00
<view class="name">
2026-03-16 10:00:58 +08:00
{{item.name.length > 6 ? item.name.slice(0,5) + '...' : item.name}}
2025-12-20 14:32:28 +08:00
</view>
</view>
</view>
<view class="titname" @click="btnjqjs">
景区简介 <view class="">更多介绍 <image src="https://api.ccttiot.com/smartmeter/img/static/u4wkK5Qag3jpDNatLVQi" mode=""></image> </view>
</view>
<view class="jieshao">
{{ xqobj.description ? (xqobj.description.length > 40 ? xqobj.description.slice(0, 40) + '...' : xqobj.description) : '' }}
</view>
<view class="titname">
玩法攻略
</view>
<view class="anniu">
<view :class="tabindex == 0 ? 'active' : ''" @click="btnqh(0)">
玩法攻略
</view>
<!-- <view :class="tabindex == 1 ? 'active' : ''" @click="btnqh(1)">
住宿
</view> -->
</view>
<view class="listimg">
2026-01-15 14:44:11 +08:00
<view class="listitem" v-for="(item,index) in gllist" :key="index" @click="btngl(item)">
<view class="image-wrapper">
2026-03-16 10:00:58 +08:00
<image :src="getFirstImage(item.photo)" mode="aspectFill"></image>
2026-01-15 14:44:11 +08:00
<view class="item-info">
<view class="item-name">{{ truncateText(item.name, 10) }}</view>
<view class="item-desc" v-if="item.description">{{ truncateText(item.description, 20) }}</view>
</view>
</view>
2025-12-20 14:32:28 +08:00
</view>
</view>
<view class="titname" v-if="xqobj.nearbyAreas.length > 0">
周边推荐
</view>
<view class="listimg">
2026-01-15 14:44:11 +08:00
<view class="listitem" v-for="(item,index) in xqobj.nearbyAreas" :key="index" @click="btntj(item)">
<view class="image-wrapper">
<image :src="getFirstImage(item.picture)" mode="aspectFill"></image>
<view class="item-info">
<view class="item-name">{{ truncateText(item.name, 10) }}</view>
<view class="item-desc" v-if="item.description">{{ truncateText(item.description, 20) }}</view>
</view>
</view>
2025-12-20 14:32:28 +08:00
</view>
</view>
</view>
</view>
<image v-else style="width: 100%;height: 100vh;position: fixed;top: 160rpx;left: 0;z-index: 999;" src="https://api.ccttiot.com/mgV9maxWGSQb6aa145cf863980513eecdf75080f75a0.png" mode=""></image>
2025-11-08 11:21:57 +08:00
</view>
</template>
<script>
export default {
data() {
return {
bgc: {
backgroundColor: "#fff",
},
tabindex:0,
list: [],
id:'',
xqobj:{},
hxjdlist:[],
mplist:{},
2025-12-20 14:32:28 +08:00
gllist:[],
dongtaiflag:false
2025-11-08 11:21:57 +08:00
}
},
onLoad(option) {
2026-03-16 10:00:58 +08:00
this.id = option.id
2025-11-08 11:21:57 +08:00
this.getxq()
this.getjd()
this.getmp()
this.getgl()
},
2026-03-16 10:00:58 +08:00
// 分享到好友(会话)
onShareAppMessage: function() {
return {
title: '玩转福鼎',
path: '/page_fenbao/remenxq?id=' + this.id + '&fanhui=1'
}
},
// 分享到朋友圈
onShareTimeline: function() {
return {
title: '玩转福鼎',
query: '',
path: '/page_fenbao/remenxq?id=' + this.id + '&fanhui=1'
}
},
2025-11-08 11:21:57 +08:00
methods: {
2026-03-16 10:00:58 +08:00
// 点击门票进行跳转
btnmp(item){
if(item.linkType == 2){
uni.navigateToMiniProgram({ //跳转到美团app预定酒店
appId: item.linkAppId, // 目标小程序的 AppID必须正确
path: item.linkUrl, // 跳转路径,空字符串表示首页
success(res) {
console.log('跳转成功', res);
},
fail(err) {
console.error('跳转失败', err);
uni.showToast({
title: '暂无门票购买渠道',
icon: 'none',
duration:5000
})
// 常见失败原因AppID错误、用户拒绝跳转、目标小程序未上线
}
})
}
},
2025-12-20 14:32:28 +08:00
// 点击进行收藏
btnscqd(){
let data = {
bstType:3,
bstId:this.id
}
this.$u.post(`/app/favorite/add`,data).then(res =>{
if(res.code == 200){
uni.showToast({
title: '收藏成功',
icon: 'success',
duration:3000
})
this.xqobj.isCollected = true
}else{
uni.showToast({
title: res.msg,
icon: 'none',
duration:3000
})
}
})
},
// 点击进行取消收藏
btnscqx(){
this.$u.delete(`/app/favorite/cancel/${this.id}?bstType=3`).then(res =>{
if(res.code == 200){
uni.showToast({
title: '取消收藏成功',
icon: 'success',
duration:3000
})
this.xqobj.isCollected = false
}else{
uni.showToast({
title: res.msg,
icon: 'none',
duration:3000
})
}
})
},
2026-01-15 14:44:11 +08:00
// 跳转到景点详情页
goToScenicSpot(id) {
if (!id) {
uni.showToast({
title: '暂无该景点详情',
icon: 'none',
duration: 2000
})
return
}
uni.navigateTo({
url: '/page_fenbao/gonglue/jingdianxq?id=' + id
})
},
2025-11-08 11:21:57 +08:00
// 点击景区更多介绍
btnjqjs(){
uni.navigateTo({
url:'/page_fenbao/jqjieshao?id=' + this.id
})
},
// 点击拨打电话
btntel(){
uni.makePhoneCall({
phoneNumber: this.xqobj.phone,
success: function(res) {
console.log('拨打电话成功', res)
},
fail: function(err) {
console.error('拨打电话失败', err)
}
})
},
// 点击进行导航
btndh(){
if (!this.xqobj.latitude || !this.xqobj.longitude) {
uni.showToast({
title: '坐标数据不完整',
icon: 'none',
duration:3000
})
return
}
uni.getSetting({
success: (res) => {
if (res.authSetting['scope.userLocation'] === false) {
uni.showModal({
title: '位置权限',
content: '需要获取您的位置信息才能进行导航,请在设置中开启位置权限',
confirmText: '去设置',
success: (modalRes) => {
if (modalRes.confirm) {
uni.openSetting()
}
}
})
return
}
this.openMap()
}
})
},
// 打开地图
openMap() {
uni.openLocation({
latitude: parseFloat(this.xqobj.latitude), // 确保是数字类型
longitude: parseFloat(this.xqobj.longitude), // 确保是数字类型
name: this.xqobj.name || '目的地', // 地点名称
success: function(res) {
console.log('打开地图成功', res)
},
fail: function(err) {
console.error('打开地图失败', err)
uni.showToast({
title: '打开地图失败: ' + (err.errMsg || '未知错误'),
icon: 'none',
duration: 3000
})
}
})
},
// 点击查询其他周边景点
btntj(item){
this.id = item.id
this.getxq()
this.getjd()
this.getmp()
this.getgl()
},
// 点击跳转到攻略
btngl(item){
uni.navigateTo({
url:'/page_fenbao/gonglue/gongluexq?id=' + item.id
})
},
// 请求景区详情
getxq(){
this.$u.get(`/app/scenicArea/detail/${this.id}`).then(res =>{
if(res.code == 200){
2025-12-20 14:32:28 +08:00
this.dongtaiflag = false
2025-11-08 11:21:57 +08:00
this.xqobj = res.data
let imgArray = this.getAllImages(this.xqobj.picture)
imgArray.forEach(item =>{
this.list.push({
image: item
})
})
2025-12-20 14:32:28 +08:00
}else if(res.msg == '景区不存在'){
this.dongtaiflag = true
2025-11-08 11:21:57 +08:00
}
})
},
// 获取所有图片数组
getAllImages(pictureString) {
// 默认图片
const defaultImage = '/static/image/a1.png';
if (!pictureString || pictureString.trim() === '') {
return [defaultImage]
}
let imageArray = []
// 如果包含逗号,分割成数组
if (pictureString.includes(',')) {
imageArray = pictureString.split(',').map(url => url.trim()).filter(url => url && url.length > 0); // 过滤空字符串
} else {
// 单张图片
const trimmedUrl = pictureString.trim()
if (trimmedUrl && trimmedUrl.length > 0) {
imageArray = [trimmedUrl]
}
}
// 如果处理后没有有效图片,返回默认图片
if (imageArray.length === 0) {
return [defaultImage]
}
return imageArray
},
// 查询核心景点
getjd(){
2025-12-20 14:32:28 +08:00
this.$u.get(`/app/scenicSpot/list?pageNum=1&pageSize=99&areaId=${this.id}`).then(res =>{
2025-11-08 11:21:57 +08:00
if(res.code == 200){
this.hxjdlist = res.rows
}
})
},
// 查询门票
getmp(){
this.$u.get(`/app/ticket/list?pageNum=1&pageSize=99&areaId=${this.id}`).then(res =>{
if(res.code == 200){
this.mplist = res.rows
}
})
},
// 查询攻略
getgl(){
2026-03-16 10:00:58 +08:00
this.$u.get(`/app/strategy/list?pageNum=1&pageSize=99&areaIds=${this.id}`).then(res =>{
2025-11-08 11:21:57 +08:00
if(res.code == 200){
this.gllist = res.rows
}
})
},
// 点击切换选项
btnqh(num){
this.tabindex = num
},
// 获取第一张图片
getFirstImage(pictureString) {
// 默认图片
const defaultImage = '/static/image/a1.png';
if (!pictureString || pictureString.trim() === '') {
return defaultImage;
}
// 将字符串转换为数组并取第一个
if (pictureString.includes(',')) {
const imageArray = pictureString.split(',').map(url => url.trim()).filter(url => url && url.length > 0);
return imageArray.length > 0 ? imageArray[0] : defaultImage;
} else {
// 单张图片
return pictureString.trim() || defaultImage;
}
2026-01-15 14:44:11 +08:00
},
// 截取文字
truncateText(text, maxLength) {
if (!text) return '';
if (text.length <= maxLength) return text;
return text.slice(0, maxLength) + '...';
2025-11-08 11:21:57 +08:00
}
}
}
</script>
<style lang="scss">
page {
background: #fff;
}
.active{
background-color: #3D3D3D !important;
color: #fff !important;
}
.listimg{
display: flex;
gap: 20rpx;
margin-top: 30rpx;
overflow: scroll;
2026-01-15 14:44:11 +08:00
.listitem{
width: 204rpx;
flex-shrink: 0;
.image-wrapper{
position: relative;
2025-11-08 11:21:57 +08:00
width: 204rpx;
height: 204rpx;
border-radius: 10rpx;
2026-01-15 14:44:11 +08:00
overflow: hidden;
image{
width: 100%;
height: 100%;
display: block;
}
.item-info{
position: absolute;
bottom: 0;
left: 0;
right: 0;
padding: 20rpx 16rpx 16rpx;
background: linear-gradient(transparent, rgba(0, 0, 0, 0.6));
.item-name{
font-size: 24rpx;
font-weight: 600;
color: #fff;
line-height: 1.4;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.item-desc{
font-size: 22rpx;
color: rgba(255, 255, 255, 0.9);
line-height: 1.4;
margin-top: 8rpx;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
}
2025-11-08 11:21:57 +08:00
}
}
}
.anniu{
display: flex;
margin-top: 18rpx;
view{
padding: 10rpx 26rpx;
box-sizing: border-box;
background-color: #EBEBEB;
font-weight: 600;
font-size: 28rpx;
color: #3D3D3D;
margin-right: 16rpx;
border-radius: 10rpx;
}
}
.jieshao{
margin-top: 26rpx;
font-size: 30rpx;
color: #3D3D3D;
text-indent: 2em;
}
.jdlist{
display: flex;
gap: 20rpx;
overflow: scroll;
margin-top: 32rpx;
padding-bottom: 30rpx;
.jditem{
text-align: center;
image{
width: 204rpx;
height: 204rpx;
border-radius: 10rpx;
}
view{
font-weight: 600;
font-size: 32rpx;
color: #3D3D3D;
}
}
}
.menpiao{
2025-12-20 14:32:28 +08:00
width: 100%;
2025-11-08 11:21:57 +08:00
background: #F6F6F6;
2026-03-16 10:00:58 +08:00
border-radius: 14rpx;
2025-11-08 11:21:57 +08:00
margin-top: 32rpx;
2026-03-16 10:00:58 +08:00
padding: 34rpx 40rpx;
box-sizing: border-box;
2025-11-08 11:21:57 +08:00
.piao{
2026-03-16 10:00:58 +08:00
&:not(:last-child) {
margin-bottom: 32rpx;
}
&:last-child .dz{
border-bottom: none;
padding-bottom: 0;
}
2025-11-08 11:21:57 +08:00
.dz{
display: flex;
justify-content: space-between;
2026-03-16 10:00:58 +08:00
align-items: flex-start;
2025-11-08 11:21:57 +08:00
margin-top: 28rpx;
padding-bottom: 24rpx;
2026-03-16 10:00:58 +08:00
border-bottom: 1px solid #D8D8D8;
gap: 20rpx;
2025-11-08 11:21:57 +08:00
.qian{
2026-03-16 10:00:58 +08:00
flex: 1;
font-size: 30rpx;
font-weight: 600;
color: #3D3D3D;
line-height: 1.6;
word-wrap: break-word;
word-break: break-all;
min-width: 0;
2025-11-08 11:21:57 +08:00
}
.hou{
2026-03-16 10:00:58 +08:00
flex-shrink: 0;
display: flex;
align-items: baseline;
2025-11-08 11:21:57 +08:00
font-size: 24rpx;
color: #3D3D3D;
2026-03-16 10:00:58 +08:00
white-space: nowrap;
.price{
font-size: 32rpx;
2025-11-08 11:21:57 +08:00
color: #1EC28B;
font-weight: 600;
2026-03-16 10:00:58 +08:00
margin-right: 4rpx;
}
.qi{
font-size: 24rpx;
color: #999;
2025-11-08 11:21:57 +08:00
}
}
}
.jd{
display: flex;
align-items: center;
font-weight: 600;
font-size: 28rpx;
color: #3D3D3D;
image{
width: 32rpx;
height: 32rpx;
margin-right: 20rpx;
2026-03-16 10:00:58 +08:00
flex-shrink: 0;
2025-11-08 11:21:57 +08:00
}
}
}
}
.titname{
font-weight: 600;
font-size: 36rpx;
color: #3D3D3D;
margin-top: 20rpx;
display: flex;
justify-content: space-between;
width: 100%;
align-items: center;
view{
font-size: 24rpx;
color: #3D3D3D;
display: flex;
align-items: center;
font-weight: 400;
image{
width: 32rpx;
height: 32rpx;
}
}
}
.boxxx{
width: 750rpx;
max-height: 999vh;
background: #FFFFFF;
padding: 44rpx 24rpx;
box-sizing: border-box;
border-radius: 30rpx 30rpx 0 0 !important;
position: relative;
top: -50rpx;
.liyou{
width: 100%;
max-height: 1142rpx;
background: #E7F9F4;
border-radius: 4rpx;
padding: 24rpx 40rpx;
box-sizing: border-box;
margin-top: 22rpx;
.tit{
font-weight: 600;
font-size: 32rpx;
color: #3D3D3D;
margin-top: 0;
}
view{
font-size: 24rpx;
color: #3D3D3D;
margin-top: 12rpx;
}
}
.dizhi{
font-size: 28rpx;
color: #3D3D3D;
display: flex;
align-items: center;
margin-top: 20rpx;
image{
width: 38rpx;
height: 38rpx;
}
}
.kftime{
font-size: 28rpx;
color: #3D3D3D;
margin-top: 18rpx;
}
.titlt{
display: flex;
justify-content: space-between;
align-items: center;
width: 100%;
view{
font-weight: 600;
font-size: 52rpx;
color: #3D3D3D;
display: flex;
gap: 50rpx;
image{
width: 40rpx;
height: 40rpx;
}
}
}
}
2025-12-20 14:32:28 +08:00
.wrap{
position: relative;
.sc{
width: 60rpx;
height: 60rpx;
position: absolute;
top: 30rpx;
right: 30rpx;
}
}
2025-11-08 11:21:57 +08:00
::v-deep .u-swiper-image{
width: 750rpx !important;
height: 462rpx !important;
}
::v-deep .u-swiper-indicator{
bottom: 70rpx !important;
}
::v-deep .u-list-image-wrap{
border-radius: 0 !important;
}
::v-deep .u-swiper-wrap{
border-radius: 0 !important;
}
::v-deep .u-indicator-item-round{
width: 6rpx !important;
height: 6rpx !important;
background: #606060;
border-radius: 50%;
opacity: 0.5;
}
::v-deep .u-indicator-item-round-active{
width: 46rpx !important;
height: 6rpx;
background: #fff !important;
border-radius: 9rpx 9rpx 9rpx 9rpx;
}
2026-03-16 10:00:58 +08:00
// 标签容器样式
.tags-container {
margin-top: 20rpx;
display: flex;
gap: 16rpx;
flex-wrap: wrap;
}
.tag-item {
padding: 8rpx 20rpx;
background: #E8FFFB;
color: #1EC28B;
font-size: 26rpx;
border-radius: 28rpx;
}
2025-11-08 11:21:57 +08:00
</style>