master
chaiyapeng 2024-09-02 14:33:24 +08:00
parent 55cbd8ffb5
commit 5c01f9ba83
3 changed files with 178 additions and 1 deletions

View File

@ -79,3 +79,11 @@ export function doBuyInterface(data) {
data:data
})
}
//资产列表
export function findConnectorUserList(data) {
return request({
url: '/mart/connector/findConnectorUserList',
method: 'post',
data:data
})
}

View File

@ -0,0 +1,140 @@
<template>
<div>
<p style="font-weight: bold;font-size: 20px">余额{{ userBalanceData.userBalance || '加载中...' }}</p>
<el-table
:data="tableData"
style="width: 100%">
<el-table-column
label="编号"
width="180">
<template slot-scope="scope">
<span style="margin-left: 10px">{{ scope.row.connectorUserId }}</span>
</template>
</el-table-column>
<el-table-column
label="用户"
width="180">
<template slot-scope="scope">
<span style="margin-left: 10px">{{ scope.row.userName }}</span>
</template>
</el-table-column>
<el-table-column
label="接口"
width="180">
<template slot-scope="scope">
<span style="margin-left: 10px">{{ scope.row.connectorName }}</span>
</template>
</el-table-column>
<el-table-column
label="剩余次数"
width="180">
<template slot-scope="scope">
<span style="margin-left: 10px">{{ scope.row.connectorResidueDegree }}</span>
</template>
</el-table-column>
<el-table-column
label="购买次数"
width="180">
<template slot-scope="scope">
<span style="margin-left: 10px">{{ scope.row.connectorFrequency }}</span>
</template>
</el-table-column>
<el-table-column label="操作">
<template slot-scope="scope">
<el-button
size="mini"
@click="handleEdit(scope.$index, scope.row)">编辑</el-button>
<el-button
size="mini"
type="danger"
@click="handleDelete(scope.$index, scope.row)">删除</el-button>
</template>
</el-table-column>
</el-table>
</div>
</template>
<script>
//jsjsjson,
//import from ',
import {findConnectorUserList} from "@/api/port/port";
import {userBalance} from "@/api/system/user";
export default {
//import使"
components: {},
props: {},
data() {
//"
return {
userBalanceData: {
userBalance: '加载中...'
},
tableData:[],
form:{},
};
},
// data",
computed: {},
//data",
watch: {},
//",
methods: {
findConnectorUserList(){
findConnectorUserList(this.form).then((res)=>{
this.tableData=res.data;
})
},
async fetchUserBalance() {
try {
const userId = localStorage.getItem('userId');
console.log(userId)// userIdlocalStorage
if (!userId) {
this.userBalanceData = {userBalance: '未登录'};
return;
}
const response = await userBalance(userId);
if (response.data) {
console.log(response.data)
this.userBalanceData.userBalance = response.data;
} else {
this.userBalanceData.userBalance = {userBalance: '获取失败'};
}
} catch (error) {
this.userBalanceData = {userBalance: '获取失败'};
console.error('Error fetching user balance:', error);
}
},
},
// - 访this",
created() {
this.fetchUserBalance();
this.findConnectorUserList();
},
// - 访DOM",
mounted() {
},
beforeCreate() {
}, // - ",
beforeMount() {
}, // - ",
beforeUpdate() {
}, // - ",
updated() {
}, // - ",
beforeDestroy() {
}, // - ",
destroyed() {
}, // - ",
activated() {
} //keep-alive",
};
</script>
<style scoped>
</style>

View File

@ -21,6 +21,8 @@
<el-button type="primary" style="float: right; padding: 10px 10px" @click="testWeather()" v-if="connector.connectorName=='气象预警'">API</el-button>
<el-button type="primary" style="float: right; padding: 10px 10px" @click="testBirthdate()" v-if="connector.connectorName=='生辰助手'">API</el-button>
<el-button type="primary" style="float: right; padding: 10px 10px" @click="testMailbox()" v-if="connector.connectorName=='邮编查询'">API</el-button>
<el-button type="primary" style="float: right; padding: 10px 10px" @click="applyFor()">API</el-button>
</el-card>
</el-col>
</el-row>
@ -180,8 +182,10 @@
</el-form-item>
<el-form-item label="购买次数" :label-width="formLabelWidth">
<el-input-number v-model="buyForm.connectorFrequency" controls-position="right" @change="handleChange" :min="1" :max="10"></el-input-number>
<el-input-number v-model="buyForm.connectorFrequency" controls-position="right" @change="handleChange" :min="1"></el-input-number>
</el-form-item>
<p style="font-weight: bold;font-size: 20px">余额{{ userBalanceData.userBalance || '加载中...' }}</p>
<span style="font-weight: bold;font-size: 20px">共计{{buyForm.connectorPrice*buyForm.connectorFrequency}}</span>
</el-form>
<div slot="footer" class="dialog-footer">
@ -204,6 +208,7 @@ import {getBirthday} from "@/api/port/port";
import {getPostcode} from "@/api/port/port";
import {getWeather} from "@/api/port/port";
import {doBuyInterface} from "@/api/port/port";
import {userBalance} from "@/api/system/user";
export default {
//import使"
components: {},
@ -212,6 +217,9 @@ export default {
//"
return {
userBalanceData: {
userBalance: '加载中...'
},
formWeather:{},
data:[],
defaultProps: {
@ -305,6 +313,26 @@ export default {
watch: {},
//",
methods: {
async fetchUserBalance() {
try {
const userId = localStorage.getItem('userId');
console.log(userId)// userIdlocalStorage
if (!userId) {
this.userBalanceData = {userBalance: '未登录'};
return;
}
const response = await userBalance(userId);
if (response.data) {
console.log(response.data)
this.userBalanceData.userBalance = response.data;
} else {
this.userBalanceData.userBalance = {userBalance: '获取失败'};
}
} catch (error) {
this.userBalanceData = {userBalance: '获取失败'};
console.error('Error fetching user balance:', error);
}
},
buyInterface(){
doBuyInterface(this.buyForm).then((res)=>{
console.log(res);
@ -414,6 +442,7 @@ export default {
},
// - 访this",
created() {
this.fetchUserBalance();
this.findConnectorList();
},
// - 访DOM",