chain balance query
This commit is contained in:
parent
faa991e1a0
commit
b07f2bc077
@ -24,3 +24,11 @@ export function getNFTInfo(data, cursor, pagesize) {
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function getBalanceInfo(data) {
|
||||
return request({
|
||||
url: '/nft/balancequery',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
@ -318,6 +318,12 @@ export const asyncRoutes = [
|
||||
name: 'nftquery',
|
||||
meta: { title: 'NFT查询', pername: 'nftquery' },
|
||||
hidden: false
|
||||
}, {
|
||||
path: 'balancequery',
|
||||
component: () => import('@/views/nft/balancequery'),
|
||||
name: 'balancequery',
|
||||
meta: { title: '余额查询', pername: 'balancequery' },
|
||||
hidden: false
|
||||
}
|
||||
]
|
||||
}, {
|
||||
|
@ -7,7 +7,7 @@ import { getToken } from '@/utils/auth'
|
||||
const service = axios.create({
|
||||
baseURL: process.env.VUE_APP_BASE_API, // url = base url + request url
|
||||
// withCredentials: true, // send cookies when cross-domain requests
|
||||
timeout: 5000 // request timeout
|
||||
timeout: 10000 // request timeout
|
||||
})
|
||||
|
||||
// request interceptor
|
||||
|
167
src/views/nft/balancequery.vue
Normal file
167
src/views/nft/balancequery.vue
Normal file
@ -0,0 +1,167 @@
|
||||
<template>
|
||||
<div class="createPost-container">
|
||||
<el-form ref="postForm" :model="postForm" :rules="rules" class="form-container">
|
||||
<div class="createPost-main-container">
|
||||
<el-row>
|
||||
<el-col :span="5">
|
||||
<el-form-item label-width="120px" label="address:" class="postInfo-container-item" prop="account_address">
|
||||
<el-input v-model="postForm.account_address" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-button style="margin-left: 10px;" type="success" @click="submitForm()">
|
||||
查询
|
||||
</el-button>
|
||||
</el-row>
|
||||
|
||||
<el-table
|
||||
:empty-text="emptytext"
|
||||
:data="balancelist"
|
||||
border
|
||||
fit
|
||||
highlight-current-row
|
||||
show-summary
|
||||
:summary-method="getSummaries"
|
||||
style="width: 100%;"
|
||||
>
|
||||
<el-table-column
|
||||
prop="account_address"
|
||||
label="账号地址"
|
||||
/>
|
||||
<el-table-column
|
||||
prop="token_name"
|
||||
label="token_name"
|
||||
/>
|
||||
<el-table-column
|
||||
prop="net_id"
|
||||
label="net_id"
|
||||
/>
|
||||
<el-table-column
|
||||
prop="chain_balance"
|
||||
label="余额"
|
||||
align="right"
|
||||
/>
|
||||
<el-table-column
|
||||
prop="recharge"
|
||||
label="充值总额"
|
||||
align="right"
|
||||
/>
|
||||
</el-table>
|
||||
</div>
|
||||
</el-form>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getBalanceInfo } from '@/api/nft'
|
||||
|
||||
export default {
|
||||
name: 'Balance',
|
||||
data() {
|
||||
return {
|
||||
postForm: {
|
||||
account_address: ''
|
||||
},
|
||||
rules: {
|
||||
account_address: [{ required: false, message: '', trigger: 'blur' }]
|
||||
},
|
||||
emptytext: ' ',
|
||||
balancelist: []
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
},
|
||||
mounted() {
|
||||
},
|
||||
methods: {
|
||||
submitForm() {
|
||||
try {
|
||||
this.$refs['postForm'].validate((valid) => {
|
||||
if (valid) {
|
||||
const querydata = JSON.parse(JSON.stringify(this.postForm))
|
||||
getBalanceInfo(querydata).then(response => {
|
||||
if (response.code === 0) {
|
||||
this.balancelist = response.data
|
||||
if (this.balancelist === undefined || this.balancelist.length <= 0) {
|
||||
this.emptytext = 'No data'
|
||||
}
|
||||
this.$message({
|
||||
message: '收到回应',
|
||||
type: 'success',
|
||||
duration: 1200
|
||||
})
|
||||
}
|
||||
}).catch(error => {
|
||||
console.log('error', error)
|
||||
})
|
||||
}
|
||||
})
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
}
|
||||
},
|
||||
getSummaries(params) {
|
||||
const { columns, data } = params
|
||||
const sums = []
|
||||
columns.forEach((column, index) => {
|
||||
if (index === 0) {
|
||||
sums[index] = '合计'
|
||||
return
|
||||
}
|
||||
|
||||
const values = data.map(item => Number(item[column.property]))
|
||||
if (column.property === 'recharge') {
|
||||
sums[index] = values.reduce((prev, curr) => {
|
||||
const value = Number(curr)
|
||||
if (!isNaN(value)) {
|
||||
return prev + curr
|
||||
} else {
|
||||
return prev
|
||||
}
|
||||
}, 0)
|
||||
sums[index]
|
||||
}
|
||||
})
|
||||
return sums
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
@import "~@/styles/mixin.scss";
|
||||
|
||||
.createPost-container {
|
||||
position: relative;
|
||||
|
||||
.createPost-main-container {
|
||||
padding: 40px 45px 20px 50px;
|
||||
|
||||
.postInfo-container {
|
||||
position: relative;
|
||||
@include clearfix;
|
||||
margin-bottom: 10px;
|
||||
|
||||
.postInfo-container-item {
|
||||
float: left;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.word-counter {
|
||||
width: 40px;
|
||||
position: absolute;
|
||||
right: 10px;
|
||||
top: 0px;
|
||||
}
|
||||
}
|
||||
|
||||
.article-textarea ::v-deep {
|
||||
textarea {
|
||||
padding-right: 40px;
|
||||
resize: none;
|
||||
border: none;
|
||||
border-radius: 0px;
|
||||
border-bottom: 1px solid #bfcbd9;
|
||||
}
|
||||
}
|
||||
|
||||
</style>
|
Loading…
x
Reference in New Issue
Block a user