居民积分

This commit is contained in:
yanran200730
2023-04-06 10:32:25 +08:00
parent 46f49f4686
commit 8288b7d26a
5 changed files with 761 additions and 0 deletions

View File

@@ -0,0 +1,62 @@
<template>
<div class="AppActivitiesManagement">
<keep-alive :include="['List']">
<component ref="component" :is="component" :permissions="permissions " @change="onChange" :params="params" :instance="instance" :dict="dict"></component>
</keep-alive>
</div>
</template>
<script>
import List from './components/List'
export default {
name: 'AppIntegratingDjust',
label: '积分调整',
props: {
instance: Function,
dict: Object,
permissions: Function
},
data () {
return {
component: 'List',
params: {},
include: []
}
},
components: {
List
},
methods: {
onChange (data) {
if (data.type === 'Detail') {
this.component = 'Detail'
this.params = data.params
}
if (data.type === 'List') {
this.component = 'List'
this.params = data.params
this.$nextTick(() => {
if (data.isRefresh) {
this.$refs.component.getList()
}
})
}
}
}
}
</script>
<style lang="scss">
.AppActivitiesManagement {
height: 100%;
background: #F3F6F9;
overflow: auto;
}
</style>

View File

@@ -0,0 +1,356 @@
<template>
<ai-list class="gridScoreManage">
<ai-title slot="title" title="积分调整" isShowBottomBorder></ai-title>
<template #content>
<ai-search-bar>
<template #left>
<el-button type="primary" size="small" icon="iconfont iconAdd" @click="changeIntegral('',0)">&nbsp;批量调整积分</el-button>
<el-cascader ref="cascader1" clearable v-model="girdIdList" :options="girdOptions" placeholder="所属网格" size="small"
:props="defaultProps" :show-all-levels="false" @change="gridChange"></el-cascader>
</template>
<template #right>
<ai-import :instance="instance" :dict="dict" type="appintegraluser" name="积分管理"
@success="getTableData()">
<el-button icon="iconfont iconImport">导入</el-button>
</ai-import>
<ai-download :instance="instance" url="/app/appintegraluser/girdIntegralExport" :params="search" fileName="积分调整"
:disabled="tableData.length == 0">
</ai-download>
<el-input size="small" placeholder="姓名" v-model="search.userName" clearable
@clear="current = 1, search.userName = '', getTableData()" suffix-icon="iconfont iconSearch"
v-throttle="() => {(current = 1), getTableData();}"/>
</template>
</ai-search-bar>
<ai-table
:tableData="tableData"
:total="total"
:current.sync="current"
:size.sync="size"
@getList="getTableData()"
:col-configs="colConfigs"
:dict="dict"
@sort-change="changeTableSort">
<el-table-column slot="options" label="操作" width="140" align="center">
<template slot-scope="{ row }">
<div class="table-options">
<el-button type="text" @click="changeIntegral(row,1)">调整积分</el-button>
<el-button type="text" @click="toDetail(row.id)">详情</el-button>
</div>
</template>
</el-table-column>
</ai-table>
<ai-dialog
title="调整积分"
:visible.sync="dialog"
:destroyOnClose="true"
width="720px"
@onConfirm="onConfirm"
@closed="form={},chooseUserList=[]">
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="选择人员" prop="ids">
<ai-person-select :instance="instance" :customClicker="true" :chooseUserList="chooseUserList"
url="/app/appgirdmemberinfo/list" headerTitle="网格员列表"
:isMultiple="true" dialogTitle="选择" @selectPerson="selectPerson" class="aipersonselect">
<template name="option" v-slot:option="{ item }">
<span class="iconfont iconProlife">{{ item.name }}</span>
<ai-id mode="show" :show-eyes="false" :value="item.idNumber"/>
</template>
</ai-person-select>
</el-form-item>
<el-form-item label="调整说明" prop="eventDesc">
<el-input v-model.trim="form.eventDesc" placeholder="请输入..." type="textarea" :rows="4" show-word-limit
maxlength="100"></el-input>
</el-form-item>
<el-form-item label="上传凭证">
<ai-uploader :instance="instance" fileType="file" v-model="form.file" :limit="1"></ai-uploader>
</el-form-item>
<el-form-item label="类型" prop="integralCalcType">
<ai-select v-model="form.integralCalcType" :selectList="dict.getDict('integralCalcType')"/>
</el-form-item>
<el-form-item label="积分" prop="integral">
<el-input v-model.trim="form.integral" placeholder="请输入正数" size="small"></el-input>
</el-form-item>
</el-form>
</ai-dialog>
</template>
</ai-list>
</template>
<script>
import { mapState } from "vuex";
export default {
name: "List",
props: {
instance: Function,
dict: Object,
permissions: Function
},
data() {
return {
search: {
userName: '',
girdId: '',
current: 1,
size: 10,
sortFiled: '',
sortRule: '',
},
girdIdList: [],
tableData: [],
size: 10,
total: 0,
current: 1,
girdList: [],
form: {
ids: [],
eventDesc: "",
enclosure: "", // 附件
integralCalcType: "",
integral: '',
file: [],
},
personList: [],
dialog: false,
girdOptions: [],
defaultProps: {
label: 'girdName',
value: 'id',
checkStrictly: true,
},
chooseUserList: [],
flag: false,
}
},
created() {
this.$dict.load('integralCalcType')
this.getTableData()
this.getGridList()
},
computed: {
...mapState(['user']),
colConfigs() {
return [
{ prop: "userName", label: '姓名', align: "left", },
{ prop: "girdName", label: '所属网格' },
{ prop: "integral", label: '积分余额', align: "center", sortable: "custom" },
{ prop: "totalIntegral", label: '累计积分', align: "center", sortable: "custom" },
{ prop: "usedIntegral", label: '已用积分', align: "center", sortable: "custom" },
{ slot: "options" },
]
},
rules() {
return {
ids: [{required: true, message: '请选择人员', trigger: 'blur'}],
eventDesc: [{required: true, message: '请输入调整说明', trigger: 'blur'}],
integralCalcType: [{required: true, message: '请选择类型', trigger: 'change'}],
integral: [{required: true, message: '请输入积分', trigger: 'blur' },
{pattern: /^([1-9]\d*|0)(\.\d{1,2})?$/, message: '请输入正数且最多只能保留两位小数'}],
}
},
},
methods: {
getTableData() {
this.instance.post(`/app/appintegraluser/integralManager`,null,{
params: {
...this.search,
current: this.current,
size: this.size,
total: this.total
}
}).then(res => {
if(res?.data) {
this.tableData = res.data.records
this.total = res.data.total
}
})
},
selectPerson(val) {
if (val) {
this.personList = val
this.form.ids = [...this.personList.map(e => e.id)]
} else {
this.form.ids = this.chooseUserList.map(e => e.id)
}
},
changeIntegral(row,type) {
if(type==0) {
this.dialog = true
} else if(type ==1) {
this.chooseUserList = [{
id: row.userId,
name: row.userName
}]
this.form.ids = this.chooseUserList.map(e => e.id)
this.dialog = true
}
},
getGridList() {
this.instance.post(`/app/appgirdinfo/listAll3`).then((res) => {
if (res.code == 0) {
this.girdOptions = this.toTree(res.data)
}
})
},
// 转树形结构
toTree(data) {
let result = [];
if (!Array.isArray(data)) {
return result
}
let map = {};
data.forEach(item => {
map[item.id] = item;
});
data.forEach(item => {
let parent = map[item.parentGirdId];
if (parent) {
(parent.children || (parent.children = [])).push(item);
} else {
result.push(item);
}
});
return result;
},
gridChange(val) {
this.girdIdList = val
this.search.girdId = val?.[val.length - 1]
this.$refs.cascader1.dropDownVisible = false;
this.getTableData()
},
changeTableSort(col) {
if(col.prop === 'integral') { // 剩余积分
this.search.sortFiled = 0
if(col.order === 'ascending') {
this.search.sortRule = true
} else if(col.order === 'descending') {
this.search.sortRule = false
} else if(col.order === null) {
this.search.sortRule = ''
}
} else if(col.prop === 'totalIntegral') { // 累计积分
this.search.sortFiled = 1
if(col.order === 'ascending') {
this.search.sortRule = true
} else if(col.order === 'descending') {
this.search.sortRule = false
} else if(col.order === null) {
this.search.sortRule = ''
}
} else if(col.prop === 'usedIntegral') { // 已用积分
this.search.sortFiled = 2
if(col.order === 'ascending') {
this.search.sortRule = true
} else if(col.order === 'descending') {
this.search.sortRule = false
} else if(col.order === null) {
this.search.sortRule = ''
}
}
this.getTableData()
},
onConfirm() {
if(this.flag) return
if(this.form.file?.length) {
this.form.enclosure = this.form.file[0].url
}
this.$refs.form.validate((valid)=> {
if(valid) {
this.flag = true
this.instance.post(`/app/appintegraluser/changeIntegral`,{
ids: this.form.ids,
eventDesc: this.form.eventDesc,
enclosure: this.form.enclosure, // 附件
integralCalcType: this.form.integralCalcType,
integral: this.form.integral,
}).then(res => {
if(res?.code == 0) {
this.$message.success('调整积分成功')
setTimeout(() =>{
this.dialog = false
this.getTableData()
this.flag = false
}, 600)
} else {
this.flag = false
}
})
}
})
},
toDetail(id) {
this.$emit('change', {
type: 'gridScoreDetail',
params: {
id: id
}
})
}
},
}
</script>
<style lang="scss" scoped>
.gridScoreManage {
.userlist {
display: inline-block;
}
.userlist, .user {
display: inline-block;
}
.user {
position: relative;
width: 70px;
text-align: center;
.remove-icon {
position: absolute;
right: 7px;
top: -4px;
line-height: 1;
padding: 6px 0;
font-size: 16px;
cursor: pointer;
&:hover {
color: crimson;
}
}
img, h2 {
display: block;
width: 40px;
height: 40px;
line-height: 40px;
text-align: center;
margin: 0 auto 4px;
font-size: 14px;
color: #fff;
border-radius: 50%;
}
h2 {
background-color: $primaryColor;
}
span {
color: #666;
font-size: 14px;
white-space: nowrap;
overflow: hidden;
word-break: break-all;
text-overflow: ellipsis;
}
}
}
</style>

