234 lines
5.7 KiB
Vue
234 lines
5.7 KiB
Vue
<template>
|
|
<view class="money_detail">
|
|
<web-view :webview-styles="webviewStyles" style="visibility: hidden; height: 1px; width: 100%;" src="/static/web3/transfer-web.html" @message="handleWebViewMessage"
|
|
:fullscreen="false" :update-title="false"></web-view>
|
|
<scroll-view scroll-y="true" class="" style="height: 100%;padding-top: 20rpx;box-sizing: border-box;">
|
|
<view v-if="swiperList.length == 0" style="text-align: center; width: 50%;margin: 20rpx auto;color: #fff;">
|
|
<view>暫無數據</view>
|
|
</view>
|
|
<view class="each_content" v-for="(item, index) in swiperList" :key="item.id">
|
|
<view class="each_content_left">
|
|
<view class="header_money">
|
|
<view class="text-green" v-if="item.to == userMoneyAdress">
|
|
<text class=" "></text>
|
|
<text class="">{{ "+ " + (item.value / 1e18).toFixed(6) + " USDT" }}</text>
|
|
</view>
|
|
<view class="text-red" v-else>
|
|
<text class=" "></text>
|
|
<text class="">{{ "- " + (item.value / 1e18).toFixed(6) + " USDT" }}</text>
|
|
</view>
|
|
</view>
|
|
<view class="content_adress">
|
|
<view class="text-gray">
|
|
收款地址:{{ adressOptions(item.to) }}
|
|
</view>
|
|
<view class="margin-top-lg">
|
|
<image @click="fuzhi(item.to)" src="/static/fizhi.png" style="width: 35rpx;height: 35rpx;">
|
|
</image>
|
|
</view>
|
|
</view>
|
|
<view class="content_adress">
|
|
<view class="text-gray">
|
|
付款地址:{{ adressOptions(item.from) }}
|
|
</view>
|
|
<view class="margin-top-lg">
|
|
<image @click="fuzhi(item.from)" src="/static/fizhi.png"
|
|
style="width: 35rpx;height: 35rpx;"></image>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<view class="each_content_right">
|
|
<view class="timeBtn">
|
|
{{ timeOptions(item.timeStamp * 1000) }}</view>
|
|
</view>
|
|
</view>
|
|
</scroll-view>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import { _coinlist, _userInfos } from "@/request/api.js"
|
|
export default {
|
|
data() {
|
|
return {
|
|
webviewStyles: {
|
|
progress: false,
|
|
width: "0px",
|
|
height: "0px"
|
|
},
|
|
webviewInstance: null,
|
|
userinfo: {},
|
|
swiperList: [],
|
|
userMoneyAdress: ""
|
|
}
|
|
},
|
|
onReady() {
|
|
// 获取当前页面
|
|
const currentWebview = this.$scope.$getAppWebview();
|
|
// 获取web-view组件对象
|
|
this.webviewInstance = currentWebview.children()[0];
|
|
},
|
|
onShow() {
|
|
this.getUserInfos();
|
|
},
|
|
methods: {
|
|
handleWebViewMessage(event) {
|
|
let _that = this;
|
|
let obj = event.detail.data;
|
|
if (obj.length > 0) {
|
|
if (obj[0].status == "success") {
|
|
obj[0].transactions.map(item => {
|
|
let a = Number(item.value);
|
|
if (a > 0) {
|
|
_that.swiperList.push(item)
|
|
}
|
|
})
|
|
console.log(_that.swiperList,'ssssaaa')
|
|
}
|
|
}
|
|
},
|
|
adressOptions(data) {
|
|
let start = data.substring(0, 10);
|
|
let end = data.substring(data.length - 4);
|
|
let middle = "…";
|
|
let finalString = start + middle + end;
|
|
return finalString
|
|
},
|
|
async getUserInfos() {
|
|
let res = await _userInfos();
|
|
if (res.code === 1) {
|
|
this.userinfo = res.data.userinfo;
|
|
this.userMoneyAdress = res.data.userinfo.wallet.address;
|
|
this.userMoneyAdress = this.userMoneyAdress.toLowerCase();
|
|
this.getCoinlist();
|
|
}
|
|
},
|
|
getCoinlist() {
|
|
if (this.webviewInstance) {
|
|
this.webviewInstance.evalJS(`
|
|
getTransactions(${JSON.stringify(this.userinfo.wallet.address)});
|
|
`);
|
|
}
|
|
// uni.request({
|
|
// url:'https://nfta.ikiry.com/transactions?address=' + _that.userinfo.wallet.address,
|
|
// success(res) {
|
|
// let arrayM = res.data;
|
|
// arrayM.map(item=>{
|
|
// let a = Number(item.value);
|
|
// if(a > 0){
|
|
// _that.swiperList.push(item)
|
|
// }
|
|
// })
|
|
// },
|
|
// fail(err) {
|
|
// console.log(err,'err');
|
|
// }
|
|
// })
|
|
},
|
|
timeOptions(timestamp) {
|
|
const date = new Date(timestamp);
|
|
const year = date.getFullYear();
|
|
const month = (date.getMonth() + 1).toString().padStart(2, '0');
|
|
const day = date.getDate().toString().padStart(2, '0');
|
|
const hours = date.getHours().toString().padStart(2, '0');
|
|
const minutes = date.getMinutes().toString().padStart(2, '0');
|
|
const seconds = date.getSeconds().toString().padStart(2, '0');
|
|
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`
|
|
},
|
|
fuzhi(e) {
|
|
uni.setClipboardData({
|
|
data: e,
|
|
success: function () {
|
|
uni.showToast({
|
|
title: '複製成功'
|
|
})
|
|
}
|
|
})
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
.money_detail {
|
|
width: 100vw;
|
|
height: 100vh;
|
|
background: linear-gradient(to bottom, #000033, #51599b);
|
|
padding: 20rpx;
|
|
box-sizing: border-box;
|
|
|
|
.each_content {
|
|
height: 180rpx;
|
|
background-color: #4c5188;
|
|
border-radius: 20rpx;
|
|
display: flex;
|
|
padding: 20rpx;
|
|
box-sizing: border-box;
|
|
margin-bottom: 30rpx;
|
|
color: #fff;
|
|
|
|
.header_money {
|
|
height: calc(100% / 3);
|
|
display: flex;
|
|
align-items: center;
|
|
|
|
.text-green {
|
|
color: #3eb93b;
|
|
font-weight: 700;
|
|
}
|
|
|
|
.text-red {
|
|
color: #e54d42;
|
|
font-weight: 700;
|
|
}
|
|
}
|
|
|
|
.footer_shouy {
|
|
width: 60%;
|
|
text-align: center;
|
|
color: #0081ff;
|
|
border: 1px solid skyblue;
|
|
border-radius: 30rpx;
|
|
font-weight: 700;
|
|
font-size: 30rpx;
|
|
line-height: 50rpx;
|
|
}
|
|
|
|
.content_adress {
|
|
display: flex;
|
|
align-items: center;
|
|
height: calc(100% / 3);
|
|
|
|
.text-gray {
|
|
width: calc(92% - 35rpx);
|
|
font-size: 25rpx;
|
|
}
|
|
}
|
|
|
|
.each_content_left {
|
|
width: 60%;
|
|
height: 100%;
|
|
}
|
|
|
|
.each_content_right {
|
|
width: 40%;
|
|
height: 100%;
|
|
display: flex;
|
|
justify-content: center;
|
|
align-items: center;
|
|
|
|
.timeBtn {
|
|
background: linear-gradient(to right, #8f8f8f, #3e3e3e);
|
|
font-size: 25rpx;
|
|
border-radius: 40rpx;
|
|
color: #fff;
|
|
height: 75rpx;
|
|
width: 90%;
|
|
display: flex;
|
|
justify-content: center;
|
|
align-items: center;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
</style> |