You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

212 lines
6.9 KiB

3 years ago
<template>
<div class="main">
<el-card class="box-card">
<template #header>
<div class="card-header">
<span>帐户管理</span>
<div>
<el-button type="success" style="margin-right: 10px;" @click="flush()"></el-button>
<router-link to="/money">
<el-button type="primary">去充值</el-button>
</router-link>
</div>
</div>
</template>
<el-row :gutter="20" class="info">
<el-col :span="8">帐户余额<el-text class="mx-1" >{{ NumFilter(userBalance) }}</el-text></el-col>
<el-col :span="8">本月消费<el-text class="mx-1" >{{ NumFilter(userBalanceMonth) }}</el-text></el-col>
3 years ago
<el-col :span="8">当日消费<el-text class="mx-1" >{{ NumFilter(userBalanceDay) }}</el-text></el-col>
</el-row>
</el-card>
<div class="main2" v-if="pushSwitch == 'Y'">
<el-card class="box-card">
<template #header>
<div class="card-header">
<span>推荐计划</span>
</div>
</template>
<el-input v-model="pushUrl" size="large" readonly @click.stop="handleCopy(pushUrl)">
<template #append>
<el-button @click="handleCopy(pushUrl)"></el-button>
</template>
</el-input>
</el-card>
<el-alert :title="'推荐用户首次充值成功后将获得佣金奖励:' + rewardDesc+',奖励可在充值记录中查看'" type="success" :closable="false" />
</div>
<div class="main2">
<el-card class="box-card">
<template #header>
<div class="card-header">
<span>服务信息</span>
<div>
<router-link to="/key">
<el-button type="primary">KEY管理</el-button>
</router-link>
</div>
</div>
</template>
<div style="margin-top: 10px; margin-bottom: 10px;">
<el-input v-model="serverUrl" size="large" readonly @click.stop="handleCopy(serverUrl)">
<template #prepend>Api Server:</template>
<template #append>
<el-button @click="handleCopy(serverUrl)"></el-button>
</template>
</el-input>
</div>
<div style="margin-top: 10px; margin-bottom: 10px;">
<el-input v-model="userKey" size="large" readonly @click.stop="handleCopy(userKey)">
<template #prepend>Api Key:</template>
<template #append>
<el-button @click="handleCopy(userKey)"></el-button>
</template>
</el-input>
</div>
<div style="margin-top: 10px; margin-bottom: 10px;">
<el-input v-model="serverUrl2" size="large" type="password" readonly @click.stop="handleCopy(serverUrl2)">
<template #prepend>Api Server备用:</template>
<template #append>
<el-button @click="handleCopy(serverUrl2)"></el-button>
</template>
</el-input>
</div>
</el-card>
<el-alert title="点击输入框或按钮可直接复制" type="success" :closable="false" />
</div>
<div class="main2">
<el-card class="box-card">
<template #header>
<div class="card-header">
<span>模型定价</span>
</div>
</template>
<div style="margin-bottom: 10px;">
<el-alert title="注意模型价格中的计费单位为每1000个token而不是字数。算法基本和官方保持一致一个中文字符大致消耗2个token, 用英文提问回复更省token" type="warning" :closable="false"/>
</div>
3 years ago
<el-table :data="modelList" height="800" style="width: 100%">
<el-table-column prop="modelName" label="模型" />
<el-table-column prop="modelPrice" label="提问价格" width="180" >
<template #default="scope">
{{NumFilter4(scope.row.modelPrice*1000)}}/k
</template>
</el-table-column>
<el-table-column prop="modelPrice2" label="回答价格" width="180">
<template #default="scope">
{{NumFilter4(scope.row.modelPrice2*1000)}}/k
</template>
</el-table-column>
<el-table-column prop="remark" label="备注" />
</el-table>
</el-card>
</div>
3 years ago
</div>
</template>
<script setup name="Index">
import { getCertIndex } from '@/api/cert/index'
import { getConfigKey } from "@/api/system/config";
import { ref } from 'vue';
const { proxy } = getCurrentInstance();
const modelList = ref([]);
const serverUrl = ref("");
const serverUrl2 = ref("");
const userKey = ref("");
const userBalance = ref(0);
const userBalanceMonth = ref(0);
3 years ago
const userBalanceDay = ref(0);
const pushUrl = ref("");
const pushSwitch = ref("N")
const rewardDesc = ref("")
function getIndex() {
// 是否开启推广链接
getConfigKey("invite.distribution.switch").then(response => {
pushSwitch.value = response.msg;
});
getConfigKey("invite.distribution.type").then(resp1 => {
getConfigKey("invite.distribution.quota").then(resp2 => {
const type = resp1.msg
const quota = resp2.msg
if (type == "percent") {
rewardDesc.value = "被邀请用户首单充值"+quota+"%"
}else {
rewardDesc.value = quota +"元"
}
});
});
getCertIndex().then(response => {
serverUrl.value = response.data.serverUrl
serverUrl2.value = response.data.serverUrl2
userKey.value = response.data.userKey
userBalance.value = response.data.userBalance
userBalanceMonth.value = response.data.userBalanceMonth
3 years ago
userBalanceDay.value = response.data.userBalanceDay
pushUrl.value = response.data.pushUrl
modelList.value = response.data.modelList
})
}
function handleCopy(id){
// 获取需要复制的元素以及元素内的文本内容
const text = id;
// 添加一个input元素放置需要的文本内容
const input = document.createElement("input");
input.value = text;
document.body.appendChild(input);
// 选中并复制文本到剪切板
input.select();
document.execCommand("copy");
// 移除input元素
document.body.removeChild(input);
proxy.$modal.msgSuccess("复制成功");
}
function NumFilter (value) {
// 截取当前数据到小数点后两位
let realVal = parseFloat(value).toFixed(2)
return realVal
}
function NumFilter4 (value) {
// 截取当前数据到小数点后两位
let realVal = parseFloat(value).toFixed(4)
return realVal
}
function flush () {
getIndex()
proxy.$modal.msgSuccess("刷新成功");
}
getIndex()
3 years ago
</script>
<style scoped lang="scss">
.main {
padding: 20px;
}
.main2 {
margin-top: 20px;
}
3 years ago
.card-header {
display: flex;
justify-content: space-between;
align-items: center;
}
3 years ago
.text {
font-size: 14px;
}
3 years ago
.item {
margin-bottom: 18px;
3 years ago
}
.info {
font-size: 15px;
color: #606266;
}
3 years ago
</style>