View File

@@ -0,0 +1,64 @@
<template>
<div class="AppActivitiesManagement">
<keep-alive :include="['List']">
<component ref="component" :is="component" :permissions="permissions " @change="onChange" :params="params" :instance="instance" :dict="dict"></component>
</keep-alive>
</div>
</template>
<script>
import List from './components/List'
import Detail from './components/Detail'
export default {
name: 'AppResidentIntegrating',
label: '居民积分',
props: {
instance: Function,
dict: Object,
permissions: Function
},
data () {
return {
component: 'List',
params: {},
include: []
}
},
components: {
List,
Detail
},
methods: {
onChange (data) {
if (data.type === 'Detail') {
this.component = 'Detail'
this.params = data.params
}
if (data.type === 'List') {
this.component = 'List'
this.params = data.params
this.$nextTick(() => {
if (data.isRefresh) {
this.$refs.component.getList()
}
})
}
}
}
}
</script>
<style lang="scss">
.AppActivitiesManagement {
height: 100%;
background: #F3F6F9;
overflow: auto;
}
</style>

View File

@@ -0,0 +1,140 @@
<template>
<ai-detail>
<template slot="title">
<ai-title title="详情" isShowBack isShowBottomBorder @onBackClick="cancel(false)">
</ai-title>
</template>
<template slot="content">
<ai-card title="基本信息">
<template #content>
<ai-wrapper
label-width="120px">
<ai-info-item label="姓名" isLine :value="info.userName"></ai-info-item>
<ai-info-item label="个人积分" isLine :value="info.integral || 0"></ai-info-item>
<ai-info-item label="已用积分" isLine :value="info.usedIntegral || 0"></ai-info-item>
</ai-wrapper>
</template>
</ai-card>
<ai-card>
<ai-title slot="title" title="余额变动明细"/>
<template #content>
<ai-search-bar>
<template #left>
<ai-select v-model="search.type" placeholder="请选择类型" @change="search.current = 1, getList()" :selectList="dict.getDict('integralType')"/>
</template>
<template #right>
<ai-download
:instance="instance"
:url="`/app/appintegraluser/changeIntegralExport?id=${params.id}`"
:params="search"
fileName="余额变动明细"
:disabled="tableData.length == 0">
<el-button size="small">导出</el-button>
</ai-download>
</template>
</ai-search-bar>
<ai-table :tableData="tableData" :total="total" :current.sync="search.current" :size.sync="search.size"
@getList="getList" :col-configs="colConfigs" :dict="dict">
<el-table-column slot="changeIntegral" label="变动积分" align="center">
<template slot-scope="{ row }">
<span v-if="row.integralType == 3">{{ row.changeIntegral | formatTime }}</span>
<span v-if="row.integralType == 0 || row.integralType == 2">{{ row.integralCalcType == 0 ? '-' : '+' }}{{ row.changeIntegral }}</span>
</template>
</el-table-column>
<el-table-column slot="integralType" label="类型" align="center">
<template slot-scope="{ row }">
<span v-if="row.integralType == 0">积分调整</span>
<span v-else>{{ row.eventType }}</span>
</template>
</el-table-column>
<el-table-column slot="eventDesc" label='事件' align="center" width="400px" show-overflow-tooltip>
<template slot-scope="{ row }">
<span>{{ row.eventDesc || row.eventName }}</span>
</template>
</el-table-column>
</ai-table>
</template>
</ai-card>
</template>
</ai-detail>
</template>
<script>
export default {
name: 'Detail',
props: {
instance: Function,
dict: Object,
params: Object
},
data () {
return {
info: {},
id: '',
search: {
current: 1,
size: 10,
type: ''
},
total: 0,
tableData: []
}
},
computed: {
colConfigs() {
return [
{prop: "doTime", label: '时间', align: "left", width: "200px"},
{slot: "integralType", label: '类型', align: "center", width: "240px", dict: "integralType"},
{slot: "changeIntegral"},
{prop: "nowIntegral", label: '剩余积分', align: "center", width: "200px"},
{slot: "eventDesc"},
]
}
},
created () {
console.log(this.params.id)
this.dict.load('integralType').then(() => {
this.getInfo()
this.getList()
})
},
methods: {
getInfo (id) {
this.instance.post(`/app/appintegraluser/girdDetail?id=${this.params.id}`).then(res => {
if (res.code === 0) {
this.info = res.data
}
})
},
getList () {
this.instance.post(`/app/appintegraluser/getChangeDetail`, null, {
params: {
...this.search,
id: this.params.id
}
}).then(res => {
if (res.code === 0) {
this.tableData = res.data.records
this.total = res.data.total
}
})
},
cancel (isRefresh) {
this.$emit('change', {
type: 'List',
isRefresh: !!isRefresh
})
}
}
}
</script>
<style scoped lang="scss">
</style>

