Browse Source

用户积分统计

feature/syp_points
songyunpeng 5 years ago
parent
commit
2e4658d7f3
  1. 159
      src/views/modules/points/user.vue
  2. 166
      src/views/modules/points/userinfo-points-adjust.vue

159
src/views/modules/points/user.vue

@ -0,0 +1,159 @@
<template>
<el-card shadow="never" class="aui-card--fill">
<div class="mod-sys__user">
<el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
<el-form-item label="姓名">
<el-input v-model="dataForm.realName" placeholder="姓名" clearable></el-input>
</el-form-item>
<el-form-item label="手机号">
<el-input v-model="dataForm.mobile" placeholder="手机号" clearable></el-input>
</el-form-item>
<el-form-item label="所属机构">
<el-cascader v-model="deptIdList"
:options="options"
:props="{ checkStrictly: true }"
clearable>
</el-cascader>
</el-form-item>
<el-form-item>
<el-button @click="getDataList()">{{ $t('query') }}</el-button>
</el-form-item>
</el-form>
<el-table
v-loading="dataListLoading"
:data="dataList"
border
@selection-change="dataListSelectionChangeHandle"
@sort-change="dataListSortChangeHandle"
style="width: 100%;">
<el-table-column prop="realName" label="姓名" header-align="center" align="center" :formatter="realNameFormat"></el-table-column>
<el-table-column prop="mobile" label="手机号" sortable="custom" header-align="center" align="center"></el-table-column>
<el-table-column prop="communityName" label="所属社区" header-align="center" align="center"></el-table-column>
<el-table-column prop="gridName" label="所属网格" header-align="center" align="center"></el-table-column>
<el-table-column prop="address" label="居住地址" header-align="center" align="center"></el-table-column>
<el-table-column prop="points" label="积分" header-align="center" align="center"></el-table-column>
<el-table-column :label="$t('handle')" fixed="right" header-align="center" align="center" width="150">
<template slot-scope="scope">
<el-button type="text"
size="small"
@click="pointsAdjustHandle(scope.row.id)">积分调整</el-button>
<el-button type="text"
size="small"
@click="pointsLogs(scope.row.id)">积分记录</el-button>
</template>
</el-table-column>
</el-table>
<el-pagination
:current-page="page"
:page-sizes="[10, 20, 50, 100]"
:page-size="limit"
:total="total"
layout="total, sizes, prev, pager, next, jumper"
@size-change="pageSizeChangeHandle"
@current-change="pageCurrentChangeHandle">
</el-pagination>
</div>
<!-- 弹窗, 积分调整 -->
<volunteerinfo-points-adjust v-if="volunteerinfoPointsAdjustVisible"
ref="volunteerinfoPointsAdjust"
@refreshDataList="getDataList"></volunteerinfo-points-adjust>
<!-- 积分记录 -->
<volunteer-points-log v-if="volunteerPointsLogVisible"
ref="volunteerPointsLog"
@refreshDataList="getDataList"></volunteer-points-log>
</el-card>
</template>
<script>
import mixinViewModule from '@/mixins/view-module'
import volunteerinfoPointsAdjust from './userinfo-points-adjust'
import volunteerPointsLog from './volunteer-points-log'
export default {
mixins: [mixinViewModule],
data () {
return {
mixinViewModuleOptions: {
getDataListURL: '/app-user/user/pageForPoints',
getDataListIsPage: true
},
dataForm: {
realName: '',
mobile: '',
streetId: '',
communityId: '',
gridId: ''
},
options: [],
deptIdList: [],
volunteerinfoDetailVisible: false,
volunteerinfoPointsAdjustVisible: false,
volunteerPointsLogVisible: false,
volunteerinfoCheckVisible: false
}
},
created () {
this.$http
.get(`/sys/user/deptOptions/getByLoginUser`)
.then(({ data: res }) => {
if (res.code !== 0) {
return this.$message.error(res.msg)
}
this.options = res.data.options
})
.catch(() => { })
},
watch: {
'deptIdList': function (val) {
if (val.length === 0) {
this.dataForm.streetId = ''
this.dataForm.communityId = ''
this.dataForm.gridId = ''
}
if (val.length === 1) {
this.dataForm.streetId = this.deptIdList[0]
this.dataForm.communityId = ''
this.dataForm.gridId = ''
}
if (val.length === 2) {
this.dataForm.streetId = this.deptIdList[0]
this.dataForm.communityId = this.deptIdList[1]
this.dataForm.gridId = ''
}
if (val.length === 3) {
this.dataForm.streetId = this.deptIdList[0]
this.dataForm.communityId = this.deptIdList[1]
this.dataForm.gridId = this.deptIdList[2]
}
}
},
methods: {
realNameFormat (row, column) {
if (row.realName) {
return row.realName
}
return row.nickname
},
//
pointsAdjustHandle (id) {
this.volunteerinfoPointsAdjustVisible = true
this.$nextTick(() => {
this.$refs.volunteerinfoPointsAdjust.dataForm.id = id
this.$refs.volunteerinfoPointsAdjust.init()
})
},
//
pointsLogs (id) {
this.volunteerPointsLogVisible = true
this.$nextTick(() => {
this.$refs.volunteerPointsLog.dataForm.userId = id
this.$refs.volunteerPointsLog.init()
})
}
},
components: {
volunteerinfoPointsAdjust,
volunteerPointsLog
}
}
</script>

