Files
xdd-uniapp-new/pkg_product/views/experienceProjectDetail.vue
T
2026-03-16 18:09:41 +08:00

545 lines
14 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<template>
<view class="experience-project-page">
<hx-navbar
:fixed="true"
:background-color="[0, [0, 0, 0, 0], [0, 0, 0, 0]]"
statusBarFontColor="#ffffff"
barPlaceholder="hidden"
transparent="auto"
color="#ffffff"
/>
<scroll-view scroll-y class="page-scroll">
<view class="hero-wrap">
<image
v-if="project.cover"
:src="project.cover"
class="hero-img"
mode="aspectFill"
/>
</view>
<view class="content">
<view class="store-card">
<view class="store-name">
{{ project.name }}
</view>
<view class="store-intro">
{{ project.intro }}
</view>
<view class="store-tags">
<view class="time-tag">
<view class="time-tag-label">营业时间</view>
<view class="time-tag-value">{{ project.serviceTime }}~{{ project.serviceEndTime }}</view>
</view>
<view class="license-tag">营业执照</view>
</view>
<view class="store-meta">
<view class="meta-left">
<u-icon
:name="webUrl + '/page/qianxian/icon-location.png'"
size="20"
color="#C52733"
/>
<text class="meta-text">
{{ project.cityName }}{{ project.address }}
</text>
</view>
<view class="meta-actions">
<view class="action-item" @click="handleNavigate">
<view class="action-icon">
<u-icon :name="webUrl + '/page/qianxian/icon-addr.png'" color="#fff" size="24"></u-icon>
</view>
<text class="action-text">导航</text>
</view>
<view class="action-item" @click="handleContact">
<view class="action-icon">
<u-icon :name="webUrl + '/page/qianxian/icon-phone.png'" color="#fff" size="24"></u-icon>
</view>
<text class="action-text">客服</text>
</view>
</view>
</view>
</view>
<view class="section-experience">
<view class="experience-badge-wrap">
<view class="experience-badge">
<u-icon name="diamond-fill" color="#F9D24D" size="18"></u-icon>
<text class="badge-text">超值体验</text>
</view>
</view>
<view class="experience-card">
<image
v-if="project.cover"
:src="project.cover"
class="experience-image"
mode="aspectFill"
/>
<view class="experience-info">
<view class="experience-title-wrap">
<view class="experience-title">
{{ project.experienceTitle || project.name }}
</view>
</view>
<view class="experience-subtitle">
{{ project.experienceSubTitle || project.intro }}
</view>
</view>
</view>
</view>
<view class="section">
<view class="section-title">详情</view>
<view v-if="detailList && detailList.length" class="detail-list">
<view
v-for="(item, index) in detailList"
:key="index"
class="detail-item"
>
<view class="detail-name">
<text class="dot"></text>
<text>{{ item.name }}</text>
</view>
<view class="detail-count">({{ item.count }})</view>
</view>
</view>
<view v-else class="section-text with-dot">
<text class="dot"></text>
<text>{{ project.detailText || '详情信息由商家提供' }}</text>
</view>
</view>
<view class="section" v-if="project.remark">
<view class="section-title">备注</view>
<view class="section-text with-dot">
<text class="dot"></text>
<text>{{ project.remark }}</text>
</view>
</view>
<view class="section">
<view class="section-title">使用须知</view>
<view class="section-text with-dot">
<text class="dot"></text>
<text>有效期: {{ validFrom || '2026年1月1日' }} {{ validTo || '2026年1月31日' }}</text>
</view>
<view class="section-text with-dot">
<text class="dot"></text>
<text>{{ usageNotice || '无需预约,如遇消费高峰时段您可能需要排队' }}</text>
</view>
<view class="section-text with-dot">
<text class="dot"></text>
<text>平台温馨提醒:您在到店体验本商品/服务期间请关注商家的安全提示内容了解相关注意事项做好安全防护措施保护您的安全</text>
</view>
</view>
<view class="bottom-space" />
</view>
</scroll-view>
</view>
</template>
<script>
import { getExperienceStoreDetail } from '@/api/qianxian'
export default {
data() {
const webUrl = this.$VUE_APP_RESOURCES_URL
return {
webUrl,
project: {
id: '',
name: '',
cover: '',
intro: '',
serviceTime: '',
serviceEndTime: '',
cityName: '',
address: '',
latitude: '',
longitude: '',
phone: '',
wechat: '',
experienceTitle: '',
experienceSubTitle: '',
detailText: '',
remark: ''
},
detailList: [],
experienceMerchantId: '',
totalPrice: 0,
validFrom: '',
validTo: '',
usageNotice: ''
}
},
onLoad(query) {
const decode = v => decodeURIComponent(v || '')
const id = query.experienceMerchantId || query.id || ''
this.experienceMerchantId = id
this.project.id = id
this.project.name = decode(query.name)
this.project.cover = decode(query.cover)
this.project.intro = decode(query.intro)
this.project.serviceTime = query.serviceTime || ''
this.project.serviceEndTime = query.serviceEndTime || ''
this.project.cityName = decode(query.cityName)
this.project.address = decode(query.address)
this.project.latitude = query.latitude || ''
this.project.longitude = query.longitude || ''
this.project.experienceTitle = decode(query.experienceTitle || '')
this.project.experienceSubTitle = decode(query.experienceSubTitle || '')
this.project.detailText = decode(query.detailText || '')
this.project.remark = decode(query.remark || '')
this.validFrom = query.validFrom || ''
this.validTo = query.validTo || ''
this.usageNotice = decode(query.usageNotice || '')
if (query.detailList) {
try {
const list = JSON.parse(decode(query.detailList))
if (Array.isArray(list)) {
this.detailList = list.map(item => ({
name: item.name || '',
count: item.count || ''
}))
}
} catch (e) {}
}
this.fetchProjectDetail()
},
methods: {
fetchProjectDetail() {
if (!this.experienceMerchantId) {
return
}
uni.showLoading({
title: '加载中',
mask: true
})
getExperienceStoreDetail(this.experienceMerchantId).then(res => {
if (res && res.status === 200) {
const data = res.data || {}
this.project.name = data.name || this.project.name
this.project.cover = data.cover || this.project.cover
this.project.intro = data.intro || this.project.intro
this.project.serviceTime = data.serviceTime || this.project.serviceTime
this.project.serviceEndTime = data.serviceEndTime || this.project.serviceEndTime
this.project.cityName = data.cityName || this.project.cityName
this.project.address = data.address || this.project.address
this.project.latitude = data.latitude || this.project.latitude
this.project.longitude = data.longitude || this.project.longitude
this.project.phone = data.phone || this.project.phone
this.project.wechat = data.wechat || this.project.wechat
const project = data.project || {}
this.project.experienceTitle = project.themeName || this.project.experienceTitle || this.project.name
if (project.themeImage) {
this.project.cover = project.themeImage
}
this.project.detailText = project.detail || this.project.detailText
this.project.remark = project.remark || this.project.remark
this.usageNotice = project.useNotice || this.usageNotice
if (project.totalPrice != null) {
this.totalPrice = project.totalPrice
}
if (data.totalPrice != null && this.totalPrice === 0) {
this.totalPrice = data.totalPrice
}
if (project.validityStartTime) {
this.validFrom = project.validityStartTime
}
if (project.validityEndTime) {
this.validTo = project.validityEndTime
}
if (project.projectList && project.projectList.length) {
this.detailList = project.projectList.map(item => ({
name: item.projectName || '',
count: item.projectIntro || ''
}))
}
}
}).finally(() => {
uni.hideLoading()
})
},
handleNavigate() {
if (!this.project.latitude || !this.project.longitude) {
uni.showToast({
title: '暂无位置信息',
icon: 'none'
})
return
}
uni.openLocation({
latitude: Number(this.project.latitude),
longitude: Number(this.project.longitude),
name: this.project.name,
address: this.project.address
})
},
handleContact() {
if (!this.project.phone) {
uni.showToast({
title: '暂无联系方式',
icon: 'none'
})
return
}
uni.makePhoneCall({
phoneNumber: this.project.phone
})
}
}
}
</script>
<style scoped lang="less">
.experience-project-page {
min-height: 100vh;
background: #f5f5f5;
}
.page-scroll {
height: calc(100vh - 120rpx);
}
.hero-wrap {
position: relative;
width: 100%;
height: 400rpx;
overflow: hidden;
}
.hero-img {
width: 100%;
height: 100%;
}
.content {
margin-top: -60rpx;
padding: 0 24rpx 40rpx;
box-sizing: border-box;
position: relative;
z-index: 2;
}
.store-card {
padding: 32rpx 24rpx;
border-radius: 24rpx;
background: #ffffff;
box-shadow: 0 8rpx 24rpx rgba(0, 0, 0, 0.06);
}
.store-name {
color: #333;
font-size: 36rpx;
font-weight: bold;
}
.store-intro {
margin-top: 16rpx;
color: #666;
font-size: 26rpx;
line-height: 1.5;
}
.store-tags {
display: flex;
align-items: center;
margin-top: 24rpx;
gap: 16rpx;
}
.time-tag {
display: flex;
align-items: center;
border: 1rpx solid #C52733;
border-radius: 24rpx;
overflow: hidden;
height: 40rpx;
}
.time-tag-label {
background: #C52733;
color: #ffffff;
font-size: 22rpx;
padding: 0 16rpx;
height: 100%;
line-height: 40rpx;
}
.time-tag-value {
color: #333;
font-size: 22rpx;
padding: 0 16rpx;
height: 100%;
line-height: 40rpx;
background: #ffffff;
}
.license-tag {
border: 1rpx solid #C52733;
color: #C52733;
font-size: 22rpx;
padding: 0 16rpx;
border-radius: 24rpx;
height: 40rpx;
line-height: 40rpx;
}
.store-meta {
margin-top: 32rpx;
padding-top: 32rpx;
border-top: 1rpx solid #f0f0f0;
display: flex;
align-items: center;
justify-content: space-between;
}
.meta-left {
flex: 1;
display: flex;
align-items: center;
padding-right: 32rpx;
}
.meta-text {
margin-left: 12rpx;
font-size: 26rpx;
color: #333;
font-weight: 500;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
overflow: hidden;
}
.meta-actions {
display: flex;
align-items: center;
gap: 32rpx;
flex-shrink: 0;
}
.action-item {
display: flex;
flex-direction: column;
align-items: center;
}
.action-icon {
width: 64rpx;
height: 64rpx;
border-radius: 50%;
background: #C52733;
display: flex;
align-items: center;
justify-content: center;
margin-bottom: 8rpx;
}
.action-text {
font-size: 22rpx;
color: #333;
}
.section-experience {
margin-top: 40rpx;
position: relative;
}
.experience-badge-wrap {
position: absolute;
top: -24rpx;
left: 0;
z-index: 10;
}
.experience-badge {
display: inline-flex;
align-items: center;
background: linear-gradient(90deg, #E63E48, #C52733);
padding: 8rpx 24rpx 8rpx 16rpx;
border-radius: 8rpx 32rpx 32rpx 8rpx;
position: relative;
box-shadow: 0 4rpx 12rpx rgba(197, 39, 51, 0.3);
}
.experience-badge::after {
content: '';
position: absolute;
left: 0;
bottom: -8rpx;
border-top: 8rpx solid #901b24;
border-left: 8rpx solid transparent;
}
.badge-text {
color: #ffffff;
font-size: 28rpx;
font-weight: bold;
font-style: italic;
margin-left: 8rpx;
}
.experience-card {
border-radius: 24rpx;
background: #C52733;
overflow: hidden;
box-shadow: 0 8rpx 24rpx rgba(197, 39, 51, 0.15);
}
.experience-image {
width: 100%;
height: 360rpx;
border-radius: 24rpx;
display: block;
}
.experience-info {
padding: 24rpx;
}
.experience-title-wrap {
display: inline-block;
background: #ffffff;
border-radius: 40rpx;
padding: 8rpx 32rpx;
margin-bottom: 16rpx;
}
.experience-title {
color: #C52733;
font-size: 32rpx;
font-weight: bold;
}
.experience-subtitle {
color: #ffffff;
font-size: 26rpx;
opacity: 0.9;
}
.section {
margin-top: 24rpx;
padding: 32rpx 24rpx;
border-radius: 24rpx;
background: #ffffff;
}
.section-title {
font-size: 32rpx;
font-weight: bold;
color: #333;
margin-bottom: 24rpx;
}
.detail-list {
background: transparent;
}
.detail-item {
display: flex;
align-items: flex-start;
justify-content: space-between;
font-size: 26rpx;
color: #666;
margin-bottom: 16rpx;
}
.detail-name {
flex: 1;
display: flex;
align-items: flex-start;
line-height: 1.5;
}
.detail-count {
margin-left: 24rpx;
color: #999;
}
.dot {
display: inline-block;
width: 8rpx;
height: 8rpx;
border-radius: 50%;
background: #999;
margin-top: 14rpx;
margin-right: 16rpx;
flex-shrink: 0;
}
.section-text {
font-size: 26rpx;
color: #666;
line-height: 1.6;
}
.with-dot {
display: flex;
align-items: flex-start;
margin-bottom: 16rpx;
}
.bottom-space {
height: 40rpx;
}
</style>