2026-05-06 19:03:04 +08:00

165 lines
4.6 KiB
Vue

<!--签到记录表格-->
<template>
<div class="app-container">
<div class="filter-containers">
<div class="filter-item">
<account-input v-model="listQuery.userId" :placeholder="$t('pages.userCheckIns.placeholder.userId')" />
</div>
<div class="filter-item">
<el-date-picker
v-model="rangeDate"
value-format="timestamp"
type="datetimerange"
:picker-options="pickerOptions"
:range-separator="$t('pages.userCheckIns.word.to')"
:start-placeholder="$t('pages.userCheckIns.placeholder.startDate')"
:end-placeholder="$t('pages.userCheckIns.placeholder.endDate')"
/>
</div>
<el-button
:loading="searchLoading"
class="filter-item"
type="primary"
icon="el-icon-search"
:disabled="searchDisabled"
@click="handleSearch"
>
{{ $t('common.search') }}
</el-button>
</div>
<el-table
v-loading="listLoading"
:data="list"
:element-loading-text="$t('pages.userCheckIns.word.loading')"
fit
highlight-current-row
>
<el-table-column prop="userId" :label="$t('pages.userCheckIns.table.userId')" align="center" />
<el-table-column :label="$t('pages.userCheckIns.table.nickname')" align="center">
<template slot-scope="scope">
<el-link v-if="scope.row.userNickname" @click="queryUserDetails(scope.row.userId)">{{ scope.row.userNickname }}</el-link>
</template>
</el-table-column>
<el-table-column prop="userSexName" :label="$t('pages.userCheckIns.table.gender')" align="center" />
<el-table-column prop="checkInNumber" :label="$t('pages.userCheckIns.table.consecutiveCheckInDays')" align="center" min-width="160" />
<el-table-column :label="$t('pages.userCheckIns.table.checkInReward')" align="center" min-width="220">
<template slot-scope="scope">
<el-image
v-if="scope.row.propsId"
style="width: 50px; height: 50px"
:src="scope.row.propsSourceRecord ? scope.row.propsSourceRecord.cover : ''"
/>
<span v-else>{{ scope.row.quantity }}</span>
</template>
</el-table-column>
<el-table-column prop="createTime" :label="$t('pages.userCheckIns.table.checkInTime')" align="center" min-width="160">
<template slot-scope="scope">
{{ scope.row.createTime | dateFormat }}
</template>
</el-table-column>
</el-table>
<pagination
v-show="total > 0"
:total="total"
:page.sync="listQuery.cursor"
:limit.sync="listQuery.limit"
@pagination="renderData"
/>
<user-deatils-drawer
v-if="userDeatilsDrawerVisible"
:user-id="thatSelectedUserId"
@close="userDeatilsDrawerVisible=false"
/>
</div>
</template>
<script>
import { pageUserCheckLog } from '@/api/approval'
import Pagination from '@/components/Pagination'
import { pickerOptions } from '@/constant/el-const'
export default {
components: { Pagination },
data() {
return {
pickerOptions,
searchDisabled: false,
list: [],
userDeatilsDrawerVisible: false,
thatSelectedUserId: '',
userRegisterInfo: {},
listQuery: {
cursor: 1,
limit: 20,
userId: '',
startTime: '',
endTime: ''
},
total: 0,
searchLoading: false,
listLoading: false,
rangeDate: []
}
},
watch: {
rangeDate: {
immediate: true,
deep: true,
handler(newVal) {
if (newVal && newVal.length > 0) {
this.listQuery.startTime = newVal[0]
this.listQuery.endTime = newVal[1]
return
}
this.listQuery.startTime = ''
this.listQuery.endTime = ''
}
}
},
created() {
this.renderData()
},
methods: {
renderData() {
const that = this
that.listLoading = true
pageUserCheckLog(that.listQuery).then(res => {
const { body } = res
that.total = body.total || 0
that.list = body.records
that.searchLoading = that.listLoading = false
}).catch(er => {
that.searchLoading = that.listLoading = false
})
},
handleSearch() {
this.searchLoading = true
this.renderData()
},
queryUserDetails(id) {
this.userDeatilsDrawerVisible = true
this.thatSelectedUserId = id
},
handleClose() {
this.$emit('close')
}
}
}
</script>
<style scoped lang='scss'>
.filter-containers {
padding-bottom: 10px;
float:left;
.filter-item {
display: inline-block;
vertical-align: middle;
margin-bottom: 10px;
}
}
</style>