用户金币流水日期查询 修复

(cherry picked from commit 53713b4201d5f43684f402b7c93b01965b0b9ebb)
This commit is contained in:
tianfeng 2026-06-01 16:14:14 +08:00
parent 6950aa1b40
commit 89b748a69c

View File

@ -20,7 +20,7 @@
:start-placeholder="$t('pages.goldRunningWater.filter.startDate')" :start-placeholder="$t('pages.goldRunningWater.filter.startDate')"
:end-placeholder="$t('pages.goldRunningWater.filter.endDate')" :end-placeholder="$t('pages.goldRunningWater.filter.endDate')"
:clearable="false" :clearable="false"
@change="renderData" @change="handleDateChange"
/> />
</div> </div>
<div class="gold-running-water-content"> <div class="gold-running-water-content">
@ -129,7 +129,6 @@
</template> </template>
<script> <script>
import { listGoldRunningWater } from '@/api/purchase' import { listGoldRunningWater } from '@/api/purchase'
import { beforeDateObject, datePlusDays, getMonthLastDate } from '@/utils'
export default { export default {
name: 'RunningWaterPreviewTabs', name: 'RunningWaterPreviewTabs',
props: { props: {
@ -142,8 +141,6 @@ export default {
return { return {
listLoading: false, listLoading: false,
list: [], list: [],
notProccessRangeDate: false,
beforeIntervalDays: 1,
rangeDate: [], rangeDate: [],
listQuery: { listQuery: {
userId: '', userId: '',
@ -154,43 +151,56 @@ export default {
notMore: false, notMore: false,
pickerOptions: { pickerOptions: {
disabledDate(date) { disabledDate(date) {
return date.getTime() > datePlusDays(new Date(), 1).getTime() const tomorrow = new Date()
tomorrow.setDate(tomorrow.getDate() + 1)
tomorrow.setHours(23, 59, 59, 999)
return date.getTime() > tomorrow.getTime()
} }
} }
} }
}, },
created() {
// 00:00:00 ~ 23:59:59
const defaultRangeTime = this.defaultRangeTimestamp()
this.rangeDate = defaultRangeTime
this.listQuery.startTime = defaultRangeTime[0]
this.listQuery.endTime = defaultRangeTime[1]
// userId
if (this.userId) {
this.listQuery.userId = this.userId
this.renderData()
}
},
watch: { watch: {
userId: { userId(newVal) {
handler(newVal) { if (newVal) {
if (newVal) { this.listQuery.userId = newVal
this.listQuery.userId = newVal this.resetAndLoad()
this.renderData() }
} }
}, },
immediate: true methods: {
}, // change watch
rangeDate: { handleDateChange(val) {
immediate: true, if (val && val.length === 2) {
deep: true, this.listQuery.startTime = val[0]
handler(newVal) { this.listQuery.endTime = val[1]
if (this.notProccessRangeDate === true) { } else {
this.notProccessRangeDate = false //
return
}
if (newVal && newVal.length > 0) {
this.listQuery.startTime = newVal[0]
this.listQuery.endTime = newVal[1]
return
}
this.notProccessRangeDate = true
const defaultRangeTime = this.defaultRangeTimestamp() const defaultRangeTime = this.defaultRangeTimestamp()
this.rangeDate = defaultRangeTime this.rangeDate = defaultRangeTime
this.listQuery.startTime = defaultRangeTime[0] this.listQuery.startTime = defaultRangeTime[0]
this.listQuery.endTime = defaultRangeTime[1] this.listQuery.endTime = defaultRangeTime[1]
} }
} this.resetAndLoad()
}, },
methods: { //
resetAndLoad() {
this.list = []
this.listQuery.lastId = ''
this.notMore = false
this.renderData()
},
renderData() { renderData() {
const that = this const that = this
if (!that.listQuery.userId) { if (!that.listQuery.userId) {
@ -214,31 +224,15 @@ export default {
console.error(er) console.error(er)
}) })
}, },
// 00:00:00 ~ 23:59:59
defaultRangeTimestamp() { defaultRangeTimestamp() {
const defStartDate = beforeDateObject(this.beforeIntervalDays) const startDate = new Date()
const mDate = datePlusDays(new Date(), 1) startDate.setHours(0, 0, 0, 0)
mDate.setHours(23)
mDate.setMinutes(59)
mDate.setSeconds(59)
const monthLastDate = getMonthLastDate()
monthLastDate.setHours(23)
monthLastDate.setMinutes(59)
monthLastDate.setSeconds(59)
const nowDate = mDate.getMonth() !== monthLastDate.getMonth() ? monthLastDate : mDate
if (nowDate.getMonth() !== defStartDate.getMonth()) { const endDate = new Date()
// endDate.setHours(23, 59, 59, 0)
const startDate = nowDate.getTime() - 60 * 60 * 1000 * 2
if (startDate.getMonth() !== nowDate.getMonth()) { return [startDate.getTime(), endDate.getTime()]
// 2
return [nowDate.getTime() - 60 * 1000 * 2, nowDate.getTime()]
}
return [defStartDate.getTime(), nowDate.getTime()]
}
return [defStartDate.getTime(), nowDate.getTime()]
}, },
handleClose() { handleClose() {
this.$emit('close') this.$emit('close')