bitcooo
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.
 
 
 
 

368 lines
10 KiB

<template>
<view class="">
<navigation :showBack="true" :bgnum="true">
<text class="big_title" v-if="userObject.coinList[0].xname=='Bitcoin'">
BTC
</text>
<text class="big_title" v-if="userObject.coinList[0].xname=='Ethereum'">
ETH
</text>
<text class="big_title" v-if="userObject.coinList[0].xname=='TRON'">
TRX
</text>
</navigation>
<view class="main">
<view class="money_con"
:class="{'money_con': userObject.coinList[0].xname=='Ethereum', 'money_con2': userObject.coinList[0].xname=='Bitcoin', 'money_con3': userObject.coinList[0].xname=='TRON'}">
<view class="textcon1">
<text class="text1">
<view class="" v-if="userObject.coinList[0].xname=='Bitcoin'">
{{this.infoWallet.balance}} BTC
</view>
<view class="" v-if="userObject.coinList[0].xname=='Ethereum'">
0.00 ETH
</view>
<view class="" v-if="userObject.coinList[0].xname=='TRON'">
0.00 TRX
</view>
<text class="text2"> $0.0</text>
</text>
<image src="../../../../static/tongyonh/ethereum.png" mode="aspectFit" class="img1"
v-if="userObject.coinList[0].xname=='Ethereum'"></image>
<image src="../../../../static/tongyonh/Frame28.png" mode="aspectFit" class="img1"
v-if="userObject.coinList[0].xname=='Bitcoin'"></image>
<image src="../../../../static/tongyonh/tronicon.png" mode="aspectFit" class="img1"
v-if="userObject.coinList[0].xname=='TRON'"></image>
</view>
<view class="textcon1">
<view class="v1">
<view class="t1">
0.0
</view>
<view class="t2">
Existing balance
</view>
</view>
<view class="v1 v2">
<view class="t1">
0.0
</view>
<view class="t2">
Freeze balance
</view>
</view>
</view>
</view>
<view class="select_con">
<view class="select">
<u-tabs height="120" bar-width="172" active-color="#6F69FF" inactive-color="#A3AED0" :list="list"
:is-scroll="false" :current="current" @change="change"></u-tabs>
<u-empty text="No content" mode="list" v-if="showInfo"></u-empty>
<view class="" v-if="!showInfo">
<view class="item1" v-for="(item,index) in trxs" v-if="current==1&&item.outputs.address!=address"
@click="goDetail(item,index)">
<view class="lef_con">
<image src="../../../../static/tongyonh/arrow-up-left_1.png" mode="aspectFit"
v-if="item.outputs.address!=address" class="img1"></image>
<view class="textcon">
<view class="text1" v-if="item.outputs.address!=address">
{{item.outputs[0].address}}
</view>
<view class="text2">
{{item.time}}
</view>
</view>
</view>
<view class="rig_con">
<view class="text1">
<text class="text1" v-if="item.outputs.address!=address">
<text>-</text>
{{item.outputs[0].value}}
</text>
<text class="">
{{item.network}}
</text>
</view>
<image src="../../../../static/tongyonh/Shape.png" mode="aspectFit" class="img1">
</image>
</view>
</view>
<view class="item1" v-for="(item,index) in trxs" v-if="current==0"
@click="goDetail(item,index)">
<view class="lef_con">
<image src="../../../../static/tongyonh/arrow-up-left.png" mode="aspectFit" class="img1"
v-if="item.outputs.address==address"></image>
<image src="../../../../static/tongyonh/arrow-up-left_1.png" mode="aspectFit"
v-if="item.outputs.address!=address" class="img1"></image>
<view class="textcon">
<view class="text1" v-if="item.outputs.address==address">
{{item.inputs[0].address}}
</view>
<view class="text1" v-if="item.outputs.address!=address">
{{item.outputs[0].address}}
</view>
<view class="text2">
{{item.time}}
</view>
</view>
</view>
<view class="rig_con">
<view class="text1">
<text class="text1" v-if="item.outputs.address==address">
<text>+</text>
{{item.inputs[0].value}}
</text>
<text class="text1" v-if="item.outputs.address!=address">
<text>-</text>
{{item.outputs[0].value}}
</text>
<text class="">
{{item.network}}
</text>
</view>
<image src="../../../../static/tongyonh/Shape.png" mode="aspectFit" class="img1">
</image>
</view>
</view>
<view class="item1" v-for="(item,index) in trxs" v-if="current==2&&item.outputs.address==address"
@click="goDetail(item,index)">
<view class="lef_con">
<image src="../../../../static/tongyonh/arrow-up-left.png" mode="aspectFit" class="img1"
v-if="item.outputs.address==address"></image>
<view class="textcon">
<view class="text1" v-if="item.outputs.address==address">
{{item.inputs[0].address}}
</view>
<view class="text2">
{{item.time}}
</view>
</view>
</view>
<view class="rig_con">
<view class="text1">
<text class="text1" v-if="item.outputs.address==address">
<text>+</text>
{{item.inputs[0].value}}
</text>
<text class="">
{{item.network}}
</text>
</view>
<image src="../../../../static/tongyonh/Shape.png" mode="aspectFit" class="img1">
</image>
</view>
</view>
</view>
</view>
</view>
<view class="btnconn">
<view class="btn active" @click="goSend">
<image src="../../../../static/tongyonh/arrow-up-leftw.png" mode="aspectFit" class="arrow-up-left">
</image>
Send
</view>
<view class="btn" @click="goReceive">
<image src="../../../../static/tongyonh/arrow-up-leftp.png" mode="aspectFit" class="arrow-up-left">
</image>
<text class="btn13">Receive</text>
</view>
</view>
</view>
</view>
</template>
<script>
import cont from "@/components/navigation/navigation.vue"
import api from '@/utils/api'
import index from '@/utils/index.js'
export default {
data() {
return {
// 拿账单的address
coinInfo: {},
trxs: [],
trxs2: [],
address: '',
userObject: {},
showInfo: false,
list: [{
name: 'All'
}, {
name: 'Send'
}, {
name: 'Receive',
}],
infoWallet: {},
current: 0,
pageSize: 10,
pageNum: 1,
param: {
'address': '',
'pageNum': 1,
'pageSize': 10,
}
}
},
methods: {
goSend() {
uni.navigateTo({
url: '/pages/menu/sendToken/transfer2/index'
})
},
goReceive() {
let itemm = JSON.stringify(this.infoWallet)
uni.navigateTo({
url: '/pages/menu/sendToken/index?item=' + itemm
})
},
goDetail(item, index) {
let itemm = JSON.stringify(this.trxs2[index])
uni.navigateTo({
url: '/pages/menu/transction/detail2/index?item=' + itemm
})
},
change(index) {
console.log(index)
this.current = index;
console.log(this.current)
},
getInfo() {
this.param.address = this.address2
const post = api.addressbtc(
this.param
)
post.then(res => {
this.trxs2 = res.data.data[0].txs
})
},
// 拿btc账单
getWalletInfo() {
if (this.infoWallet.coinList[0].xname == 'Bitcoin') {
this.address = this.infoWallet.address
this.address2 =this.infoWallet.address
// this.address2 = '14sA8jqYQgMRQV9zUtGFvpeMEw7YDn77SK';
// this.address = '14sA8jqYQgMRQV9zUtGFvpeMEw7YDn77SK';
this.param.address = this.address
this.userObject = this.infoWallet
// #ifdef APP-PLUS
uni.request({
url: 'http://scan.weirui0755.com/btc/api/address/btc/'+this.param.address+'/'+this.param.pageNum+'/'+this.param.pageSize, //请求接口
header: {
'content-type': 'application/x-www-form-urlencoded', //自定义请求头信息
},
success: (res) => {
console.log(res, 77)
if (res.data.code == 404) {
this.showInfo = true;
return;
}
if (res.data.data.network == 'ETH') {
this.trxs = res.data.data.txs
for (var i = 0; i < this.trxs.length; i++) {
this.trxs[i].from = this.trxs[i].from.substring(0, 6) + '...' + this.trxs[i].from
.substring(35, this.trxs[i].from.length);
this.trxs[i].to = this.trxs[i].to.substring(0, 6) + '...' + this.trxs[i].to.substring(
35, this.trxs[i].to.length);
this.trxs[i].time = index.formatyymmddhhmmss(this.trxs[i].time);
this.trxs[i].value = parseFloat(this.trxs[i].value).toFixed(5)
}
}
}
});
// #endif
// #ifdef H5
const post = api.addressbtc(
this.param
)
post.then(res => {
if (res.data.code == 404) {
this.showInfo = true;
return;
}
if (res.data.data[0].network == 'BTC') {
this.trxs = res.data.data[0].txs
console.log(this.trxs, 7777)
for (var i = 0; i < this.trxs.length; i++) {
for (var j = 0; j < this.trxs[i].inputs.length; j++) {
this.trxs[i].inputs[j].address = this.trxs[i].inputs[j].address.substring(0,
6) + '...' + this.trxs[i].inputs[j].address.substring(30, this.trxs[i]
.inputs[j].address.length);
this.trxs[i].inputs[j].value = parseFloat(this.trxs[i].inputs[j].value)
.toFixed(5)
}
this.trxs[i].time = index.formatyymmddhhmmss(this.trxs[i].time);
}
for (var i = 0; i < this.trxs.length; i++) {
for (var j = 0; j < this.trxs[i].outputs.length; j++) {
if (this.trxs[i].outputs[j].address != undefined) {
this.trxs[i].outputs[j].address = this.trxs[i].outputs[j].address
.substring(0, 6) + '...' + this.trxs[i].outputs[j].address.substring(
30, this.trxs[i].outputs[j].address.length);
this.trxs[i].outputs[j].value = parseFloat(this.trxs[i].outputs[j].value)
.toFixed(5)
}
}
}
}
})
// #endif
this.address = this.address.substring(0, 6) + '...' + this.address.substring(30, this.address.length);
this.getInfo()
}
}
},
onLoad(option) {
const item = JSON.parse(option.item);
this.infoWallet = item
this.getWalletInfo();
},
onReachBottom() {
this.param.pageSize += 5;
this.getWalletInfo()
}
};
</script>
<style scoped>
page {
background: #FAFAFA;
}
</style>
<style>
@import './index.css';
</style>