consumer模块完成度95%,优化安卓端界面和小程序测试3

This commit is contained in:
cyh666666
2026-03-13 17:12:00 +08:00
parent b2a6e5a142
commit b5c7947ad8
1741 changed files with 3427 additions and 2036 deletions

View File

@@ -7,14 +7,14 @@
<!-- 基础用户信息:头像和昵称 -->
<view class="nav-user-basic" @click="editProfile">
<image
:src="userInfo.avatar_url != '' ? userInfo.avatar_url : '/static/default-avatar.png'"
:src="userInfo.avatar_url != '' ? userInfo.avatar_url : '/static/images/default-product.png'"
class="nav-avatar"
/>
<text class="nav-user-name">{{ userInfo.nickname != '' ? userInfo.nickname : userInfo.phone }}</text>
</view>
<!-- 用户资产横向排列 (积分、余额、优惠券) -->
<view class="nav-user-stats">
<view class="nav-user-stats" :style="{ marginRight: navBarRight + 'px' }">
<view class="nav-stat-item" @click="goToPoints">
<text class="nav-stat-label">积分</text>
<text class="nav-stat-value">{{ userStats.points }}</text>
@@ -371,6 +371,7 @@ export default {
save_amount: 0
} as ConsumptionStatsType,
statusBarHeight: 0,
navBarRight: 0, // 导航栏右侧预留空间(小程序胶囊按钮)
currentOrderTab: 'all' as string,
allOrders: [] as Array<OrderItemType>
}
@@ -529,6 +530,19 @@ export default {
initPage() {
const systemInfo = uni.getSystemInfoSync()
this.statusBarHeight = systemInfo.statusBarHeight ?? 0
// 获取小程序胶囊按钮信息
// #ifdef MP-WEIXIN
try {
const menuButton = uni.getMenuButtonBoundingClientRect()
if (menuButton != null) {
this.navBarRight = (systemInfo.screenWidth - menuButton.left) + 10
}
} catch (e) {
console.log('获取胶囊按钮信息失败', e)
this.navBarRight = 90
}
// #endif
},
async loadUserProfile() {
try {
@@ -570,7 +584,7 @@ export default {
phone: uPhone,
email: uEmail,
nickname: uNickname != '' ? uNickname : '微信用户',
avatar_url: uAvatar != '' ? uAvatar : '/static/default-avatar.png',
avatar_url: uAvatar != '' ? uAvatar : '/static/images/default-product.png',
gender: uGender,
user_type: 1,
status: 1,
@@ -929,20 +943,20 @@ export default {
getOrderMainImage(order: OrderItemType): string {
const itemsRaw = order.ml_order_items
if (itemsRaw == null) return '/static/product1.jpg'
if (itemsRaw == null) return '/static/images/default-product.png'
const items = itemsRaw as any[]
if (items.length > 0) {
const firstItem = items[0]
const itemStr = JSON.stringify(firstItem)
const itemParsed = JSON.parse(itemStr)
if (itemParsed == null) return '/static/product1.jpg'
if (itemParsed == null) return '/static/images/default-product.png'
const itemObj = itemParsed as UTSJSONObject
const imgUrl = itemObj.getString('image_url')
const prodImg = itemObj.getString('product_image')
const img = (imgUrl != null && imgUrl !== '') ? imgUrl : prodImg
if (img != null && img !== '') return img
}
return '/static/product1.jpg'
return '/static/images/default-product.png'
},
getOrderTitle(order: OrderItemType): string {