Commit 4dac456e by 吕明尚

增加套餐管理页面

parent 0a36f3a7
import request from '@/utils/request'
// 查询套餐列表
export function listPack(query) {
return request({
url: '/system/pack/list',
method: 'get',
params: query
})
}
export function query() {
return request({
url: '/system/pack/query',
method: 'get',
})
}
// 查询套餐详细
export function getPack(id) {
return request({
url: '/system/pack/' + id,
method: 'get'
})
}
// 新增套餐
export function addPack(data) {
return request({
url: '/system/pack',
method: 'post',
data: data
})
}
// 修改套餐
export function updatePack(data) {
return request({
url: '/system/pack',
method: 'put',
data: data
})
}
// 删除套餐
export function delPack(id) {
return request({
url: '/system/pack/' + id,
method: 'delete'
})
}
......@@ -42,3 +42,10 @@ export function delRoom(id) {
method: 'delete'
})
}
export function getRoomPack(id) {
return request({
url: '/system/roomPack/getPackId/'+id,
method: 'get'
})
}
......@@ -126,6 +126,13 @@
</template>
</el-table-column>
<el-table-column label="房间单价" width="80" align="center" prop="price" />
<el-table-column label="套餐" align="center" prop="packIds" >
<template slot-scope="scope">
<div v-if="scope.row.packIds" style="display: flex;flex-wrap: wrap;width: 100%;">
<dict-tag style="margin: 0 3px;" v-for="(item ,k) in packList" :key="k" :options="packIds" :value="item.name+'-'+'时段'+item.packaStartPeriod+'-'+item.packaEndPeriod"/>
</div>
</template>
</el-table-column>
<el-table-column label="备注" align="center" prop="remark" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
......@@ -201,6 +208,16 @@
<el-form-item label="房间单价" prop="price" required>
<el-input v-model="form.price" placeholder="请输入房间单价(默认单位:元/小时)" />
</el-form-item>
<el-form-item label="套餐" prop="packIds">
<el-select style="width: 100%;" v-model="packIds" multiple placeholder="套餐" @change="onChangePackId">
<el-option
v-for="item in packList"
:key="item.id"
:label="item.name+'-'+'时段'+item.packaStartPeriod+'-'+item.packaEndPeriod"
:value="item.id"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
</el-form-item>
......@@ -216,6 +233,7 @@
<script>
import { listRoom, getRoom, delRoom, addRoom, updateRoom } from "@/api/system/room";
import { allList } from '@/api/system/store'
import { query } from '@/api/system/pack'
export default {
name: "Room",
......@@ -234,6 +252,8 @@ export default {
// 显示搜索条件
showSearch: true,
options: [],
packList: [],
packIds: [],
// 总条数
total: 0,
// 房间表格数据
......@@ -279,6 +299,7 @@ export default {
},
created() {
this.onGetAllStoreList()
this.onPackList()
this.getList();
},
methods: {
......@@ -286,11 +307,21 @@ export default {
console.log(e)
this.form.facilities = e.join()
},
onChangePackId(e){
console.log(e)
this.form.packIds = e.join()
},
onGetAllStoreList(){
allList().then(res => {
this.options = res.data
})
},
onPackList(){
query().then(res => {
this.packList = res.data
})
},
/** 查询房间列表 */
getList() {
this.loading = true;
......@@ -357,6 +388,7 @@ export default {
handleAdd() {
this.reset();
this.open = true;
console.log(this.facilities)
this.title = "添加房间";
},
/** 修改按钮操作 */
......@@ -368,6 +400,13 @@ export default {
if(this.form.facilities){
this.facilities = this.form.facilities.split(",")
}
if(this.form.packIds){
//字符串转数字
var int = this.form.packIds.split(",")
this.packIds = int.map((item) => {
return Number(item);
});
}
this.open = true;
this.title = "修改房间";
});
......@@ -383,6 +422,9 @@ export default {
this.getList();
});
} else {
if(this.form.packIds){
this.packIds = this.form.packIds.split(",")
}
addRoom(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
......
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