Commit be596f83 by YG8999

协议管理、bug修复

parent c113b22a
import request from '@/utils/request'
// 查询小程序协议管理列表
export function listProtocol(query) {
return request({
url: '/system/protocol/list',
method: 'get',
params: query
})
}
// 查询小程序协议管理详细
export function getProtocol(id) {
return request({
url: '/system/protocol/' + id,
method: 'get'
})
}
// 新增小程序协议管理
export function addProtocol(data) {
return request({
url: '/system/protocol',
method: 'post',
data: data
})
}
// 修改小程序协议管理
export function updateProtocol(data) {
return request({
url: '/system/protocol',
method: 'put',
data: data
})
}
// 删除小程序协议管理
export function delProtocol(id) {
return request({
url: '/system/protocol/' + id,
method: 'delete'
})
}
<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="100px">
<el-form-item label="用户ID" prop="consumerId"> <el-form-item label="用户ID" prop="consumerId">
<el-input <!-- <el-input-->
v-model="queryParams.consumerId" <!-- v-model="queryParams.consumerId"-->
placeholder="请输入用户ID" <!-- placeholder="请输入用户ID"-->
clearable <!-- clearable-->
@keyup.enter.native="handleQuery" <!-- @keyup.enter.native="handleQuery"-->
/> <!-- />-->
</el-form-item> <!-- </el-form-item>-->
<el-form-item label="优惠券ID" prop="couponId"> <!-- <el-form-item label="优惠券ID" prop="couponId">-->
<el-input <!-- <el-input-->
v-model="queryParams.couponId" <!-- v-model="queryParams.couponId"-->
placeholder="请输入优惠券ID" <!-- placeholder="请输入优惠券ID"-->
clearable <!-- clearable-->
@keyup.enter.native="handleQuery" <!-- @keyup.enter.native="handleQuery"-->
/> <!-- />-->
</el-form-item> <!-- </el-form-item>-->
<el-form-item label="优惠券编码" prop="couponCode"> <el-form-item label="优惠券编码" prop="couponCode">
<el-input <el-input
v-model="queryParams.couponCode" v-model="queryParams.couponCode"
...@@ -33,38 +33,38 @@ ...@@ -33,38 +33,38 @@
@keyup.enter.native="handleQuery" @keyup.enter.native="handleQuery"
/> />
</el-form-item> </el-form-item>
<el-form-item label="优惠开始" prop="couponTimeStart"> <!-- <el-form-item label="优惠开始" prop="couponTimeStart">-->
<el-input <!-- <el-input-->
v-model="queryParams.couponTimeStart" <!-- v-model="queryParams.couponTimeStart"-->
placeholder="请输入优惠开始" <!-- placeholder="请输入优惠开始"-->
clearable <!-- clearable-->
@keyup.enter.native="handleQuery" <!-- @keyup.enter.native="handleQuery"-->
/> <!-- />-->
</el-form-item> <!-- </el-form-item>-->
<el-form-item label="优惠结束" prop="couponTimeEnd"> <!-- <el-form-item label="优惠结束" prop="couponTimeEnd">-->
<el-input <!-- <el-input-->
v-model="queryParams.couponTimeEnd" <!-- v-model="queryParams.couponTimeEnd"-->
placeholder="请输入优惠结束" <!-- placeholder="请输入优惠结束"-->
clearable <!-- clearable-->
@keyup.enter.native="handleQuery" <!-- @keyup.enter.native="handleQuery"-->
/> <!-- />-->
</el-form-item> <!-- </el-form-item>-->
<el-form-item label="折扣最大时长" prop="maxDuration"> <!-- <el-form-item label="折扣最大时长" prop="maxDuration">-->
<el-input <!-- <el-input-->
v-model="queryParams.maxDuration" <!-- v-model="queryParams.maxDuration"-->
placeholder="请输入折扣最大时长" <!-- placeholder="请输入折扣最大时长"-->
clearable <!-- clearable-->
@keyup.enter.native="handleQuery" <!-- @keyup.enter.native="handleQuery"-->
/> <!-- />-->
</el-form-item> <!-- </el-form-item>-->
<el-form-item label="时长" prop="duration"> <!-- <el-form-item label="时长" prop="duration">-->
<el-input <!-- <el-input-->
v-model="queryParams.duration" <!-- v-model="queryParams.duration"-->
placeholder="请输入时长" <!-- placeholder="请输入时长"-->
clearable <!-- clearable-->
@keyup.enter.native="handleQuery" <!-- @keyup.enter.native="handleQuery"-->
/> <!-- />-->
</el-form-item> <!-- </el-form-item>-->
<el-form-item label="门槛金额" prop="minPrice"> <el-form-item label="门槛金额" prop="minPrice">
<el-input <el-input
v-model="queryParams.minPrice" v-model="queryParams.minPrice"
...@@ -108,31 +108,31 @@ ...@@ -108,31 +108,31 @@
> >
</el-date-picker> </el-date-picker>
</el-form-item> </el-form-item>
<el-form-item label="删除状态" prop="isDelete"> <!-- <el-form-item label="删除状态" prop="isDelete">-->
<el-input <!-- <el-input-->
v-model="queryParams.isDelete" <!-- v-model="queryParams.isDelete"-->
placeholder="请输入删除状态(0:未删除,1:已删除)" <!-- placeholder="请输入删除状态(0:未删除,1:已删除)"-->
clearable <!-- clearable-->
@keyup.enter.native="handleQuery" <!-- @keyup.enter.native="handleQuery"-->
/> <!-- />-->
</el-form-item> <!-- </el-form-item>-->
<el-form-item label="更新者" prop="deleteBy"> <!-- <el-form-item label="更新者" prop="deleteBy">-->
<el-input <!-- <el-input-->
v-model="queryParams.deleteBy" <!-- v-model="queryParams.deleteBy"-->
placeholder="请输入更新者" <!-- placeholder="请输入更新者"-->
clearable <!-- clearable-->
@keyup.enter.native="handleQuery" <!-- @keyup.enter.native="handleQuery"-->
/> <!-- />-->
</el-form-item> <!-- </el-form-item>-->
<el-form-item label="更新时间" prop="deleteTime"> <!-- <el-form-item label="更新时间" prop="deleteTime">-->
<el-date-picker clearable <!-- <el-date-picker clearable-->
v-model="queryParams.deleteTime" <!-- v-model="queryParams.deleteTime"-->
type="date" <!-- type="date"-->
value-format="yyyy-MM-dd" <!-- value-format="yyyy-MM-dd"-->
placeholder="请选择更新时间" <!-- placeholder="请选择更新时间"-->
> <!-- >-->
</el-date-picker> <!-- </el-date-picker>-->
</el-form-item> <!-- </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>
......
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="90npx">
<el-form-item label="协议标题" prop="protocolTitle">
<el-input
v-model="queryParams.protocolTitle"
placeholder="请输入协议标题"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="协议key名" prop="protocolKey">
<el-input
v-model="queryParams.protocolKey"
placeholder="请输入协议key名"
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>
</el-form-item>
</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="['system:protocol: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="['system:protocol: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="['system:protocol:remove']"
>删除</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="protocolList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="序号" align="center" prop="id" width="100" />
<el-table-column
label="协议标题"
align="center"
prop="protocolTitle"
:show-overflow-tooltip="true"
/>
<el-table-column label="协议key名" align="center" prop="protocolKey" width="210" />
<el-table-column label="状态" align="center" prop="status" width="100">
<template slot-scope="scope">
<dict-tag :options="dict.type.sys_notice_status" :value="scope.row.status"/>
</template>
</el-table-column>
<el-table-column label="创建者" align="center" prop="createBy" width="120" />
<el-table-column label="创建时间" align="center" prop="createTime" width="120">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['system:protocol:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['system:protocol:remove']"
>删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改小程序协议管理对话框 -->
<el-dialog :title="title" :visible.sync="open" width="60%" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
<el-form-item label="协议标题" prop="protocolTitle">
<el-input v-model="form.protocolTitle" placeholder="请输入协议标题" />
</el-form-item>
<el-form-item label="协议key名" prop="protocolKey">
<el-input v-model="form.protocolKey" placeholder="请输入协议key名" />
</el-form-item>
<el-form-item label="状态">
<el-radio-group v-model="form.status">
<el-radio
v-for="dict in dict.type.sys_notice_status"
:key="dict.value"
:label="dict.value"
>{{dict.label}}</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="内容">
<editor v-model="form.content" :min-height="192"/>
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" placeholder="请输入备注" />
</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 { listProtocol, getProtocol, delProtocol, addProtocol, updateProtocol } from "@/api/system/protocol";
export default {
name: "Protocol",
dicts: ['sys_notice_status'],
data() {
return {
// 遮罩层
loading: true,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 小程序协议管理表格数据
protocolList: [],
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
protocolTitle: null,
protocolKey: null,
content: null,
status: null,
},
// 表单参数
form: {},
// 表单校验
rules: {
protocolTitle: [
{ required: true, message: "协议标题不能为空", trigger: "blur" }
],
protocolKey: [
{ required: true, message: "协议key名不能为空", trigger: "blur" }
],
}
};
},
created() {
this.getList();
},
methods: {
/** 查询小程序协议管理列表 */
getList() {
this.loading = true;
listProtocol(this.queryParams).then(response => {
this.protocolList = response.rows;
this.total = response.total;
this.loading = false;
});
},
// 取消按钮
cancel() {
this.open = false;
this.reset();
},
// 表单重置
reset() {
this.form = {
id: null,
protocolTitle: null,
protocolKey: null,
content: null,
status: "0",
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
getProtocol(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) {
updateProtocol(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addProtocol(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 delProtocol(ids);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
this.download('system/protocol/export', {
...this.queryParams
}, `protocol_${new Date().getTime()}.xlsx`)
}
}
};
</script>
...@@ -113,7 +113,7 @@ ...@@ -113,7 +113,7 @@
<image-preview :src="scope.row.images" :width="50" :height="50"/> <image-preview :src="scope.row.images" :width="50" :height="50"/>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="房间设施" align="center" prop="facilities" > <el-table-column label="房间设施" align="center" prop="facilities" width="250" >
<template slot-scope="scope"> <template slot-scope="scope">
<div v-if="scope.row.facilities.length" style="display: flex;flex-wrap: wrap;width: 100%;"> <div v-if="scope.row.facilities.length" style="display: flex;flex-wrap: wrap;width: 100%;">
<dict-tag style="margin: 0 3px;" v-for="(item ,k) in scope.row.facilities" :key="k" :options="dict.type.indoor_facilities" :value="item"/> <dict-tag style="margin: 0 3px;" v-for="(item ,k) in scope.row.facilities" :key="k" :options="dict.type.indoor_facilities" :value="item"/>
...@@ -133,7 +133,7 @@ ...@@ -133,7 +133,7 @@
</div> </div>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="备注" align="center" prop="remark" /> <!-- <el-table-column label="备注" align="center" prop="remark" />-->
<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 slot-scope="scope">
<el-button <el-button
...@@ -197,7 +197,7 @@ ...@@ -197,7 +197,7 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="房间主图" prop="images"> <el-form-item label="房间主图" prop="images">
<image-upload v-model="form.images"/> <image-upload :limit="1" v-model="form.images"/>
</el-form-item> </el-form-item>
<el-form-item label="房间设施" prop="facilities"> <el-form-item label="房间设施" prop="facilities">
<el-select style="width: 100%;" v-model="facilities" multiple placeholder="请选择房间设施" @change="onChange"> <el-select style="width: 100%;" v-model="facilities" multiple placeholder="请选择房间设施" @change="onChange">
......
...@@ -107,7 +107,7 @@ ...@@ -107,7 +107,7 @@
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="门店地址" align="center" prop="address"/> <el-table-column label="门店地址" align="center" prop="address" width="200"/>
<el-table-column label="营业时间" align="center" prop="openStartTime"> <el-table-column label="营业时间" align="center" prop="openStartTime">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ scope.row.openStartTime }}</span>-<span>{{ scope.row.openEndTime }}</span> <span>{{ scope.row.openStartTime }}</span>-<span>{{ scope.row.openEndTime }}</span>
...@@ -120,7 +120,7 @@ ...@@ -120,7 +120,7 @@
<dict-tag :options="dict.type.store_status" :value="scope.row.status"/> <dict-tag :options="dict.type.store_status" :value="scope.row.status"/>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="备注" align="center" prop="remark"/> <!-- <el-table-column label="备注" align="center" prop="remark"/>-->
<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 slot-scope="scope">
<el-button <el-button
...@@ -163,7 +163,7 @@ ...@@ -163,7 +163,7 @@
<el-form ref="form" :model="form" :rules="rules" label-width="120px"> <el-form ref="form" :model="form" :rules="rules" label-width="120px">
<el-row> <el-row>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="门店名称" prop="name" required> <el-form-item label="门店名称" prop="name" >
<el-input v-model="form.name" placeholder="请输入门店名称"/> <el-input v-model="form.name" placeholder="请输入门店名称"/>
</el-form-item> </el-form-item>
</el-col> </el-col>
......
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