积分活动管理

This commit is contained in:
HuskyOo 2022-05-13 15:04:18 +08:00
parent 79bd7a92e7
commit 30b0d587af
2 changed files with 338 additions and 0 deletions

View File

@ -0,0 +1,103 @@
<template>
<div class="app-container">
<el-form
ref="convenienceForm"
style="width:680px"
:model="form"
:rules="rules"
:disabled="pageQuery.type === 'detail'"
label-width="80px"
class="el-form"
>
<el-form-item label="标题" prop="title">
<el-input
v-model="form.title"
placeholder="请输入"
/>
</el-form-item>
<el-form-item label="简介" prop="introduction">
<el-input
v-model="form.introduction"
type="textarea"
placeholder="请输入"
/>
</el-form-item>
<el-form-item label="图片" prop="images">
<template v-if="pageQuery.type === 'detail'">
<el-image v-for="item of form.images" :key="item" :src="item" />
</template>
<CutUploadImage v-else :disabled="pageQuery.type === 'detail'" :init-url="form.images" multiple @imgupload="imgUpload" />
</el-form-item>
<el-form-item label="内容" prop="content">
<UEditor v-model="form.content" :disabled="pageQuery.type === 'detail'" />
</el-form-item>
<el-form-item v-if="pageQuery.type !== 'detail'">
<el-button type="primary" @click="handleAdd">提交</el-button>
</el-form-item>
</el-form>
</div>
</template>
<script>
import { activityUpdate, activityInfo } from '@/api/fingertipIntegral'
import UEditor from '@/components/UEditor'
import CutUploadImage from '@/components/cutUploadImage'
export default {
components: { UEditor, CutUploadImage },
data() {
return {
pageQuery: {
type: undefined,
id: undefined
},
form: {
active: true,
audioImage: undefined,
audioUrl: undefined,
content: undefined,
images: [],
introduction: undefined,
show: true,
subtitle: undefined,
title: undefined,
videoUrl: undefined
},
rules: {
title: [{ required: true, message: '请输入', trigger: 'change' }]
}
}
},
created() {
this.pageQuery = this.$route.query
if (this.pageQuery.id) this.getInfo()
},
methods: {
getInfo() {
activityInfo({ id: this.pageQuery.id }).then(res => {
console.log(res)
this.form = res.d
})
},
imgUpload(e) {
this.form.images = e
},
handleAdd() {
this.$refs.convenienceForm.validate(valid => {
if (valid) {
const form = this.form
activityUpdate(form).then(res => {
this.$message({
type: 'success',
message: '操作成功!'
})
this.$router.back()
})
}
})
}
}
}
</script>
<style scope></style>

View File

@ -0,0 +1,235 @@
<template>
<div class="app-container">
<div class="filter-container">
<el-input
v-model="listQuery.title"
style="width:200px;margin-right:10px"
class="filter-item"
placeholder="请输入标题"
clearable
/>
<!-- <el-select v-model="listQuery.source" clearable class="filter-item" placeholder="请选择积分来源">
<el-option v-for="item of sourceOptions" :key="item.value" v-bind="item" />
</el-select> -->
<el-button
type="primary"
style="margin-left:10px"
@click="handleSearch"
>搜索</el-button>
</div>
<el-button
type="primary"
size="mini"
style="margin-bottom:20px"
@click="handleAdd"
>新增活动</el-button>
<el-table v-loading="loading" :data="list" border style="width: 100%">
<el-table-column label="标题" prop="title" />
<el-table-column label="简介" prop="introduction" />
<el-table-column label="图片" prop="images">
<template v-if="scope.row.images && scope.row.images.length" slot-scope="scope">
<el-image
style="width: 100px; height: 100px"
:src="scope.row.images[0]"
:preview-src-list="scope.row.images"
/>
</template>
</el-table-column>
<el-table-column label="创建时间">
<template slot-scope="scope">
<span>{{
scope.row.createDate | parseTime("{y}-{m}-{d} {h}:{i}:{s}")
}}</span>
</template>
</el-table-column>
<el-table-column label="操作" fixed="right" align="center" width="280px">
<template slot-scope="scope">
<el-button
size="mini"
type="primary"
round
style="font-size:14px;padding:10px 20px"
@click="handleDetail(scope.row)"
>查看详情</el-button>
<el-button
size="mini"
type="primary"
round
style="font-size:14px;padding:10px 20px"
@click="handleUpdate(scope.row)"
>编辑</el-button>
<el-button
size="mini"
type="danger"
round
style="font-size:14px;padding:10px 20px"
@click="handleDel(scope.row)"
>删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-if="total > 0"
:total="total"
:page.sync="listQuery.lastPageIndex"
:limit.sync="listQuery.size"
@pagination="getList"
/>
</div>
</template>
<script>
import Pagination from '@/components/Pagination'
import { activityList, activityDel } from '@/api/fingertipIntegral'
export default {
components: { Pagination },
filters: {
optionsFilter(value, options = []) {
const findItem = options.find((option) => option.value === value)
if (findItem) {
return findItem.label
}
return ''
}
},
data() {
return {
loading: false,
total: 0,
listQuery: {
lastPageIndex: 1,
size: 10,
title: undefined
},
list: undefined,
sourceOptions: [
{
value: 'REAL_NAME_AUTHENTICATION',
label: '实名认证'
},
{
value: 'HANDLING',
label: '处理办件'
},
{
value: 'APPLY',
label: '申请办件'
},
{
value: 'TIMEOUT',
label: '超期办件扣分'
},
{
value: 'VERY_SATISFIED',
label: '非常满意得分'
},
{
value: 'NEGATIVE_COMMENT',
label: '差评扣分'
},
{
value: 'READ',
label: '阅读'
},
{
value: 'SEND_A_CIRCLE_OF_FRIENDS',
label: '发朋友圈'
},
{
value: 'CONSUMPTION',
label: '消费'
},
{
value: 'MERCHANT_SETTLEMENT',
label: '商户结算'
},
{
value: 'POINT_REFUND',
label: '积分回退'
},
{
value: 'REGULATORY_PUNISHMENT_AND_REWARD',
label: '监管惩罚'
},
{
value: 'SPECIAL_WORK_TYPE',
label: '特殊工单类型奖励积分(医保卫生)'
}
]
}
},
watch: {
'listQuery.lastPageIndex': {
handler(val) {
this.getList()
},
deep: true // true
}
},
created() {
this.getList()
},
methods: {
getList() {
this.loading = true
activityList(this.listQuery).then(res => {
this.list = res.d.records
this.total = res.d.total
// this.pageSize = res.d.pageSize
this.loading = false
}).catch(() => {
this.loading = false
})
},
handleDel(item) {
this.$confirm('此操作将永久删除, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
activityDel({ id: item.id }).then(() => {
this.$message({
type: 'success',
message: '删除成功!'
})
this.getList()
})
})
},
handleAdd() {
this.$router.push({
path: '/fingertipIntegral/activityCreate'
})
},
handleUpdate(item) {
this.$router.push({
path: '/fingertipIntegral/activityChange',
query: {
id: item.id
}
})
},
handleDetail(item) {
this.$router.push({
path: '/fingertipIntegral/activityDetail',
query: {
type: 'detail',
id: item.id
}
})
},
handleSearch() {
const { listQuery } = this
this.listQuery.lastPageIndex = 1
Object.keys(listQuery).forEach(key => {
if (listQuery[key] === '') listQuery[key] = undefined
})
this.getList()
}
}
}
</script>
<style></style>