diff --git a/src/layout/Layout.vue b/src/layout/Layout.vue index e8055b2..cd90f74 100644 --- a/src/layout/Layout.vue +++ b/src/layout/Layout.vue @@ -29,9 +29,9 @@ - + - + diff --git a/src/router/index.js b/src/router/index.js index 7556852..ae8d32e 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -83,9 +83,9 @@ const routes = [ } }, { - path: 'income', - name: 'Income', - component: () => import('@/views/Income.vue'), + path: 'withdrawals', + name: 'Withdrawals', + component: () => import('@/views/WithdrawalApproval.vue'), meta: { title: '提现管理', icon: 'Money', diff --git a/src/utils/api.js b/src/utils/api.js index 1a1b317..4795d9d 100644 --- a/src/utils/api.js +++ b/src/utils/api.js @@ -247,9 +247,9 @@ const api = { }, // 提现管理 - income: { - getIncomeList: (params) => apiRequest.get('/income', {params}), - createIncome: (data) => apiRequest.post('/income', data), + withdraw: { + getWithdrawList: (params) => apiRequest.get('/withdrawals', {params}), + createWithdraw: (data) => apiRequest.post('/withdrawals', data), }, diff --git a/src/views/Income.vue b/src/views/WithdrawalApproval.vue similarity index 89% rename from src/views/Income.vue rename to src/views/WithdrawalApproval.vue index f24abfc..ee34813 100644 --- a/src/views/Income.vue +++ b/src/views/WithdrawalApproval.vue @@ -10,7 +10,7 @@ type="primary" size="large" class="withdraw-btn" - @click="getIncome" + @click="getWithdraw" > 申请提现 @@ -21,20 +21,20 @@
- - + + - + - + @@ -61,8 +61,8 @@ :page-sizes="[10, 20, 50, 100]" :total="pagination.total" layout="total, sizes, prev, pager, next, jumper" - @size-change="loadIncomeList" - @current-change="loadIncomeList" + @size-change="loadWithdrawList" + @current-change="loadWithdrawList" class="custom-pagination" />
@@ -83,7 +83,7 @@ > @@ -120,7 +120,7 @@ import { ElForm, ElFormItem, ElInput, ElMessage } from 'element-plus' import { Money, Plus, Check } from '@element-plus/icons-vue' const userStore = useUserStore() -const incomeList = ref([]) +const withdrawList = ref([]) const loading = ref(false) const drawerVisible = ref(false) const formRef = ref(null) @@ -143,11 +143,9 @@ const pagination = reactive({ // 状态类型映射 const getStatusType = (status) => { const statusMap = { - 'pending': 'warning', - 'processing': 'primary', - 'completed': 'success', - 'failed': 'danger', - 'cancelled': 'info' + 'pending': 'info', + 'success': 'success', + 'canceled': 'danger' } return statusMap[status] || 'info' } @@ -156,10 +154,8 @@ const getStatusType = (status) => { const getStatusText = (status) => { const statusMap = { 'pending': '待处理', - 'processing': '处理中', - 'completed': '已完成', - 'failed': '失败', - 'cancelled': '已取消' + 'success': '已通过', + 'canceled': '已取消' } return statusMap[status] || status } @@ -177,15 +173,15 @@ const formatTime = (time) => { }) } -const loadIncomeList = async () => { +const loadWithdrawList = async () => { loading.value = true try { - const { data } = await api.income.getIncomeList({ + const { data } = await api.withdraw.getWithdrawList({ page: pagination.page, limit: pagination.limit }) - incomeList.value = data - pagination.total = data.total + withdrawList.value = data.data.withdrawals || [] + pagination.total = data.data.pagination.total || 0 } catch (error) { console.error('获取提现列表失败:', error) ElMessage.error('获取提现列表失败') @@ -194,7 +190,7 @@ const loadIncomeList = async () => { } } -const getIncome = async () => { +const getWithdraw = async () => { drawerVisible.value = true // 重置表单 form.amount = 0 @@ -210,14 +206,14 @@ const submitForm = async () => { const valid = await formRef.value.validate() if (!valid) return - const response = await api.income.createIncome({ + const response = await api.withdraw.createWithdraw({ amount: Number(form.amount), userId: userStore.user.id }) if (response.data) { ElMessage.success('提现申请提交成功') - loadIncomeList() + loadWithdrawList() drawerVisible.value = false } } catch (error) { @@ -227,13 +223,13 @@ const submitForm = async () => { } onMounted(async () => { - loadIncomeList() + loadWithdrawList() })