Blame view

member-miniapp/pages/mall/mall.vue 12.8 KB
5f2c4d97   “wangming”   Add billing amoun...
1
  <template>
5c34676a   “wangming”   对会员端进行了设计
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
    <view class="page-shell mall-page">
      <view class="page-blur"></view>
      <view class="page-blur-secondary"></view>
      <view class="page-blur-tertiary"></view>
  
      <view class="page-content">
        <view class="mall-header capsule-safe">
          <view>
            <text class="mall-title">美容商城</text>
            <text class="mall-subtitle">把门店里的护理感,慢慢带回日常。</text>
          </view>
        </view>
  
        <view class="feature-card glass-card">
          <view class="feature-copy">
            <text class="feature-tag">CURATED COLLECTION</text>
            <text class="feature-title">把门店里的护理感带回家</text>
            <text class="feature-desc">按当下所需慢慢挑选,在轻盈的双列陈列里,找到适合自己的护理好物。</text>
          </view>
          <view class="feature-art-wrap">
            <image class="feature-art" src="/static/images/art-home.png" mode="aspectFill" />
          </view>
        </view>
  
        <view class="search-card glass-card">
          <view class="search-icon"></view>
          <input
            v-model="searchKeyword"
            class="search-input"
            placeholder="搜索精华、面膜、身体护理、香氛好物"
            placeholder-class="search-placeholder"
            confirm-type="search"
          />
        </view>
  
        <view class="category-row">
          <view
            v-for="item in categories"
            :key="item"
            class="category-chip"
            :class="{ active: activeCategory === item }"
            @tap="activeCategory = item"
          >
            {{ item }}
          </view>
        </view>
  
        <view class="section-head product-head">
          <text class="section-title">甄选好物</text>
          <text class="section-link">{{ filteredProducts.length }} 件在售</text>
        </view>
  
        <view v-if="filteredProducts.length" class="waterfall">
          <view class="waterfall-col">
            <view
              v-for="product in leftProducts"
              :key="product.name"
              class="product-card glass-card"
              @tap="previewProduct(product)"
            >
              <view class="product-cover" :style="product.coverStyle">
                <image class="product-photo" :src="product.image" mode="aspectFill" />
                <view class="product-cover-mask"></view>
                <text class="product-badge">{{ product.badge }}</text>
                <text class="product-cover-title">{{ product.coverTitle }}</text>
              </view>
              <view class="product-body">
                <text class="product-name">{{ product.name }}</text>
                <view class="product-tags">
                  <text v-for="tag in product.tags" :key="tag" class="product-tag">{{ tag }}</text>
                </view>
                <view class="product-footer">
                  <view>
                    <text class="price-symbol">¥</text>
                    <text class="product-price">{{ product.price }}</text>
                  </view>
                  <text class="product-sales">已售 {{ product.sales }}</text>
                </view>
              </view>
            </view>
          </view>
  
          <view class="waterfall-col">
            <view
              v-for="product in rightProducts"
              :key="product.name"
              class="product-card glass-card"
              @tap="previewProduct(product)"
            >
              <view class="product-cover" :style="product.coverStyle">
                <image class="product-photo" :src="product.image" mode="aspectFill" />
                <view class="product-cover-mask"></view>
                <text class="product-badge">{{ product.badge }}</text>
                <text class="product-cover-title">{{ product.coverTitle }}</text>
              </view>
              <view class="product-body">
                <text class="product-name">{{ product.name }}</text>
                <view class="product-tags">
                  <text v-for="tag in product.tags" :key="tag" class="product-tag">{{ tag }}</text>
                </view>
                <view class="product-footer">
                  <view>
                    <text class="price-symbol">¥</text>
                    <text class="product-price">{{ product.price }}</text>
                  </view>
                  <text class="product-sales">已售 {{ product.sales }}</text>
                </view>
              </view>
            </view>
          </view>
        </view>
  
        <view v-else class="empty-card glass-card">
          <text class="empty-title">暂未找到相关商品</text>
          <text class="empty-desc">可以换个关键词,或切换分类继续看看。</text>
        </view>
  
        <view class="safe-bottom-space"></view>
      </view>
  
      <view class="lf-tabbar-wrap">
        <view class="lf-tabbar-panel">
          <view
            v-for="item in tabs"
            :key="item.key"
            class="lf-tabbar-item"
            :class="{ active: item.key === 'mall' }"
            @tap="goTab(item)"
          >
            <view class="lf-tabbar-icon-shell">
              <image
                class="lf-tabbar-icon"
                :src="item.key === 'mall' ? item.activeIcon : item.icon"
                mode="aspectFit"
              />
            </view>
            <text class="lf-tabbar-label">{{ item.label }}</text>
          </view>
        </view>
      </view>
    </view>
