This commit is contained in:
张良(004796)
2024-03-12 18:08:38 +08:00
parent 4ff37871f8
commit bfeac76d05
5 changed files with 359 additions and 410 deletions

View File

@@ -75,11 +75,6 @@ export const isAnchorList = [
{ value: 0, label: '否',listClass: listClass.info},
]
export const enableStatusList = [
{ value: 1, label: '正常'},
{ value: 0, label: '禁用'},
]
export const userRiskLowList = [
{ value: 1, label: '低风险',listClass: listClass.info},
{ value: 2, label: '高风险',listClass: listClass.danger},
@@ -528,3 +523,8 @@ export const auditStatusList = [
{ value: 2, label: '审核通过',listClass: listClass.primary},
{ value: 3, label: '审核不通过',listClass: listClass.danger},
]
export const enableStatusList = [
{ value: 1, label: '正常',listClass: listClass.primary},
{ value: 0, label: '禁用',listClass: listClass.danger},
]

View 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>

View File

@@ -1,14 +1,6 @@
<template>
<div class="app-container">
<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-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>
@@ -24,7 +16,8 @@
size="mini"
@click="handleAdd"
v-hasPermi="['xq:banner:add']"
>新增</el-button>
>新增
</el-button>
</el-col>
<el-col :span="1.5">
<el-button
@@ -35,7 +28,8 @@
:disabled="single"
@click="handleUpdate"
v-hasPermi="['xq:banner:edit']"
>修改</el-button>
>修改
</el-button>
</el-col>
<el-col :span="1.5">
<el-button
@@ -46,42 +40,43 @@
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['xq:banner: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:banner:export']"
>导出</el-button>
>删除
</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="bannerList" @selection-change="handleSelectionChange">
<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="1-启用 0-禁用" align="center" prop="enableStatus" />
<el-table-column type="selection" width="55" align="center"/>
<el-table-column label="轮播" align="center" prop="banner">
<template v-slot="scope">
<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">
<template slot-scope="scope">
<template v-slot="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['xq:banner:edit']"
>修改</el-button>
>修改
</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['xq:banner:remove']"
>删除</el-button>
>删除
</el-button>
</template>
</el-table-column>
</el-table>
@@ -93,31 +88,22 @@
:limit.sync="queryParams.pageSize"
@pagination="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>
<banner-add-update-dialog v-if="bannerAddUpdateDialogVisible" ref="bannerAddUpdateDialog" @refreshDataList="getList"/>
</div>
</template>
<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 {
name: "Banner",
name: 'Banner',
components: { BannerAddUpdateDialog },
data() {
return {
// 按钮loading
buttonLoading: false,
enableStatusList,
bannerAddUpdateDialogVisible: false,
// 遮罩层
loading: true,
// 选中数组
@@ -133,7 +119,7 @@ export default {
// 轮播图表格数据
bannerList: [],
// 弹出层标题
title: "",
title: '',
// 是否显示弹出层
open: false,
// 查询参数
@@ -141,136 +127,68 @@ export default {
pageNum: 1,
pageSize: 10,
banner: 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" }
],
enableStatus: undefined
}
}
};
},
created() {
this.getList();
this.getList()
},
methods: {
/** 查询轮播图列表 */
getList() {
this.loading = true;
this.loading = true
listBanner(this.queryParams).then(response => {
this.bannerList = response.rows;
this.total = response.total;
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");
this.bannerList = response.rows
this.total = response.total
this.loading = false
})
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
this.queryParams.pageNum = 1
this.getList()
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
this.resetForm('queryForm')
this.handleQuery()
},
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length!==1
this.single = selection.length !== 1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加轮播图";
this.bannerAddUpdateDialogVisible = true
this.$nextTick(() => {
this.$refs.bannerAddUpdateDialog.init()
})
},
/** 修改按钮操作 */
handleUpdate(row) {
this.loading = true;
this.reset();
const id = row.id || this.ids
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;
});
}
}
});
this.bannerAddUpdateDialogVisible = true
this.$nextTick(() => {
this.$refs.bannerAddUpdateDialog.init(row.id)
})
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
const ids = row.id || this.ids
this.$modal.confirm('是否确认删除轮播图编号为"' + ids + '"的数据项?').then(() => {
this.loading = true;
return delBanner(ids);
this.loading = true
return delBanner(ids)
}).then(() => {
this.loading = false;
this.getList();
this.$modal.msgSuccess("删除成功");
this.loading = false
this.getList()
this.$modal.msgSuccess('删除成功')
}).catch(() => {
}).finally(() => {
this.loading = false;
});
},
/** 导出按钮操作 */
handleExport() {
this.download('xq/banner/export', {
...this.queryParams
}, `banner_${new Date().getTime()}.xlsx`)
this.loading = false
})
}
}
};
}
</script>

