index.vue
11.8 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
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
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
<template>
<view class="profile-page">
<!-- 用户信息卡片 -->
<view class="user-card">
<view class="user-info">
<image :src="userInfo.avatar" class="user-avatar" mode="aspectFill" />
<view class="user-details">
<text class="user-name">{{ userInfo.name }}</text>
<text class="user-school">{{ userInfo.school }}</text>
<view class="user-stats">
<text class="stat-item">信用分: {{ userInfo.creditScore }}</text>
<text class="stat-item">成交: {{ userInfo.dealCount }}笔</text>
</view>
</view>
</view>
<view class="edit-btn" @click="onEditProfile">
<Edit size="20" color="#f97316" />
</view>
</view>
<!-- 我的车辆 -->
<view class="section">
<view class="section-header">
<text class="section-title">我的车辆</text>
</view>
<view class="vehicle-stats">
<view class="stat-card" @click="onMyVehicles('selling')">
<text class="stat-number">{{ vehicleStats.selling }}</text>
<text class="stat-label">在售</text>
</view>
<view class="stat-card" @click="onMyVehicles('sold')">
<text class="stat-number">{{ vehicleStats.sold }}</text>
<text class="stat-label">已售</text>
</view>
<view class="stat-card" @click="onMyFavorites">
<text class="stat-number">{{ vehicleStats.favorites }}</text>
<text class="stat-label">收藏</text>
</view>
</view>
</view>
<!-- 功能菜单 -->
<view class="menu-section">
<view class="menu-item" @click="onOrderManagement">
<view class="menu-icon">
<Cart size="20" color="#f97316" />
</view>
<text class="menu-text">订单管理</text>
<Right size="16" color="#9ca3af" />
</view>
<view class="menu-item" @click="onCertification">
<view class="menu-icon">
<Service size="20" color="#f97316" />
</view>
<text class="menu-text">车辆认证</text>
<view class="certification-badge">
<text class="badge-text">{{ userInfo.isCertified ? '已认证' : '未认证' }}</text>
</view>
<Right size="16" color="#9ca3af" />
</view>
<view class="menu-item" @click="onWallet">
<view class="menu-icon">
<Shop size="20" color="#f97316" />
</view>
<text class="menu-text">我的钱包</text>
<text class="wallet-balance">¥{{ userInfo.balance }}</text>
<Right size="16" color="#9ca3af" />
</view>
<view class="menu-item" @click="onAddress">
<view class="menu-icon">
<Location size="20" color="#f97316" />
</view>
<text class="menu-text">收货地址</text>
<Right size="16" color="#9ca3af" />
</view>
</view>
<!-- 服务菜单 -->
<view class="menu-section">
<view class="menu-item" @click="onCustomerService">
<view class="menu-icon">
<Voice size="20" color="#f97316" />
</view>
<text class="menu-text">客服中心</text>
<Right size="16" color="#9ca3af" />
</view>
<view class="menu-item" @click="onFeedback">
<view class="menu-icon">
<Message size="20" color="#f97316" />
</view>
<text class="menu-text">意见反馈</text>
<Right size="16" color="#9ca3af" />
</view>
<view class="menu-item" @click="onAbout">
<view class="menu-icon">
<Tips size="20" color="#f97316" />
</view>
<text class="menu-text">关于我们</text>
<Right size="16" color="#9ca3af" />
</view>
</view>
<!-- 设置菜单 -->
<view class="menu-section">
<view class="menu-item" @click="onSettings">
<view class="menu-icon">
<Setting size="20" color="#f97316" />
</view>
<text class="menu-text">设置</text>
<Right size="16" color="#9ca3af" />
</view>
</view>
<!-- 退出登录 -->
<view class="logout-section">
<button class="logout-btn" @click="onLogout">退出登录</button>
</view>
<!-- 自定义TabBar -->
<TabBar />
</view>
</template>
<script setup>
import { ref } from 'vue'
import {
Edit, Right, Cart, Service, Shop, Location,
Voice, Message, Tips, Setting
} from '@nutui/icons-vue-taro'
import Taro from '@tarojs/taro'
import TabBar from '@/components/TabBar.vue'
// 用户信息
const userInfo = ref({
name: '张同学',
school: '清华大学',
avatar: 'https://images.unsplash.com/photo-1535713875002-d1d0cf377fde?w=100&h=100&fit=crop&crop=face',
creditScore: 95,
dealCount: 12,
isCertified: true,
balance: 1580.50
})
// 车辆统计
const vehicleStats = ref({
selling: 3,
sold: 8,
favorites: 15
})
/**
* 编辑个人资料
*/
const onEditProfile = () => {
Taro.navigateTo({
url: '/pages/edit-profile/index'
})
}
/**
* 我的车辆
* @param {string} type - 车辆类型
*/
const onMyVehicles = (type) => {
Taro.navigateTo({
url: `/pages/my-vehicles/index?type=${type}`
})
}
/**
* 我的收藏
*/
const onMyFavorites = () => {
Taro.navigateTo({
url: '/pages/my-favorites/index'
})
}
/**
* 订单管理
*/
const onOrderManagement = () => {
Taro.navigateTo({
url: '/pages/order-management/index'
})
}
/**
* 车辆认证
*/
const onCertification = () => {
if (userInfo.value.isCertified) {
Taro.navigateTo({
url: '/pages/certification-status/index'
})
} else {
Taro.navigateTo({
url: '/pages/certification-apply/index'
})
}
}
/**
* 我的钱包
*/
const onWallet = () => {
Taro.navigateTo({
url: '/pages/wallet/index'
})
}
/**
* 收货地址
*/
const onAddress = () => {
Taro.navigateTo({
url: '/pages/address/index'
})
}
/**
* 客服中心
*/
const onCustomerService = () => {
Taro.showActionSheet({
itemList: ['在线客服', '电话客服', '常见问题'],
success: (res) => {
if (res.tapIndex === 0) {
// 在线客服
Taro.navigateTo({
url: '/pages/online-service/index'
})
} else if (res.tapIndex === 1) {
// 电话客服
Taro.makePhoneCall({
phoneNumber: '400-123-4567'
})
} else if (res.tapIndex === 2) {
// 常见问题
Taro.navigateTo({
url: '/pages/faq/index'
})
}
}
})
}
/**
* 意见反馈
*/
const onFeedback = () => {
Taro.navigateTo({
url: '/pages/feedback/index'
})
}
/**
* 关于我们
*/
const onAbout = () => {
Taro.navigateTo({
url: '/pages/about/index'
})
}
/**
* 设置
*/
const onSettings = () => {
Taro.navigateTo({
url: '/pages/settings/index'
})
}
/**
* 退出登录
*/
const onLogout = () => {
Taro.showModal({
title: '确认退出',
content: '确定要退出登录吗?',
success: (res) => {
if (res.confirm) {
// 清除用户数据
Taro.clearStorageSync()
// 跳转到登录页
Taro.redirectTo({
url: '/pages/auth/index'
})
Taro.showToast({
title: '已退出登录',
icon: 'success'
})
}
}
})
}
</script>
<style lang="less">
.profile-page {
min-height: 100vh;
background-color: #f9fafb;
padding-bottom: 100px;
}
.user-card {
background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
padding: 24px 16px;
display: flex;
justify-content: space-between;
align-items: center;
}
.user-info {
display: flex;
align-items: center;
flex: 1;
}
.user-avatar {
width: 64px;
height: 64px;
border-radius: 50%;
object-fit: cover;
border: 3px solid rgba(255, 255, 255, 0.3);
margin-right: 16px;
}
.user-details {
flex: 1;
}
.user-name {
font-size: 20px;
font-weight: 600;
color: #ffffff;
display: block;
margin-bottom: 4px;
}
.user-school {
font-size: 14px;
color: rgba(255, 255, 255, 0.8);
display: block;
margin-bottom: 8px;
}
.user-stats {
display: flex;
gap: 16px;
}
.stat-item {
font-size: 12px;
color: rgba(255, 255, 255, 0.9);
background-color: rgba(255, 255, 255, 0.2);
padding: 4px 8px;
border-radius: 12px;
}
.edit-btn {
width: 40px;
height: 40px;
background-color: rgba(255, 255, 255, 0.2);
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
transition: all 0.2s;
}
.edit-btn:active {
transform: scale(0.95);
background-color: rgba(255, 255, 255, 0.3);
}
.section {
background-color: #ffffff;
margin: 12px 16px;
border-radius: 12px;
padding: 20px;
}
.section-header {
margin-bottom: 16px;
}
.section-title {
font-size: 18px;
font-weight: 600;
color: #111827;
display: block;
}
.vehicle-stats {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 16px;
}
.stat-card {
text-align: center;
padding: 16px 8px;
background-color: #fef7ed;
border-radius: 8px;
border: 1px solid #fed7aa;
transition: all 0.2s;
}
.stat-card:active {
transform: scale(0.95);
background-color: #fef3e2;
}
.stat-number {
font-size: 24px;
font-weight: 700;
color: #f97316;
display: block;
margin-bottom: 4px;
}
.stat-label {
font-size: 14px;
color: #6b7280;
display: block;
}
.menu-section {
background-color: #ffffff;
margin: 12px 16px;
border-radius: 12px;
overflow: hidden;
}
.menu-item {
display: flex;
align-items: center;
padding: 16px 20px;
border-bottom: 1px solid #f3f4f6;
transition: background-color 0.2s;
}
.menu-item:last-child {
border-bottom: none;
}
.menu-item:active {
background-color: #f9fafb;
}
.menu-icon {
width: 40px;
height: 40px;
background-color: #fef7ed;
border-radius: 8px;
display: flex;
align-items: center;
justify-content: center;
margin-right: 12px;
}
.menu-text {
flex: 1;
font-size: 16px;
color: #374151;
}
.certification-badge {
margin-right: 8px;
}
.badge-text {
font-size: 12px;
color: #059669;
background-color: #d1fae5;
padding: 4px 8px;
border-radius: 12px;
}
.wallet-balance {
font-size: 16px;
font-weight: 600;
color: #f97316;
margin-right: 8px;
}
.logout-section {
margin: 24px 16px;
}
.logout-btn {
width: 100%;
padding: 16px;
background-color: #ffffff;
border: 1px solid #f87171;
border-radius: 12px;
color: #ef4444;
font-size: 16px;
font-weight: 500;
transition: all 0.2s;
}
.logout-btn:active {
background-color: #fef2f2;
transform: scale(0.98);
}
</style>