diff --git a/pages/aroundDetail/index.vue b/pages/aroundDetail/index.vue
index dc8d5d4..308b21f 100644
--- a/pages/aroundDetail/index.vue
+++ b/pages/aroundDetail/index.vue
@@ -1,19 +1,123 @@
-
-
-
-
-
+
+
+
+
+
+
-
-
- {{ detailInfo.storeName }}
- 营业时间:{{ detailInfo.openAt}}
- 地址:{{ detailInfo.storeAddress }}
- 距您{{ local }}米
+
+
+
+
+
+
+ {{ detailInfo.price > 0 ? '¥' + detailInfo.price : '免费' }}
+
+
+
+ {{ formatDistance(local) }}
+
+
+
+
+
+
+
+ {{ tag }}
+
+
+
+
+
+
+
+
+
+ 详细地址
+ {{ detailInfo.storeAddress }}
+
+
+
+
+
+
+ 开放时间
+ {{ detailInfo.openAt }}
+
+
+
+
+
+
+ 联系电话
+ {{ detailInfo.concatPhone }}
+
+
+
+
+
+
+ 详情介绍
+ {{ detailInfo.content }}
+
+
+
+
+
+
+ 备注信息
+ {{ detailInfo.remark }}
+
+
+
+
+
+
+ 相关链接
+ {{ detailInfo.link }}
+
+
+
+
+
+
+
+
+
+
+ 环境展示
+
+
+
+
+
+
+
+
+
+
+
@@ -22,90 +126,416 @@
import { get, post } from '@/utils/request';
import { IMAGE_BASE_URL, BASE_URL } from '@/utils/config';
import { formatTime, formatRelativeTime } from '@/utils/timeFormat';
+
export default {
data() {
return {
- formatTime,
- IMAGE_BASE_URL,
- Id:null,
- detailInfo: {},
- local:null,
+ formatTime,
+ IMAGE_BASE_URL,
+ Id: null,
+ defaultCover: '/static/images/default-store-cover.png',
+ detailInfo: {
+ storeName: '',
+ storeCover: '',
+ storeAddress: '',
+ openAt: '',
+ content: '',
+ labels: [],
+ remark: '',
+ detailImages: [],
+ id: '',
+ createdAt: '',
+ updatedAt: '',
+ deletedAt: 0,
+ createdId: '',
+ deletedId: '',
+ typeId: '',
+ longitude: '',
+ latitude: '',
+ price: 0,
+ sequence: 0,
+ link: '',
+ status: 1
+ },
+ local: null,
+ }
+ },
+ computed: {
+ statusText() {
+ const statusMap = {
+ 1: '营业中',
+ 2: '已关闭',
+ 3: '即将开业',
+ 0: '未知状态'
+ };
+ return statusMap[this.detailInfo.status] || `状态: ${this.detailInfo.status}`;
+ },
+ statusClass() {
+ const statusMap = {
+ 1: 'status-open',
+ 2: 'status-closed',
+ 3: 'status-soon'
+ };
+ return statusMap[this.detailInfo.status] || 'status-default';
+ },
+ statusIcon() {
+ const iconMap = {
+ 1: 'home-fill',
+ 2: 'close-circle-fill',
+ 3: 'clock-fill'
+ };
+ return iconMap[this.detailInfo.status] || 'question-circle-fill';
}
},
onLoad(options) {
- if (options && options.Id && options.local) {
- this.Id = options.Id;
- this.local = options.local;
- }
+ if (options && options.Id && options.local) {
+ this.Id = options.Id;
+ this.local = options.local;
+ }
},
- mounted(){
- this.getAroundDetail();
+ mounted() {
+ this.getAroundDetail();
},
methods: {
- async getAroundDetail(){
- try {
- const res = await get(`/api/v1/apps/surrounding/${this.Id}`);
- if (!res || !res.success) {
- throw new Error('获取详情失败');
- }
- res.data.storeCover = IMAGE_BASE_URL + res.data.storeCover;
- this.detailInfo = {...res.data};
- } catch (err) {
- console.error('获取详情失败:', err);
- }
-
- }
+ formatDistance(distance) {
+ if (!distance) return '未知距离';
+ if (distance < 1000) {
+ return `${distance}米`;
+ } else {
+ return `${(distance / 1000).toFixed(1)}公里`;
+ }
+ },
+
+ async getAroundDetail() {
+ try {
+ const res = await get(`/api/v1/apps/surrounding/${this.Id}`);
+ if (!res || !res.success) {
+ throw new Error('获取详情失败');
+ }
+
+ if (res.data.storeCover) {
+ res.data.storeCover = res.data.storeCover.startsWith('http') ? res.data.storeCover : IMAGE_BASE_URL + res.data.storeCover;
+ }
+
+ this.detailInfo = {...this.detailInfo, ...res.data};
+ } catch (err) {
+ console.error('获取详情失败:', err);
+ uni.showToast({
+ title: '获取详情失败',
+ icon: 'none'
+ });
+ }
+ },
+
+ openMap() {
+ const { latitude, longitude, storeName, storeAddress } = this.detailInfo;
+ if (latitude && longitude) {
+ uni.openLocation({
+ latitude: Number(latitude),
+ longitude: Number(longitude),
+ name: storeName,
+ address: storeAddress,
+ success: () => {
+ console.log('打开地图成功');
+ },
+ fail: (err) => {
+ console.error('打开地图失败:', err);
+ uni.showToast({
+ title: '打开地图失败',
+ icon: 'none'
+ });
+ }
+ });
+ } else {
+ uni.showToast({
+ title: '暂无位置信息',
+ icon: 'none'
+ });
+ }
+ },
+
+ previewImage(index) {
+ if (!this.detailInfo.detailImages || !this.detailInfo.detailImages.length) return;
+
+ uni.previewImage({
+ current: index,
+ urls: this.detailInfo.detailImages.map(img => img.startsWith('http') ? img : IMAGE_BASE_URL + img)
+ });
+ },
+
+ handleShare() {
+ uni.showActionSheet({
+ itemList: ['分享到微信', '分享到朋友圈', '复制链接'],
+ success: (res) => {
+ uni.showToast({
+ title: `已选择: ${res.tapIndex === 0 ? '微信' : res.tapIndex === 1 ? '朋友圈' : '复制链接'}`,
+ icon: 'none'
+ });
+ }
+ });
+ }
}
}
-
\ No newline at end of file