1 <style lang="scss" scoped>
4 height:calc(100% - 80px);
6 overscroll-behavior: contain;
14 color: rgba(0, 0, 0, 0.36);
40 justify-content: space-between;
42 color: rgba(0, 0, 0, 0.88);
51 color: rgba(0, 0, 0, 0.24);
52 div:not(:first-child) {
60 .icon_circle_selected{
63 vertical-align: middle;
69 <div class="warp-child bg-grey">
70 <section class="header">
71 <BackButton :small="true" :des="'home'"/>
72 <h1 class="color-black">
73 <div class="welcome-title">{{ $t('delayTx.title')}}</div>
77 <section class="transactions" v-if="currentBlockHeight !== 0">
79 <li class="list-item" v-for="(transaction, index) in transactions" :key="index" >
80 <a :href="blockmeta(transaction.lockedTxHash)" target="_blank">
82 <div class="font-bold">
85 <div class="addr color-grey" >{{transaction.address}}</div>
88 <div class="text-align-right">
89 <div class="value">{{transaction.direct}}{{transaction.amount}} {{transaction.asset.symbol}}</div>
91 <div v-if="transaction.status === 'delay_transfer_unlocked'" class="addr color-black">
92 <i class="iconfont icon_circle_selected"></i>{{ $t('delayTx.delay_transfer_unlocked') }}
94 <div v-else class="addr">
95 {{ $t(`delayTx.${transaction.status}`, { days: ( transaction.days ) }) }}
100 <infinite-loading @infinite="infiniteHandler">
101 <div slot="no-more"></div>
102 <div slot="no-results">
103 <div class="bg-emptytx"></div>
105 <span class="color-lightgrey center-text no-record">{{$t('main.noRecord')}}</span>
117 import address from "@/utils/address";
118 import query from "@/models/query";
119 import transaction from "@/models/transaction";
120 import { BTM } from "@/utils/constants";
121 import { mapGetters, mapState } from 'vuex'
122 import moment from 'moment'
124 const EnterActive = 'animated faster fadeInLeft';
125 const LeaveActive = 'animated faster fadeOutLeft';
128 const vaporBlockTime = 0.5
129 const bytomBlockTime = 150
138 enterActive: EnterActive,
139 leaveActive: LeaveActive,
140 currentBlockHeight:0,
145 if (to.name.startsWith('menu')) {
147 } else if (from.name.startsWith('menu')) {
148 this.maskShow = false
151 // remove transition for some page
152 this.enterActive = EnterActive
153 this.leaveActive = LeaveActive
158 return this.currentAddress
159 // if(this.netType === 'vapor'){
160 // return this.currentAccount.vpAddress
162 // return this.currentAccount.address
180 infiniteHandler($state) {
181 if (this.transactions.length===0 || (this.transactions.length == (this.start)) ) {
182 this.refreshTransactions( this.start, limit).then(transactions => {
183 if (transactions.length) {
184 this.start = this.start + limit;
185 this.transactions.push(...transactions);
195 blockmeta:function (txid) {
196 if(this.netType === 'vapor'){
197 return `https://vapor.blockmeta.com/tx/${txid}`
199 return `https://classic.blockmeta.com/tx/${txid}`
205 shortAddress: function (add) {
206 return address.short(add)
208 refreshTransactions: function (start, limit) {
209 return new Promise((resolve, reject) => {
211 transaction.listDelayTransaction(this.address, start, limit, this.net).then(transactions => {
212 if (transactions == null) {
216 const formattedTx = this.transactionsFormat(transactions);
224 countDays: function (lockUntil) {
225 const blockDiff = lockUntil - this.currentBlockHeight ;
227 if(this.netType === 'bytom'){
228 timeDiff = bytomBlockTime * blockDiff;
230 timeDiff = vaporBlockTime * blockDiff
233 return moment().add(timeDiff, 'seconds').fromNow(true);
235 transactionsFormat: function (transactions) {
236 const formattedTransactions = []
238 transactions.forEach(transaction => {
239 if(transaction.fromAddress == this.address){
240 transaction.address = address.short(transaction.toAddress)
241 transaction.direct = "-";
242 transaction.type = this.$t('delayTx.scheduledTransfer')
245 transaction.address = address.short(transaction.fromAddress)
246 transaction.direct = "+";
247 transaction.type = this.$t('delayTx.scheduledReceive')
250 if(transaction.status == 'delay_transfer_locked'){
251 transaction.days = this.countDays(transaction.lockUntil)
254 formattedTransactions.push(transaction);
256 return formattedTransactions;
260 if(this.language === 'zh' ||this.language === 'cn'){
261 moment.locale('zh-cn');
266 const resp = await query.blockStatus()
267 this.currentBlockHeight = resp.blockHeight;