<template>
|
<div>
|
<list-condition-template
|
ref="table"
|
:form="listQuery"
|
:formLabel="formLabel"
|
:tableData="tableData"
|
:total="total"
|
:isShowPage="false"
|
@page-info-change="handlePageInfoChange"
|
>
|
<template slot="otherElement">
|
<el-form-item>
|
<el-button size="mini" type="primary" @click="queryData"
|
>查询</el-button
|
>
|
<el-button size="mini" @click="resetQuery">重置</el-button>
|
</el-form-item>
|
</template>
|
<template slot="operationSection">
|
<el-button size="mini" type="success" @click="addItem">新增</el-button>
|
</template>
|
<template slot="columns">
|
<el-table-column label="积分规则编码" prop="integralCode" width="150px">
|
</el-table-column>
|
<el-table-column label="积分名称" prop="integralName">
|
</el-table-column>
|
<el-table-column label="积分类型" prop="integralType" width="150px" show-overflow-tooltip>
|
<template slot-scope="scope">
|
{{ getArrayLable(formLabel[1].opts,scope.row.integralType)
|
? scope.row.integralTypeText = getArrayLable(formLabel[1].opts,scope.row.integralType)
|
:'-'
|
}}
|
</template>
|
</el-table-column>
|
<el-table-column label="开始日期" prop="startTime" width="180px">
|
</el-table-column>
|
<el-table-column label="结束日期" prop="endTime" width="180px">
|
</el-table-column>
|
<el-table-column label="修改时间" prop="modifyTime" width="180px">
|
<template slot-scope="scope">
|
{{scope.row.modifyTime ? scope.row.modifyTime : '-'}}
|
</template>
|
</el-table-column>
|
<el-table-column label="操作" :width="`${3 * $store.getters.colSize}px`">
|
<template slot-scope="scope">
|
<wly-btn @click="lookInfo(scope.row)"
|
>详情</wly-btn
|
>
|
<wly-btn
|
:type="'primary'"
|
@click="editInfo(scope.row)"
|
>编辑</wly-btn
|
>
|
<wly-btn :type="'danger'" @click="deleteItem(scope.row)">删除</wly-btn>
|
</template>
|
</el-table-column>
|
</template>
|
</list-condition-template>
|
<el-dialog
|
:visible.sync="dialogVisible"
|
title="积分规则配置详情"
|
:close-on-click-modal="false"
|
:modal-append-to-body="false"
|
width="40%"
|
>
|
<details-info :form="form"></details-info>
|
<div slot="footer" class="dialog-footer">
|
<el-button size="mini" @click="dialogVisible = false"
|
>关闭</el-button
|
>
|
</div>
|
</el-dialog>
|
</div>
|
</template>
|
|
<script>
|
import memberIntegralApi from '@/api/member/memberIntegral'
|
import detailsInfo from '@/views/integralRule/components/detailsInfo.vue'
|
import { getArrayLable } from '@/utils/getArrayLable'
|
|
export default {
|
components: { detailsInfo },
|
data () {
|
return {
|
listQuery: {
|
integralName: null,
|
integralType: null
|
},
|
formLabel: [
|
{
|
model: 'integralName',
|
label: '积分名称',
|
type: 'input'
|
},
|
{
|
model: 'integralType',
|
label: '积分类型',
|
type: 'select',
|
opts: [
|
{
|
id: '1',
|
name: '消费送积分'
|
}
|
// {
|
// id: '2',
|
// name: '注册送积分'
|
// },
|
// {
|
// id: '3',
|
// name: '评价送积分'
|
// }
|
]
|
}
|
],
|
tableData: [],
|
show: false,
|
dialogVisible: false,
|
form: {},
|
total: 0
|
}
|
},
|
/**
|
* 数据变化后刷新列表
|
*/
|
activated () {
|
this.queryList()
|
},
|
methods: {
|
/**
|
* 删除
|
*/
|
deleteItem (row) {
|
this.$confirm('确认删除吗?', '提示', {
|
confirmButtonText: '确定',
|
cancelButtonText: '取消',
|
type: 'warning'
|
}).then(() => {
|
memberIntegralApi.deleteItem({ ruleId: row.ruleId }).then(
|
(res) => {
|
if (res.code === '0') {
|
this.queryData()
|
}
|
}
|
)
|
}).catch(() => {
|
})
|
},
|
/**
|
* 获取数组的label
|
*/
|
getArrayLable,
|
/**
|
* 查看详情
|
*/
|
lookInfo (row) {
|
this.dialogVisible = true
|
this.form = row
|
},
|
/**
|
* 修改
|
*/
|
editInfo (row) {
|
this.$router.push({ name: 'editIntegralRule', query: { id: row.ruleId } })
|
},
|
/**
|
* 查询列表
|
*/
|
queryList (pageInfo) {
|
for (const key in this.listQuery) {
|
if (this.listQuery[key] === '') {
|
this.listQuery[key] = null
|
}
|
}
|
memberIntegralApi.getList(this.listQuery).then((res) => {
|
if (res.data) {
|
this.tableData = res.data
|
this.total = res.data.total
|
}
|
})
|
},
|
/**
|
* '分页信息改变时查询列表
|
*/
|
handlePageInfoChange () {
|
this.queryList()
|
},
|
|
/**
|
* 重置
|
*/
|
resetQuery () {
|
this.$refs.table.reloadCurrent()
|
},
|
/**
|
* 点击查询按钮
|
*/
|
queryData () {
|
this.$refs.table.changeCondition()
|
},
|
/**
|
* 跳转到新增页面
|
*/
|
addItem () {
|
this.$router.push({ name: 'addIntegralRule' })
|
}
|
}
|
}
|
</script>
|