3
0
Fork 0

fix(bonus): 奖金请求逻辑调整,去除分页逻辑,选择区域执行回调

This commit is contained in:
woody 2025-06-13 15:30:56 +08:00
parent 77b15ffb5c
commit 20b8a20ae0
3 changed files with 26 additions and 26 deletions

View File

@ -20,7 +20,7 @@ module.exports = vm => {
//#ifdef DEV_SERVER //#ifdef DEV_SERVER
console.log('DEV_SERVER') console.log('DEV_SERVER')
config.baseURL = 'http://192.168.0.102:8080' config.baseURL = 'http://t-app.beida777.com/prod-api'
//#endif //#endif
//#ifdef QA_SERVER //#ifdef QA_SERVER

View File

@ -27,7 +27,7 @@
</view> </view>
<!-- 奖金列表 --> <!-- 奖金列表 -->
<scroll-view scroll-y class="bonus-list-scroll" @scrolltolower="loadMore"> <scroll-view scroll-y class="bonus-list-scroll">
<view v-if="bonusList.length === 0 && !loading" class="empty-state" <view v-if="bonusList.length === 0 && !loading" class="empty-state"
>暂无数据</view >暂无数据</view
> >
@ -110,10 +110,6 @@ export default {
bonusList: [], bonusList: [],
loading: false, loading: false,
hasMore: true, hasMore: true,
page: {
pageNum: 1,
pageSize: 10,
},
BONUS_FIELD_MAP: { BONUS_FIELD_MAP: {
retailRangeIncome: '直推收益', retailRangeIncome: '直推收益',
retailSameLevelIncome: '平级收益', retailSameLevelIncome: '平级收益',
@ -160,9 +156,18 @@ export default {
}) })
return return
} }
this.page.pageNum = 1 // 31
const start = dayjs(this.startDate)
const end = dayjs(this.endDate)
console.log(end.diff(start, 'day'), '...a?')
if (end.diff(start, 'day') > 30) {
uni.showToast({
title: '最多只能查询31天内的数据',
icon: 'none',
})
return
}
this.bonusList = [] this.bonusList = []
this.hasMore = true
this.fetchBonusData() this.fetchBonusData()
}, },
onStartDateConfirm(e) { onStartDateConfirm(e) {
@ -175,13 +180,6 @@ export default {
this.endDateValue = e.value this.endDateValue = e.value
this.showEndDatePicker = false this.showEndDatePicker = false
}, },
loadMore() {
if (this.loading || !this.hasMore) {
return
}
this.page.pageNum++
this.fetchBonusData()
},
getBonusTotal() { getBonusTotal() {
queryBonusTotal().then(res => { queryBonusTotal().then(res => {
this.realIncomeTotal = res.rows[0]?.realIncomeTotal || '0.00' this.realIncomeTotal = res.rows[0]?.realIncomeTotal || '0.00'
@ -195,15 +193,10 @@ export default {
const params = { const params = {
startDate: this.startDate, startDate: this.startDate,
endDate: this.endDate, endDate: this.endDate,
pageNum: this.page.pageNum,
pageSize: this.page.pageSize,
} }
const res = await queryBonusList(params) const res = await queryBonusList(params)
console.log(res) console.log(res)
if (res.rows.length < this.page.pageSize) { this.bonusList = res.rows || []
this.hasMore = false
}
this.bonusList = [...this.bonusList, ...res.rows]
} catch (error) { } catch (error) {
console.error('Failed to fetch bonus data:', error) console.error('Failed to fetch bonus data:', error)
uni.showToast({ title: '数据加载失败', icon: 'none' }) uni.showToast({ title: '数据加载失败', icon: 'none' })

View File

@ -426,7 +426,7 @@
</u-button> </u-button>
</view> </view>
</u-popup> </u-popup>
<RegionSelect ref="regionSelect" /> <RegionSelect ref="regionSelect" @success="getRegionSelect" />
<!-- <talentList :drShow="drShow" @closeShow="closeShow"></talentList> --> <!-- <talentList :drShow="drShow" @closeShow="closeShow"></talentList> -->
</view> </view>
</template> </template>
@ -648,11 +648,18 @@ export default {
methods: { methods: {
getRegionSelect() { getRegionSelect() {
getRegionSelect().then(res => { uni.showLoading({
if (res.code == 200) { title: '加载中...',
this.regionInfo = res.data
}
}) })
getRegionSelect()
.then(res => {
if (res.code == 200) {
this.regionInfo = res.data
}
})
.finally(() => {
uni.hideLoading()
})
}, },
openRegionSelect() { openRegionSelect() {
uni.showLoading({ uni.showLoading({