roamfuding-xcx/page_user/techan/techandp.vue

255 lines
5.8 KiB
Vue
Raw Normal View History

2025-12-20 14:32:28 +08:00
<template>
<view class="page">
<u-navbar title=" " :border-bottom="false" :background="bgc" back-icon-color="#262B37" title-color='#262B37'
2026-03-16 10:00:58 +08:00
title-size='36' height='46' id="navbar" :custom-back="btnfh">
2025-12-20 14:32:28 +08:00
</u-navbar>
<u-swiper class="bj" :height="582" bg-color="#fff" :list="list"></u-swiper>
<view class="box">
<view class="name">
{{obj.name}}
</view>
<view class="xiao">
营业时间{{obj.startTime}}-{{obj.endTime}}
</view>
<view class="xiao">
地址{{obj.address}}
</view>
<view class="liat">
<image @click="btndh" src="https://api.ccttiot.com/smartmeter/img/static/u8ItYUuDcFXMAe4xGutU" mode=""></image>
<image @click="btntel" src="https://api.ccttiot.com/smartmeter/img/static/uJph4gXvhIFYLsExnUYF" mode=""></image>
<!-- <image src="" mode=""></image> -->
</view>
<view class="haowu">
2026-03-16 10:00:58 +08:00
{{tyep == 1 ? '精选美食' : '精选好物'}}
2025-12-20 14:32:28 +08:00
</view>
<view class="hwlist">
2026-03-16 10:00:58 +08:00
<view class="hwitem" v-for="(item,index) in lists" :key="index" @click="btnhw(item)">
<image v-if="type == 1" :src="item.imageUrl ? item.imageUrl.split(',')[0] : item.imageUrl" mode="aspectFill"></image>
<image v-else :src="item.picture ? item.picture.split(',')[0] : item.picture" mode="aspectFill"></image>
2025-12-20 14:32:28 +08:00
<text>{{item.name}}</text>
</view>
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
bgc: {
backgroundColor: "#fff",
},
id:'',
list:[],
2026-03-16 10:00:58 +08:00
obj:{},
type:'',
lists:[],
fanhui:''
2025-12-20 14:32:28 +08:00
}
},
onLoad(e) {
this.id = e.id
2026-03-16 10:00:58 +08:00
if(e.type){
this.type = e.type
}
2025-12-20 14:32:28 +08:00
this.getdianpu()
2026-03-16 10:00:58 +08:00
if(e && e.fanhui){
this.fanhui = e.fanhui
}
},
// 分享到好友(会话)
onShareAppMessage: function() {
return {
title: '玩转福鼎',
path: '/page_user/techan/techandp?id=' + this.id + (this.type ? '&type=' + this.type : '') + '&fanhui=1'
}
},
// 分享到朋友圈
onShareTimeline: function() {
return {
title: '玩转福鼎',
query: '',
path: '/page_user/techan/techandp?id=' + this.id + (this.type ? '&type=' + this.type : '') + '&fanhui=1'
}
2025-12-20 14:32:28 +08:00
},
methods: {
2026-03-16 10:00:58 +08:00
btnfh(){
if(this.fanhui == 1){
uni.reLaunch({
url:'/pages/index/index'
})
}else{
uni.navigateBack()
}
},
2025-12-20 14:32:28 +08:00
// 点击拨打电话
btntel(){
uni.makePhoneCall({
phoneNumber: this.obj.contactMobile,
success: function(res) {
console.log('拨打电话成功', res)
},
fail: function(err) {
console.error('拨打电话失败', err)
}
})
},
// 点击进行导航
btndh(){
if (!this.obj.latitude || !this.obj.longitude) {
uni.showToast({
title: '坐标数据不完整',
icon: 'none',
2026-03-16 10:00:58 +08:00
duration:5000
2025-12-20 14:32:28 +08:00
})
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.obj.latitude), // 确保是数字类型
longitude: parseFloat(this.obj.longitude), // 确保是数字类型
name: this.obj.name || '目的地', // 地点名称
success: function(res) {
console.log('打开地图成功', res)
},
fail: function(err) {
console.error('打开地图失败', err)
uni.showToast({
title: '打开地图失败: ' + (err.errMsg || '未知错误'),
icon: 'none',
duration: 3000
})
}
})
},
// 请求店铺详情
getdianpu(){
this.$u.get(`/app/store/detail/${this.id}`).then((res) => {
if(res.code == 200){
this.obj = res.data
2026-03-16 10:00:58 +08:00
if(this.type == 1){
this.lists = res.data.dishes
}else{
this.lists = res.data.specialties
}
2025-12-20 14:32:28 +08:00
let imgArray = res.data.picture.split(',')
imgArray.forEach(item =>{
this.list.push({
image: item
})
})
}
})
},
// 点击精选好物跳转详情
btnhw(item){
uni.navigateTo({
2026-03-16 10:00:58 +08:00
url:'/page_user/techan/techansp?id=' + item.id + '&type=' + this.type
2025-12-20 14:32:28 +08:00
})
}
}
}
</script>
<style lang="less">
::v-deep .u-icon__icon,
::v-deep .u-title{
padding-bottom: 22rpx !important;
}
.box{
width: 750rpx;
overflow: hidden;
height: 59vh;
background: #FFFFFF;
border-radius:50rpx 50rpx 0 0;
position: relative;
top: -100rpx;
2026-03-16 10:00:58 +08:00
overflow: hidden;
2025-12-20 14:32:28 +08:00
padding-bottom: 30rpx;
padding: 36rpx 48rpx;
.hwlist{
display: flex;
gap: 30rpx;
margin-top: 26rpx;
overflow: scroll;
width: 750rpx;
padding-right: 80rpx;
padding-bottom: 30rpx;
.hwitem{
width: 200rpx;
image{
width: 200rpx;
height: 200rpx;
border-radius: 10rpx;
}
text{
font-weight: 600;
font-size: 30rpx;
color: #3D3D3D;
display: block;
margin-top: 16rpx;
text-align: center;
}
}
}
.haowu{
font-weight: 600;
font-size: 36rpx;
color: #3D3D3D;
margin-top: 56rpx;
}
.liat{
display: flex;
justify-content: space-around;
gap: 122rpx;
margin-top: 68rpx;
padding-left: 38rpx;
image{
width: 112rpx;
height: 166rpx;
}
}
.name{
font-weight: 600;
font-size: 48rpx;
color: #3D3D3D;
margin-bottom: 14rpx;
}
.xiao{
font-size: 28rpx;
color: #3D3D3D;
margin-top: 16rpx;
}
}
.bj{
width: 750rpx;
height: 582rpx;
}
page {
background: #fff;
height: 100vh;
overflow: hidden;
}
</style>