Browse Source

积分记录

master
尹作梅 6 years ago
parent
commit
e1956fcfba
  1. 122
      src/views/modules/points/volunteer-points-log.vue
  2. 104
      src/views/modules/points/volunteerinfo-points-adjust.vue
  3. 25
      src/views/modules/user/volunteerinfo.vue

122
src/views/modules/points/volunteer-points-log.vue

@ -0,0 +1,122 @@
<template>
<el-dialog
:visible.sync="visible"
title="积分记录"
:close-on-click-modal="false"
:close-on-press-escape="false"
>
<el-form :model="dataForm" ref="dataForm" :label-width="$i18n.locale === 'en-US' ? '100px' : '80px'">
<el-form-item label="积分行为">
<el-select v-model="dataForm.behaviorCode" placeholder="全部" clearable @change="queryByBehaviorCode">
<el-option
v-for="item in behaviorTypeList"
:key="item.dictValue"
:label="item.dictName"
:value="item.dictValue">
</el-option>
</el-select>
</el-form-item>
</el-form>
<el-table v-loading="dataListLoading" :data="dataList" border style="width: 100%;">
<el-table-column type="index" width="50" label="序号"></el-table-column>
<el-table-column prop="operationDesc" label="操作描述" header-align="center" align="center"></el-table-column>
<el-table-column prop="behaviorCode" label="积分行为" header-align="center" align="center" :formatter="showBehaviorCodeFormatter"></el-table-column>
<el-table-column prop="operationTime" 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 prop="operationType" label="操作类型" header-align="center" align="center" :formatter="showOperationTypeFormatter"></el-table-column>
<el-table-column prop="lavePoints" label="剩余积分" header-align="center" align="center"></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>
</el-dialog>
</template>
<script>
import mixinViewModule from '@/mixins/view-module'
export default {
mixins: [mixinViewModule],
data () {
return {
mixinViewModuleOptions: {
getDataListURL: '/points/pointslogs/page',
getDataListIsPage: true
},
visible: false,
dataForm: {
volunteerId: '',
behaviorCode: ''
},
behaviorTypeList: [],
operationTypeList: []
}
},
created () {
this.getOperationTypeList()
this.getBehaviorTypeList()
},
methods: {
init () {
this.visible = true
this.$nextTick(() => {
this.$refs['dataForm'].resetFields()
if (this.dataForm.volunteerId) {
this.getDataList()
}
})
this.dataForm.behaviorCode = ''
},
//
getOperationTypeList () {
this.$http
.get(`/sys/dict/listSimple/pointsrule_operation_type`)
.then(({ data: res }) => {
if (res.code !== 0) {
return this.$message.error(res.msg)
}
this.operationTypeList = res.data
})
.catch(() => {})
},
showOperationTypeFormatter: function (row, column) {
if (row.operationType) {
let dict = this.operationTypeList.filter(item => item.dictValue === row.operationType)[0]
if (dict) {
return dict.dictName
}
}
return ''
},
getBehaviorTypeList () {
this.$http
.get(`/sys/dict/listSimple/pointsrule_behavior`)
.then(({ data: res }) => {
if (res.code !== 0) {
return this.$message.error(res.msg)
}
this.behaviorTypeList = res.data
})
.catch(() => {})
},
showBehaviorCodeFormatter: function (row, column) {
if (row.behaviorCode) {
let dict = this.behaviorTypeList.filter(item => item.dictValue === row.behaviorCode)[0]
if (dict) {
return dict.dictName
}
}
return ''
},
queryByBehaviorCode () {
this.getDataList()
}
}
}
</script>

104
src/views/modules/points/volunteerinfo-points-adjust.vue

