功能:新增下一阶段运营能力和生产部署
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
const request = require('../utils/request')
|
||||
|
||||
module.exports = {
|
||||
applyAfterSale(data) {
|
||||
return request({
|
||||
url: '/after-sale/apply',
|
||||
method: 'POST',
|
||||
data
|
||||
})
|
||||
},
|
||||
|
||||
getMyAfterSales(params) {
|
||||
return request({
|
||||
url: '/after-sale/my',
|
||||
params
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
const request = require('../utils/request')
|
||||
|
||||
module.exports = {
|
||||
getGrowthSummary() {
|
||||
return request({
|
||||
url: '/growth/summary'
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
const request = require('../utils/request')
|
||||
|
||||
module.exports = {
|
||||
prepareOrderPayment(orderId) {
|
||||
return request({
|
||||
url: `/payment/order/${orderId}/prepare`,
|
||||
method: 'POST',
|
||||
data: {}
|
||||
})
|
||||
},
|
||||
|
||||
mockOrderPaymentSuccess(orderId) {
|
||||
return request({
|
||||
url: `/payment/order/${orderId}/mock-success`,
|
||||
method: 'POST',
|
||||
data: {}
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
const assert = require('assert')
|
||||
const Module = require('module')
|
||||
|
||||
const calls = []
|
||||
const originalLoad = Module._load
|
||||
|
||||
Module._load = function mockRequestModule(request, parent, isMain) {
|
||||
if (request === '../utils/request') {
|
||||
return options => {
|
||||
calls.push(options)
|
||||
return Promise.resolve(options)
|
||||
}
|
||||
}
|
||||
return originalLoad.apply(this, arguments)
|
||||
}
|
||||
|
||||
const paymentApi = require('./payment')
|
||||
const afterSaleApi = require('./after-sale')
|
||||
const growthApi = require('./growth')
|
||||
|
||||
paymentApi.prepareOrderPayment(12)
|
||||
paymentApi.mockOrderPaymentSuccess(12)
|
||||
afterSaleApi.applyAfterSale({ orderId: 12, reason: 'need refund' })
|
||||
afterSaleApi.getMyAfterSales({ page: 2, size: 5 })
|
||||
growthApi.getGrowthSummary()
|
||||
|
||||
Module._load = originalLoad
|
||||
|
||||
assert.deepStrictEqual(calls[0], {
|
||||
url: '/payment/order/12/prepare',
|
||||
method: 'POST',
|
||||
data: {}
|
||||
})
|
||||
assert.deepStrictEqual(calls[1], {
|
||||
url: '/payment/order/12/mock-success',
|
||||
method: 'POST',
|
||||
data: {}
|
||||
})
|
||||
assert.deepStrictEqual(calls[2], {
|
||||
url: '/after-sale/apply',
|
||||
method: 'POST',
|
||||
data: { orderId: 12, reason: 'need refund' }
|
||||
})
|
||||
assert.deepStrictEqual(calls[3], {
|
||||
url: '/after-sale/my',
|
||||
params: { page: 2, size: 5 }
|
||||
})
|
||||
assert.deepStrictEqual(calls[4], {
|
||||
url: '/growth/summary'
|
||||
})
|
||||
@@ -3,6 +3,8 @@
|
||||
* 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 paymentApi = require('../../api/payment')
|
||||
const afterSaleApi = require('../../api/after-sale')
|
||||
const cartApi = require('../../api/cart')
|
||||
/**
|
||||
* Purpose: auth supports index.js by holding or executing the auth page or API role.
|
||||
@@ -35,6 +37,19 @@ const { buildRecoveryState, clearRecoveryState } = require('../../utils/recovery
|
||||
*/
|
||||
const REVIEW_SCORE_OPTIONS = [0.5, 1, 1.5, 2, 2.5, 3, 3.5, 4, 4.5, 5]
|
||||
|
||||
const PAYMENT_STATUS_TEXT = {
|
||||
UNPAID: '待支付',
|
||||
PAYING: '待确认支付',
|
||||
PAID: '已支付',
|
||||
REFUNDED: '已退款'
|
||||
}
|
||||
|
||||
const AFTER_SALE_STATUS_TEXT = {
|
||||
PENDING: '审核中',
|
||||
APPROVED: '已通过',
|
||||
REJECTED: '已拒绝'
|
||||
}
|
||||
|
||||
/**
|
||||
* Purpose: toId supports index.js by holding or executing the to id page or API role.
|
||||
* Usage: import, call, read, or update this function from the owning page/module while preserving the surrounding loading and permission flow.
|
||||
@@ -69,6 +84,120 @@ function trimText(value) {
|
||||
return String(value || '').trim()
|
||||
}
|
||||
|
||||
function normalizeStatus(value) {
|
||||
return String(value || '').trim().toUpperCase()
|
||||
}
|
||||
|
||||
function firstFilled(values) {
|
||||
return values.find(value => value !== undefined && value !== null && value !== '')
|
||||
}
|
||||
|
||||
function toAmount(value) {
|
||||
const amount = Number(value)
|
||||
return isFinite(amount) ? amount : 0
|
||||
}
|
||||
|
||||
function getOrderPayAmount(order) {
|
||||
return toAmount(firstFilled([
|
||||
order && order.payAmount,
|
||||
order && order.actualAmount,
|
||||
order && order.totalAmount
|
||||
]))
|
||||
}
|
||||
|
||||
function resolvePaymentStatus(order) {
|
||||
const status = normalizeStatus(order && (order.paymentStatus || order.payStatus || order.paymentState))
|
||||
if (status) {
|
||||
return status
|
||||
}
|
||||
if (Number(order && order.status) === 2 || getOrderPayAmount(order) <= 0) {
|
||||
return 'PAID'
|
||||
}
|
||||
return 'UNPAID'
|
||||
}
|
||||
|
||||
function buildPaymentInfo(order) {
|
||||
const status = resolvePaymentStatus(order)
|
||||
const payAmount = getOrderPayAmount(order)
|
||||
const paidAmount = toAmount(firstFilled([
|
||||
order && order.paidAmount,
|
||||
status === 'PAID' ? payAmount : ''
|
||||
]))
|
||||
return {
|
||||
status,
|
||||
statusText: PAYMENT_STATUS_TEXT[status] || status || '待支付',
|
||||
statusClass: `payment-${status.toLowerCase() || 'unpaid'}`,
|
||||
amountText: `¥${formatPrice(payAmount)}`,
|
||||
paidAmountText: `¥${formatPrice(paidAmount)}`,
|
||||
payNoText: (order && (order.paymentOrderNo || order.payNo)) || '',
|
||||
canPay: status === 'UNPAID' || status === 'PAYING',
|
||||
isPaid: status === 'PAID',
|
||||
isRefunded: status === 'REFUNDED'
|
||||
}
|
||||
}
|
||||
|
||||
function getAfterSaleStatusText(record) {
|
||||
const status = normalizeStatus(record && record.status)
|
||||
return AFTER_SALE_STATUS_TEXT[status] || status || '已申请'
|
||||
}
|
||||
|
||||
function buildAfterSaleSummary(record) {
|
||||
if (!record) {
|
||||
return null
|
||||
}
|
||||
const amount = firstFilled([record.refundAmount, record.amount])
|
||||
return {
|
||||
...record,
|
||||
status: normalizeStatus(record.status),
|
||||
statusText: getAfterSaleStatusText(record),
|
||||
typeText: record.type === 'REFUND' ? '退款' : (record.type || '售后'),
|
||||
amountText: amount === undefined || amount === null || amount === '' ? '' : `¥${formatPrice(amount)}`,
|
||||
reasonText: trimText(record.reason),
|
||||
auditReasonText: trimText(record.auditReason),
|
||||
createdText: formatDateTime(record.createTime)
|
||||
}
|
||||
}
|
||||
|
||||
function latestRecordTime(record) {
|
||||
return String((record && (record.auditTime || record.updateTime || record.createTime)) || '')
|
||||
}
|
||||
|
||||
function extractListPayload(payload) {
|
||||
if (Array.isArray(payload)) {
|
||||
return payload
|
||||
}
|
||||
if (payload && Array.isArray(payload.list)) {
|
||||
return payload.list
|
||||
}
|
||||
if (payload && Array.isArray(payload.records)) {
|
||||
return payload.records
|
||||
}
|
||||
return []
|
||||
}
|
||||
|
||||
function indexLatestAfterSaleByOrderId(list) {
|
||||
return safeList(list).reduce((result, item) => {
|
||||
const orderId = toId(item && item.orderId)
|
||||
if (!orderId) {
|
||||
return result
|
||||
}
|
||||
const current = result[orderId]
|
||||
if (!current || latestRecordTime(item).localeCompare(latestRecordTime(current)) > 0) {
|
||||
result[orderId] = item
|
||||
}
|
||||
return result
|
||||
}, {})
|
||||
}
|
||||
|
||||
function canApplyAfterSale(order, afterSaleSummary) {
|
||||
const paymentInfo = order && order.paymentInfo ? order.paymentInfo : buildPaymentInfo(order)
|
||||
const afterSaleStatus = normalizeStatus(afterSaleSummary && afterSaleSummary.status)
|
||||
return paymentInfo.isPaid
|
||||
&& Number(order && order.status) !== 3
|
||||
&& afterSaleStatus !== 'PENDING'
|
||||
&& afterSaleStatus !== 'APPROVED'
|
||||
}
|
||||
|
||||
/**
|
||||
* Purpose: formatRating supports index.js by holding or executing the format rating page or API role.
|
||||
* Usage: import, call, read, or update this function from the owning page/module while preserving the surrounding loading and permission flow.
|
||||
@@ -289,15 +418,20 @@ async function safeCall(factory, fallbackValue) {
|
||||
async function loadAssistData(orders) {
|
||||
const pendingReviewsPromise = safeCall(() => orderApi.listMyPendingReviews(), [])
|
||||
const pendingChangesPromise = safeCall(() => orderApi.listMyPendingArtistChangeRequests(), [])
|
||||
const afterSalesPromise = safeCall(() => afterSaleApi.getMyAfterSales({
|
||||
page: 1,
|
||||
size: 50
|
||||
}), { list: [] })
|
||||
const orderReviewListsPromise = Promise.all(orders.map(order => (
|
||||
safeCall(() => orderApi.listOrderReviews(order.id), [])
|
||||
)))
|
||||
const orderChangeListsPromise = Promise.all(orders.map(order => (
|
||||
safeCall(() => orderApi.listOrderArtistChangeRequests(order.id), [])
|
||||
)))
|
||||
const [pendingReviews, pendingChanges, orderReviewLists, orderChangeLists] = await Promise.all([
|
||||
const [pendingReviews, pendingChanges, afterSales, orderReviewLists, orderChangeLists] = await Promise.all([
|
||||
pendingReviewsPromise,
|
||||
pendingChangesPromise,
|
||||
afterSalesPromise,
|
||||
orderReviewListsPromise,
|
||||
orderChangeListsPromise
|
||||
])
|
||||
@@ -315,6 +449,7 @@ async function loadAssistData(orders) {
|
||||
pendingReviewByItemId: indexByOrderItemId(pendingReviews),
|
||||
submittedReviewByItemId: indexByOrderItemId(submittedReviews),
|
||||
pendingChangeByItemId: indexByOrderItemId(pendingChanges),
|
||||
afterSaleByOrderId: indexLatestAfterSaleByOrderId(extractListPayload(afterSales)),
|
||||
pendingReviews,
|
||||
reviewsByOrderId: safeList(orders).reduce((result, order, index) => {
|
||||
result[toId(order && order.id)] = safeList(orderReviewLists[index])
|
||||
@@ -435,6 +570,8 @@ Page({
|
||||
statusClass: getOrderStatusClass(order),
|
||||
shopNameText: order.shopName ? `所属店铺:${order.shopName}` : '',
|
||||
actualAmountText: `\u00a5${formatPrice(order.actualAmount)}`,
|
||||
paymentInfo: buildPaymentInfo(order),
|
||||
afterSaleSummary: buildAfterSaleSummary(order.afterSaleSummary || assistData.afterSaleByOrderId[toId(order.id)]),
|
||||
timeline: buildOrderTimeline(order, assistData.reviewsByOrderId[toId(order.id)], assistData.changesByOrderId[toId(order.id)], assistData.pendingReviews),
|
||||
items: await Promise.all(safeList(order.items).map(async item => {
|
||||
const itemId = toId(item.id)
|
||||
@@ -461,6 +598,7 @@ Page({
|
||||
|
||||
formattedOrders.forEach(order => {
|
||||
order.canRebook = Number(order.status) === 2 && getRebookableOrderItems(order).length > 0
|
||||
order.canApplyAfterSale = canApplyAfterSale(order, order.afterSaleSummary)
|
||||
})
|
||||
|
||||
this.setData({
|
||||
@@ -708,6 +846,127 @@ Page({
|
||||
}
|
||||
},
|
||||
|
||||
async handlePayOrder(event) {
|
||||
const orderId = event.currentTarget.dataset.orderId
|
||||
const order = findOrderById(this.data.orders, orderId)
|
||||
if (!order || !order.paymentInfo || !order.paymentInfo.canPay) {
|
||||
wx.showToast({
|
||||
title: '当前订单无需支付',
|
||||
icon: 'none'
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
try {
|
||||
await actionGuard.run(this, `order:pay:${orderId}`, async () => {
|
||||
await runWithLoading(() => paymentApi.prepareOrderPayment(orderId), {
|
||||
title: '准备支付'
|
||||
})
|
||||
const confirmed = await new Promise(resolve => {
|
||||
wx.showModal({
|
||||
title: '模拟支付',
|
||||
content: `本次需支付 ${order.paymentInfo.amountText},确认模拟支付成功吗?`,
|
||||
confirmText: '确认支付',
|
||||
success: res => resolve(Boolean(res.confirm)),
|
||||
fail: () => resolve(false)
|
||||
})
|
||||
})
|
||||
if (!confirmed) {
|
||||
return
|
||||
}
|
||||
await runWithLoading(() => paymentApi.mockOrderPaymentSuccess(orderId), {
|
||||
title: '确认支付'
|
||||
})
|
||||
wx.showToast({
|
||||
title: '支付已确认',
|
||||
icon: 'none'
|
||||
})
|
||||
await this.loadOrders()
|
||||
}, {
|
||||
message: '支付处理中,请勿重复点击'
|
||||
})
|
||||
} catch (error) {
|
||||
if (actionGuard.isGuardError(error)) {
|
||||
return
|
||||
}
|
||||
wx.showToast({
|
||||
title: error.message || '支付失败',
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
async handleApplyAfterSale(event) {
|
||||
const orderId = event.currentTarget.dataset.orderId
|
||||
const order = findOrderById(this.data.orders, orderId)
|
||||
if (!order || !order.canApplyAfterSale) {
|
||||
wx.showToast({
|
||||
title: '当前订单暂不可申请售后',
|
||||
icon: 'none'
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
try {
|
||||
await actionGuard.run(this, `order:after-sale:${orderId}`, async () => {
|
||||
const reason = await this.promptAfterSaleReason()
|
||||
if (!reason) {
|
||||
return
|
||||
}
|
||||
await runWithLoading(() => afterSaleApi.applyAfterSale({
|
||||
orderId,
|
||||
type: 'REFUND',
|
||||
reason,
|
||||
refundAmount: getOrderPayAmount(order)
|
||||
}), {
|
||||
title: '提交售后'
|
||||
})
|
||||
wx.showToast({
|
||||
title: '售后已提交',
|
||||
icon: 'none'
|
||||
})
|
||||
await this.loadOrders()
|
||||
}, {
|
||||
message: '售后申请提交中,请勿重复点击'
|
||||
})
|
||||
} catch (error) {
|
||||
if (actionGuard.isGuardError(error)) {
|
||||
return
|
||||
}
|
||||
wx.showToast({
|
||||
title: error.message || '售后申请失败',
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
promptAfterSaleReason() {
|
||||
return new Promise(resolve => {
|
||||
wx.showModal({
|
||||
title: '申请售后',
|
||||
content: '请填写售后原因,提交后门店会尽快处理。',
|
||||
editable: true,
|
||||
placeholderText: '例如:需要退款或调整服务',
|
||||
confirmText: '提交',
|
||||
success: res => {
|
||||
if (!res.confirm) {
|
||||
resolve('')
|
||||
return
|
||||
}
|
||||
const reason = trimText(res.content)
|
||||
if (!reason) {
|
||||
wx.showToast({
|
||||
title: '请填写售后原因',
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
resolve(reason)
|
||||
},
|
||||
fail: () => resolve('')
|
||||
})
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
* Purpose: promptRejectReason collects an optional customer reason before rejecting an artist-change request.
|
||||
* Usage: call it after the confirmation dialog and pass the returned text to rejectArtistChange.
|
||||
|
||||
@@ -25,6 +25,26 @@
|
||||
</view>
|
||||
<view wx:if="{{item.shopNameText}}" class="order-shop">{{item.shopNameText}}</view>
|
||||
|
||||
<view class="payment-panel">
|
||||
<view class="payment-copy">
|
||||
<text class="assist-label">支付状态</text>
|
||||
<text class="assist-main">{{item.paymentInfo.statusText}}</text>
|
||||
<text wx:if="{{item.paymentInfo.payNoText}}" class="assist-desc">支付单:{{item.paymentInfo.payNoText}}</text>
|
||||
</view>
|
||||
<view class="payment-amount">
|
||||
<text>{{item.paymentInfo.amountText}}</text>
|
||||
<text wx:if="{{item.paymentInfo.isPaid}}">实付 {{item.paymentInfo.paidAmountText}}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view wx:if="{{item.afterSaleSummary}}" class="after-sale-summary">
|
||||
<text class="assist-label">售后进度</text>
|
||||
<text class="assist-main">{{item.afterSaleSummary.typeText}} · {{item.afterSaleSummary.statusText}}</text>
|
||||
<text wx:if="{{item.afterSaleSummary.amountText}}" class="assist-desc">申请金额:{{item.afterSaleSummary.amountText}}</text>
|
||||
<text wx:if="{{item.afterSaleSummary.reasonText}}" class="assist-desc">原因:{{item.afterSaleSummary.reasonText}}</text>
|
||||
<text wx:if="{{item.afterSaleSummary.auditReasonText}}" class="assist-desc">处理说明:{{item.afterSaleSummary.auditReasonText}}</text>
|
||||
</view>
|
||||
|
||||
<view wx:if="{{item.timeline && item.timeline.length}}" class="order-timeline">
|
||||
<view
|
||||
wx:for="{{item.timeline}}"
|
||||
@@ -104,6 +124,8 @@
|
||||
<view class="order-foot">
|
||||
<text class="order-amount">总计:{{item.actualAmountText}}</text>
|
||||
<view class="order-actions">
|
||||
<view wx:if="{{item.paymentInfo.canPay}}" class="pay-btn" data-order-id="{{item.id}}" bindtap="handlePayOrder">去支付</view>
|
||||
<view wx:if="{{item.canApplyAfterSale}}" class="after-sale-btn" data-order-id="{{item.id}}" bindtap="handleApplyAfterSale">申请售后</view>
|
||||
<view wx:if="{{item.canRebook}}" class="rebook-btn" data-order-id="{{item.id}}" bindtap="handleRebookOrder">复刻同款</view>
|
||||
<view wx:if="{{item.status == 1}}" class="cancel-btn" data-order-id="{{item.id}}" bindtap="handleCancelOrder">取消订单</view>
|
||||
</view>
|
||||
|
||||
@@ -82,6 +82,46 @@
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
.payment-panel {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 18rpx;
|
||||
margin-top: 18rpx;
|
||||
padding: 18rpx 20rpx;
|
||||
border-radius: 18rpx;
|
||||
background: var(--theme-primary-soft);
|
||||
}
|
||||
|
||||
.payment-copy {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.payment-amount {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: flex-end;
|
||||
gap: 6rpx;
|
||||
color: #2d2430;
|
||||
font-size: 26rpx;
|
||||
font-weight: 800;
|
||||
}
|
||||
|
||||
.payment-amount text:last-child {
|
||||
color: #8d7a84;
|
||||
font-size: 22rpx;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.after-sale-summary {
|
||||
margin-top: 16rpx;
|
||||
padding: 18rpx 20rpx;
|
||||
border-radius: 18rpx;
|
||||
background: rgba(255, 247, 249, 0.82);
|
||||
border: 2rpx solid var(--theme-border);
|
||||
}
|
||||
|
||||
.order-timeline {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(5, minmax(0, 1fr));
|
||||
@@ -230,6 +270,8 @@
|
||||
color: #2d2430;
|
||||
}
|
||||
|
||||
.pay-btn,
|
||||
.after-sale-btn,
|
||||
.cancel-btn,
|
||||
.rebook-btn {
|
||||
display: inline-flex;
|
||||
@@ -243,6 +285,17 @@
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.pay-btn {
|
||||
background: var(--theme-primary);
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
.after-sale-btn {
|
||||
background: #ffffff;
|
||||
border: 2rpx solid var(--theme-border);
|
||||
color: #5d4b55;
|
||||
}
|
||||
|
||||
.rebook-btn {
|
||||
background: var(--theme-primary);
|
||||
color: #ffffff;
|
||||
|
||||
@@ -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