166
src/views/modules/points/userinfo-points-adjust.vue

@ -0,0 +1,166 @@
<template>
<el-dialog :visible.sync="visible"
title="积分调整"
:close-on-click-modal="false"
:close-on-press-escape="false">
<el-form :label-width="$i18n.locale === 'en-US' ? '100px' : '100px'"
:model="dataForm"
:rules="dataRule"
ref="dataForm">
<el-form-item label="主键 :"
v-if="false">
<div>{{dataForm.id}}</div>
</el-form-item>
<el-form-item label="userId :"
v-if="false">
<div>{{dataForm.userId}}</div>
</el-form-item>
<el-form-item label="姓名 :">
<div>{{dataForm.realName}}</div>
</el-form-item>
<el-form-item label="性别 :">
<div v-if="dataForm.sex === '1'"></div>
<div v-if="dataForm.sex === '0'"></div>
<div v-if="dataForm.sex !=='0' && dataForm.sex !=='1'">未知</div>
</el-form-item>
<el-form-item label="出生日期 :">
<el-date-picker v-model="dataForm.birthday"
type="date"
value-format="yyyy-MM-dd"
format="yyyy-MM-dd"
readonly>
</el-date-picker>
</el-form-item>
<el-form-item label="手机号 :">
<div>{{dataForm.mobile}}</div>
</el-form-item>
<el-form-item label="积分 :">
<div>{{dataForm.points}}</div>
</el-form-item>
<el-form-item label="调整原因 :"
prop="adjustReason">
<el-input v-model="dataForm.adjustReason"
maxlength="10"
placeholder="不能超过10字"></el-input>
</el-form-item>
<el-form-item label="操作类型 :"
prop="operationType">
<el-radio-group v-model="dataForm.operationType">
<el-radio :label="1">加积分</el-radio>
<el-radio :label="0">减积分</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="积分调整 :"
prop="operatePoints">
<el-input-number v-model="dataForm.operatePoints"
:min="0" :max="1000"></el-input-number>
</el-form-item>
</el-form>
<template slot="footer">
<el-button @click="visible = false">{{ $t('cancel') }}</el-button>
<el-button type="primary"
@click="dataFormSubmitHandle()">{{ $t('confirm') }}</el-button>
</template>
</el-dialog>
</template>
<script>
import debounce from 'lodash/debounce'
export default {
data () {
return {
visible: false,
dataForm: {
id: '',
userId: '',
realName: '',
nickname: '',
faceImg: '',
sex: '',
birthday: '',
mobile: '',
points: '',
adjustReason: '',
operationType: '',
operatePoints: ''
}
}
},
computed: {
dataRule () {
return {
adjustReason: [
{
required: true,
message: this.$t('validate.required'),
trigger: 'blur'
}
],
operationType: [
{
required: true,
message: this.$t('validate.required'),
trigger: 'blur'
}
],
operatePoints: [
{
required: true,
message: this.$t('validate.required'),
trigger: 'blur'
}
]
}
}
},
created () {
},
methods: {
init () {
this.visible = true
this.$nextTick(() => {
this.$refs['dataForm'].resetFields()
if (this.dataForm.id) {
this.getInfo()
this.dataForm.adjustReason = ''
this.dataForm.operationType = ''
this.dataForm.operatePoints = ''
}
})
},
getInfo () {
this.$http.get(`/app-user/user/${this.dataForm.id}`).then(({ data: res }) => {
if (res.code !== 0) {
return this.$message.error(res.msg)
}
this.dataForm = {
...this.dataForm,
...res.data
}
}).catch(() => { })
},
dataFormSubmitHandle: debounce(function () {
this.$refs['dataForm'].validate(valid => {
if (!valid) {
return false
}
this.$http['post'](
'/points/pointslogs/confirmUserAdjustPoint', this.dataForm).then(({ data: res }) => {
if (res.code !== 0) {
return this.$message.error(res.msg)
}
this.$message({
message: this.$t('prompt.success'),
type: 'success',
duration: 500,
onClose: () => {
this.visible = false
this.$emit('refreshDataList')
}
})
}).catch(() => { })
}, 1000, { 'leading': true, 'trailing': false })
})
}
}
</script>
Loading…
Cancel
Save