2024-10-02 06:56:21 +00:00
|
|
|
|
<!-- 积分商城:商品列表 -->
|
2024-09-28 03:37:22 +00:00
|
|
|
|
<template>
|
2024-10-02 03:46:50 +00:00
|
|
|
|
<s-layout title="积分商城" navbar="normal" :leftWidth="0" :rightWidth="0">
|
|
|
|
|
<scroll-view
|
|
|
|
|
class="scroll-box"
|
|
|
|
|
:style="{ height: pageHeight + 'rpx' }"
|
|
|
|
|
scroll-y="true"
|
|
|
|
|
:scroll-with-animation="false"
|
|
|
|
|
:enable-back-to-top="true"
|
|
|
|
|
>
|
2024-10-13 13:41:25 +00:00
|
|
|
|
<s-point-card ref="sPointCardRef" class="ss-p-x-20 ss-m-t-20" />
|
2024-10-02 03:46:50 +00:00
|
|
|
|
<s-empty
|
|
|
|
|
v-if="activityTotal === 0"
|
|
|
|
|
icon="/static/goods-empty.png"
|
|
|
|
|
text="暂无积分商品"
|
|
|
|
|
></s-empty>
|
|
|
|
|
<uni-load-more
|
|
|
|
|
v-if="activityTotal > 0"
|
|
|
|
|
:status="loadStatus"
|
|
|
|
|
:content-text="{
|
2024-10-13 13:41:25 +00:00
|
|
|
|
contentdown: '上拉加载更多',
|
|
|
|
|
}"
|
2024-10-02 03:46:50 +00:00
|
|
|
|
@tap="loadMore"
|
|
|
|
|
/>
|
|
|
|
|
</scroll-view>
|
2024-09-28 03:37:22 +00:00
|
|
|
|
</s-layout>
|
|
|
|
|
</template>
|
|
|
|
|
<script setup>
|
|
|
|
|
import sheep from '@/sheep';
|
|
|
|
|
import { onLoad, onReachBottom } from '@dcloudio/uni-app';
|
2024-10-02 07:40:09 +00:00
|
|
|
|
import { reactive, ref } from 'vue';
|
2024-10-02 03:46:50 +00:00
|
|
|
|
import PointApi from '@/sheep/api/promotion/point';
|
|
|
|
|
import SLayout from '@/sheep/components/s-layout/s-layout.vue';
|
2024-09-28 03:37:22 +00:00
|
|
|
|
|
2024-10-02 03:46:50 +00:00
|
|
|
|
// 计算页面高度
|
|
|
|
|
const { safeAreaInsets, safeArea } = sheep.$platform.device;
|
|
|
|
|
const statusBarHeight = sheep.$platform.device.statusBarHeight * 2;
|
|
|
|
|
const pageHeight =
|
|
|
|
|
(safeArea.height + safeAreaInsets.bottom) * 2 + statusBarHeight - sheep.$platform.navbar - 350;
|
|
|
|
|
|
|
|
|
|
const sPointCardRef = ref();
|
|
|
|
|
// 查询活动列表
|
|
|
|
|
const activityPageParams = reactive({
|
|
|
|
|
pageNo: 1, // 页码
|
|
|
|
|
pageSize: 5, // 每页数量
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
const activityTotal = ref(0); // 活动总数
|
|
|
|
|
const activityCount = ref(0); // 已加载活动数量
|
|
|
|
|
const loadStatus = ref(''); // 页面加载状态
|
|
|
|
|
async function getActivityList() {
|
|
|
|
|
loadStatus.value = 'loading';
|
|
|
|
|
const { data } = await PointApi.getPointActivityPage(activityPageParams);
|
2024-10-02 04:15:53 +00:00
|
|
|
|
await sPointCardRef.value.concatActivity(data.list);
|
|
|
|
|
activityCount.value = sPointCardRef.value.getActivityCount();
|
2024-10-02 03:46:50 +00:00
|
|
|
|
activityTotal.value = data.total;
|
|
|
|
|
|
|
|
|
|
loadStatus.value = activityCount.value < activityTotal.value ? 'more' : 'noMore';
|
2024-09-28 03:37:22 +00:00
|
|
|
|
}
|
2024-10-02 03:46:50 +00:00
|
|
|
|
|
2024-09-28 03:37:22 +00:00
|
|
|
|
// 加载更多
|
2024-10-02 03:46:50 +00:00
|
|
|
|
function loadMore() {
|
2024-10-28 12:25:50 +00:00
|
|
|
|
if (loadStatus.value !== 'noMore') {
|
2024-10-02 03:46:50 +00:00
|
|
|
|
activityPageParams.pageNo += 1;
|
|
|
|
|
getActivityList();
|
2024-09-28 03:37:22 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 上拉加载更多
|
|
|
|
|
onReachBottom(() => {
|
2024-10-02 03:46:50 +00:00
|
|
|
|
loadMore();
|
2024-09-28 03:37:22 +00:00
|
|
|
|
});
|
|
|
|
|
onLoad(() => {
|
2024-10-02 03:46:50 +00:00
|
|
|
|
getActivityList();
|
2024-09-28 03:37:22 +00:00
|
|
|
|
});
|
|
|
|
|
</script>
|