View File

@@ -1,22 +1,6 @@
<template>
<div class="app-container">
<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-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>
@@ -24,74 +8,41 @@
</el-form>
<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>
</el-row>
<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="id" v-if="true"/>
<el-table-column label="1-普通会员 2-黄金会员 3-钻石会员" align="center" prop="vipType" />
<el-table-column label="1-月卡 2-季卡 3-年卡" align="center" prop="vipTime" />
<el-table-column label="会员价格" align="center" prop="vipPrice" />
<el-table-column label="1-启用 0-禁用" align="center" prop="enableStatus" />
<el-table-column label="会员类型" align="center" prop="vipType">
<template v-slot="scope">
<cai-dict-tag :options="vipTypeList" :value="scope.row.vipType"/>
</template>
</el-table-column>
<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">
<template slot-scope="scope">
<template v-slot="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['xq:vipPrice:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['xq:vipPrice:remove']"
>删除</el-button>
>修改价格
</el-button>
</template>
</el-table-column>
</el-table>
@@ -104,33 +55,21 @@
@pagination="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>
<vip-price-update-dialog v-if="vipPriceUpdateDialogVisible" ref="vipPriceUpdateDialog" @refreshDataList="getList" />
</div>
</template>
<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 {
name: "VipPrice",
name: 'VipPrice',
components: {VipPriceUpdateDialog},
data() {
return {
// 按钮loading
buttonLoading: false,
vipTypeList,vipTimeList,
vipPriceUpdateDialogVisible: false,
// 遮罩层
loading: true,
// 选中数组
@@ -145,155 +84,63 @@ export default {
total: 0,
// 会员价格设置表格数据
vipPriceList: [],
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
// 查询参数
queryParams: {
pageNum: 1,
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" }
],
pageSize: 10
}
}
};
},
created() {
this.getList();
this.getList()
},
methods: {
/** 查询会员价格设置列表 */
getList() {
this.loading = true;
this.loading = true
listVipPrice(this.queryParams).then(response => {
this.vipPriceList = response.rows;
this.total = response.total;
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");
this.vipPriceList = response.rows
this.total = response.total
this.loading = false
})
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
this.queryParams.pageNum = 1
this.getList()
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
this.resetForm('queryForm')
this.handleQuery()
},
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length!==1
this.single = selection.length !== 1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加会员价格设置";
handleUpdate(row) {
this.vipPriceUpdateDialogVisible = true
this.$nextTick(() => {
this.$refs.vipPriceUpdateDialog.init(row.id)
})
},
/** 修改按钮操作 */
handleUpdate(row) {
this.loading = true;
this.reset();
const id = row.id || this.ids
getVipPrice(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) {
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);
handleEnableStatusChange(row) {
let text = row.enableStatus === 1 ? '开启' : '取消'
this.$confirm('确认要' + text + '会员设置数据吗?', '警告', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.loading = false;
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {
}).finally(() => {
this.loading = false;
});
},
/** 导出按钮操作 */
handleExport() {
this.download('xq/vipPrice/export', {
...this.queryParams
}, `vipPrice_${new Date().getTime()}.xlsx`)
return updateVipPrice({ id: row.id, enableStatus: row.enableStatus })
}).then(() => {
this.$modal.msgSuccess(text + '成功')
}).catch(function() {
row.enableStatus = row.enableStatus === 1 ? 0 : 1
})
}
}
};
}
</script>

View 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>