个人中心页面-根据isAgent渲染不同界面组件
This commit is contained in:
parent
c8656fd996
commit
756c105399
|
|
@ -24,14 +24,15 @@
|
|||
</text>
|
||||
</view>
|
||||
<view class="user-info">
|
||||
<view class="share-btn" @click="goToSharePromotion">
|
||||
<view v-if="isAgent" class="share-btn" @click="goToSharePromotion">
|
||||
<image :src="commonEnum.GIFT" class="share-img" mode="aspectFit"></image>
|
||||
<text class="share-text">分享推广</text>
|
||||
</view>
|
||||
<view v-else style="padding: 30rpx"></view>
|
||||
</view>
|
||||
<view class="user-details">
|
||||
<text class="user-name">{{ userInfo.nickName || '昵称' }}</text>
|
||||
<text class="user-id">{{ formatPhone(userInfo.phonenumber) || '123****8912' }}</text>
|
||||
|
||||
<view class="settings-icon" @click="goToSettings">
|
||||
<image :src="commonEnum.SET" class="settings-img" mode="aspectFit" />
|
||||
</view>
|
||||
|
|
@ -39,7 +40,7 @@
|
|||
</view>
|
||||
|
||||
<!-- 财务摘要 -->
|
||||
<view class="financial-summary">
|
||||
<view v-if="isAgent" class="financial-summary">
|
||||
<image :src="commonEnum.COIN_BACKGROUND" class="coin-background" mode="width"></image>
|
||||
<view class="main-amount">
|
||||
<text class="amount-number">{{ financialData.balance || '0.00' }}</text>
|
||||
|
|
@ -70,7 +71,7 @@
|
|||
</view>
|
||||
|
||||
<!-- 我的用户 -->
|
||||
<view class="my-users-section">
|
||||
<view v-if="isAgent" class="my-users-section">
|
||||
<view class="section-header">
|
||||
<text class="section-title">我的用户</text>
|
||||
<view class="view-details" @click="goToUserList">
|
||||
|
|
@ -88,7 +89,7 @@
|
|||
</view>
|
||||
<view class="stat-item">
|
||||
<text class="stat-number">{{ userStats.rentAmount || 0 }}</text>
|
||||
<text class="stat-label">租赁数量(个)</text>
|
||||
<text class="stat-label">租赁金额(元)</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
|
@ -99,7 +100,7 @@
|
|||
<text class="section-title">其他功能</text>
|
||||
</view>
|
||||
<view class="function-grid">
|
||||
<view class="function-item" @click="goToAgentApply">
|
||||
<view v-if="!isAgent" class="function-item" @click="goToAgentApply">
|
||||
<view class="function-icon">
|
||||
<image :src="commonEnum.REQUEST_AGENT" class="function-img" mode="aspectFit"></image>
|
||||
</view>
|
||||
|
|
@ -109,7 +110,7 @@
|
|||
<view class="function-icon">
|
||||
<image :src="commonEnum.AGENCY_INTERESTS" class="function-img" mode="aspectFit"></image>
|
||||
</view>
|
||||
<text class="function-text">代理权益</text>
|
||||
<text class="function-text">我的订单</text>
|
||||
</view>
|
||||
<view class="function-item" @click="goToCustomerService">
|
||||
<view class="function-icon">
|
||||
|
|
@ -138,7 +139,7 @@ export default {
|
|||
commonEnum,
|
||||
userInfo: {
|
||||
nickName: '昵称',
|
||||
phonenumber: '123****8912',
|
||||
|
||||
avatar: '',
|
||||
userId: '',
|
||||
},
|
||||
|
|
@ -196,7 +197,6 @@ export default {
|
|||
console.log('用户头像:', this.userInfo.avatar)
|
||||
} else {
|
||||
console.log('用户信息获取失败,使用默认值')
|
||||
console.log('当前用户信息:', this.userInfo)
|
||||
}
|
||||
|
||||
// 处理财务数据
|
||||
|
|
@ -264,30 +264,9 @@ export default {
|
|||
} catch (error) {
|
||||
console.error('获取代理统计失败:', error)
|
||||
// 如果获取失败,使用默认数据
|
||||
return {
|
||||
code: 200,
|
||||
data: {
|
||||
userNum: 0,
|
||||
deviceNum: 0,
|
||||
rentAmount: 0,
|
||||
},
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
// 格式化手机号
|
||||
formatPhone(phone) {
|
||||
if (!phone) return '123****8912'
|
||||
if (phone.length === 11) {
|
||||
return phone.replace(/(\d{3})\d{4}(\d{4})/, '$1****$2')
|
||||
}
|
||||
return phone
|
||||
},
|
||||
|
||||
gotoPage(url) {
|
||||
uni.navigateTo({ url })
|
||||
},
|
||||
|
||||
// 跳转到设置页面,传递用户信息
|
||||
goToSettings() {
|
||||
console.log('准备跳转到设置页面,当前用户信息:', this.userInfo)
|
||||
|
|
@ -298,7 +277,6 @@ export default {
|
|||
nickName: this.userInfo.nickName || this.userInfo.nickname || '昵称',
|
||||
avatar: this.userInfo.avatar || '',
|
||||
userId: this.userInfo.userId || '',
|
||||
phonenumber: this.userInfo.phonenumber || '',
|
||||
}
|
||||
|
||||
uni.setStorageSync('userInfo', userInfoToStore)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user