wangfukang 6 days ago
parent
commit
7a012e04ea
  1. 38
      package2/shop/shopSettlementDetail.vue

38
package2/shop/shopSettlementDetail.vue

@ -68,6 +68,7 @@
</view> </view>
<view class="empty-state" v-if="!loading && detailList.length === 0">暂无账单明细</view> <view class="empty-state" v-if="!loading && detailList.length === 0">暂无账单明细</view>
<view class="load-state" v-if="detailList.length > 0">{{loadStatus === 'loading' ? '加载中...' : loadStatus === 'nomore' ? '没有更多了' : '上拉加载更多'}}</view>
</view> </view>
</view> </view>
</template> </template>
@ -78,6 +79,11 @@
return { return {
menuButtonInfo: {}, menuButtonInfo: {},
loading: false, loading: false,
loadStatus: 'more',
total: 0,
pages: 1,
pageNumber: 1,
pageSize: 10,
query: { query: {
shopId: '', shopId: '',
regionId: '', regionId: '',
@ -94,6 +100,11 @@
onShow() { onShow() {
this.menuButtonInfo = uni.getMenuButtonBoundingClientRect() this.menuButtonInfo = uni.getMenuButtonBoundingClientRect()
}, },
onReachBottom() {
if (this.loading || this.pageNumber >= this.pages) return
this.pageNumber++
this.getDetailList()
},
onLoad(option) { onLoad(option) {
this.query = { this.query = {
shopId: option.shopId || uni.getStorageSync('shopId') || '', shopId: option.shopId || uni.getStorageSync('shopId') || '',
@ -105,6 +116,9 @@
totalBaseAmount: option.totalBaseAmount || 0, totalBaseAmount: option.totalBaseAmount || 0,
totalCommissionAmount: option.totalCommissionAmount || 0 totalCommissionAmount: option.totalCommissionAmount || 0
} }
this.pageNumber = 1
this.pages = 1
this.detailList = []
this.getDetailList() this.getDetailList()
}, },
methods: { methods: {
@ -121,20 +135,34 @@
getDetailList() { getDetailList() {
if (!this.query.shopId || !this.query.billTime) return if (!this.query.shopId || !this.query.billTime) return
this.loading = true this.loading = true
this.loadStatus = 'loading'
this.tui.request('/mall/admin/settlement/detailList', 'POST', { this.tui.request('/mall/admin/settlement/detailList', 'POST', {
regionId: this.query.regionId, regionId: this.query.regionId,
shopId: this.query.shopId, shopId: this.query.shopId,
settlementDate: this.query.billTime, settlementDate: this.query.billTime,
status: this.query.status status: this.query.status,
pageNumber: this.pageNumber,
pageSize: this.pageSize
}, false, false).then((res) => { }, false, false).then((res) => {
this.loading = false this.loading = false
if (res.code == 200) { if (res.code == 200) {
this.detailList = Array.isArray(res.result) ? res.result : [] const result = res.result || {}
const records = Array.isArray(result.records) ? result.records : (Array.isArray(result) ? result : [])
this.total = result.total || records.length
this.pages = result.pages || 1
if (this.pageNumber == 1) {
this.detailList = records
} else {
this.detailList = this.detailList.concat(records)
}
this.loadStatus = this.pageNumber >= this.pages ? 'nomore' : 'more'
} else { } else {
this.loadStatus = 'more'
this.tui.toast(res.message || '获取账单明细失败') this.tui.toast(res.message || '获取账单明细失败')
} }
}).catch(() => { }).catch(() => {
this.loading = false this.loading = false
this.loadStatus = 'more'
}) })
}, },
toAmount(value) { toAmount(value) {
@ -341,4 +369,10 @@
text-align: center; text-align: center;
color: #9aa6a2; color: #9aa6a2;
} }
.load-state {
padding: 36rpx 0 60rpx;
text-align: center;
color: #9aa6a2;
}
</style> </style>

Loading…
Cancel
Save