5f2c4d97   “wangming”   Add billing amoun...
143
144
145
  </template>
  
  <script>
5c34676a   “wangming”   对会员端进行了设计
146
  import { products } from '@/packageMall/data/products'
5f2c4d97   “wangming”   Add billing amoun...
147
148
  
  export default {
5c34676a   “wangming”   对会员端进行了设计
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
    data() {
      return {
        tabs: [
          {
            key: 'home',
            label: '首页',
            path: '/pages/home/home',
            icon: '/static/images/tab-home.png',
            activeIcon: '/static/images/tab-home-active.png'
          },
          {
            key: 'booking',
            label: '预约',
            path: '/pages/booking/booking',
            icon: '/static/images/tab-booking.png',
            activeIcon: '/static/images/tab-booking-active.png'
          },
          {
            key: 'mall',
            label: '商城',
            path: '/packageMall/main/main',
            icon: '/static/images/tab-mall.png',
            activeIcon: '/static/images/tab-mall-active.png'
          },
          {
            key: 'profile',
            label: '我的',
            path: '/pages/profile/profile',
            icon: '/static/images/tab-profile.png',
            activeIcon: '/static/images/tab-profile-active.png'
          }
        ],
        activeCategory: '推荐',
        searchKeyword: '',
        categories: ['推荐', '新品', '面部护理', '身体护理', '香氛好物'],
        products
      }
    },
    computed: {
      filteredProducts() {
        const categoryList = this.activeCategory === '推荐'
          ? this.products.filter(item => item.categories.indexOf('推荐') > -1)
          : this.products.filter(item => item.categories.indexOf(this.activeCategory) > -1)
  
        const keyword = String(this.searchKeyword || '').trim()
        if (!keyword) {
          return categoryList
        }
  
        return categoryList.filter(item =>
          item.name.indexOf(keyword) > -1 ||
          item.coverTitle.indexOf(keyword) > -1 ||
          item.tags.join(' ').indexOf(keyword) > -1 ||
          item.categories.join(' ').indexOf(keyword) > -1
        )
      },
      distributedColumns() {
        const columns = [
          { height: 0, items: [] },
          { height: 0, items: [] }
        ]
        this.filteredProducts.forEach((product) => {
          const target = columns[0].height <= columns[1].height ? columns[0] : columns[1]
          target.items.push(product)
          target.height += product.height
        })
        return columns
      },
      leftProducts() {
        return this.distributedColumns[0].items
      },
      rightProducts() {
        return this.distributedColumns[1].items
      }
    },
    methods: {
      previewProduct(product) {
        uni.navigateTo({
          url: `/packageMall/product-detail/product-detail?id=${product.id}`
        })
      },
      goTab(item) {
        if (item.key === 'mall') {
          return
        }
        uni.redirectTo({
          url: item.path
        })
      }
    }
5f2c4d97   “wangming”   Add billing amoun...
239
240
241
242
  }
  </script>
  
  <style lang="scss" scoped>