View File

@@ -0,0 +1,139 @@
<template>
<ai-list class="notice">
<ai-title slot="title" title="居民积分" v-model="search.areaId" isShowBottomBorder isShowArea :hideLevel="hideLevel - 1" @change="search.current = 1, getList()"></ai-title>
<template slot="content">
<ai-search-bar class="search-bar">
<template #left>
<ai-download
:instance="instance"
url="/app/appwechatuserqujing/export"
:params="search"
fileName="居民积分"
:disabled="tableData.length == 0">
<el-button icon="iconfont iconExported" :disabled="tableData.length == 0">导出</el-button>
</ai-download>
</template>
<template #right>
<el-input
v-model="search.title"
class="search-input"
size="small"
v-throttle="() => {search.current = 1, getList()}"
placeholder="姓名/身份证/手机号/微信昵称"
clearable
@clear="search.current = 1, search.title = '', getList()"
suffix-icon="iconfont iconSearch">
</el-input>
</template>
</ai-search-bar>
<ai-table
:tableData="tableData"
:col-configs="colConfigs"
:total="total"
style="margin-top: 6px;"
:current.sync="search.current"
:size.sync="search.size"
@getList="getList">
<el-table-column slot="options" width="100px" fixed="right" label="操作" align="center">
<template slot-scope="{ row }">
<div class="table-options">
<el-button type="text" @click="toDetail(row.integralUserId)">详情</el-button>
</div>
</template>
</el-table-column>
</ai-table>
</template>
</ai-list>
</template>
<script>
import { mapState } from 'vuex'
export default {
name: 'List',
props: {
instance: Function,
dict: Object
},
data() {
return {
search: {
current: 1,
size: 10,
title: '',
areaId: ''
},
total: 0,
colConfigs: [
{ prop: 'realName', label: '姓名', align: 'left', width: '200px' },
{ prop: 'phone', label: '手机号', align: 'center' },
{ prop: 'idNumber', label: '身份证号', align: 'center' },
{ prop: 'areaName', label: '所属地区', align: 'center' },
{ prop: 'girdName', label: '所属网格', align: 'center' },
{ prop: 'integral', label: '积分总分', align: 'center' },
{ prop: 'usedIntegral', label: '已用积分', align: 'center' }
],
tableData: []
}
},
computed: {
...mapState(['user']),
hideLevel () {
return this.user.info.areaList.length || 0
},
params () {
return {
...this.search
}
}
},
created() {
this.search.areaId = this.user.info.areaId
this.getList()
},
methods: {
getList () {
this.instance.post(`/app/appwechatuserqujing/listByFdAppletUser`, null, {
params: {
...this.search,
areaId: this.search.areaId
}
}).then(res => {
if (res.code == 0) {
this.tableData = res.data.records
this.total = res.data.total
}
})
},
remove(id) {
this.$confirm('确定删除该数据?').then(() => {
this.instance.post(`/app/appcontentinfo/deleteIntegralApply?ids=${id}`).then(res => {
if (res.code == 0) {
this.$message.success('下架成功!')
this.getList()
}
})
})
},
toDetail(id) {
this.$emit('change', {
type: 'Detail',
params: {
id: id || ''
}
})
}
}
}
</script>
<style lang="scss" scoped>
</style>