From 20b49801fb72cb611137c65f155ed83d15f3aaff Mon Sep 17 00:00:00 2001 From: dragon <3013557874@qq.com> Date: Tue, 24 Dec 2024 10:28:40 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=86=E9=A1=B5=E5=A4=84=E7=90=86=E6=9A=82?= =?UTF-8?q?=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../myincome/src/view/myincome/DiamondLog.vue | 38 +++++++++++++------ 1 file changed, 27 insertions(+), 11 deletions(-) diff --git a/view/molistar/vue-project/myincome/src/view/myincome/DiamondLog.vue b/view/molistar/vue-project/myincome/src/view/myincome/DiamondLog.vue index 966e6153..417cf6b0 100644 --- a/view/molistar/vue-project/myincome/src/view/myincome/DiamondLog.vue +++ b/view/molistar/vue-project/myincome/src/view/myincome/DiamondLog.vue @@ -74,7 +74,10 @@
{{ formatDate(item.date, 1) }}
- @@ -229,7 +232,6 @@ export default { formatDate, // tab切换按钮 cutTab(type) { - console.log(type); this.tabAct = type; this.time = null; this.lock = true; @@ -258,10 +260,9 @@ export default { if (this.page == 1) { this.list = res.data.data; } else { - if (res.data.data.length == 0) { - return; + if (res.data.data.length >= 1) { + this.list = this.mergeArrays(this.list, res.data.data); } - this.list.push(res.data.data); } if (this.page == 1 && res.data.data.length == 0) { this.dateLists = false; @@ -273,7 +274,6 @@ export default { this.lock = false; } } - console.log(this.list, "sssssssss"); } else { this.lock = true; Toast(res.data.message); @@ -319,6 +319,20 @@ export default { this.loading = false; }); }, + mergeArrays(arr1, arr2) { + const resultMap = new Map(); + [...arr1, ...arr2].forEach((item) => { + if (resultMap.has(item.date)) { + const existing = resultMap.get(item.date); + existing.recordList = [...existing.recordList, ...item.recordList]; + existing.totalAmount += item.totalAmount; + } else { + resultMap.set(item.date, { ...item }); + } + }); + + return Array.from(resultMap.values()); + }, handleScroll(event) { const container = event.target; // 获取滚动容器 if ( @@ -327,11 +341,13 @@ export default { ) { // 滚动到底部 console.log("已经到底部"); - this.page++; - if (this.tabAct == 4) { - this.giftReceiveFun(1); - } else { - this.getDate(1); + if (this.lock) { + this.page++; + if (this.tabAct == 4) { + this.giftReceiveFun(1); + } else { + this.getDate(1); + } } } },