功能(网页):新增客户体验流程

This commit is contained in:
xiaowang
2026-05-23 21:56:18 +08:00
parent c2c985b2f8
commit 861eea933b
28 changed files with 2236 additions and 108 deletions
+38 -2
View File
@@ -83,6 +83,10 @@
</div>
</a-col>
</a-row>
<button v-if="pendingReviewCount > 0" class="pending-review-card" type="button" @click="openPendingReviews">
<span>待评价 {{ pendingReviewCount }}</span>
<small>给服务过你的美甲师一点反馈</small>
</button>
</a-card>
</div>
@@ -260,6 +264,8 @@ const needSetPassword = ref(false)
const hasNotification = ref(false)
/** unreadMessageCount is a reactive state variable used by the template and event handlers. */
const unreadMessageCount = ref(0)
/** pendingReviewCount is the number of completed services waiting for customer review. */
const pendingReviewCount = ref(0)
/** orderCount is a reactive state variable used by the template and event handlers. */
const orderCount = ref(0)
/** couponCount is a reactive state variable used by the template and event handlers. */
@@ -484,16 +490,18 @@ const fetchUserInfo = async () => {
const loadCounts = async () => {
try {
const orderListRequest = isServiceUser.value ? orderApi.getArtistOrders() : orderApi.getOrderList()
const [orders, coupons, wishlist, unreadMessages] = await Promise.all([
const [orders, coupons, wishlist, unreadMessages, pendingReviews] = await Promise.all([
orderListRequest,
couponApi.listUserCoupons(),
wishlistApi.getWishlist(),
userApi.getMyUnreadMessageCount()
userApi.getMyUnreadMessageCount(),
isServiceUser.value ? Promise.resolve([]) : orderApi.getMyPendingReviews().catch(() => [])
])
orderCount.value = Array.isArray(orders) ? orders.length : 0
couponCount.value = Array.isArray(coupons) ? coupons.length : 0
wishlistCount.value = Array.isArray(wishlist) ? wishlist.length : 0
unreadMessageCount.value = Number(unreadMessages?.unreadCount || 0)
pendingReviewCount.value = Array.isArray(pendingReviews) ? pendingReviews.length : 0
hasNotification.value = unreadMessageCount.value > 0
} catch (error) {
console.error('加载个人中心统计失败:', error)
@@ -505,6 +513,11 @@ const openOrders = () => {
router.push(isServiceUser.value ? '/artist-orders' : '/orders')
}
/** openPendingReviews jumps directly to the first pending review on the order page. */
const openPendingReviews = () => {
router.push('/orders?review=pending&source=profile')
}
/** handleEditProfile is a local helper used by this page script. */
const handleEditProfile = () => {
avatarUploadTask?.cancel()
@@ -911,6 +924,29 @@ onMounted(async () => {
padding: 20px 16px;
}
.pending-review-card {
display: grid;
gap: 4px;
width: 100%;
margin-top: 18px;
padding: 12px 14px;
border: 1px solid var(--theme-border);
border-radius: 8px;
background: var(--theme-primary-soft);
color: var(--text-primary);
text-align: left;
cursor: pointer;
}
.pending-review-card span {
color: var(--theme-primary);
font-weight: 700;
}
.pending-review-card small {
color: var(--text-secondary);
}
.stat-item {
display: flex;
flex-direction: column;