功能:新增下一阶段运营能力和生产部署
This commit is contained in:
@@ -13,6 +13,7 @@ const couponApi = require('../../api/coupon')
|
||||
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
|
||||
*/
|
||||
const orderApi = require('../../api/order')
|
||||
const growthApi = require('../../api/growth')
|
||||
/**
|
||||
* Purpose: userApi supports index.js by holding or executing the user api page or API role.
|
||||
* Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow.
|
||||
@@ -46,6 +47,18 @@ const theme = require('../../utils/theme')
|
||||
const { DEFAULT_AVATAR } = require('../../utils/config')
|
||||
const { runWithLoading } = require('../../utils/loading')
|
||||
|
||||
function formatGrowthSummary(summary) {
|
||||
if (!summary) {
|
||||
return null
|
||||
}
|
||||
return {
|
||||
levelName: summary.levelName || '成长新客',
|
||||
growthValue: Number(summary.growthValue || 0),
|
||||
appointmentCount: Number(summary.appointmentCount || 0),
|
||||
reviewCount: Number(summary.reviewCount || 0)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* profile page logic.
|
||||
* Call guide: page data drives the WXML template, and each method is called by user events or lifecycle callbacks.
|
||||
@@ -61,6 +74,7 @@ Page({
|
||||
couponCount: 0,
|
||||
wishlistCount: 0,
|
||||
unreadMessageCount: 0,
|
||||
growthSummary: null,
|
||||
defaultAvatar: DEFAULT_AVATAR
|
||||
}),
|
||||
|
||||
@@ -91,19 +105,21 @@ Page({
|
||||
orderCount: 0,
|
||||
couponCount: 0,
|
||||
wishlistCount: 0,
|
||||
growthSummary: null,
|
||||
loading: false
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
try {
|
||||
const [userInfo, orders, coupons, wishlist, unreadMessages, pendingReviews] = await Promise.all([
|
||||
const [userInfo, orders, coupons, wishlist, unreadMessages, pendingReviews, growthSummary] = await Promise.all([
|
||||
userApi.getUserInfo(),
|
||||
orderApi.getOrderList(),
|
||||
couponApi.listUserCoupons(),
|
||||
wishlistApi.getWishlist(),
|
||||
userApi.getMyUnreadMessageCount(),
|
||||
orderApi.listMyPendingReviews().catch(() => [])
|
||||
orderApi.listMyPendingReviews().catch(() => []),
|
||||
growthApi.getGrowthSummary().catch(() => null)
|
||||
])
|
||||
|
||||
getApp().refreshUserInfo(userInfo)
|
||||
@@ -113,7 +129,8 @@ Page({
|
||||
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)
|
||||
unreadMessageCount: Number((unreadMessages && unreadMessages.unreadCount) || 0),
|
||||
growthSummary: formatGrowthSummary(growthSummary)
|
||||
})
|
||||
await this.checkPopupMessages()
|
||||
} catch (error) {
|
||||
|
||||
@@ -42,6 +42,27 @@
|
||||
<text>给服务过你的美甲师一点反馈</text>
|
||||
</view>
|
||||
|
||||
<view wx:if="{{growthSummary}}" class="growth-card">
|
||||
<view class="growth-head">
|
||||
<text class="growth-label">成长等级</text>
|
||||
<text class="growth-level">{{growthSummary.levelName}}</text>
|
||||
</view>
|
||||
<view class="growth-metrics">
|
||||
<view>
|
||||
<text>{{growthSummary.growthValue}}</text>
|
||||
<text>成长值</text>
|
||||
</view>
|
||||
<view>
|
||||
<text>{{growthSummary.appointmentCount}}</text>
|
||||
<text>预约</text>
|
||||
</view>
|
||||
<view>
|
||||
<text>{{growthSummary.reviewCount}}</text>
|
||||
<text>评价</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="shop-box" bindtap="handleSwitchShop">
|
||||
<view>
|
||||
<view class="shop-label">当前登录门店</view>
|
||||
|
||||
@@ -111,6 +111,57 @@
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.growth-card {
|
||||
margin-top: 22rpx;
|
||||
padding: 22rpx 24rpx;
|
||||
border-radius: 20rpx;
|
||||
background: #ffffff;
|
||||
border: 2rpx solid var(--theme-border);
|
||||
}
|
||||
|
||||
.growth-head {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 18rpx;
|
||||
}
|
||||
|
||||
.growth-label {
|
||||
color: #8d7a84;
|
||||
font-size: 24rpx;
|
||||
}
|
||||
|
||||
.growth-level {
|
||||
color: var(--theme-primary);
|
||||
font-size: 28rpx;
|
||||
font-weight: 800;
|
||||
}
|
||||
|
||||
.growth-metrics {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(3, minmax(0, 1fr));
|
||||
gap: 12rpx;
|
||||
margin-top: 18rpx;
|
||||
}
|
||||
|
||||
.growth-metrics view {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 6rpx;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.growth-metrics text:first-child {
|
||||
color: #2d2430;
|
||||
font-size: 30rpx;
|
||||
font-weight: 800;
|
||||
}
|
||||
|
||||
.growth-metrics text:last-child {
|
||||
color: #8d7a84;
|
||||
font-size: 22rpx;
|
||||
}
|
||||
|
||||
.shop-box {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
Reference in New Issue
Block a user