init
This commit is contained in:
@@ -75,11 +75,6 @@ export const isAnchorList = [
|
|||||||
{ value: 0, label: '否',listClass: listClass.info},
|
{ value: 0, label: '否',listClass: listClass.info},
|
||||||
]
|
]
|
||||||
|
|
||||||
export const enableStatusList = [
|
|
||||||
{ value: 1, label: '正常'},
|
|
||||||
{ value: 0, label: '禁用'},
|
|
||||||
]
|
|
||||||
|
|
||||||
export const userRiskLowList = [
|
export const userRiskLowList = [
|
||||||
{ value: 1, label: '低风险',listClass: listClass.info},
|
{ value: 1, label: '低风险',listClass: listClass.info},
|
||||||
{ value: 2, label: '高风险',listClass: listClass.danger},
|
{ value: 2, label: '高风险',listClass: listClass.danger},
|
||||||
@@ -528,3 +523,8 @@ export const auditStatusList = [
|
|||||||
{ value: 2, label: '审核通过',listClass: listClass.primary},
|
{ value: 2, label: '审核通过',listClass: listClass.primary},
|
||||||
{ value: 3, label: '审核不通过',listClass: listClass.danger},
|
{ value: 3, label: '审核不通过',listClass: listClass.danger},
|
||||||
]
|
]
|
||||||
|
|
||||||
|
export const enableStatusList = [
|
||||||
|
{ value: 1, label: '正常',listClass: listClass.primary},
|
||||||
|
{ value: 0, label: '禁用',listClass: listClass.danger},
|
||||||
|
]
|
||||||
|
|||||||
111
src/views/xq/banner/banner-add-update-dialog.vue
Normal file
111
src/views/xq/banner/banner-add-update-dialog.vue
Normal file
@@ -0,0 +1,111 @@
|
|||||||
|
<template>
|
||||||
|
<el-dialog :title="title" :close-on-click-modal="false" :visible.sync="open" width="700px" append-to-body>
|
||||||
|
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
||||||
|
<el-form-item label="轮播图" prop="banner">
|
||||||
|
<image-upload2 v-model="form.banner"/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="排序" prop="sort">
|
||||||
|
<el-input v-model="form.sort" placeholder="请输入排序" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="状态" prop="enableStatus">
|
||||||
|
<el-select v-model="form.enableStatus" placeholder="状态" size="small">
|
||||||
|
<el-option
|
||||||
|
v-for="dict in enableStatusList"
|
||||||
|
:key="dict.value"
|
||||||
|
:label="dict.label"
|
||||||
|
:value="dict.value"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<div slot="footer" class="dialog-footer">
|
||||||
|
<el-button :loading="buttonLoading" type="primary" @click="submitForm">确 定</el-button>
|
||||||
|
<el-button @click="open = false">取 消</el-button>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { addBanner, getBanner, updateBanner } from '@/api/xq/banner'
|
||||||
|
import { enableStatusList } from '@/constant/statusMap'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
components: {
|
||||||
|
},
|
||||||
|
data () {
|
||||||
|
return {
|
||||||
|
enableStatusList,
|
||||||
|
open: false,
|
||||||
|
title: '',
|
||||||
|
form:{
|
||||||
|
id: undefined,
|
||||||
|
banner: undefined,
|
||||||
|
sort: undefined,
|
||||||
|
title: undefined,
|
||||||
|
enableStatus: undefined,
|
||||||
|
},
|
||||||
|
// 表单校验
|
||||||
|
rules: {
|
||||||
|
banner: [
|
||||||
|
{ required: true, message: "数据不能为空", trigger: "blur" }
|
||||||
|
],
|
||||||
|
sort: [
|
||||||
|
{ required: true, message: "数据不能为空", trigger: "blur" }
|
||||||
|
],
|
||||||
|
title: [
|
||||||
|
{ required: true, message: "数据不能为空", trigger: "blur" }
|
||||||
|
],
|
||||||
|
enableStatus: [
|
||||||
|
{ required: true, message: "数据不能为空", trigger: "change" }
|
||||||
|
],
|
||||||
|
},
|
||||||
|
buttonLoading: false,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
init (id) {
|
||||||
|
this.form.id = id || undefined;
|
||||||
|
this.title = (id ? "修改" : "新增") + "轮播";
|
||||||
|
this.open = true;
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.$refs['form'].resetFields();
|
||||||
|
if(this.form.id){
|
||||||
|
getBanner(id).then(response => {
|
||||||
|
this.form = response.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
// 表单提交
|
||||||
|
submitForm () {
|
||||||
|
this.$refs['form'].validate((valid) => {
|
||||||
|
if (valid) {
|
||||||
|
this.buttonLoading = true;
|
||||||
|
if (this.form.id != null) {
|
||||||
|
updateBanner(this.form).then(data => {
|
||||||
|
this.$modal.msgSuccess("修改成功");
|
||||||
|
this.$modal.buttonLoading = false;
|
||||||
|
this.open = false
|
||||||
|
this.$emit('refreshDataList')
|
||||||
|
}).finally(() => {
|
||||||
|
this.buttonLoading = false;
|
||||||
|
});
|
||||||
|
}else{
|
||||||
|
addBanner(this.form).then(data => {
|
||||||
|
this.$modal.msgSuccess("修改成功");
|
||||||
|
this.buttonLoading = false;
|
||||||
|
this.open = false
|
||||||
|
this.$emit('refreshDataList')
|
||||||
|
}).finally(() => {
|
||||||
|
this.buttonLoading = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
@@ -1,14 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="app-container">
|
<div class="app-container">
|
||||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
||||||
<el-form-item label="轮播" prop="banner">
|
|
||||||
<el-input
|
|
||||||
v-model="queryParams.banner"
|
|
||||||
placeholder="请输入轮播"
|
|
||||||
clearable
|
|
||||||
@keyup.enter.native="handleQuery"
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||||
@@ -18,106 +10,100 @@
|
|||||||
<el-row :gutter="10" class="mb8">
|
<el-row :gutter="10" class="mb8">
|
||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button
|
<el-button
|
||||||
type="primary"
|
type="primary"
|
||||||
plain
|
plain
|
||||||
icon="el-icon-plus"
|
icon="el-icon-plus"
|
||||||
size="mini"
|
size="mini"
|
||||||
@click="handleAdd"
|
@click="handleAdd"
|
||||||
v-hasPermi="['xq:banner:add']"
|
v-hasPermi="['xq:banner:add']"
|
||||||
>新增</el-button>
|
>新增
|
||||||
|
</el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button
|
<el-button
|
||||||
type="success"
|
type="success"
|
||||||
plain
|
plain
|
||||||
icon="el-icon-edit"
|
icon="el-icon-edit"
|
||||||
size="mini"
|
size="mini"
|
||||||
:disabled="single"
|
:disabled="single"
|
||||||
@click="handleUpdate"
|
@click="handleUpdate"
|
||||||
v-hasPermi="['xq:banner:edit']"
|
v-hasPermi="['xq:banner:edit']"
|
||||||
>修改</el-button>
|
>修改
|
||||||
|
</el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button
|
<el-button
|
||||||
type="danger"
|
type="danger"
|
||||||
plain
|
plain
|
||||||
icon="el-icon-delete"
|
icon="el-icon-delete"
|
||||||
size="mini"
|
size="mini"
|
||||||
:disabled="multiple"
|
:disabled="multiple"
|
||||||
@click="handleDelete"
|
@click="handleDelete"
|
||||||
v-hasPermi="['xq:banner:remove']"
|
v-hasPermi="['xq:banner:remove']"
|
||||||
>删除</el-button>
|
>删除
|
||||||
</el-col>
|
</el-button>
|
||||||
<el-col :span="1.5">
|
|
||||||
<el-button
|
|
||||||
type="warning"
|
|
||||||
plain
|
|
||||||
icon="el-icon-download"
|
|
||||||
size="mini"
|
|
||||||
@click="handleExport"
|
|
||||||
v-hasPermi="['xq:banner:export']"
|
|
||||||
>导出</el-button>
|
|
||||||
</el-col>
|
</el-col>
|
||||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
|
||||||
<el-table v-loading="loading" :data="bannerList" @selection-change="handleSelectionChange">
|
<el-table v-loading="loading" :data="bannerList" @selection-change="handleSelectionChange">
|
||||||
<el-table-column type="selection" width="55" align="center" />
|
<el-table-column type="selection" width="55" align="center"/>
|
||||||
<el-table-column label="" align="center" prop="id" v-if="true"/>
|
<el-table-column label="轮播" align="center" prop="banner">
|
||||||
<el-table-column label="轮播" align="center" prop="banner" />
|
<template v-slot="scope">
|
||||||
<el-table-column label="1-启用 0-禁用" align="center" prop="enableStatus" />
|
<image-preview :src="scope.row.banner" :height="75" :width="120"/>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="状态" align="center" prop="enableStatus">
|
||||||
|
<template v-slot="scope">
|
||||||
|
<cai-dict-tag :options="enableStatusList" :value="scope.row.enableStatus"/>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="排序" align="center" prop="sort"/>
|
||||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||||
<template slot-scope="scope">
|
<template v-slot="scope">
|
||||||
<el-button
|
<el-button
|
||||||
size="mini"
|
size="mini"
|
||||||
type="text"
|
type="text"
|
||||||
icon="el-icon-edit"
|
icon="el-icon-edit"
|
||||||
@click="handleUpdate(scope.row)"
|
@click="handleUpdate(scope.row)"
|
||||||
v-hasPermi="['xq:banner:edit']"
|
v-hasPermi="['xq:banner:edit']"
|
||||||
>修改</el-button>
|
>修改
|
||||||
|
</el-button>
|
||||||
<el-button
|
<el-button
|
||||||
size="mini"
|
size="mini"
|
||||||
type="text"
|
type="text"
|
||||||
icon="el-icon-delete"
|
icon="el-icon-delete"
|
||||||
@click="handleDelete(scope.row)"
|
@click="handleDelete(scope.row)"
|
||||||
v-hasPermi="['xq:banner:remove']"
|
v-hasPermi="['xq:banner:remove']"
|
||||||
>删除</el-button>
|
>删除
|
||||||
|
</el-button>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
|
|
||||||
<pagination
|
<pagination
|
||||||
v-show="total>0"
|
v-show="total>0"
|
||||||
:total="total"
|
:total="total"
|
||||||
:page.sync="queryParams.pageNum"
|
:page.sync="queryParams.pageNum"
|
||||||
:limit.sync="queryParams.pageSize"
|
:limit.sync="queryParams.pageSize"
|
||||||
@pagination="getList"
|
@pagination="getList"
|
||||||
/>
|
/>
|
||||||
|
<banner-add-update-dialog v-if="bannerAddUpdateDialogVisible" ref="bannerAddUpdateDialog" @refreshDataList="getList"/>
|
||||||
<!-- 添加或修改轮播图对话框 -->
|
|
||||||
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
|
||||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
|
||||||
<el-form-item label="轮播" prop="banner">
|
|
||||||
<el-input v-model="form.banner" placeholder="请输入轮播" />
|
|
||||||
</el-form-item>
|
|
||||||
</el-form>
|
|
||||||
<div slot="footer" class="dialog-footer">
|
|
||||||
<el-button :loading="buttonLoading" type="primary" @click="submitForm">确 定</el-button>
|
|
||||||
<el-button @click="cancel">取 消</el-button>
|
|
||||||
</div>
|
|
||||||
</el-dialog>
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { listBanner, getBanner, delBanner, addBanner, updateBanner } from "@/api/xq/banner";
|
import { delBanner, listBanner } from '@/api/xq/banner'
|
||||||
|
import { enableStatusList } from '@/constant/statusMap'
|
||||||
|
import BannerAddUpdateDialog from '@/views/xq/banner/banner-add-update-dialog.vue'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "Banner",
|
name: 'Banner',
|
||||||
|
components: { BannerAddUpdateDialog },
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
// 按钮loading
|
enableStatusList,
|
||||||
buttonLoading: false,
|
bannerAddUpdateDialogVisible: false,
|
||||||
// 遮罩层
|
// 遮罩层
|
||||||
loading: true,
|
loading: true,
|
||||||
// 选中数组
|
// 选中数组
|
||||||
@@ -133,7 +119,7 @@ export default {
|
|||||||
// 轮播图表格数据
|
// 轮播图表格数据
|
||||||
bannerList: [],
|
bannerList: [],
|
||||||
// 弹出层标题
|
// 弹出层标题
|
||||||
title: "",
|
title: '',
|
||||||
// 是否显示弹出层
|
// 是否显示弹出层
|
||||||
open: false,
|
open: false,
|
||||||
// 查询参数
|
// 查询参数
|
||||||
@@ -141,136 +127,68 @@ export default {
|
|||||||
pageNum: 1,
|
pageNum: 1,
|
||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
banner: undefined,
|
banner: undefined,
|
||||||
enableStatus: undefined,
|
enableStatus: undefined
|
||||||
},
|
|
||||||
// 表单参数
|
|
||||||
form: {},
|
|
||||||
// 表单校验
|
|
||||||
rules: {
|
|
||||||
id: [
|
|
||||||
{ required: true, message: "不能为空", trigger: "blur" }
|
|
||||||
],
|
|
||||||
banner: [
|
|
||||||
{ required: true, message: "轮播不能为空", trigger: "blur" }
|
|
||||||
],
|
|
||||||
enableStatus: [
|
|
||||||
{ required: true, message: "1-启用 0-禁用不能为空", trigger: "change" }
|
|
||||||
],
|
|
||||||
createTime: [
|
|
||||||
{ required: true, message: "创建时间不能为空", trigger: "blur" }
|
|
||||||
],
|
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
this.getList();
|
this.getList()
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
/** 查询轮播图列表 */
|
/** 查询轮播图列表 */
|
||||||
getList() {
|
getList() {
|
||||||
this.loading = true;
|
this.loading = true
|
||||||
listBanner(this.queryParams).then(response => {
|
listBanner(this.queryParams).then(response => {
|
||||||
this.bannerList = response.rows;
|
this.bannerList = response.rows
|
||||||
this.total = response.total;
|
this.total = response.total
|
||||||
this.loading = false;
|
this.loading = false
|
||||||
});
|
})
|
||||||
},
|
|
||||||
// 取消按钮
|
|
||||||
cancel() {
|
|
||||||
this.open = false;
|
|
||||||
this.reset();
|
|
||||||
},
|
|
||||||
// 表单重置
|
|
||||||
reset() {
|
|
||||||
this.form = {
|
|
||||||
id: undefined,
|
|
||||||
banner: undefined,
|
|
||||||
enableStatus: undefined,
|
|
||||||
createTime: undefined,
|
|
||||||
updateTime: undefined
|
|
||||||
};
|
|
||||||
this.resetForm("form");
|
|
||||||
},
|
},
|
||||||
/** 搜索按钮操作 */
|
/** 搜索按钮操作 */
|
||||||
handleQuery() {
|
handleQuery() {
|
||||||
this.queryParams.pageNum = 1;
|
this.queryParams.pageNum = 1
|
||||||
this.getList();
|
this.getList()
|
||||||
},
|
},
|
||||||
/** 重置按钮操作 */
|
/** 重置按钮操作 */
|
||||||
resetQuery() {
|
resetQuery() {
|
||||||
this.resetForm("queryForm");
|
this.resetForm('queryForm')
|
||||||
this.handleQuery();
|
this.handleQuery()
|
||||||
},
|
},
|
||||||
// 多选框选中数据
|
// 多选框选中数据
|
||||||
handleSelectionChange(selection) {
|
handleSelectionChange(selection) {
|
||||||
this.ids = selection.map(item => item.id)
|
this.ids = selection.map(item => item.id)
|
||||||
this.single = selection.length!==1
|
this.single = selection.length !== 1
|
||||||
this.multiple = !selection.length
|
this.multiple = !selection.length
|
||||||
},
|
},
|
||||||
/** 新增按钮操作 */
|
/** 新增按钮操作 */
|
||||||
handleAdd() {
|
handleAdd() {
|
||||||
this.reset();
|
this.bannerAddUpdateDialogVisible = true
|
||||||
this.open = true;
|
this.$nextTick(() => {
|
||||||
this.title = "添加轮播图";
|
this.$refs.bannerAddUpdateDialog.init()
|
||||||
|
})
|
||||||
},
|
},
|
||||||
/** 修改按钮操作 */
|
/** 修改按钮操作 */
|
||||||
handleUpdate(row) {
|
handleUpdate(row) {
|
||||||
this.loading = true;
|
this.bannerAddUpdateDialogVisible = true
|
||||||
this.reset();
|
this.$nextTick(() => {
|
||||||
const id = row.id || this.ids
|
this.$refs.bannerAddUpdateDialog.init(row.id)
|
||||||
getBanner(id).then(response => {
|
})
|
||||||
this.loading = false;
|
|
||||||
this.form = response.data;
|
|
||||||
this.open = true;
|
|
||||||
this.title = "修改轮播图";
|
|
||||||
});
|
|
||||||
},
|
|
||||||
/** 提交按钮 */
|
|
||||||
submitForm() {
|
|
||||||
this.$refs["form"].validate(valid => {
|
|
||||||
if (valid) {
|
|
||||||
this.buttonLoading = true;
|
|
||||||
if (this.form.id != null) {
|
|
||||||
updateBanner(this.form).then(response => {
|
|
||||||
this.$modal.msgSuccess("修改成功");
|
|
||||||
this.open = false;
|
|
||||||
this.getList();
|
|
||||||
}).finally(() => {
|
|
||||||
this.buttonLoading = false;
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
addBanner(this.form).then(response => {
|
|
||||||
this.$modal.msgSuccess("新增成功");
|
|
||||||
this.open = false;
|
|
||||||
this.getList();
|
|
||||||
}).finally(() => {
|
|
||||||
this.buttonLoading = false;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
/** 删除按钮操作 */
|
/** 删除按钮操作 */
|
||||||
handleDelete(row) {
|
handleDelete(row) {
|
||||||
const ids = row.id || this.ids;
|
const ids = row.id || this.ids
|
||||||
this.$modal.confirm('是否确认删除轮播图编号为"' + ids + '"的数据项?').then(() => {
|
this.$modal.confirm('是否确认删除轮播图编号为"' + ids + '"的数据项?').then(() => {
|
||||||
this.loading = true;
|
this.loading = true
|
||||||
return delBanner(ids);
|
return delBanner(ids)
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
this.loading = false;
|
this.loading = false
|
||||||
this.getList();
|
this.getList()
|
||||||
this.$modal.msgSuccess("删除成功");
|
this.$modal.msgSuccess('删除成功')
|
||||||
}).catch(() => {
|
}).catch(() => {
|
||||||
}).finally(() => {
|
}).finally(() => {
|
||||||
this.loading = false;
|
this.loading = false
|
||||||
});
|
})
|
||||||
},
|
|
||||||
/** 导出按钮操作 */
|
|
||||||
handleExport() {
|
|
||||||
this.download('xq/banner/export', {
|
|
||||||
...this.queryParams
|
|
||||||
}, `banner_${new Date().getTime()}.xlsx`)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -1,22 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="app-container">
|
<div class="app-container">
|
||||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
||||||
<el-form-item label="1-月卡 2-季卡 3-年卡" prop="vipTime">
|
|
||||||
<el-input
|
|
||||||
v-model="queryParams.vipTime"
|
|
||||||
placeholder="请输入1-月卡 2-季卡 3-年卡"
|
|
||||||
clearable
|
|
||||||
@keyup.enter.native="handleQuery"
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="会员价格" prop="vipPrice">
|
|
||||||
<el-input
|
|
||||||
v-model="queryParams.vipPrice"
|
|
||||||
placeholder="请输入会员价格"
|
|
||||||
clearable
|
|
||||||
@keyup.enter.native="handleQuery"
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||||
@@ -24,113 +8,68 @@
|
|||||||
</el-form>
|
</el-form>
|
||||||
|
|
||||||
<el-row :gutter="10" class="mb8">
|
<el-row :gutter="10" class="mb8">
|
||||||
<el-col :span="1.5">
|
|
||||||
<el-button
|
|
||||||
type="primary"
|
|
||||||
plain
|
|
||||||
icon="el-icon-plus"
|
|
||||||
size="mini"
|
|
||||||
@click="handleAdd"
|
|
||||||
v-hasPermi="['xq:vipPrice:add']"
|
|
||||||
>新增</el-button>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="1.5">
|
|
||||||
<el-button
|
|
||||||
type="success"
|
|
||||||
plain
|
|
||||||
icon="el-icon-edit"
|
|
||||||
size="mini"
|
|
||||||
:disabled="single"
|
|
||||||
@click="handleUpdate"
|
|
||||||
v-hasPermi="['xq:vipPrice:edit']"
|
|
||||||
>修改</el-button>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="1.5">
|
|
||||||
<el-button
|
|
||||||
type="danger"
|
|
||||||
plain
|
|
||||||
icon="el-icon-delete"
|
|
||||||
size="mini"
|
|
||||||
:disabled="multiple"
|
|
||||||
@click="handleDelete"
|
|
||||||
v-hasPermi="['xq:vipPrice:remove']"
|
|
||||||
>删除</el-button>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="1.5">
|
|
||||||
<el-button
|
|
||||||
type="warning"
|
|
||||||
plain
|
|
||||||
icon="el-icon-download"
|
|
||||||
size="mini"
|
|
||||||
@click="handleExport"
|
|
||||||
v-hasPermi="['xq:vipPrice:export']"
|
|
||||||
>导出</el-button>
|
|
||||||
</el-col>
|
|
||||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
|
||||||
<el-table v-loading="loading" :data="vipPriceList" @selection-change="handleSelectionChange">
|
<el-table v-loading="loading" :data="vipPriceList" @selection-change="handleSelectionChange">
|
||||||
<el-table-column type="selection" width="55" align="center" />
|
<el-table-column label="会员类型" align="center" prop="vipType">
|
||||||
<el-table-column label="" align="center" prop="id" v-if="true"/>
|
<template v-slot="scope">
|
||||||
<el-table-column label="1-普通会员 2-黄金会员 3-钻石会员" align="center" prop="vipType" />
|
<cai-dict-tag :options="vipTypeList" :value="scope.row.vipType"/>
|
||||||
<el-table-column label="1-月卡 2-季卡 3-年卡" align="center" prop="vipTime" />
|
</template>
|
||||||
<el-table-column label="会员价格" align="center" prop="vipPrice" />
|
</el-table-column>
|
||||||
<el-table-column label="1-启用 0-禁用" align="center" prop="enableStatus" />
|
<el-table-column label="会员时间" align="center" prop="vipTime">
|
||||||
|
<template v-slot="scope">
|
||||||
|
<cai-dict-tag :options="vipTimeList" :value="scope.row.vipTime"/>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="会员价格" align="center" prop="vipPrice"/>
|
||||||
|
<el-table-column label="状态" align="center" prop="enableStatus">
|
||||||
|
<template v-slot="scope">
|
||||||
|
<el-switch
|
||||||
|
v-model="scope.row.enableStatus"
|
||||||
|
:active-value="1"
|
||||||
|
:inactive-value="0"
|
||||||
|
@change="handleEnableStatusChange(scope.row)"
|
||||||
|
></el-switch>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||||
<template slot-scope="scope">
|
<template v-slot="scope">
|
||||||
<el-button
|
<el-button
|
||||||
size="mini"
|
size="mini"
|
||||||
type="text"
|
type="text"
|
||||||
icon="el-icon-edit"
|
icon="el-icon-edit"
|
||||||
@click="handleUpdate(scope.row)"
|
@click="handleUpdate(scope.row)"
|
||||||
v-hasPermi="['xq:vipPrice:edit']"
|
v-hasPermi="['xq:vipPrice:edit']"
|
||||||
>修改</el-button>
|
>修改价格
|
||||||
<el-button
|
</el-button>
|
||||||
size="mini"
|
|
||||||
type="text"
|
|
||||||
icon="el-icon-delete"
|
|
||||||
@click="handleDelete(scope.row)"
|
|
||||||
v-hasPermi="['xq:vipPrice:remove']"
|
|
||||||
>删除</el-button>
|
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
|
|
||||||
<pagination
|
<pagination
|
||||||
v-show="total>0"
|
v-show="total>0"
|
||||||
:total="total"
|
:total="total"
|
||||||
:page.sync="queryParams.pageNum"
|
:page.sync="queryParams.pageNum"
|
||||||
:limit.sync="queryParams.pageSize"
|
:limit.sync="queryParams.pageSize"
|
||||||
@pagination="getList"
|
@pagination="getList"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<!-- 添加或修改会员价格设置对话框 -->
|
<vip-price-update-dialog v-if="vipPriceUpdateDialogVisible" ref="vipPriceUpdateDialog" @refreshDataList="getList" />
|
||||||
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
|
||||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
|
||||||
<el-form-item label="1-月卡 2-季卡 3-年卡" prop="vipTime">
|
|
||||||
<el-input v-model="form.vipTime" placeholder="请输入1-月卡 2-季卡 3-年卡" />
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item label="会员价格" prop="vipPrice">
|
|
||||||
<el-input v-model="form.vipPrice" placeholder="请输入会员价格" />
|
|
||||||
</el-form-item>
|
|
||||||
</el-form>
|
|
||||||
<div slot="footer" class="dialog-footer">
|
|
||||||
<el-button :loading="buttonLoading" type="primary" @click="submitForm">确 定</el-button>
|
|
||||||
<el-button @click="cancel">取 消</el-button>
|
|
||||||
</div>
|
|
||||||
</el-dialog>
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { listVipPrice, getVipPrice, delVipPrice, addVipPrice, updateVipPrice } from "@/api/xq/vipPrice";
|
import { listVipPrice, updateVipPrice } from '@/api/xq/vipPrice'
|
||||||
|
import { vipTimeList, vipTypeList } from '@/constant/statusMap'
|
||||||
|
import VipPriceUpdateDialog from '@/views/xq/vipPrice/vip-price-update-dialog.vue'
|
||||||
export default {
|
export default {
|
||||||
name: "VipPrice",
|
name: 'VipPrice',
|
||||||
|
components: {VipPriceUpdateDialog},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
// 按钮loading
|
vipTypeList,vipTimeList,
|
||||||
buttonLoading: false,
|
vipPriceUpdateDialogVisible: false,
|
||||||
// 遮罩层
|
// 遮罩层
|
||||||
loading: true,
|
loading: true,
|
||||||
// 选中数组
|
// 选中数组
|
||||||
@@ -145,155 +84,63 @@ export default {
|
|||||||
total: 0,
|
total: 0,
|
||||||
// 会员价格设置表格数据
|
// 会员价格设置表格数据
|
||||||
vipPriceList: [],
|
vipPriceList: [],
|
||||||
// 弹出层标题
|
|
||||||
title: "",
|
|
||||||
// 是否显示弹出层
|
|
||||||
open: false,
|
|
||||||
// 查询参数
|
// 查询参数
|
||||||
queryParams: {
|
queryParams: {
|
||||||
pageNum: 1,
|
pageNum: 1,
|
||||||
pageSize: 10,
|
pageSize: 10
|
||||||
vipType: undefined,
|
|
||||||
vipTime: undefined,
|
|
||||||
vipPrice: undefined,
|
|
||||||
enableStatus: undefined,
|
|
||||||
},
|
|
||||||
// 表单参数
|
|
||||||
form: {},
|
|
||||||
// 表单校验
|
|
||||||
rules: {
|
|
||||||
id: [
|
|
||||||
{ required: true, message: "不能为空", trigger: "blur" }
|
|
||||||
],
|
|
||||||
vipType: [
|
|
||||||
{ required: true, message: "1-普通会员 2-黄金会员 3-钻石会员不能为空", trigger: "change" }
|
|
||||||
],
|
|
||||||
vipTime: [
|
|
||||||
{ required: true, message: "1-月卡 2-季卡 3-年卡不能为空", trigger: "blur" }
|
|
||||||
],
|
|
||||||
vipPrice: [
|
|
||||||
{ required: true, message: "会员价格不能为空", trigger: "blur" }
|
|
||||||
],
|
|
||||||
enableStatus: [
|
|
||||||
{ required: true, message: "1-启用 0-禁用不能为空", trigger: "change" }
|
|
||||||
],
|
|
||||||
createTime: [
|
|
||||||
{ required: true, message: "创建时间不能为空", trigger: "blur" }
|
|
||||||
],
|
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
this.getList();
|
this.getList()
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
/** 查询会员价格设置列表 */
|
/** 查询会员价格设置列表 */
|
||||||
getList() {
|
getList() {
|
||||||
this.loading = true;
|
this.loading = true
|
||||||
listVipPrice(this.queryParams).then(response => {
|
listVipPrice(this.queryParams).then(response => {
|
||||||
this.vipPriceList = response.rows;
|
this.vipPriceList = response.rows
|
||||||
this.total = response.total;
|
this.total = response.total
|
||||||
this.loading = false;
|
this.loading = false
|
||||||
});
|
})
|
||||||
},
|
|
||||||
// 取消按钮
|
|
||||||
cancel() {
|
|
||||||
this.open = false;
|
|
||||||
this.reset();
|
|
||||||
},
|
|
||||||
// 表单重置
|
|
||||||
reset() {
|
|
||||||
this.form = {
|
|
||||||
id: undefined,
|
|
||||||
vipType: undefined,
|
|
||||||
vipTime: undefined,
|
|
||||||
vipPrice: undefined,
|
|
||||||
enableStatus: undefined,
|
|
||||||
createTime: undefined,
|
|
||||||
updateTime: undefined
|
|
||||||
};
|
|
||||||
this.resetForm("form");
|
|
||||||
},
|
},
|
||||||
/** 搜索按钮操作 */
|
/** 搜索按钮操作 */
|
||||||
handleQuery() {
|
handleQuery() {
|
||||||
this.queryParams.pageNum = 1;
|
this.queryParams.pageNum = 1
|
||||||
this.getList();
|
this.getList()
|
||||||
},
|
},
|
||||||
/** 重置按钮操作 */
|
/** 重置按钮操作 */
|
||||||
resetQuery() {
|
resetQuery() {
|
||||||
this.resetForm("queryForm");
|
this.resetForm('queryForm')
|
||||||
this.handleQuery();
|
this.handleQuery()
|
||||||
},
|
},
|
||||||
// 多选框选中数据
|
// 多选框选中数据
|
||||||
handleSelectionChange(selection) {
|
handleSelectionChange(selection) {
|
||||||
this.ids = selection.map(item => item.id)
|
this.ids = selection.map(item => item.id)
|
||||||
this.single = selection.length!==1
|
this.single = selection.length !== 1
|
||||||
this.multiple = !selection.length
|
this.multiple = !selection.length
|
||||||
},
|
},
|
||||||
/** 新增按钮操作 */
|
handleUpdate(row) {
|
||||||
handleAdd() {
|
this.vipPriceUpdateDialogVisible = true
|
||||||
this.reset();
|
this.$nextTick(() => {
|
||||||
this.open = true;
|
this.$refs.vipPriceUpdateDialog.init(row.id)
|
||||||
this.title = "添加会员价格设置";
|
})
|
||||||
},
|
},
|
||||||
/** 修改按钮操作 */
|
/** 修改按钮操作 */
|
||||||
handleUpdate(row) {
|
handleEnableStatusChange(row) {
|
||||||
this.loading = true;
|
let text = row.enableStatus === 1 ? '开启' : '取消'
|
||||||
this.reset();
|
this.$confirm('确认要' + text + '会员设置数据吗?', '警告', {
|
||||||
const id = row.id || this.ids
|
confirmButtonText: '确定',
|
||||||
getVipPrice(id).then(response => {
|
cancelButtonText: '取消',
|
||||||
this.loading = false;
|
type: 'warning'
|
||||||
this.form = response.data;
|
|
||||||
this.open = true;
|
|
||||||
this.title = "修改会员价格设置";
|
|
||||||
});
|
|
||||||
},
|
|
||||||
/** 提交按钮 */
|
|
||||||
submitForm() {
|
|
||||||
this.$refs["form"].validate(valid => {
|
|
||||||
if (valid) {
|
|
||||||
this.buttonLoading = true;
|
|
||||||
if (this.form.id != null) {
|
|
||||||
updateVipPrice(this.form).then(response => {
|
|
||||||
this.$modal.msgSuccess("修改成功");
|
|
||||||
this.open = false;
|
|
||||||
this.getList();
|
|
||||||
}).finally(() => {
|
|
||||||
this.buttonLoading = false;
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
addVipPrice(this.form).then(response => {
|
|
||||||
this.$modal.msgSuccess("新增成功");
|
|
||||||
this.open = false;
|
|
||||||
this.getList();
|
|
||||||
}).finally(() => {
|
|
||||||
this.buttonLoading = false;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
|
||||||
/** 删除按钮操作 */
|
|
||||||
handleDelete(row) {
|
|
||||||
const ids = row.id || this.ids;
|
|
||||||
this.$modal.confirm('是否确认删除会员价格设置编号为"' + ids + '"的数据项?').then(() => {
|
|
||||||
this.loading = true;
|
|
||||||
return delVipPrice(ids);
|
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
this.loading = false;
|
return updateVipPrice({ id: row.id, enableStatus: row.enableStatus })
|
||||||
this.getList();
|
}).then(() => {
|
||||||
this.$modal.msgSuccess("删除成功");
|
this.$modal.msgSuccess(text + '成功')
|
||||||
}).catch(() => {
|
}).catch(function() {
|
||||||
}).finally(() => {
|
row.enableStatus = row.enableStatus === 1 ? 0 : 1
|
||||||
this.loading = false;
|
})
|
||||||
});
|
|
||||||
},
|
|
||||||
/** 导出按钮操作 */
|
|
||||||
handleExport() {
|
|
||||||
this.download('xq/vipPrice/export', {
|
|
||||||
...this.queryParams
|
|
||||||
}, `vipPrice_${new Date().getTime()}.xlsx`)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
73
src/views/xq/vipPrice/vip-price-update-dialog.vue
Normal file
73
src/views/xq/vipPrice/vip-price-update-dialog.vue
Normal file
@@ -0,0 +1,73 @@
|
|||||||
|
<template>
|
||||||
|
<el-dialog title="修改会员价格" :close-on-click-modal="false" :visible.sync="open" width="700px" append-to-body>
|
||||||
|
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
||||||
|
<el-form-item label="价格" prop="vipPrice">
|
||||||
|
<el-input v-model="form.vipPrice" placeholder="请输入会员价格"/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<div slot="footer" class="dialog-footer">
|
||||||
|
<el-button :loading="buttonLoading" type="primary" @click="submitForm">确 定</el-button>
|
||||||
|
<el-button @click="open = false">取 消</el-button>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { getVipPrice, updateVipPrice } from '@/api/xq/vipPrice'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
components: {
|
||||||
|
},
|
||||||
|
data () {
|
||||||
|
return {
|
||||||
|
open: false,
|
||||||
|
form:{
|
||||||
|
id: undefined,
|
||||||
|
vipPrice: undefined,
|
||||||
|
},
|
||||||
|
// 表单校验
|
||||||
|
rules: {
|
||||||
|
vipPrice: [
|
||||||
|
{ required: true, message: "数据不能为空", trigger: "blur" }
|
||||||
|
],
|
||||||
|
},
|
||||||
|
buttonLoading: false,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
init (id) {
|
||||||
|
this.form.id = id || undefined;
|
||||||
|
this.open = true;
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.$refs['form'].resetFields();
|
||||||
|
if(this.form.id){
|
||||||
|
getVipPrice(id).then(response => {
|
||||||
|
this.form = response.data;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
// 表单提交
|
||||||
|
submitForm () {
|
||||||
|
this.$refs['form'].validate((valid) => {
|
||||||
|
if (valid) {
|
||||||
|
this.buttonLoading = true;
|
||||||
|
updateVipPrice({
|
||||||
|
id: this.form.id,
|
||||||
|
vipPrice: this.form.vipPrice
|
||||||
|
}).then(data => {
|
||||||
|
this.$modal.msgSuccess("修改成功");
|
||||||
|
this.$modal.buttonLoading = false;
|
||||||
|
this.open = false
|
||||||
|
this.$emit('refreshDataList')
|
||||||
|
}).finally(() => {
|
||||||
|
this.buttonLoading = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
Reference in New Issue
Block a user