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) { ...@@ -42,3 +42,10 @@ export function delRoom(id) {
method: 'delete' method: 'delete'
}) })
} }
export function getRoomPack(id) {
return request({
url: '/system/roomPack/getPackId/'+id,
method: 'get'
})
}
...@@ -126,6 +126,13 @@ ...@@ -126,6 +126,13 @@
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="房间单价" width="80" align="center" prop="price" /> <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" 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">
...@@ -201,6 +208,16 @@ ...@@ -201,6 +208,16 @@
<el-form-item label="房间单价" prop="price" required> <el-form-item label="房间单价" prop="price" required>
<el-input v-model="form.price" placeholder="请输入房间单价(默认单位:元/小时)" /> <el-input v-model="form.price" placeholder="请输入房间单价(默认单位:元/小时)" />
</el-form-item> </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-form-item label="备注" prop="remark">
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容" /> <el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
</el-form-item> </el-form-item>
...@@ -216,6 +233,7 @@ ...@@ -216,6 +233,7 @@
<script> <script>
import { listRoom, getRoom, delRoom, addRoom, updateRoom } from "@/api/system/room"; import { listRoom, getRoom, delRoom, addRoom, updateRoom } from "@/api/system/room";
import { allList } from '@/api/system/store' import { allList } from '@/api/system/store'
import { query } from '@/api/system/pack'
export default { export default {
name: "Room", name: "Room",
...@@ -234,6 +252,8 @@ export default { ...@@ -234,6 +252,8 @@ export default {
// 显示搜索条件 // 显示搜索条件
showSearch: true, showSearch: true,
options: [], options: [],
packList: [],
packIds: [],
// 总条数 // 总条数
total: 0, total: 0,
// 房间表格数据 // 房间表格数据
...@@ -279,6 +299,7 @@ export default { ...@@ -279,6 +299,7 @@ export default {
}, },
created() { created() {
this.onGetAllStoreList() this.onGetAllStoreList()
this.onPackList()
this.getList(); this.getList();
}, },
methods: { methods: {
...@@ -286,11 +307,21 @@ export default { ...@@ -286,11 +307,21 @@ export default {
console.log(e) console.log(e)
this.form.facilities = e.join() this.form.facilities = e.join()
}, },
onChangePackId(e){
console.log(e)
this.form.packIds = e.join()
},
onGetAllStoreList(){ onGetAllStoreList(){
allList().then(res => { allList().then(res => {
this.options = res.data this.options = res.data
}) })
}, },
onPackList(){
query().then(res => {
this.packList = res.data
})
},
/** 查询房间列表 */ /** 查询房间列表 */
getList() { getList() {
this.loading = true; this.loading = true;
...@@ -357,6 +388,7 @@ export default { ...@@ -357,6 +388,7 @@ export default {
handleAdd() { handleAdd() {
this.reset(); this.reset();
this.open = true; this.open = true;
console.log(this.facilities)
this.title = "添加房间"; this.title = "添加房间";
}, },
/** 修改按钮操作 */ /** 修改按钮操作 */
...@@ -368,6 +400,13 @@ export default { ...@@ -368,6 +400,13 @@ export default {
if(this.form.facilities){ if(this.form.facilities){
this.facilities = this.form.facilities.split(",") 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.open = true;
this.title = "修改房间"; this.title = "修改房间";
}); });
...@@ -383,6 +422,9 @@ export default { ...@@ -383,6 +422,9 @@ export default {
this.getList(); this.getList();
}); });
} else { } else {
if(this.form.packIds){
this.packIds = this.form.packIds.split(",")
}
addRoom(this.form).then(response => { addRoom(this.form).then(response => {
this.$modal.msgSuccess("新增成功"); this.$modal.msgSuccess("新增成功");
this.open = false; 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