Commit ad1aef80 by 吕明尚

增加标签管理

parent 69434d51
import request from '@/utils/request'
// 查询标签列表
export function listLabel(query) {
return request({
url: '/system/label/list',
method: 'get',
params: query
})
}
// 查询标签详细
export function getLabel(id) {
return request({
url: '/system/label/' + id,
method: 'get'
})
}
// 新增标签
export function addLabel(data) {
return request({
url: '/system/label',
method: 'post',
data: data
})
}
// 修改标签
export function updateLabel(data) {
return request({
url: '/system/label',
method: 'put',
data: data
})
}
// 删除标签
export function delLabel(id) {
return request({
url: '/system/label/' + id,
method: 'delete'
})
}
......@@ -119,7 +119,7 @@
<el-table-column label="优惠券原始金额" align="center" prop="subPrice"/>
<el-table-column align="center" label="优惠券售卖金额" prop="couponPayPrice"/>
<!-- <el-table-column label="时长" align="center" prop="duration" />-->
<el-table-column align="center" label="时长" prop="duration"/>
<el-table-column label="平台类型" align="center" prop="platformType">
<template slot-scope="scope">
<dict-tag :options="dict.type.store_platform_type" :value="scope.row.platformType"/>
......@@ -211,9 +211,9 @@
></el-option>
</el-select>
</el-form-item>
<!-- <el-form-item label="时长" prop="duration">-->
<!-- <el-input-number v-model="form.duration" :min="0" :max="24" placeholder="请输入时长"/>-->
<!-- </el-form-item>-->
<el-form-item label="时长" prop="duration">
<el-input-number v-model="form.duration" :max="24" :min="0" placeholder="请输入时长"/>
</el-form-item>
<el-form-item label="平台类型" prop="platformType">
<!--输入框 显示美团 值为2-->
<el-select v-model="form.platformType" placeholder="请选择平台类型" clearable disabled>
......
......@@ -118,7 +118,7 @@
</el-table-column>
<el-table-column label="优惠券原始金额" align="center" prop="subPrice"/>
<el-table-column align="center" label="优惠券售卖金额" prop="couponPayPrice"/>
<!-- <el-table-column label="时长" align="center" prop="duration" />-->
<el-table-column align="center" label="时长" prop="duration"/>
<el-table-column label="平台类型" align="center" prop="platformType">
<template slot-scope="scope">
<dict-tag :options="dict.type.store_platform_type" :value="scope.row.platformType"/>
......@@ -210,9 +210,9 @@
></el-option>
</el-select>
</el-form-item>
<!-- <el-form-item label="时长" prop="duration">-->
<!-- <el-input-number v-model="form.duration" :min="0" :max="24" placeholder="请输入时长"/>-->
<!-- </el-form-item>-->
<el-form-item label="时长" prop="duration">
<el-input-number v-model="form.duration" :max="24" :min="0" placeholder="请输入时长"/>
</el-form-item>
<el-form-item label="平台类型" prop="platformType">
<!--输入框 显示美团 值为2-->
<el-select v-model="form.platformType" placeholder="请选择平台类型" clearable disabled>
......
<template>
<div class="app-container">
<el-form v-show="showSearch" ref="queryForm" :inline="true" :model="queryParams" label-width="68px" size="small">
<el-form-item label="标签名称" prop="name">
<el-input
v-model="queryParams.name"
clearable
placeholder="请输入标签名称"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="时长" prop="duration">
<el-input
v-model="queryParams.duration"
clearable
placeholder="请输入时长"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="套餐类型" prop="type">
<el-select v-model="queryParams.type" clearable placeholder="套餐类型">
<el-option
v-for="dict in dict.type.label_type"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item>
<el-button icon="el-icon-search" size="mini" type="primary" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
v-hasPermi="['system:label:add']"
icon="el-icon-plus"
plain
size="mini"
type="primary"
@click="handleAdd"
>新增
</el-button>
</el-col>
<el-col :span="1.5">
<el-button
v-hasPermi="['system:label:edit']"
:disabled="single"
icon="el-icon-edit"
plain
size="mini"
type="success"
@click="handleUpdate"
>修改
</el-button>
</el-col>
<el-col :span="1.5">
<el-button
v-hasPermi="['system:label:remove']"
:disabled="multiple"
icon="el-icon-delete"
plain
size="mini"
type="danger"
@click="handleDelete"
>删除
</el-button>
</el-col>
<el-col :span="1.5">
<el-button
v-hasPermi="['system:label:export']"
icon="el-icon-download"
plain
size="mini"
type="warning"
@click="handleExport"
>导出
</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="labelList" @selection-change="handleSelectionChange">
<el-table-column align="center" type="selection" width="55"/>
<el-table-column align="center" label="标签名称" prop="name"/>
<el-table-column align="center" label="时长" prop="duration"/>
<!-- <el-table-column label="套餐类型:0:标签,1:房间" align="center" prop="type" />-->
<el-table-column align="center" label="套餐类型" prop="type">
<template slot-scope="scope">
<dict-tag :options="dict.type.label_type" :value="scope.row.type"/>
</template>
</el-table-column>
<el-table-column align="center" label="备注" prop="remark"/>
<el-table-column align="center" class-name="small-padding fixed-width" label="操作">
<template slot-scope="scope">
<el-button
v-hasPermi="['system:label:edit']"
icon="el-icon-edit"
size="mini"
type="text"
@click="handleUpdate(scope.row)"
>修改
</el-button>
<el-button
v-hasPermi="['system:label:remove']"
icon="el-icon-delete"
size="mini"
type="text"
@click="handleDelete(scope.row)"
>删除
</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:limit.sync="queryParams.pageSize"
:page.sync="queryParams.pageNum"
:total="total"
@pagination="getList"
/>
<!-- 添加或修改标签对话框 -->
<el-dialog :title="title" :visible.sync="open" append-to-body width="500px">
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="标签名称" prop="name">
<el-input v-model="form.name" placeholder="请输入标签名称"/>
</el-form-item>
<el-form-item label="时长" prop="duration">
<el-input-number v-model="form.duration" :max="24" :min="0.5" :step="0.5" placeholder="请输入时长"/>
</el-form-item>
<el-form-item label="套餐类型" prop="type">
<el-radio-group v-model="form.type">
<el-radio
v-for="dict in dict.type.label_type"
:key="dict.value"
:label="parseInt(dict.value)"
>{{ dict.label }}
</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" placeholder="请输入内容" type="textarea"/>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm">确 定</el-button>
<el-button @click="cancel">取 消</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import {listLabel, getLabel, delLabel, addLabel, updateLabel} from "@/api/system/label";
export default {
name: "Label",
dicts: ['label_type'],
data() {
return {
// 遮罩层
loading: true,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 标签表格数据
labelList: [],
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
name: null,
duration: null,
type: null
},
// 表单参数
form: {},
// 表单校验
rules: {}
};
},
created() {
this.getList();
},
methods: {
/** 查询标签列表 */
getList() {
this.loading = true;
listLabel(this.queryParams).then(response => {
this.labelList = response.rows;
this.total = response.total;
this.loading = false;
});
},
// 取消按钮
cancel() {
this.open = false;
this.reset();
},
// 表单重置
reset() {
this.form = {
id: null,
name: null,
duration: null,
type: null,
createBy: null,
createTime: null,
updateBy: null,
updateTime: null,
remark: null,
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length !== 1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加标签";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id || this.ids
getLabel(id).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改标签";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.id != null) {
updateLabel(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addLabel(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$modal.confirm('是否确认删除标签编号为"' + ids + '"的数据项?').then(function () {
return delLabel(ids);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {
});
},
/** 导出按钮操作 */
handleExport() {
this.download('system/label/export', {
...this.queryParams
}, `label_${new Date().getTime()}.xlsx`)
}
}
};
</script>
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form v-show="showSearch" ref="queryForm" :inline="true" :model="queryParams" label-width="150px" size="small">
<el-form-item label="套餐名称" prop="name">
<el-input
v-model="queryParams.name"
......@@ -41,12 +41,42 @@
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="是否首次下单可用" prop="firstOrderAvailable">
<el-select v-model="queryParams.firstOrderAvailable" placeholder="请选择是否首次下单可用" clearable>
<el-option label="是" value="1" />
<el-option label="否" value="0" />
<!--<el-form-item label="是否首次下单可用" prop="firstOrderAvailable">-->
<!-- <el-select v-model="queryParams.firstOrderAvailable" placeholder="请选择是否首次下单可用" clearable>-->
<!-- <el-option label="是" value="1" />-->
<!-- <el-option label="否" value="0" />-->
<!-- </el-select>-->
<!--</el-form-item>-->
<el-form-item label="是否首次下单可用" prop="firstOrderAvailable">
<el-select v-model="queryParams.firstOrderAvailable" clearable placeholder="请选择是否首次下单可用">
<el-option
v-for="dict in dict.type.store_is_use_coupon"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item label="是否固定结束时间" prop="isFixedEndTime">
<el-select v-model="queryParams.isFixedEndTime" clearable placeholder="请选择是否固定结束时间">
<el-option
v-for="dict in dict.type.store_is_use_coupon"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item label="套餐类型" prop="type">
<el-select v-model="queryParams.type" clearable placeholder="请选择套餐类型">
<el-option
v-for="dict in dict.type.pack_type"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</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 icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
......@@ -112,6 +142,16 @@
<dict-tag :options="dict.type.store_is_use_coupon" :value="scope.row.firstOrderAvailable"/>
</template>
</el-table-column>
<el-table-column align="center" label="是否固定结束时间" prop="isFixedEndTime">
<template slot-scope="scope">
<dict-tag :options="dict.type.store_is_use_coupon" :value="scope.row.isFixedEndTime"/>
</template>
</el-table-column>
<el-table-column align="center" label="套餐类型" prop="type">
<template slot-scope="scope">
<dict-tag :options="dict.type.pack_type" :value="scope.row.type"/>
</template>
</el-table-column>
<el-table-column label="备注" align="center" prop="remark" width="300px"/>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
......@@ -143,7 +183,7 @@
<!-- 添加或修改套餐对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="120px">
<el-form ref="form" :model="form" :rules="rules" label-width="150px">
<el-form-item label="套餐名称" prop="name">
<el-input v-model="form.name" placeholder="请输入套餐名称" />
</el-form-item>
......@@ -173,6 +213,26 @@
>{{dict.label}}</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="是否固定结束时间" prop="isFixedEndTime">
<el-radio-group v-model="form.isFixedEndTime">
<el-radio
v-for="dict in dict.type.store_is_use_coupon"
:key="dict.value"
:label="parseInt(dict.value)"
>{{ dict.label }}
</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="套餐类型" prop="type">
<el-radio-group v-model="form.type">
<el-radio
v-for="dict in dict.type.pack_type"
:key="dict.value"
:label="parseInt(dict.value)"
>{{ dict.label }}
</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
</el-form-item>
......@@ -192,7 +252,7 @@ import {getRoom, getRoomPack} from "@/api/system/room";
let roomPackList = [];
export default {
name: "Pack",
dicts: [ 'store_is_use_coupon'],
dicts: ['store_is_use_coupon', 'pack_type'],
data() {
return {
// 遮罩层
......@@ -223,7 +283,9 @@ export default {
price: null,
packaStartPeriod: null,
packaEndPeriod: null,
firstOrderAvailable: null
firstOrderAvailable: null,
type: null,
isFixedEndTime: null
},
// 表单参数
form: {},
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment