UI优化,红包领取后缺少头像,名称字段
This commit is contained in:
@@ -6,10 +6,11 @@
|
||||
import { useUI } from '@/utils/use-ui'
|
||||
import { useAuthUser } from '@/composables/useAuthUser'
|
||||
import { useUserStore } from '@/stores/user'
|
||||
import { formatNumberWithWan } from '../../utils'
|
||||
|
||||
const { showToast } = useUI()
|
||||
const { userInfo } = useAuthUser()
|
||||
const { refreshUserInfo } = useUserStore()
|
||||
const { integralData } = useAuthUser()
|
||||
const { getIntegral } = useUserStore()
|
||||
|
||||
const weekList = [
|
||||
{ name: '一', value: 1 },
|
||||
@@ -45,7 +46,7 @@
|
||||
)
|
||||
|
||||
if (msg) {
|
||||
await refreshUserInfo()
|
||||
await getIntegral()
|
||||
showToast(msg)
|
||||
}
|
||||
|
||||
@@ -161,22 +162,6 @@
|
||||
getData()
|
||||
}
|
||||
|
||||
const formatNumberWithWan = num => {
|
||||
if (num < 10000) {
|
||||
return num.toString()
|
||||
}
|
||||
|
||||
// 保留小数:根据需求可调整 toFixed 的位数
|
||||
let wan = num / 10000
|
||||
|
||||
// 如果是整数万,不显示小数;否则保留两位小数(或你想要的位数)
|
||||
if (wan % 1 === 0) {
|
||||
return wan + '万'
|
||||
} else {
|
||||
return wan.toFixed(2).replace(/\.?0+$/, '') + '万' // 去掉不必要的尾随零
|
||||
}
|
||||
}
|
||||
|
||||
onLoad(() => {
|
||||
const now = new Date()
|
||||
currentYear.value = now.getFullYear()
|
||||
@@ -200,8 +185,8 @@
|
||||
<view class="public-header—box">
|
||||
<view class="integral-box">
|
||||
<text>我的积分</text>
|
||||
<text style="font-size: 80rpx; margin-top: 30rpx;">
|
||||
{{ formatNumberWithWan(userInfo.totalPoints) }}
|
||||
<text style="font-size: 80rpx; margin-top: 30rpx">
|
||||
{{ formatNumberWithWan(integralData) }}
|
||||
</text>
|
||||
</view>
|
||||
<image
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
import { ref } from 'vue'
|
||||
import { onLoad, onPageScroll } from '@dcloudio/uni-app'
|
||||
import { getUserIntegralRank } from '@/api'
|
||||
import { formatNumberWithWan } from '../../utils'
|
||||
|
||||
const cbNavBar = ref({})
|
||||
const listData = ref([])
|
||||
@@ -104,7 +105,9 @@
|
||||
</uni-col>
|
||||
<uni-col :span="6">
|
||||
<view class="table-right">
|
||||
<text class="item-text">{{ item.totalPoints }}</text>
|
||||
<text class="item-text">
|
||||
{{ formatNumberWithWan(item.totalPoints) }}
|
||||
</text>
|
||||
</view>
|
||||
</uni-col>
|
||||
</uni-row>
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
import { onLoad } from '@dcloudio/uni-app'
|
||||
import { navigateTo } from '@/utils/router'
|
||||
import { useUI } from '@/utils/use-ui'
|
||||
import { formatNumberWithWan } from '../../utils'
|
||||
|
||||
const bottomList = [
|
||||
{
|
||||
@@ -40,7 +41,7 @@
|
||||
]
|
||||
|
||||
const { showDialog } = useUI()
|
||||
const { userInfo } = useAuthUser()
|
||||
const { userInfo, integralData } = useAuthUser()
|
||||
|
||||
onLoad(() => {
|
||||
// 获取用户信息
|
||||
@@ -78,7 +79,7 @@
|
||||
<view class="top-box">
|
||||
<view class="left-name">
|
||||
<text>账户积分</text>
|
||||
<text>{{ userInfo?.totalPoints }}</text>
|
||||
<text>{{ formatNumberWithWan(integralData) }}</text>
|
||||
</view>
|
||||
<view class="right-btn">
|
||||
<button
|
||||
|
||||
@@ -5,8 +5,9 @@
|
||||
import { getUserPayPwd } from '@/api/my-index'
|
||||
import { useAuthUser } from '@/composables/useAuthUser'
|
||||
import { useUI } from '@/utils/use-ui'
|
||||
import { formatNumberWithWan } from '../../../utils'
|
||||
|
||||
const { userInfo } = useAuthUser()
|
||||
const { integralData } = useAuthUser()
|
||||
const { showDialog } = useUI()
|
||||
|
||||
const itemList = ref([])
|
||||
@@ -57,7 +58,7 @@
|
||||
<view class="top-card">
|
||||
<view class="left-box">
|
||||
<text>我的资产</text>
|
||||
<text>{{ userInfo?.totalPoints }}</text>
|
||||
<text>{{ formatNumberWithWan(integralData) }}</text>
|
||||
</view>
|
||||
<view class="right-box">
|
||||
<button
|
||||
|
||||
@@ -7,13 +7,14 @@
|
||||
getUserThirdPayList,
|
||||
getUserBankList,
|
||||
getUserWithdrawConfig,
|
||||
getUserIntegral,
|
||||
addUserWithdraw,
|
||||
getUserPayPwd
|
||||
} from '@/api/my-index'
|
||||
import { useUI } from '@/utils/use-ui'
|
||||
import { useAuthUser } from '@/composables/useAuthUser'
|
||||
|
||||
const { showToast, showDialog } = useUI()
|
||||
const { integralData } = useAuthUser()
|
||||
|
||||
const tixian = ref(null)
|
||||
const popup = ref(null)
|
||||
@@ -43,12 +44,6 @@
|
||||
return Number(value.toFixed(2))
|
||||
})
|
||||
|
||||
/** 获取积分 */
|
||||
const getIntegral = async () => {
|
||||
const res = await getUserIntegral()
|
||||
withdrawData.availablePoints = res.data.availablePoints
|
||||
}
|
||||
|
||||
const getData = async () => {
|
||||
const res = await getUserWithdrawConfig(topData.value.withdrawalType)
|
||||
withdrawData.minAmount = res.data.minAmount
|
||||
@@ -134,7 +129,7 @@
|
||||
}
|
||||
|
||||
onShow(() => {
|
||||
getIntegral()
|
||||
withdrawData.availablePoints = integralData.value
|
||||
getList()
|
||||
})
|
||||
</script>
|
||||
|
||||
@@ -60,28 +60,44 @@
|
||||
|
||||
<!-- 红包信息 -->
|
||||
<view class="red-envelope-info">
|
||||
<text v-if="isPersonal">
|
||||
<text>
|
||||
{{
|
||||
viewData.hasReceived
|
||||
? `${viewData.remainCount}个红包${viewData.remainAmount}积分`
|
||||
viewData.receiveList.length > 0
|
||||
? `${viewData.totalCount}个红包${viewData.totalAmount}积分`
|
||||
: `红包${viewData.remainAmount}积分,等待对方领取`
|
||||
}}
|
||||
</text>
|
||||
<text v-else>1个红包共5.00元</text>
|
||||
<!-- <text v-else>1个红包共5.00元</text> -->
|
||||
</view>
|
||||
|
||||
<!-- 领取人卡片信息 -->
|
||||
<view
|
||||
v-if="isPersonal && viewData.hasReceived"
|
||||
class="red-envelope-card"
|
||||
>
|
||||
<view class="avatar"></view>
|
||||
<view class="right-box">
|
||||
<view class="top-name">
|
||||
<text>用户名称</text>
|
||||
<text>5积分</text>
|
||||
<view v-if="viewData.receiveList.length > 0">
|
||||
<view
|
||||
v-for="item in viewData.receiveList"
|
||||
:key="item.id"
|
||||
class="red-envelope-card"
|
||||
>
|
||||
<view class="avatar"></view>
|
||||
<view class="right-box">
|
||||
<view class="top-name">
|
||||
<text>用户名称</text>
|
||||
<text>{{ item.receiveAmount }}积分</text>
|
||||
</view>
|
||||
<view class="bottom-name">
|
||||
<text class="date">{{ item.receiveTime }}</text>
|
||||
<view
|
||||
v-if="viewData.luckyReceive.userId === item.userId"
|
||||
class="tisp"
|
||||
>
|
||||
<image
|
||||
src="/static/images/best.svg"
|
||||
mode="heightFix"
|
||||
class="best-icon"
|
||||
></image>
|
||||
<text>手气最佳</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<text class="date">用户名称</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -123,9 +139,24 @@
|
||||
color: #333333;
|
||||
}
|
||||
}
|
||||
.date {
|
||||
.bottom-name {
|
||||
font-size: 28rpx;
|
||||
color: #a1a1a1;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
.date {
|
||||
color: #a1a1a1;
|
||||
}
|
||||
.tisp {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
.best-icon {
|
||||
height: 34rpx;
|
||||
margin-right: 10rpx;
|
||||
}
|
||||
text {
|
||||
color: #e7ba24;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user