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