dealer(withdraw): 优化提现页面展示逻辑
- 添加金额格式化函数,确保余额显示格式统一- 调整余额显示布局,使界面更加清晰 -移除输入框的 clearable属性,避免用户误操作
This commit is contained in:
@@ -2,6 +2,7 @@ import React, { useState, useRef, useEffect, useCallback } from 'react'
|
|||||||
import { View, Text } from '@tarojs/components'
|
import { View, Text } from '@tarojs/components'
|
||||||
import {
|
import {
|
||||||
Cell,
|
Cell,
|
||||||
|
Space,
|
||||||
Button,
|
Button,
|
||||||
Form,
|
Form,
|
||||||
Input,
|
Input,
|
||||||
@@ -38,6 +39,7 @@ const DealerWithdraw: React.FC = () => {
|
|||||||
|
|
||||||
// 获取可提现余额
|
// 获取可提现余额
|
||||||
const fetchBalance = useCallback(async () => {
|
const fetchBalance = useCallback(async () => {
|
||||||
|
console.log(dealerUser,'dealerUser...')
|
||||||
try {
|
try {
|
||||||
setAvailableAmount(dealerUser?.money || '0.00')
|
setAvailableAmount(dealerUser?.money || '0.00')
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@@ -211,8 +213,14 @@ const DealerWithdraw: React.FC = () => {
|
|||||||
formRef.current?.setFieldsValue({ amount: availableAmount.replace(',', '') })
|
formRef.current?.setFieldsValue({ amount: availableAmount.replace(',', '') })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 格式化金额
|
||||||
|
const formatMoney = (money?: string) => {
|
||||||
|
if (!money) return '0.00'
|
||||||
|
return parseFloat(money).toFixed(2)
|
||||||
|
}
|
||||||
|
|
||||||
const renderWithdrawForm = () => (
|
const renderWithdrawForm = () => (
|
||||||
<View className="p-4">
|
<View>
|
||||||
{/* 余额卡片 */}
|
{/* 余额卡片 */}
|
||||||
<View className="rounded-xl p-6 mb-6 text-white relative overflow-hidden" style={{
|
<View className="rounded-xl p-6 mb-6 text-white relative overflow-hidden" style={{
|
||||||
background: businessGradients.dealer.header
|
background: businessGradients.dealer.header
|
||||||
@@ -225,9 +233,9 @@ const DealerWithdraw: React.FC = () => {
|
|||||||
}}></View>
|
}}></View>
|
||||||
|
|
||||||
<View className="flex items-center justify-between relative z-10">
|
<View className="flex items-center justify-between relative z-10">
|
||||||
<View>
|
<View className={'flex flex-col'}>
|
||||||
|
<Text className="text-2xl font-bold text-white">{formatMoney(dealerUser?.money)}</Text>
|
||||||
<Text className="text-white text-opacity-80 text-sm mb-1">可提现余额</Text>
|
<Text className="text-white text-opacity-80 text-sm mb-1">可提现余额</Text>
|
||||||
<Text className="text-2xl font-bold text-white">¥{availableAmount}</Text>
|
|
||||||
</View>
|
</View>
|
||||||
<View className="p-3 rounded-full" style={{
|
<View className="p-3 rounded-full" style={{
|
||||||
background: 'rgba(255, 255, 255, 0.2)'
|
background: 'rgba(255, 255, 255, 0.2)'
|
||||||
@@ -254,7 +262,6 @@ const DealerWithdraw: React.FC = () => {
|
|||||||
<Input
|
<Input
|
||||||
placeholder="请输入提现金额"
|
placeholder="请输入提现金额"
|
||||||
type="number"
|
type="number"
|
||||||
clearable
|
|
||||||
/>
|
/>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user