stores.vue
8.71 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
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
<template>
<view class="page-shell store-list-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="store-top-card glass-card">
<text class="hero-kicker">STORE GUIDE</text>
<text class="hero-title">三十余家门店,慢慢挑一间顺路又合心意的</text>
<text class="hero-desc">可以按区域、营业状态或距离轻松筛选,也可以直接搜索门店名与所在片区。</text>
</view>
<view class="search-card glass-card">
<view class="search-icon"></view>
<input
v-model="keyword"
class="search-input"
placeholder="搜索门店名、区域或街道"
placeholder-class="search-placeholder"
confirm-type="search"
/>
</view>
<scroll-view class="filter-scroll" scroll-x>
<view class="filter-row">
<view
v-for="item in filters"
:key="item.key"
class="filter-chip"
:class="{ active: activeFilter === item.key }"
@tap="activeFilter = item.key"
>
{{ item.label }}
</view>
</view>
</scroll-view>
<view class="section-head store-head">
<text class="section-title">为你找到 {{ filteredStores.length }} 家门店</text>
<text class="section-link">{{ headText }}</text>
</view>
<view
v-for="store in filteredStores"
:key="store.id"
class="store-list-card glass-card"
@tap="goDetail(store)"
>
<image class="store-thumb" :src="store.cover" mode="aspectFill" />
<view class="store-main">
<view class="store-title-row">
<text class="store-name">{{ store.name }}</text>
<text class="store-distance">{{ store.distance }}</text>
</view>
<view class="store-tag-row">
<text class="store-chip">{{ store.district }}</text>
<text class="store-chip rose">{{ store.openStatus }}</text>
<text class="store-chip">{{ store.vacancy }}</text>
</view>
<text class="store-address">{{ store.address }}</text>
<text class="store-meta">营业时间 {{ store.hours }}</text>
<view class="store-actions">
<view class="mini-button" @tap.stop="openMap(store)">导航</view>
<view class="mini-button primary-mini" @tap.stop="bookStore(store)">预约</view>
</view>
</view>
</view>
<view v-if="!filteredStores.length" class="subpage-card">
<text class="empty-tip">暂时没有找到合适的门店,换个区域或关键词再看看。</text>
</view>
</view>
</view>
</template>
<script>
import { stores } from '@/data/mock'
export default {
data() {
return {
stores,
keyword: '',
activeFilter: 'all',
filters: [
{ key: 'all', label: '全部' },
{ key: 'near', label: '离我较近' },
{ key: 'open', label: '营业中' },
{ key: '锦江', label: '锦江' },
{ key: '武侯', label: '武侯' },
{ key: '高新', label: '高新' }
]
}
},
computed: {
filteredStores() {
let list = this.stores.slice()
if (this.activeFilter === 'near') {
list = list.filter(item => parseFloat(item.distance) <= 3.5)
} else if (this.activeFilter === 'open') {
list = list.filter(item => item.openStatus === '营业中')
} else if (this.activeFilter !== 'all') {
list = list.filter(item => item.district === this.activeFilter)
}
const keyword = String(this.keyword || '').trim()
if (!keyword) {
return list
}
return list.filter(item =>
item.name.indexOf(keyword) > -1 ||
item.district.indexOf(keyword) > -1 ||
item.address.indexOf(keyword) > -1
)
},
headText() {
if (this.activeFilter === 'near') {
return '离你更近'
}
if (this.activeFilter === 'open') {
return '正在营业'
}
if (this.activeFilter !== 'all') {
return `${this.activeFilter}片区`
}
return '可按区域筛选'
}
},
methods: {
goBack() {
uni.navigateBack({
fail: () => {
uni.redirectTo({ url: '/pages/home/home' })
}
})
},
goDetail(store) {
uni.navigateTo({
url: `/packageBooking/store-detail/store-detail?id=${store.id}`
})
},
openMap(store) {
uni.showToast({ title: `已为你准备 ${store.name} 导航`, icon: 'none' })
},
bookStore(store) {
uni.redirectTo({ url: `/pages/booking/booking?storeId=${store.id}` })
}
}
}
</script>
<style lang="scss" scoped>
@import '@/styles/mixins.scss';
@import '@/styles/subpage.scss';
.store-top-card {
padding: 34rpx;
margin-bottom: 24rpx;
transition: transform 340ms cubic-bezier(0.22, 1, 0.36, 1), box-shadow 340ms ease;
}
.store-top-card:active {
transform: translateY(-4rpx);
}
.search-card {
display: flex;
align-items: center;
padding: 0 24rpx;
min-height: 92rpx;
margin-bottom: 20rpx;
transition: transform 320ms cubic-bezier(0.22, 1, 0.36, 1), box-shadow 320ms ease;
}
.search-card:active {
transform: translateY(-3rpx);
}
.search-icon {
width: 34rpx;
height: 34rpx;
margin-right: 16rpx;
border: 3rpx solid rgba(100, 140, 118, 0.52);
border-radius: 50%;
position: relative;
}
.search-icon::after {
content: '';
position: absolute;
right: -10rpx;
bottom: -7rpx;
width: 14rpx;
height: 3rpx;
border-radius: 999rpx;
background: rgba(100, 140, 118, 0.52);
transform: rotate(45deg);
}
.search-input {
flex: 1;
height: 92rpx;
font-size: 26rpx;
color: $text-primary;
}
.search-placeholder {
color: $text-tertiary;
}
.filter-scroll {
white-space: nowrap;
margin-bottom: 20rpx;
}
.filter-row {
display: inline-flex;
padding-bottom: 6rpx;
}
.filter-chip {
@include selection-chip;
min-width: 136rpx;
padding: 20rpx 26rpx;
margin-right: 16rpx;
text-align: center;
font-size: 24rpx;
color: $text-secondary;
transition: transform 240ms ease, box-shadow 240ms ease, background 240ms ease, color 240ms ease;
}
.filter-chip:active {
transform: translateY(-2rpx) scale(0.98);
}
.filter-chip.active {
@include selection-chip-active;
}
.store-head {
margin-bottom: 20rpx;
}
.store-list-card {
display: flex;
padding: 24rpx;
margin-bottom: 18rpx;
transition: transform 340ms cubic-bezier(0.22, 1, 0.36, 1), box-shadow 340ms ease;
animation: lfRevealUp 760ms cubic-bezier(0.22, 1, 0.36, 1) both;
}
.store-list-card:nth-of-type(1) { animation-delay: 0.08s; }
.store-list-card:nth-of-type(2) { animation-delay: 0.16s; }
.store-list-card:nth-of-type(3) { animation-delay: 0.24s; }
.store-list-card:nth-of-type(4) { animation-delay: 0.32s; }
.store-list-card:active {
transform: translateY(-5rpx);
}
.store-thumb {
width: 176rpx;
height: 176rpx;
border-radius: 28rpx;
flex-shrink: 0;
transition: transform 1.1s ease;
}
.store-list-card:active .store-thumb {
transform: scale(1.04);
}
.store-main {
flex: 1;
margin-left: 20rpx;
}
.store-title-row {
display: flex;
justify-content: space-between;
gap: 16rpx;
align-items: flex-start;
}
.store-name {
flex: 1;
font-size: 30rpx;
line-height: 1.45;
font-weight: 700;
color: $text-primary;
}
.store-distance {
font-size: 22rpx;
color: $brand-accent;
white-space: nowrap;
}
.store-tag-row {
display: flex;
flex-wrap: wrap;
gap: 10rpx;
margin-top: 12rpx;
}
.store-chip {
@include chip-soft;
padding: 8rpx 16rpx;
font-size: 20rpx;
transition: transform 240ms ease;
}
.store-chip.rose {
@include chip-rose;
padding: 8rpx 16rpx;
font-size: 20rpx;
}
.store-address,
.store-meta {
display: block;
font-size: 23rpx;
line-height: 1.7;
color: $text-secondary;
}
.store-address {
margin-top: 14rpx;
}
.store-meta {
margin-top: 4rpx;
}
.store-actions {
display: flex;
gap: 12rpx;
margin-top: 16rpx;
}
.mini-button {
@include secondary-button;
flex: 1;
min-width: 0;
height: 70rpx;
font-size: 24rpx;
letter-spacing: 1rpx;
transition: transform 240ms ease, box-shadow 240ms ease;
}
.mini-button:active {
transform: scale(0.97);
box-shadow: 0 10rpx 20rpx rgba(54, 77, 64, 0.08);
}
.primary-mini {
color: #fff;
background: $brand-primary-deep;
}
</style>