1
This commit is contained in:
parent
2712949a96
commit
2d0d6eb59b
@ -49,3 +49,6 @@ export const getHostInfo=(params:any)=>request.get('/v1/host/info',{params})
|
||||
//兑换算力点
|
||||
export const exchangePoint=(params:any)=>request.put('/v1/balance/exchange_point',params)
|
||||
|
||||
//创建实例
|
||||
export const createHost=(params:any)=>request.post('/v1/host/host_case',params)
|
||||
|
||||
|
||||
@ -9,7 +9,7 @@
|
||||
</a-breadcrumb>
|
||||
|
||||
<!-- 余额卡片 -->
|
||||
<a-card class="balance-card">
|
||||
<a-card class="balance-card" >
|
||||
<div class="balance-info">
|
||||
<div class="balance-item">
|
||||
<div class="balance-label">
|
||||
@ -17,7 +17,7 @@
|
||||
</div>
|
||||
<div class="balance-value">
|
||||
<span class="currency">¥</span>
|
||||
<span class="amount">{{ userInfo.balance }}</span>
|
||||
<span class="amount">{{ formatCurrency(balance) }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="balance-item">
|
||||
@ -262,7 +262,7 @@ const handleCustomAmountChange = () => {
|
||||
if (!isNaN(amount)) {
|
||||
if (amount > 10000) {
|
||||
customAmountError.value = '单次最大兑换金额为10000元'
|
||||
} else if (amount > userInfo.value.balance) {
|
||||
} else if (amount > balance.value) {
|
||||
customAmountError.value = '兑换金额不能超过余额'
|
||||
} else {
|
||||
customAmountError.value = ''
|
||||
@ -289,15 +289,18 @@ const handleAgreementConfirm = () => {
|
||||
// 处理兑换
|
||||
const handleExchange = async () => {
|
||||
showAgreementError.value = false
|
||||
|
||||
if (!agreementChecked.value) {
|
||||
showAgreementError.value = true
|
||||
message.error('请先阅读并确认用户协议')
|
||||
return
|
||||
}
|
||||
if (selectedExchangeAmount.value > userInfo.value.balance) {
|
||||
|
||||
if (selectedExchangeAmount.value > balance.value) {
|
||||
message.error('兑换金额不能超过余额')
|
||||
return
|
||||
}
|
||||
|
||||
Modal.confirm({
|
||||
title: '确认兑换',
|
||||
content: `您确定要兑换 ¥${selectedExchangeAmount.value} 获得 ${selectedExchangeAmount.value} 算力点吗?此操作不可撤销。`,
|
||||
@ -423,6 +426,7 @@ onMounted(() => {
|
||||
/* 样式保持不变,同上 */
|
||||
.points-exchange-page {
|
||||
padding: 20px;
|
||||
background-color: #ffffff;
|
||||
/* min-height: 100vh; */
|
||||
}
|
||||
|
||||
@ -493,7 +497,6 @@ onMounted(() => {
|
||||
font-weight: 600;
|
||||
color: rgba(0, 0, 0, 0.85);
|
||||
margin-bottom: 8px;
|
||||
width: 120px;
|
||||
}
|
||||
|
||||
.amount-options {
|
||||
|
||||
@ -90,9 +90,7 @@
|
||||
</template>
|
||||
<!-- 支付状态列 -->
|
||||
<template v-if="column.key === 'pay_status'">
|
||||
<a-tag :color="getPayStatusColor(record.pay_status)">
|
||||
{{ getPayStatusText(record.pay_status) }}
|
||||
</a-tag>
|
||||
<a-tag> {{ record.pay_status }}</a-tag>
|
||||
</template>
|
||||
<!-- <template v-if="column.key === 'action'">
|
||||
<a-space>
|
||||
|
||||
@ -4,6 +4,12 @@
|
||||
<!-- 服务器选择 -->
|
||||
<a-card class="card select-server" title="服务器选择">
|
||||
<div class="list-filter">
|
||||
<div class="filter-item">
|
||||
<span class="filter-label">实例名称:</span>
|
||||
<div class="filter-content">
|
||||
<a-input v-model:value="instanceName"></a-input>
|
||||
</div>
|
||||
</div>
|
||||
<div class="filter-item">
|
||||
<span class="filter-label">计费方式<span style="color: #ff4d4f;margin: 0 2px">*</span>:</span>
|
||||
<div class="filter-content">
|
||||
@ -128,7 +134,7 @@ import { message } from 'ant-design-vue'
|
||||
import type { TableColumnsType } from 'ant-design-vue'
|
||||
import { useRoute,useRouter } from 'vue-router'
|
||||
import { getImages } from "@/apis/home"
|
||||
import { getMyCouponTotal, getTotalCost, getHostInfo } from "@/apis/home"
|
||||
import { getMyCouponTotal, getTotalCost, getHostInfo,createHost } from "@/apis/home"
|
||||
const router=useRouter()
|
||||
interface GpuModelOption {
|
||||
value: string
|
||||
@ -138,7 +144,7 @@ interface GpuModelOption {
|
||||
regions: string[]
|
||||
}
|
||||
|
||||
|
||||
const instanceName=ref('')
|
||||
const checked = ref(false)
|
||||
const totalMoney = ref(0)
|
||||
// 响应式数据
|
||||
@ -222,8 +228,17 @@ const isShow=computed(()=>{
|
||||
const handleCreate = async () => {
|
||||
creating.value = true
|
||||
try {
|
||||
await new Promise(resolve => setTimeout(resolve, 2000))
|
||||
const params={
|
||||
host_id:HostId.value,
|
||||
billingMethod:billingType.value,
|
||||
gpuNum:gpuCount.value,
|
||||
case_name:instanceName.value,
|
||||
image_id:selectedImage.value,
|
||||
is_use_voucher:checked.value
|
||||
}
|
||||
const res=await createHost(params)
|
||||
message.success('实例创建成功!')
|
||||
creating.value=false
|
||||
} catch (error) {
|
||||
message.error('创建失败,请重试')
|
||||
} finally {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user