fix(withdraw): 修复经销商提现页面类型定义和渲染逻辑
- 将 activeTab 状态类型从 string | number 限定为 string - 统一 Tab 切换处理中的值转换逻辑,避免类型不一致问题 - 修复条件判断中的字符串比较,确保类型安全 - 调整组件渲染方式,改为按需渲染当前选中的标签页内容 - 更新骑手页面工资统计标题为配送提成以匹配实际业务逻辑
This commit is contained in:
@@ -98,7 +98,7 @@ const normalizeMoneyString = (money: unknown) => {
|
||||
}
|
||||
|
||||
const DealerWithdraw: React.FC = () => {
|
||||
const [activeTab, setActiveTab] = useState<string | number>('0')
|
||||
const [activeTab, setActiveTab] = useState<string>('0')
|
||||
const [loading, setLoading] = useState<boolean>(false)
|
||||
const [refreshing, setRefreshing] = useState<boolean>(false)
|
||||
const [submitting, setSubmitting] = useState<boolean>(false)
|
||||
@@ -114,10 +114,11 @@ const DealerWithdraw: React.FC = () => {
|
||||
// Tab 切换处理函数
|
||||
const handleTabChange = (value: string | number) => {
|
||||
console.log('Tab切换到:', value)
|
||||
setActiveTab(value)
|
||||
const next = String(value)
|
||||
setActiveTab(next)
|
||||
|
||||
// 如果切换到提现记录页面,刷新数据
|
||||
if (String(value) === '1') {
|
||||
if (next === '1') {
|
||||
fetchWithdrawRecords()
|
||||
}
|
||||
}
|
||||
@@ -628,13 +629,12 @@ const DealerWithdraw: React.FC = () => {
|
||||
<View className="bg-gray-50 min-h-screen">
|
||||
<Tabs value={activeTab} onChange={handleTabChange}>
|
||||
<Tabs.TabPane title="申请提现" value="0">
|
||||
{renderWithdrawForm()}
|
||||
</Tabs.TabPane>
|
||||
|
||||
<Tabs.TabPane title="提现记录" value="1">
|
||||
{renderWithdrawRecords()}
|
||||
</Tabs.TabPane>
|
||||
</Tabs>
|
||||
{activeTab === '0' ? renderWithdrawForm() : renderWithdrawRecords()}
|
||||
</View>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -130,7 +130,7 @@ const DealerIndex: React.FC = () => {
|
||||
{dealerUser && (
|
||||
<View className="mx-4 -mt-6 rounded-xl p-4 relative z-10" style={cardGradients.elevated}>
|
||||
<View className="mb-4">
|
||||
<Text className="font-semibold text-gray-800">工资统计</Text>
|
||||
<Text className="font-semibold text-gray-800">配送提成</Text>
|
||||
</View>
|
||||
<View className="grid grid-cols-3 gap-3">
|
||||
<View className="text-center p-3 rounded-lg flex flex-col" style={{
|
||||
|
||||
Reference in New Issue
Block a user