diff --git a/src/api/admin/kvmService.js b/src/api/admin/kvmService.js index a5d545f..f9b6dcf 100644 --- a/src/api/admin/kvmService.js +++ b/src/api/admin/kvmService.js @@ -145,6 +145,11 @@ export const getRemoteHostMetrics = (params) => { return http2.get('/api/v1/admin/server/host_service/point/host/metrics', { params }) } +/** 获取宿主机内虚拟机指标 Top 榜单 */ +export const getHostMetricsTop = (params) => { + return http2.get('/api/v1/admin/server/host_service/point/host/metrics/top', { params }) +} + /** 查询历史指标(宿主机或虚拟机) */ export const getMetricsHistory = (params) => { return http2.get('/api/v1/admin/server/host_service/point/host/metrics_history', { params }) diff --git a/src/api/admin/order.js b/src/api/admin/order.js index 7a4340f..f656685 100644 --- a/src/api/admin/order.js +++ b/src/api/admin/order.js @@ -7,6 +7,14 @@ export const getOrderList = (params) => { export const getOrderDetail = (params) => { return http2.get('/api/v1/admin/order/detail', {params: params}) } +/**计算新购订单价格 */ +export const getOrderPrice = (data) => { + return http2.post('/api/v1/admin/order/price', data, { + headers:{ + 'Content-Type':'multipart/form-data' + } + }) +} /**删除订单 (未提供删除接口,暂时保留) */ /**删除订单 */ export const deleteOrder = (data) => { @@ -41,3 +49,12 @@ export const retryOrderHook = (data) => { } }) } + +/**订单退款 */ +export const refundOrder = (data) => { + return http2.post('/api/v1/admin/order/refund', data, { + headers:{ + 'Content-Type':'multipart/form-data' + } + }) +} diff --git a/src/api/admin/pay007.js b/src/api/admin/pay007.js new file mode 100644 index 0000000..c03e275 --- /dev/null +++ b/src/api/admin/pay007.js @@ -0,0 +1,25 @@ +import { http2 } from '@/utils/request.js' + +/** 获取 007pay 支付配置 */ +export const getPay007Config = () => { + return http2.get('/api/v1/admin/pay007/config') +} + +/** 更新 007pay 支付配置 */ +export const updatePay007Config = (data) => { + return http2.post('/api/v1/admin/pay007/config/update', data, { + headers: { + 'Content-Type': 'multipart/form-data' + } + }) +} + +/** 查询 007pay 订单 */ +export const getPay007Orders = (params) => { + return http2.get('/api/v1/admin/pay007/orders', { params }) +} + +/** 查询 007pay 收益统计 */ +export const getPay007Stats = (params) => { + return http2.get('/api/v1/admin/pay007/stats', { params }) +} diff --git a/src/components/admin/ImageSelector.vue b/src/components/admin/ImageSelector.vue index 10585f6..3f794d6 100644 --- a/src/components/admin/ImageSelector.vue +++ b/src/components/admin/ImageSelector.vue @@ -1,7 +1,7 @@ - - -
@@ -131,6 +126,16 @@ 减少 + + + @@ -180,28 +185,6 @@ - - - - - - - - - - - - 退回余额 - 提现 - -
退回余额:将退款金额添加到对应余额;提现:将退款金额提现
-
-
- -
@@ -210,7 +193,7 @@ import { ref, reactive, onMounted, computed, watch } from 'vue' import { useRoute, useRouter } from 'vue-router' import { ElMessage } from 'element-plus' import { Refresh, ArrowLeft } from '@element-plus/icons-vue' -import { getUserBalanceRecord, editUserBalance, addUserConsumption, getUserBalanceCount, getUserList, refundBalance } from '@/api/admin/user' +import { getUserBalanceRecord, editUserBalance, addUserConsumption, getUserBalanceCount, getUserList } from '@/api/admin/user' const route = useRoute() const router = useRouter() @@ -246,11 +229,8 @@ const userList = ref([]) // 对话框 const balanceDialogVisible = ref(false) const recordDialogVisible = ref(false) -const refundDialogVisible = ref(false) const balanceFormRef = ref(null) const recordFormRef = ref(null) -const refundFormRef = ref(null) -const refundLoading = ref(false) // 余额表单 const balanceForm = reactive({ @@ -258,7 +238,8 @@ const balanceForm = reactive({ balance_type: '', price: 0, state: 'add', - note: '' + note: '', + account_amount: false }) const balanceRules = { @@ -290,18 +271,6 @@ const recordRules = { note: [{ required: true, message: '请输入备注', trigger: 'blur' }] } -// 退款表单 -const refundForm = reactive({ - history_id: 0, - order_id: 0, - bandwidth: false -}) - -const refundRules = { - order_id: [{ required: true, message: '请输入订单ID', trigger: 'blur' }], - bandwidth: [{ required: true, message: '请选择退款方式', trigger: 'change' }] -} - // 当前余额显示 const currentBalanceDisplay = computed(() => { const balance = balanceList.value.find(b => userBalance[b.type]?.type === balanceForm.balance_type) @@ -445,7 +414,8 @@ const handleEditBalance = (balanceType) => { balance_type: apiType, price: 0, state: 'add', - note: '' + note: '', + account_amount: false }) balanceDialogVisible.value = true } @@ -471,7 +441,11 @@ const submitBalanceForm = () => { balanceFormRef.value?.validate(async (valid) => { if (valid) { try { - const res = await editUserBalance(balanceForm) + const submitData = { ...balanceForm } + if (submitData.state !== 'add' || !submitData.account_amount) { + delete submitData.account_amount + } + const res = await editUserBalance(submitData) if (res.data.code === 200) { ElMessage.success('修改成功') balanceDialogVisible.value = false @@ -517,40 +491,6 @@ const handleRecordCurrentChange = () => { fetchBalanceRecord() } -// 退款 -const handleRefund = (row) => { - Object.assign(refundForm, { - history_id: row.Id, - order_id: String(row.OrderId) || 0, - bandwidth: false - }) - refundDialogVisible.value = true -} - -// 提交退款 -const submitRefundForm = () => { - refundFormRef.value?.validate(async (valid) => { - if (valid) { - refundLoading.value = true - try { - const res = await refundBalance(refundForm) - if (res.data.code === 200) { - ElMessage.success('退款成功') - refundDialogVisible.value = false - fetchUserBalance() - } else { - ElMessage.error(res.data.message || '退款失败') - } - } catch (error) { - console.error('退款错误:', error) - ElMessage.error('退款失败') - } finally { - refundLoading.value = false - } - } - }) -} - // 初始化 onMounted(() => { getUserListData() @@ -573,6 +513,15 @@ watch( }, { immediate: true } ) + +watch( + () => balanceForm.state, + (state) => { + if (state !== 'add') { + balanceForm.account_amount = false + } + } +)