diff --git a/api/appUser.js b/api/appUser.js
index 682c5d9..a83da33 100644
--- a/api/appUser.js
+++ b/api/appUser.js
@@ -102,8 +102,8 @@ export function cancelShipping(user_id, batch_no) {
return authRequest({ url: `/api/app/users/${user_id}/inventory/cancel-shipping`, method: 'POST', data: { batch_no } })
}
-export function getItemCards(user_id, status) {
- const data = {}
+export function getItemCards(user_id, status, page = 1, page_size = 20) {
+ const data = { page, page_size }
if (status !== undefined) data.status = status
return authRequest({ url: `/api/app/users/${user_id}/item_cards`, method: 'GET', data })
}
diff --git a/components/activity/RecordsList.vue b/components/activity/RecordsList.vue
index 89cae0f..d69a744 100644
--- a/components/activity/RecordsList.vue
+++ b/components/activity/RecordsList.vue
@@ -7,7 +7,7 @@
{{ item.title }}
x{{ item.count }}
- {{ item.percent }}%
+
diff --git a/composables/useRecords.js b/composables/useRecords.js
index 913aa11..c0b6ab0 100644
--- a/composables/useRecords.js
+++ b/composables/useRecords.js
@@ -39,10 +39,10 @@ export function useRecords() {
aggregate[key].count += 1
})
- const total = list.length || 1
+ // const total = list.length || 1
winRecords.value = Object.values(aggregate).map(it => ({
...it,
- percent: ((it.count / total) * 100).toFixed(1)
+ // percent: ((it.count / total) * 100).toFixed(1)
}))
} catch (e) {
console.error('fetchWinRecords error', e)
diff --git a/pages/item-cards/index.vue b/pages/item-cards/index.vue
index dc1cb0f..ed5bd52 100644
--- a/pages/item-cards/index.vue
+++ b/pages/item-cards/index.vue
@@ -31,6 +31,7 @@
refresher-enabled
:refresher-triggered="isRefreshing"
@refresherrefresh="onRefresh"
+ @scrolltolower="loadMore"
>
@@ -109,6 +110,13 @@
+
+
+
+
+ 加载更多...
+
+ - 到底啦 -
@@ -122,6 +130,9 @@ const list = ref([])
const loading = ref(false)
const isRefreshing = ref(false)
const currentTab = ref(0)
+const page = ref(1)
+const pageSize = 20
+const hasMore = ref(true)
// 获取用户ID
function getUserId() {
@@ -185,18 +196,28 @@ function switchTab(tab) {
uni.vibrateShort({ type: 'light' })
currentTab.value = tab
list.value = []
+ page.value = 1
+ hasMore.value = true
fetchData()
}
// 下拉刷新
async function onRefresh() {
isRefreshing.value = true
- await fetchData()
+ page.value = 1
+ hasMore.value = true
+ await fetchData(false)
isRefreshing.value = false
}
+// 加载更多
+async function loadMore() {
+ if (loading.value || !hasMore.value) return
+ await fetchData(true)
+}
+
// 获取数据
-async function fetchData() {
+async function fetchData(append = false) {
if (!checkAuth()) return
if (loading.value) return
@@ -205,15 +226,24 @@ async function fetchData() {
const userId = getUserId()
// status: 1=unused, 2=used, 3=expired
const status = currentTab.value === 0 ? 1 : (currentTab.value === 1 ? 2 : 3)
- const res = await getItemCards(userId, status)
+ const res = await getItemCards(userId, status, page.value, pageSize)
let items = Array.isArray(res) ? res : (res.list || res.data || [])
- // items is now a direct list of individual cards (backend aggregation removed)
- list.value = items
+ if (append) {
+ list.value = [...list.value, ...items]
+ } else {
+ list.value = items
+ }
+
+ if (items.length < pageSize) {
+ hasMore.value = false
+ } else {
+ page.value++
+ }
} catch (e) {
console.error('获取道具卡失败:', e)
- list.value = []
+ hasMore.value = false
} finally {
loading.value = false
}
@@ -657,4 +687,23 @@ onLoad(() => {
transform: rotate(360deg);
}
}
+
+/* 加载更多 */
+.loading-more {
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ padding: 30rpx 0;
+ color: $text-tertiary;
+ font-size: 24rpx;
+ gap: 12rpx;
+}
+
+.no-more {
+ text-align: center;
+ padding: 40rpx 0;
+ color: $text-tertiary;
+ font-size: 24rpx;
+ opacity: 0.6;
+}
diff --git a/pages/shop/index.vue b/pages/shop/index.vue
index b4c30ea..e9e87cf 100644
--- a/pages/shop/index.vue
+++ b/pages/shop/index.vue
@@ -97,12 +97,19 @@
暂无相关兑换项
+
+
+
+
+ 加载更多...
+
+ - 到底啦 -
@@ -426,4 +462,23 @@ watch(keyword, () => applyFilters())
}
@keyframes spin { to { transform: rotate(360deg); } }
+/* 加载更多 */
+.loading-more {
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ padding: 30rpx 0;
+ color: $text-tertiary;
+ font-size: 24rpx;
+ gap: 12rpx;
+}
+
+.no-more {
+ text-align: center;
+ padding: 40rpx 0;
+ color: $text-tertiary;
+ font-size: 24rpx;
+ opacity: 0.6;
+}
+