Files
RentWeAppFront/pages-biz/myrent/myLease.vue
2026-05-14 14:42:51 +08:00

108 lines
2.3 KiB
Vue

<template>
<view class="page">
<!-- 顶部自定义导航栏 -->
<customNavbar title="我的租赁资产" />
<!-- 租赁资产列表组件 -->
<scroll-view
scroll-y
class="scroll-content"
@scrolltolower="loadMore"
>
<asset-list
:list="assetList"
@click="goDetail"
/>
<!-- 加载更多 -->
<u-loadmore :status="loadStatus" />
</scroll-view>
</view>
</template>
<script>
import AssetList from '@/components/asset/assetList.vue'
export default {
name: 'MyLease',
components: { AssetList },
data() {
return {
assetList: [],
pageNo: 1,
pageSize: 10,
loadStatus: 'more', // ✅ 修复为官方正确值
cusNo: ''
};
},
onLoad(options) {
this.cusNo = options.cusNo;
this.loadAssets();
},
onShow() {
this.$checkToken(this.$getToken())
},
// ✅ 删除和 scroll-view 冲突的 onReachBottom
computed: {
staticHost() {
return this.$config.staticUrl
}
},
methods: {
loadAssets() {
// ✅ 正确判断加载状态
if (this.loadStatus !== 'more') return;
this.loadStatus = 'loading';
this.$u.post('/assets/getMyAssetsList', {
pageNo: this.pageNo,
pageSize: this.pageSize
}, {
WT: this.$getToken()
}).then(res => {
const rows = res.data.result || [];
if (this.pageNo === 1) this.assetList = [];
this.assetList = this.assetList.concat(rows);
// ✅ 判断是否还有更多数据
if (rows.length < this.pageSize) {
this.loadStatus = 'nomore';
} else {
this.pageNo++;
this.loadStatus = 'more';
}
}).catch(err => {
console.error(err);
this.loadStatus = 'more'; // ✅ 异常恢复
});
},
loadMore() {
this.loadAssets();
},
goDetail(item) {
uni.navigateTo({
url: `/pages-assets/assets/assetsDetail?assetsNo=${item.assetsNo}`,
});
},
},
};
</script>
<style lang="scss" scoped>
.page {
display: flex;
flex-direction: column;
min-height: 100vh;
background: #f7f8fa;
padding-top: 175rpx;
box-sizing: border-box;
}
.scroll-content {
flex: 1;
height: calc(100vh - 175rpx); /* ✅ 正确高度,不超出屏幕 */
box-sizing: border-box;
}
</style>