store-detail.vue
5.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
<template>
<view class="page-shell store-detail-page">
<view class="page-blur"></view>
<view class="page-blur-secondary"></view>
<view class="page-blur-tertiary"></view>
<view class="page-content subpage-content">
<view class="subpage-nav">
<view class="subpage-back" @tap="goBack">‹</view>
<view class="subpage-title-wrap">
<text class="subpage-title">门店详情</text>
<text class="subpage-subtitle">空间、交通与到店提醒,都为你提前准备好</text>
</view>
</view>
<view class="detail-hero glass-card">
<image v-if="store.cover" class="hero-image" :src="store.cover" mode="aspectFill" />
<view class="hero-overlay"></view>
<view class="hero-content">
<text class="hero-kicker">{{ store.city || '门店' }}</text>
<text class="hero-title">{{ store.name }}</text>
<text v-if="store.description" class="hero-desc">{{ store.description }}</text>
</view>
</view>
<view class="subpage-card">
<view class="info-list">
<view class="info-row">
<text class="info-label">地址</text>
<text class="info-value">{{ store.address || '无' }}</text>
</view>
<view class="info-row">
<text class="info-label">营业时间</text>
<text class="info-value">{{ store.hours || '无' }}</text>
</view>
<view class="info-row">
<text class="info-label">联系电话</text>
<text class="info-value">{{ store.phone || '无' }}</text>
</view>
<view v-if="store.city" class="info-row">
<text class="info-label">所在城市</text>
<text class="info-value">{{ store.city }}</text>
</view>
</view>
</view>
<view v-if="store.description" class="subpage-card">
<view class="section-head">
<text class="section-title">门店介绍</text>
</view>
<view class="soft-panel note-panel">
<text class="note-desc">{{ store.description }}</text>
</view>
</view>
<view class="cta-row">
<view class="secondary-button" @tap="openMap">导航前往</view>
<view v-if="store.phone" class="secondary-button" @tap="callStore">联系门店</view>
<view class="primary-button" @tap="bookStore">预约到店</view>
</view>
</view>
</view>
</template>
<script>
import { getPickupStores } from '@/api/mall'
import { normalizeStore } from '@/utils/store'
export default {
data() {
return {
storeId: '',
store: {
id: '',
name: '门店详情',
city: '',
address: '',
phone: '',
hours: '',
description: '',
cover: '',
latitude: null,
longitude: null
}
}
},
onLoad(options) {
this.storeId = options && options.id ? String(options.id) : ''
this.loadStore()
},
methods: {
loadStore() {
getPickupStores({})
.then((list) => {
const rows = Array.isArray(list) ? list : []
const found = rows.find(item => String(item.id) === this.storeId) || rows[0]
if (found) {
this.store = normalizeStore(found)
}
})
.catch(() => {})
},
goBack() {
uni.navigateBack({
fail: () => {
uni.redirectTo({ url: '/packageBooking/stores/stores' })
}
})
},
callStore() {
if (!this.store.phone) return
uni.makePhoneCall({ phoneNumber: String(this.store.phone) })
},
openMap() {
if (this.store.latitude === null || this.store.longitude === null) {
uni.showToast({ title: '该门店暂无坐标,无法导航', icon: 'none' })
return
}
uni.openLocation({
latitude: this.store.latitude,
longitude: this.store.longitude,
name: this.store.name,
address: this.store.address || ''
})
},
bookStore() {
uni.redirectTo({ url: `/pages/booking/booking?storeId=${this.store.id}` })
}
}
}
</script>
<style lang="scss" scoped>
@import '@/styles/mixins.scss';
@import '@/styles/subpage.scss';
.detail-hero {
position: relative;
overflow: hidden;
min-height: 360rpx;
margin-bottom: 28rpx;
transition: transform 360ms cubic-bezier(0.22, 1, 0.36, 1), box-shadow 360ms ease;
}
.detail-hero:active {
transform: translateY(-4rpx);
}
.hero-image,
.hero-overlay {
position: absolute;
inset: 0;
width: 100%;
height: 100%;
}
.hero-overlay {
background: linear-gradient(180deg, rgba(36, 74, 61, 0.08), rgba(36, 74, 61, 0.34));
}
.hero-image {
transition: transform 1.2s ease;
}
.detail-hero:active .hero-image {
transform: scale(1.05);
}
.detail-hero::after {
content: '';
position: absolute;
right: -80rpx;
top: -40rpx;
width: 260rpx;
height: 260rpx;
border-radius: 50%;
background: radial-gradient(circle, rgba(255, 255, 255, 0.26), rgba(255, 255, 255, 0));
animation: lfFloatSoft 11.6s ease-in-out infinite;
}
.hero-content {
position: relative;
z-index: 2;
padding: 210rpx 34rpx 34rpx;
}
.hero-kicker {
color: rgba(255, 255, 255, 0.86);
}
.hero-title {
color: #fff;
}
.hero-desc {
color: rgba(255, 255, 255, 0.82);
}
.note-panel {
margin-top: 26rpx;
}
.note-title {
display: block;
font-size: 28rpx;
font-weight: 600;
color: $brand-primary-deep;
}
.note-desc {
display: block;
margin-top: 12rpx;
font-size: 24rpx;
line-height: 1.8;
color: $text-secondary;
}
</style>