@ -5,7 +5,10 @@
:close-on-click-modal="false" :close-on-click-modal="false"
:close-on-press-escape="false" :close-on-press-escape="false"
> >
<el-form :label-width="$i18n.locale === 'en-US' ? '100px' : '80px'"> <el-form :label-width="$i18n.locale === 'en-US' ? '100px' : '100px'"
:model="dataForm"
:rules="dataRule"
ref="dataForm">
<el-form-item label="主键:" v-if="false"> <el-form-item label="主键:" v-if="false">
<div>{{dataForm.id}}</div> <div>{{dataForm.id}}</div>
</el-form-item> </el-form-item>
@ -33,16 +36,26 @@
<el-form-item label="积分:"> <el-form-item label="积分:">
<div>{{dataForm.points}}</div> <div>{{dataForm.points}}</div>
</el-form-item> </el-form-item>
<el-form-item label="积分行为" prop="behaviorCode">
<el-select v-model="dataForm.behaviorCode">
<el-option
v-for="item in behaviorTypeList"
:key="item.dictValue"
:label="item.dictName"
:value="item.dictValue">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="调整原因:" prop="adjustReason"> <el-form-item label="调整原因:" prop="adjustReason">
<el-input v-model="dataForm.adjustReason" type="textarea" placeholder="不超过500字"></el-input> <el-input v-model="dataForm.adjustReason" type="textarea" placeholder="不超过500字"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="操作类型:"> <el-form-item label="操作类型:" prop="operationType">
<el-radio-group v-model="dataForm.operationType"> <el-radio-group v-model="dataForm.operationType">
<el-radio :label="1">加积分</el-radio> <el-radio :label="1">加积分</el-radio>
<el-radio :label="0">减积分</el-radio> <el-radio :label="0">减积分</el-radio>
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
<el-form-item label="积分调整:"> <el-form-item label="积分调整:" prop="operatePoints">
<el-input-number v-model="dataForm.operatePoints" :min="0"></el-input-number> <el-input-number v-model="dataForm.operatePoints" :min="0"></el-input-number>
</el-form-item> </el-form-item>
</el-form> </el-form>
@ -69,19 +82,60 @@ export default {
points: '', points: '',
adjustReason: '', adjustReason: '',
operationType: '', operationType: '',
operatePoints: '' operatePoints: '',
behaviorCode: ''
},
behaviorTypeList: []
}
},
computed: {
dataRule () {
return {
behaviorCode: [
{
required: true,
message: this.$t('validate.required'),
trigger: 'blur'
}
],
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 () {
this.getBehaviorTypeList()
},
methods: { methods: {
init () { init () {
this.visible = true this.visible = true
this.$nextTick(() => { this.$nextTick(() => {
this.$refs['dataForm'].resetFields()
if (this.dataForm.id) { if (this.dataForm.id) {
this.getInfo() this.getInfo()
this.dataForm.adjustReason = '' this.dataForm.adjustReason = ''
this.dataForm.operationType = '' this.dataForm.operationType = ''
this.dataForm.operatePoints = '' this.dataForm.operatePoints = ''
this.dataForm.behaviorCode = ''
} }
}) })
}, },
@ -97,22 +151,38 @@ export default {
}).catch(() => {}) }).catch(() => {})
}, },
dataFormSubmitHandle: debounce(function () { dataFormSubmitHandle: debounce(function () {
this.$http['post']( this.$refs['dataForm'].validate(valid => {
'/points/pointslogs/confirmAdjustPoint', this.dataForm).then(({ data: res }) => { if (!valid) {
if (res.code !== 0) { return false
return this.$message.error(res.msg)
} }
this.$message({ this.$http['post'](
message: this.$t('prompt.success'), '/points/pointslogs/confirmAdjustPoint', this.dataForm).then(({ data: res }) => {
type: 'success', if (res.code !== 0) {
duration: 500, return this.$message.error(res.msg)
onClose: () => {
this.visible = false
this.$emit('refreshDataList')
} }
this.$message({
message: this.$t('prompt.success'),
type: 'success',
duration: 500,
onClose: () => {
this.visible = false
this.$emit('refreshDataList')
}
})
}).catch(() => {})
}, 1000, { 'leading': true, 'trailing': false })
}),
getBehaviorTypeList () {
this.$http
.get(`/sys/dict/listSimple/pointsrule_behavior`)
.then(({ data: res }) => {
if (res.code !== 0) {
return this.$message.error(res.msg)
}
this.behaviorTypeList = res.data
}) })
}).catch(() => {}) .catch(() => {})
}, 1000, { 'leading': true, 'trailing': false }) }
} }
} }
</script> </script>

