Skip to content

Commit

Permalink
add receive history
Browse files Browse the repository at this point in the history
  • Loading branch information
winter520 authored and winter520 committed Feb 13, 2020
1 parent 1ebca46 commit 1f03c14
Showing 1 changed file with 52 additions and 11 deletions.
63 changes: 52 additions & 11 deletions src/renderer/components/account/receive.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,31 +24,35 @@
</div>
</div>

<div class="tableHistory_box">
<div class="tableHistory_box mt-20">
<hgroup class="tableHistory_title">
<h3 class="title">{{$t('title').history}}:</h3>
</hgroup>
<div class="tableHistory_table table-responsive" v-loading="loading.history" :element-loading-text="$t('loading').l_1">
<el-table :data="historyData" style="width: 100%" empty-text="Null">
<el-table-column :label="$t('state').state" width="80">
<el-table :data="historyData" style="width: 100%" empty-text="Null" size="mini">
<el-table-column :label="$t('state').name" width="80">
<template slot-scope="scope">
<span v-html="scope.row.status" :class="scope.row.status !== 'Success' ? 'red' : ''"></span>
<span v-html="scope.row.status" class="color_green"></span>
</template>
</el-table-column>
<el-table-column :label="$t('label').coinType" prop="coinType" width="80"></el-table-column>
<el-table-column :label="$t('label').amount" prop="value" width="120">
<el-table-column :label="$t('label').amount" width="120">
<template slot-scope="scope">
<span>{{scope.row.contractValue ? scope.row.contractValue : scope.row.value}}</span>
</template>
</el-table-column>
<el-table-column :label="$t('label').date" prop="date" width="180"></el-table-column>
<el-table-column :label="$t('label').date" prop="date" width="180">
<template slot-scope="scope">
{{$$.timeChange(scope.row.timestamp, 'yyyy-mm-dd hh:mm')}}
</template>
</el-table-column>
<el-table-column :label="$t('label').info" min-width="360">
<template slot-scope="scope">
<el-collapse class="moreInfo_box" accordion v-model="activeNames">
<el-collapse-item :title="scope.row.hash">
<ul class="list">
<li>{{$t('label').hash}}:{{scope.row.hash}}</li>
<li>{{$t('label').address}}:{{scope.row.from}}</li>
<li @click="copyTxt(scope.row.hash)">{{$t('label').hash}}:{{scope.row.hash}}</li>
<li @click="copyTxt(scope.row.from)">{{$t('label').from}}:{{scope.row.from}}</li>
</ul>
</el-collapse-item>
</el-collapse>
Expand Down Expand Up @@ -95,6 +99,19 @@
.receiveAddress_btn .btn .icon img{width: 100%;height: 100%;}
.receiveAddress_btn .blue{background:#3078d7;margin-right:12px;}
.receiveAddress_btn .cyan{background:#285b7e;}
/* .tableHistory_table .el-collapse-item__header {overflow: hidden;white-space: nowrap;} */
.moreInfo_box{width:100%;position:relative;}
/* .moreInfo_box .moreInfo_hax{width:100%;max-width:300px;cursor:pointer;} */
.moreInfo_box .el-collapse-item__header{width:100%;height: 30px;line-height:30px;cursor:pointer;display: block;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;border: none;font-size:12px!important;padding-right: 30px;}
.moreInfo_box .el-icon-arrow-right{position: absolute;top:10px;right: 0;}
.moreInfo_box .el-collapse-item__content{padding: 0;}
.moreInfo_box.el-collapse{border: none}
.moreInfo_box .list{width:100%;background:#fff;border:1px solid #eee;font-size: 12px}
.moreInfo_box .list li{width:100%;word-break: break-all;border-bottom:1px solid #eee;padding: 10px 10px;line-height: 21px;cursor: pointer;}
.moreInfo_box .list li:last-child{border-bottom:none}
/* .moreInfo_box:hover .list{display:block;z-index:99;} */
.moreInfo_box .list li:hover{background: #eee;}
</style>

<script>
Expand Down Expand Up @@ -155,14 +172,38 @@ export default {
console.log(coininfo)
},
getSendHistory () {
this.loading.history = false
// this.loading.history = false
let url = this.$$.config.receiveAddrUrl + `txs/${this.selectData.coinType}/${this.selectData.address.toLowerCase()}`
// let url = this.getHistoryUrl()
const coin = this.$$.cutERC20(this.selectData.coinType).coinType
// let url = 'http://5.189.139.168:5000/txs/ETH/0x21c743d9637cba6c133f86312d24ed012ff4?6f42'
console.log(url)
this.historyData = []
this.$axios.get(url).then(res => {
console.log(res)
let data = res.data
console.log(data)
if (data && data.length > 0) {
for (let obj of data) {
let tData = {
from: obj.FromAddress,
hash: obj.Txhash,
timestamp: obj.Timestamp,
value: 0,
coinType: coin,
status: 'Success'
}
for (let obj2 of obj.TxOutputs) {
if (obj2.ToAddress.toLowerCase() === this.selectData.address.toLowerCase()) {
tData.value += Number(this.$$.thousandBit(this.$$.fromWei(obj2.Value, coin), 'no'))
}
}
this.historyData.push(tData)
// tData.value = this.$$.thousandBit(this.$$.fromWei(tData.value, coin), 'no')
}
}
this.loading.history = false
}).catch(err => {
console.log(err)
this.loading.history = false
})
// if (Number(this.$$.getCookies(this.$$.config.cookies.safeMode))) {
// this.historyLoading = false
Expand Down

0 comments on commit 1f03c14

Please sign in to comment.