5c34676a   “wangming”   对会员端进行了设计
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
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
  @import '@/styles/mixins.scss';
  
  .mall-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 28rpx;
  }
  
  .mall-title {
    display: block;
    font-size: 44rpx;
    font-weight: 700;
  }
  
  .mall-subtitle {
    display: block;
    margin-top: 10rpx;
    font-size: 24rpx;
    color: $text-secondary;
    line-height: 1.7;
  }
  
  .feature-card {
    position: relative;
    overflow: hidden;
    min-height: 260rpx;
    margin-bottom: 28rpx;
    padding: 34rpx;
  
    &::after {
      content: '';
      position: absolute;
      right: -82rpx;
      top: -10rpx;
      width: 380rpx;
      height: 380rpx;
      border-radius: 50%;
      background: radial-gradient(circle, rgba(100, 140, 118, 0.04), rgba(100, 140, 118, 0));
      z-index: 0;
    }
  
    &::before {
      content: '';
      position: absolute;
      right: 6rpx;
      top: 60rpx;
      width: 220rpx;
      height: 220rpx;
      border-radius: 50%;
      border: 2rpx solid rgba(100, 140, 118, 0.035);
      z-index: 1;
    }
  }
  
  .feature-copy {
    position: relative;
    z-index: 3;
    max-width: 100%;
    padding-right: 36rpx;
  }
  
  .feature-tag {
    display: inline-block;
    font-size: 20rpx;
    letter-spacing: 3rpx;
    color: $brand-primary;
  }
  
  .feature-title {
    display: block;
    margin: 16rpx 0 12rpx;
    font-size: 40rpx;
    font-weight: 700;
    line-height: 1.35;
  }
  
  .feature-desc {
    display: block;
    font-size: 24rpx;
    color: $text-secondary;
    line-height: 1.8;
  }
  
  .feature-art-wrap {
    position: absolute;
    right: -118rpx;
    top: -34rpx;
    z-index: 1;
    width: 420rpx;
    height: 420rpx;
    border-radius: 50%;
    overflow: hidden;
    opacity: 0.08;
    pointer-events: none;
  
    &::after {
      content: '';
      position: absolute;
      inset: 0;
      background: radial-gradient(circle at 34% 40%, rgba(255, 255, 255, 0.40), rgba(255, 255, 255, 0.12) 44%, rgba(255, 255, 255, 0));
    }
  }
  
  .feature-art {
    width: 480rpx;
    height: 480rpx;
    margin-left: -38rpx;
    margin-top: -28rpx;
    transform: rotate(-10deg) scale(1.04);
    filter: saturate(0.72) brightness(1.04);
  }
  
  .search-card {
    @include outlined-card(0.92);
    display: flex;
    align-items: center;
    min-height: 92rpx;
    margin-bottom: 24rpx;
    padding: 0 26rpx;
  }
  
  .search-icon {
    position: relative;
    width: 36rpx;
    height: 36rpx;
    margin-right: 18rpx;
    border: 3rpx solid rgba(182, 142, 154, 0.42);
    border-radius: 50%;
  
    &::after {
      content: '';
      position: absolute;
      width: 16rpx;
      height: 3rpx;
      right: -8rpx;
      bottom: 0;
      background: rgba(182, 142, 154, 0.42);
      transform: rotate(45deg);
      border-radius: 999rpx;
    }
  }
  
  .search-input {
    flex: 1;
    height: 92rpx;
    font-size: 26rpx;
    color: $text-primary;
  }
  
  .search-placeholder {
    color: $text-tertiary;
  }
5f2c4d97   “wangming”   Add billing amoun...
396
  
5c34676a   “wangming”   对会员端进行了设计
397
398
399
400
  .category-row {
    display: flex;
    flex-wrap: wrap;
    margin-bottom: 28rpx;
5f2c4d97   “wangming”   Add billing amoun...
401
402
  }
  
5c34676a   “wangming”   对会员端进行了设计
403
404
405
406
407
408
409
410
  .category-chip {
    padding: 16rpx 28rpx;
    margin: 0 16rpx 16rpx 0;
    border-radius: 999rpx;
    font-size: 24rpx;
    color: $text-secondary;
    background: rgba(255, 255, 255, 0.80);
    border: 1rpx solid rgba(210, 191, 156, 0.14);
5f2c4d97   “wangming”   Add billing amoun...
411
412
  }
  
5c34676a   “wangming”   对会员端进行了设计
413
414
415
416
417
  .category-chip.active {
    color: #fff;
    background: $brand-primary-deep;
    border-color: rgba(210, 191, 156, 0.22);
    box-shadow: $shadow-chip;
5f2c4d97   “wangming”   Add billing amoun...
418
419
  }
  
5c34676a   “wangming”   对会员端进行了设计
420
421
  .product-head {
    margin-bottom: 18rpx;
5f2c4d97   “wangming”   Add billing amoun...
422
423
  }
  
5c34676a   “wangming”   对会员端进行了设计
424
425
426
  .waterfall {
    display: flex;
    justify-content: space-between;
5f2c4d97   “wangming”   Add billing amoun...
427
428
  }
  
5c34676a   “wangming”   对会员端进行了设计
429
430
  .waterfall-col {
    width: calc((100% - 18rpx) / 2);
5f2c4d97   “wangming”   Add billing amoun...
431
432
433
  }
  
  .product-card {
5c34676a   “wangming”   对会员端进行了设计
434
435
436
437
    @include outlined-card(0.92);
    overflow: hidden;
    margin-bottom: 20rpx;
    padding: 0;
5f2c4d97   “wangming”   Add billing amoun...
438
439
  }
  
5c34676a   “wangming”   对会员端进行了设计
440
441
442
443
  .product-cover {
    position: relative;
    padding: 24rpx;
    color: #fff;
5f2c4d97   “wangming”   Add billing amoun...
444
445
  }
  
