修改物业费数据展示不全的问题
This commit is contained in:
parent
ca7806578b
commit
730eac05b7
@ -1,5 +1,6 @@
|
|||||||
page {
|
page {
|
||||||
background-color: #f6f7fb;
|
background-color: #f6f7fb;
|
||||||
|
padding-bottom: 0rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.header {
|
.header {
|
||||||
@ -145,3 +146,11 @@ page {
|
|||||||
color: #999999;
|
color: #999999;
|
||||||
margin-top: 10rpx;
|
margin-top: 10rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* 加载更多提示样式 */
|
||||||
|
.load-more {
|
||||||
|
padding: 30rpx 0;
|
||||||
|
text-align: center;
|
||||||
|
font-size: 28rpx;
|
||||||
|
color: #999999;
|
||||||
|
}
|
||||||
@ -54,6 +54,11 @@
|
|||||||
<view v-else>
|
<view v-else>
|
||||||
<view class="no-record">暂无变动记录</view>
|
<view class="no-record">暂无变动记录</view>
|
||||||
</view>
|
</view>
|
||||||
|
<!-- 加载更多提示 -->
|
||||||
|
<view v-if="records.length > 0" class="load-more">
|
||||||
|
<text v-if="loading">加载中...</text>
|
||||||
|
<text v-else-if="!hasMore">没有更多数据了</text>
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@ -74,6 +79,8 @@ export default {
|
|||||||
itemType: '',
|
itemType: '',
|
||||||
page_num: 1,
|
page_num: 1,
|
||||||
page_size: 10,
|
page_size: 10,
|
||||||
|
loading: false,
|
||||||
|
hasMore: true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onLoad(options) {
|
onLoad(options) {
|
||||||
@ -84,7 +91,27 @@ export default {
|
|||||||
this.photoVal = options.type == 1 ? 'https://wechat-img-file.oss-cn-beijing.aliyuncs.com//user_wallet1.png' : (options.type == 2 ? 'https://wechat-img-file.oss-cn-beijing.aliyuncs.com//user_wallet2.png' : 'https://wechat-img-file.oss-cn-beijing.aliyuncs.com//user_wallet3.png');
|
this.photoVal = options.type == 1 ? 'https://wechat-img-file.oss-cn-beijing.aliyuncs.com//user_wallet1.png' : (options.type == 2 ? 'https://wechat-img-file.oss-cn-beijing.aliyuncs.com//user_wallet2.png' : 'https://wechat-img-file.oss-cn-beijing.aliyuncs.com//user_wallet3.png');
|
||||||
this.itemObj = JSON.parse(options.item);
|
this.itemObj = JSON.parse(options.item);
|
||||||
this.itemType = options.type;
|
this.itemType = options.type;
|
||||||
this.balance = options.type == 1 ? this.itemObj.points : (options.type == 2 ? this.itemObj.property_housing_fund : 0)
|
this.balance = options.type == 1 ? this.itemObj.points : (options.type == 2 ? this.itemObj.property_housing_fund : 0);
|
||||||
|
this.page_num = 1;
|
||||||
|
this.records = [];
|
||||||
|
this.hasMore = true;
|
||||||
|
this.getWalletInfo();
|
||||||
|
},
|
||||||
|
|
||||||
|
// 下拉刷新
|
||||||
|
onPullDownRefresh() {
|
||||||
|
this.page_num = 1;
|
||||||
|
this.records = [];
|
||||||
|
this.hasMore = true;
|
||||||
|
this.getWalletInfo().then(() => {
|
||||||
|
uni.stopPullDownRefresh();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
// 触底加载更多
|
||||||
|
onReachBottom() {
|
||||||
|
if (this.loading || !this.hasMore) return;
|
||||||
|
this.page_num++;
|
||||||
this.getWalletInfo();
|
this.getWalletInfo();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
@ -95,18 +122,54 @@ export default {
|
|||||||
},
|
},
|
||||||
// 获取钱包信息
|
// 获取钱包信息
|
||||||
getWalletInfo() {
|
getWalletInfo() {
|
||||||
|
if (this.loading) return Promise.resolve();
|
||||||
|
|
||||||
|
this.loading = true;
|
||||||
const params = {
|
const params = {
|
||||||
page_num: this.page_num,
|
page_num: this.page_num,
|
||||||
page_size: this.page_size,
|
page_size: this.page_size,
|
||||||
}
|
}
|
||||||
if (this.itemType == 1) {
|
|
||||||
request(apiArr.getPoints, 'POST', params, { silent: false }).then(res => {
|
const requestPromise = new Promise((resolve, reject) => {
|
||||||
|
if (this.itemType == 1) {
|
||||||
|
request(apiArr.getPoints, 'POST', params, { silent: false }).then(res => {
|
||||||
|
this.handleResponse(res);
|
||||||
|
resolve();
|
||||||
|
}).catch(err => {
|
||||||
|
reject(err);
|
||||||
|
})
|
||||||
|
} else if (this.itemType == 2) {
|
||||||
|
request(apiArr.getAccumulationFund, 'POST', params, { silent: false }).then(res => {
|
||||||
|
this.handleResponse(res);
|
||||||
|
resolve();
|
||||||
|
}).catch(err => {
|
||||||
|
reject(err);
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
resolve();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
requestPromise.finally(() => {
|
||||||
|
this.loading = false;
|
||||||
|
});
|
||||||
|
|
||||||
|
return requestPromise;
|
||||||
|
},
|
||||||
|
|
||||||
|
// 处理响应数据
|
||||||
|
handleResponse(res) {
|
||||||
|
if (res && res.rows) {
|
||||||
|
if (this.page_num === 1) {
|
||||||
|
// 第一页数据直接替换
|
||||||
this.records = res.rows;
|
this.records = res.rows;
|
||||||
})
|
} else {
|
||||||
} else if (this.itemType == 2) {
|
// 后续页数据追加
|
||||||
request(apiArr.getAccumulationFund, 'POST', params, { silent: false }).then(res => {
|
this.records = [...this.records, ...res.rows];
|
||||||
this.records = res.rows;
|
}
|
||||||
})
|
|
||||||
|
// 判断是否还有更多数据
|
||||||
|
this.hasMore = res.rows.length >= this.page_size;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user