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

38
package2/shop/shopSettlementDetail.vue

@ -68,6 +68,7 @@
</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>
</template>
@ -78,6 +79,11 @@
return {
menuButtonInfo: {},
loading: false,
loadStatus: 'more',
total: 0,
pages: 1,
pageNumber: 1,
pageSize: 10,
query: {
shopId: '',
regionId: '',
@ -94,6 +100,11 @@
onShow() {
this.menuButtonInfo = uni.getMenuButtonBoundingClientRect()
},
onReachBottom() {
if (this.loading || this.pageNumber >= this.pages) return
this.pageNumber++
this.getDetailList()
},
onLoad(option) {
this.query = {
shopId: option.shopId || uni.getStorageSync('shopId') || '',
@ -105,6 +116,9 @@
totalBaseAmount: option.totalBaseAmount || 0,
totalCommissionAmount: option.totalCommissionAmount || 0
}
this.pageNumber = 1
this.pages = 1
this.detailList = []
this.getDetailList()
},
methods: {
@ -121,20 +135,34 @@
getDetailList() {
if (!this.query.shopId || !this.query.billTime) return
this.loading = true
this.loadStatus = 'loading'
this.tui.request('/mall/admin/settlement/detailList', 'POST', {
regionId: this.query.regionId,
shopId: this.query.shopId,
settlementDate: this.query.billTime,
status: this.query.status
status: this.query.status,
pageNumber: this.pageNumber,
pageSize: this.pageSize
}, false, false).then((res) => {
this.loading = false
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 {
this.loadStatus = 'more'
this.tui.toast(res.message || '获取账单明细失败')
}
}).catch(() => {
this.loading = false
this.loadStatus = 'more'
})
},
toAmount(value) {
@ -341,4 +369,10 @@
text-align: center;
color: #9aa6a2;
}
.load-state {
padding: 36rpx 0 60rpx;
text-align: center;
color: #9aa6a2;
}
</style>

Loading…
Cancel
Save