功能(小程序):同步用户体验流程到小程序
This commit is contained in:
@@ -57,6 +57,7 @@ Page({
|
||||
needSetPassword: false,
|
||||
userInfo: null,
|
||||
orderCount: 0,
|
||||
pendingReviewCount: 0,
|
||||
couponCount: 0,
|
||||
wishlistCount: 0,
|
||||
unreadMessageCount: 0,
|
||||
@@ -96,18 +97,20 @@ Page({
|
||||
}
|
||||
|
||||
try {
|
||||
const [userInfo, orders, coupons, wishlist, unreadMessages] = await Promise.all([
|
||||
const [userInfo, orders, coupons, wishlist, unreadMessages, pendingReviews] = await Promise.all([
|
||||
userApi.getUserInfo(),
|
||||
orderApi.getOrderList(),
|
||||
couponApi.listUserCoupons(),
|
||||
wishlistApi.getWishlist(),
|
||||
userApi.getMyUnreadMessageCount()
|
||||
userApi.getMyUnreadMessageCount(),
|
||||
orderApi.listMyPendingReviews().catch(() => [])
|
||||
])
|
||||
|
||||
getApp().refreshUserInfo(userInfo)
|
||||
this.setData({
|
||||
userInfo,
|
||||
orderCount: Array.isArray(orders) ? orders.length : 0,
|
||||
pendingReviewCount: Array.isArray(pendingReviews) ? pendingReviews.length : 0,
|
||||
couponCount: Array.isArray(coupons) ? coupons.length : 0,
|
||||
wishlistCount: Array.isArray(wishlist) ? wishlist.length : 0,
|
||||
unreadMessageCount: Number((unreadMessages && unreadMessages.unreadCount) || 0)
|
||||
@@ -160,6 +163,20 @@ Page({
|
||||
navigation.navigate('/pages/orders/index')
|
||||
},
|
||||
|
||||
/**
|
||||
* Purpose: handleOpenPendingReviews jumps straight to the order-page pending review focus.
|
||||
* Usage: bind the pending-review card in profile WXML.
|
||||
*/
|
||||
handleOpenPendingReviews() {
|
||||
if (!navigation.ensureLogin('查看待评价')) {
|
||||
return
|
||||
}
|
||||
navigation.navigate('/pages/orders/index', {
|
||||
review: 'pending',
|
||||
source: 'profile'
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
* `handleOpenWishlist` page method. Use this from WXML event bindings or lifecycle hooks.
|
||||
* Call guide: read or update page data with `this.setData(...)` inside the method when state changes.
|
||||
|
||||
@@ -37,6 +37,10 @@
|
||||
<text class="summary-value">{{couponCount}}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view wx:if="{{pendingReviewCount > 0}}" class="pending-review-card" bindtap="handleOpenPendingReviews">
|
||||
<text>待评价 {{pendingReviewCount}}</text>
|
||||
<text>给服务过你的美甲师一点反馈</text>
|
||||
</view>
|
||||
|
||||
<view class="shop-box" bindtap="handleSwitchShop">
|
||||
<view>
|
||||
@@ -57,6 +61,7 @@
|
||||
<view class="section-title">常用入口</view>
|
||||
<view class="menu-item" bindtap="handleOpenOrders">
|
||||
<text>我的订单</text>
|
||||
<text wx:if="{{pendingReviewCount > 0}}" class="menu-badge">待评价 {{pendingReviewCount}}</text>
|
||||
<text class="menu-arrow">></text>
|
||||
</view>
|
||||
<view class="menu-item" bindtap="handleOpenWishlist">
|
||||
|
||||
@@ -94,6 +94,23 @@
|
||||
margin-top: 26rpx;
|
||||
}
|
||||
|
||||
.pending-review-card {
|
||||
display: grid;
|
||||
gap: 8rpx;
|
||||
margin-top: 22rpx;
|
||||
padding: 20rpx 24rpx;
|
||||
border-radius: 20rpx;
|
||||
background: var(--theme-primary-soft);
|
||||
color: #8d7a84;
|
||||
font-size: 24rpx;
|
||||
}
|
||||
|
||||
.pending-review-card text:first-child {
|
||||
color: var(--theme-primary);
|
||||
font-size: 28rpx;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.shop-box {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
Reference in New Issue
Block a user