From eefd82d20b6f68f5c8cf7f7b2af064d6d8408ee9 Mon Sep 17 00:00:00 2001
From: hxhxhx <2357034401@qq.com>
Date: Wed, 23 Apr 2025 14:56:14 +0800
Subject: [PATCH] 1
---
pages/mymoney/moneyDetail - 副本.vue | 234 +++++++++++++++++++++++++++
pages/mymoney/moneyDetail.vue | 146 ++++++++++-------
2 files changed, 325 insertions(+), 55 deletions(-)
create mode 100644 pages/mymoney/moneyDetail - 副本.vue
diff --git a/pages/mymoney/moneyDetail - 副本.vue b/pages/mymoney/moneyDetail - 副本.vue
new file mode 100644
index 0000000..8f9e56b
--- /dev/null
+++ b/pages/mymoney/moneyDetail - 副本.vue
@@ -0,0 +1,234 @@
+
+
+
+
+
+ 暫無數據
+
+
+
+
+
+
+ 收款地址:{{ adressOptions(item.to) }}
+
+
+
+
+
+
+
+
+ 付款地址:{{ adressOptions(item.from) }}
+
+
+
+
+
+
+
+
+ {{ timeOptions(item.timeStamp * 1000) }}
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/pages/mymoney/moneyDetail.vue b/pages/mymoney/moneyDetail.vue
index 8f9e56b..2d78cbc 100644
--- a/pages/mymoney/moneyDetail.vue
+++ b/pages/mymoney/moneyDetail.vue
@@ -1,8 +1,9 @@
-
-
+
+ 目前選擇:{{ selectData[selectType] }}
+
+
暫無數據
@@ -11,11 +12,12 @@
@@ -51,42 +53,22 @@ import { _coinlist, _userInfos } from "@/request/api.js"
export default {
data() {
return {
- webviewStyles: {
- progress: false,
- width: "0px",
- height: "0px"
- },
- webviewInstance: null,
+ selectData:['USDT','BNB','ETH','BTC'],
+ selectType: '0',
+ contractaddress:"0x55d398326f99059fF775485246999027B3197955",
userinfo: {},
swiperList: [],
- userMoneyAdress: ""
+ userMoneyAdress: "",
+ page: 1,
+ offset: 10,
+ isLoading: false,
+ hasMore: true
}
},
- onReady() {
- // 获取当前页面
- const currentWebview = this.$scope.$getAppWebview();
- // 获取web-view组件对象
- this.webviewInstance = currentWebview.children()[0];
- },
- onShow() {
+ mounted() {
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);
@@ -103,27 +85,81 @@ export default {
this.getCoinlist();
}
},
- getCoinlist() {
- if (this.webviewInstance) {
- this.webviewInstance.evalJS(`
- getTransactions(${JSON.stringify(this.userinfo.wallet.address)});
- `);
+ selectTypeChange(selObj){
+ this.selectType = selObj.detail.value;
+ switch(this.selectData[this.selectType]){
+ case 'USDT':
+ this.contractaddress = '0x55d398326f99059fF775485246999027B3197955';
+ break;
+ case 'BNB':
+ this.contractaddress = '';
+ break;
+ case 'ETH':
+ this.contractaddress = '0x2170ed0880ac9a755fd29b2688956bd959f933f8';
+ break;
+ case 'BTC':
+ this.contractaddress = '0x7130d2a12b9bcbfae4f2634d864a1ee1ce3ead9c';
+ break;
+ }
+ this.swiperList = [];
+ this.getCoinlist();
+ },
+ getCoinlist() {
+ if (this.isLoading || !this.hasMore) return;
+ this.isLoading = true;
+ uni.showLoading({
+ mask:true,
+ title: "載入中..."
+ })
+ let _that = this;
+ let params = {
+ module: 'account',
+ apikey: '1UQ3PHID4UJUDTVD4EJK35PZB8XDKS7K9T',
+ sort: 'desc',
+ address: _that.userMoneyAdress,
+ page: _that.page,
+ offset: _that.offset,
+ };
+ if (_that.contractaddress && _that.contractaddress != '') {
+ params.action = 'tokentx';
+ params.contractaddress = _that.contractaddress;
+ } else {
+ params.action = 'txlist';
+ }
+ uni.request({
+ url:'https://api.bscscan.com/api',
+ data: params,
+ success(res) {
+ if(res.data.status == 1){
+ const newData = res.data.result;
+ if (newData.length < _that.offset) {
+ _that.hasMore = false;
+ }
+ if (_that.page === 1) {
+ _that.swiperList = newData;
+ } else {
+ _that.swiperList = [..._that.swiperList, ...newData];
+ }
+ }
+ },
+ fail(err) {
+ console.log(err,'err');
+ uni.showToast({
+ title: '加载失败',
+ icon: 'none'
+ });
+ },
+ complete() {
+ _that.isLoading = false;
+ uni.hideLoading();
+ }
+ })
+ },
+ loadMore() {
+ if (this.hasMore && !this.isLoading) {
+ this.page += 1;
+ this.getCoinlist();
}
- // 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);
@@ -153,7 +189,7 @@ export default {
.money_detail {
width: 100vw;
height: 100vh;
- background: linear-gradient(to bottom, #000033, #51599b);
+ background: #000033;
padding: 20rpx;
box-sizing: border-box;