25
src/views/modules/user/volunteerinfo.vue

@ -77,7 +77,7 @@
@click="checkHandle(scope.row.id, 2)" @click="checkHandle(scope.row.id, 2)"
>拉入黑名单</el-button> >拉入黑名单</el-button>
<el-button type="text" size="small" @click="pointsAdjustHandle(scope.row.id)">积分调整</el-button> <el-button type="text" size="small" @click="pointsAdjustHandle(scope.row.id)">积分调整</el-button>
<!-- <el-button type="text" size="small" @click="deleteHandle(scope.row.id)">积分记录</el-button> --> <el-button type="text" size="small" @click="pointsLogs(scope.row.id)">积分记录</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@ -109,7 +109,13 @@
v-if="volunteerinfoPointsAdjustVisible" v-if="volunteerinfoPointsAdjustVisible"
ref="volunteerinfoPointsAdjust" ref="volunteerinfoPointsAdjust"
@refreshDataList="getDataList" @refreshDataList="getDataList"
></volunteerinfo-points-adjust> ></volunteerinfo-points-adjust>
<!-- 积分记录 -->
<volunteer-points-log
v-if="volunteerPointsLogVisible"
ref="volunteerPointsLog"
@refreshDataList="getDataList"
></volunteer-points-log>
</div> </div>
</el-card> </el-card>
</template> </template>
@ -119,7 +125,8 @@ import mixinViewModule from '@/mixins/view-module'
import AddOrUpdate from './volunteerinfo-add-or-update' import AddOrUpdate from './volunteerinfo-add-or-update'
// import debounce from 'lodash/debounce' // import debounce from 'lodash/debounce'
import volunteerinfoDetail from './volunteerinfo-detail' import volunteerinfoDetail from './volunteerinfo-detail'
import volunteerinfoPointsAdjust from '../points/volunteerinfo-points-adjust.vue' import volunteerinfoPointsAdjust from '../points/volunteerinfo-points-adjust'
import volunteerPointsLog from '../points/volunteer-points-log'
import volunteerinfoCheck from './volunteerinfo-check' import volunteerinfoCheck from './volunteerinfo-check'
// import func from '../../../../vue-temp/vue-editor-bridge' // import func from '../../../../vue-temp/vue-editor-bridge'
export default { export default {
@ -158,6 +165,7 @@ export default {
options: [], options: [],
volunteerinfoDetailVisible: false, volunteerinfoDetailVisible: false,
volunteerinfoPointsAdjustVisible: false, volunteerinfoPointsAdjustVisible: false,
volunteerPointsLogVisible: false,
volunteerinfoCheckVisible: false volunteerinfoCheckVisible: false
} }
}, },
@ -222,6 +230,14 @@ export default {
this.$refs.volunteerinfoPointsAdjust.init() this.$refs.volunteerinfoPointsAdjust.init()
}) })
}, },
//
pointsLogs (id) {
this.volunteerPointsLogVisible = true
this.$nextTick(() => {
this.$refs.volunteerPointsLog.dataForm.volunteerId = id
this.$refs.volunteerPointsLog.init()
})
},
// //
sexState: function (row, column) { sexState: function (row, column) {
let state = row.sex let state = row.sex
@ -249,7 +265,8 @@ export default {
AddOrUpdate, AddOrUpdate,
volunteerinfoDetail, volunteerinfoDetail,
volunteerinfoPointsAdjust, volunteerinfoPointsAdjust,
volunteerinfoCheck volunteerinfoCheck,
volunteerPointsLog
} }
} }
</script> </script>

Loading…
Cancel
Save