5c34676a   “wangming”   对会员端进行了设计
446
447
448
449
450
451
452
  .product-photo,
  .product-cover-mask {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
5f2c4d97   “wangming”   Add billing amoun...
453
454
  }
  
5c34676a   “wangming”   对会员端进行了设计
455
456
  .product-cover-mask {
    background: linear-gradient(180deg, rgba(32, 53, 45, 0.02), rgba(32, 53, 45, 0.08) 56%, rgba(32, 53, 45, 0.36) 100%);
5f2c4d97   “wangming”   Add billing amoun...
457
458
  }
  
5c34676a   “wangming”   对会员端进行了设计
459
460
461
462
  .product-badge {
    position: relative;
    z-index: 2;
    @include chip-inverse;
5f2c4d97   “wangming”   Add billing amoun...
463
464
  }
  
5c34676a   “wangming”   对会员端进行了设计
465
466
467
468
469
470
471
472
473
  .product-cover-title {
    position: absolute;
    left: 24rpx;
    right: 24rpx;
    bottom: 24rpx;
    z-index: 2;
    font-size: 34rpx;
    line-height: 1.35;
    font-weight: 700;
5f2c4d97   “wangming”   Add billing amoun...
474
475
  }
  
5c34676a   “wangming”   对会员端进行了设计
476
477
  .product-body {
    padding: 24rpx;
5f2c4d97   “wangming”   Add billing amoun...
478
479
  }
  
5c34676a   “wangming”   对会员端进行了设计
480
481
482
483
484
  .product-name {
    display: block;
    font-size: 30rpx;
    line-height: 1.45;
    font-weight: 700;
5f2c4d97   “wangming”   Add billing amoun...
485
486
  }
  
5c34676a   “wangming”   对会员端进行了设计
487
488
489
490
  .product-tags {
    display: flex;
    flex-wrap: wrap;
    margin-top: 16rpx;
5f2c4d97   “wangming”   Add billing amoun...
491
492
  }
  
5c34676a   “wangming”   对会员端进行了设计
493
494
495
496
497
  .product-tag {
    @include chip-soft;
    margin: 0 12rpx 12rpx 0;
    font-size: 20rpx;
    padding: 8rpx 16rpx;
5f2c4d97   “wangming”   Add billing amoun...
498
499
  }
  
5c34676a   “wangming”   对会员端进行了设计
500
501
  .product-tag:nth-child(2) {
    @include chip-rose;
5f2c4d97   “wangming”   Add billing amoun...
502
503
  }
  
5c34676a   “wangming”   对会员端进行了设计
504
505
506
507
508
  .product-footer {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    margin-top: 12rpx;
5f2c4d97   “wangming”   Add billing amoun...
509
510
  }
  
5c34676a   “wangming”   对会员端进行了设计
511
512
513
514
  .price-symbol,
  .product-price {
    color: $brand-primary-deep;
    font-weight: 700;
5f2c4d97   “wangming”   Add billing amoun...
515
516
  }
  
5c34676a   “wangming”   对会员端进行了设计
517
518
519
  .price-symbol {
    font-size: 22rpx;
    color: $brand-accent;
5f2c4d97   “wangming”   Add billing amoun...
520
521
  }
  
5c34676a   “wangming”   对会员端进行了设计
522
523
  .product-sales {
    color: $brand-rose;
5f2c4d97   “wangming”   Add billing amoun...
524
525
  }
  
5c34676a   “wangming”   对会员端进行了设计
526
527
  .product-price {
    font-size: 38rpx;
5f2c4d97   “wangming”   Add billing amoun...
528
529
  }
  
5c34676a   “wangming”   对会员端进行了设计
530
531
532
  .product-sales {
    font-size: 22rpx;
    color: $text-tertiary;
5f2c4d97   “wangming”   Add billing amoun...
533
534
  }
  
5c34676a   “wangming”   对会员端进行了设计
535
536
537
538
  .empty-card {
    @include outlined-card(0.94);
    padding: 40rpx 32rpx;
    text-align: center;
5f2c4d97   “wangming”   Add billing amoun...
539
540
  }
  
5c34676a   “wangming”   对会员端进行了设计
541
542
543
544
545
  .empty-title {
    display: block;
    font-size: 30rpx;
    font-weight: 700;
    color: $text-primary;
5f2c4d97   “wangming”   Add billing amoun...
546
547
  }
  
5c34676a   “wangming”   对会员端进行了设计
548
549
550
551
552
  .empty-desc {
    display: block;
    margin-top: 12rpx;
    font-size: 24rpx;
    color: $text-secondary;
5f2c4d97   “wangming”   Add billing amoun...
553
554
  }
  </style>