Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gxpt_web
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
pseer
gxpt_web
Commits
4dac456e
Commit
4dac456e
authored
Oct 31, 2023
by
吕明尚
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加套餐管理页面
parent
0a36f3a7
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
423 additions
and
0 deletions
+423
-0
pack.js
src/api/system/pack.js
+51
-0
room.js
src/api/system/room.js
+7
-0
index.vue
src/views/system/pack/index.vue
+323
-0
index.vue
src/views/system/room/index.vue
+42
-0
No files found.
src/api/system/pack.js
0 → 100644
View file @
4dac456e
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'
})
}
src/api/system/room.js
View file @
4dac456e
...
...
@@ -42,3 +42,10 @@ export function delRoom(id) {
method
:
'delete'
})
}
export
function
getRoomPack
(
id
)
{
return
request
({
url
:
'/system/roomPack/getPackId/'
+
id
,
method
:
'get'
})
}
src/views/system/pack/index.vue
0 → 100644
View file @
4dac456e
<
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=
"name"
>
<el-input
v-model=
"queryParams.name"
placeholder=
"请输入套餐名称"
clearable
@
keyup
.
enter
.
native=
"handleQuery"
/>
</el-form-item>
<el-form-item
label=
"时长"
prop=
"duration"
>
<el-input
v-model=
"queryParams.duration"
placeholder=
"请输入时长"
clearable
@
keyup
.
enter
.
native=
"handleQuery"
/>
</el-form-item>
<el-form-item
label=
"金额"
prop=
"price"
>
<el-input
v-model=
"queryParams.price"
placeholder=
"请输入金额"
clearable
@
keyup
.
enter
.
native=
"handleQuery"
/>
</el-form-item>
<el-form-item
label=
"套餐开始时段"
prop=
"packaStartPeriod"
>
<el-input
v-model=
"queryParams.packaStartPeriod"
placeholder=
"请输入套餐开始时段"
clearable
@
keyup
.
enter
.
native=
"handleQuery"
/>
</el-form-item>
<el-form-item
label=
"套餐结束时段"
prop=
"packaEndPeriod"
>
<el-input
v-model=
"queryParams.packaEndPeriod"
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>
</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:pack: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:pack: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:pack: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=
"['system:pack:export']"
>
导出
</el-button>
</el-col>
<right-toolbar
:showSearch
.
sync=
"showSearch"
@
queryTable=
"getList"
></right-toolbar>
</el-row>
<el-table
v-loading=
"loading"
:data=
"packList"
@
selection-change=
"handleSelectionChange"
>
<el-table-column
type=
"selection"
width=
"55"
align=
"center"
/>
<el-table-column
label=
"套餐名称"
align=
"center"
prop=
"name"
/>
<el-table-column
label=
"时长"
align=
"center"
prop=
"duration"
/>
<el-table-column
label=
"金额"
align=
"center"
prop=
"price"
/>
<el-table-column
label=
"套餐开始时段"
align=
"center"
prop=
"packaStartPeriod"
/>
<el-table-column
label=
"套餐结束时段"
align=
"center"
prop=
"packaEndPeriod"
/>
<el-table-column
label=
"备注"
align=
"center"
prop=
"remark"
/>
<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:pack:edit']"
>
修改
</el-button>
<el-button
size=
"mini"
type=
"text"
icon=
"el-icon-delete"
@
click=
"handleDelete(scope.row)"
v-hasPermi=
"['system:pack: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=
"500px"
append-to-body
>
<el-form
ref=
"form"
:model=
"form"
:rules=
"rules"
label-width=
"120px"
>
<el-form-item
label=
"套餐名称"
prop=
"name"
>
<el-input
v-model=
"form.name"
placeholder=
"请输入套餐名称"
/>
</el-form-item>
<el-form-item
label=
"时长"
prop=
"duration"
>
<el-input
v-model=
"form.duration"
placeholder=
"请输入时长"
/>
</el-form-item>
<el-form-item
label=
"金额"
prop=
"price"
>
<el-input
v-model=
"form.price"
placeholder=
"请输入金额"
/>
</el-form-item>
<el-form-item
label=
"套餐开始时段"
prop=
"packaStartPeriod"
>
<el-input
v-model=
"form.packaStartPeriod"
placeholder=
"请输入套餐开始时段"
/>
</el-form-item>
<el-form-item
label=
"套餐结束时段"
prop=
"packaEndPeriod"
>
<el-input
v-model=
"form.packaEndPeriod"
placeholder=
"请输入套餐结束时段"
/>
</el-form-item>
<el-form-item
label=
"备注"
prop=
"remark"
>
<el-input
v-model=
"form.remark"
type=
"textarea"
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
{
listPack
,
getPack
,
delPack
,
addPack
,
updatePack
}
from
"@/api/system/pack"
;
import
{
getRoom
,
getRoomPack
}
from
"@/api/system/room"
;
let
roomPackList
=
[];
export
default
{
name
:
"Pack"
,
data
()
{
return
{
// 遮罩层
loading
:
true
,
// 选中数组
ids
:
[],
// 非单个禁用
single
:
true
,
// 非多个禁用
multiple
:
true
,
// 显示搜索条件
showSearch
:
true
,
// 总条数
total
:
0
,
// 套餐表格数据
packList
:
[],
roomPackList
:
[],
// 弹出层标题
title
:
""
,
// 是否显示弹出层
open
:
false
,
// 查询参数
queryParams
:
{
pageNum
:
1
,
pageSize
:
10
,
name
:
null
,
duration
:
null
,
price
:
null
,
packaStartPeriod
:
null
,
packaEndPeriod
:
null
,
},
// 表单参数
form
:
{},
// 表单校验
rules
:
{
}
};
},
created
()
{
this
.
getList
();
},
methods
:
{
/** 查询套餐列表 */
getList
()
{
this
.
loading
=
true
;
listPack
(
this
.
queryParams
).
then
(
response
=>
{
this
.
packList
=
response
.
rows
;
this
.
total
=
response
.
total
;
this
.
loading
=
false
;
});
},
getRoomPackList
(
id
)
{
getRoomPack
(
id
).
then
(
response
=>
{
roomPackList
=
response
.
data
;
});
},
// 取消按钮
cancel
()
{
this
.
open
=
false
;
this
.
reset
();
},
// 表单重置
reset
()
{
this
.
form
=
{
id
:
null
,
name
:
null
,
duration
:
null
,
price
:
null
,
packaStartPeriod
:
null
,
packaEndPeriod
:
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
getPack
(
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
)
{
updatePack
(
this
.
form
).
then
(
response
=>
{
this
.
$modal
.
msgSuccess
(
"修改成功"
);
this
.
open
=
false
;
this
.
getList
();
});
}
else
{
addPack
(
this
.
form
).
then
(
response
=>
{
this
.
$modal
.
msgSuccess
(
"新增成功"
);
this
.
open
=
false
;
this
.
getList
();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete
(
row
)
{
let
name
;
const
ids
=
row
.
id
||
this
.
ids
;
this
.
getRoomPackList
(
ids
);
var
roomId
=
roomPackList
[
0
].
roomId
;
getRoom
(
roomId
).
then
(
response
=>
{
name
=
response
.
data
.
name
;
this
.
$modal
.
confirm
(
"当前套餐下有"
+
name
+
"房间,请确认删除"
).
then
((
result
)
=>
{
return
delPack
(
ids
);
}).
then
(()
=>
{
this
.
getList
();
this
.
$modal
.
msgSuccess
(
"删除成功"
);
}).
catch
(()
=>
{});
});
},
/** 导出按钮操作 */
handleExport
()
{
this
.
download
(
'system/pack/export'
,
{
...
this
.
queryParams
},
`pack_
${
new
Date
().
getTime
()}
.xlsx`
)
}
}
};
</
script
>
src/views/system/room/index.vue
View file @
4dac456e
...
...
@@ -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
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment