Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
任超
/
js.portalStaticPage
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
c1822b35
authored
2020-12-16 13:37:51 +0800
by
田浩浩
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
修改预约加载
1 parent
fb176d9a
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
66 additions
and
161 deletions
staticJs/yysj.js
staticViews/yysj.html
staticJs/yysj.js
View file @
c1822b3
...
...
@@ -60,49 +60,26 @@ $(function () {
});
});
}
// 业务选择
// $(document).on("click", ".business_item ul .item_appoint ", function (e) {
// console.log(5555)
// jgid = GetRequest();
// appuintText = $(this).find("h3").text();
// periodRulesId = $(this).data('id')
// console.log('aaa', periodRulesId)
// checkAppointment()
// handle();
// });
$
(
document
).
on
(
"click"
,
".cancel"
,
function
()
{
layer
.
closeAll
();
});
$
(
document
).
on
(
"click"
,
".confim"
,
function
()
{
if
(
flag
)
{
var
paramsobj
=
{}
paramsobj
.
jgid
=
GetRequest
()
paramsobj
.
jgid
=
GetQueryString
(
"jgid"
);
paramsobj
.
periodRulesId
=
periodRulesId
paramsobj
.
userid
=
getCookie
().
userid
makeAppointment
(
paramsobj
)
}
});
});
function
GetRequest
()
{
var
url
=
location
.
search
;
//获取url中"?"符后的字串
var
theRequest
=
new
Object
();
if
(
url
.
indexOf
(
"?"
)
!=
-
1
)
{
var
str
=
url
.
substr
(
1
);
strs
=
str
.
split
(
"?"
);
for
(
var
i
=
0
;
i
<
strs
.
length
;
i
++
)
{
theRequest
[
strs
[
i
].
split
(
"="
)[
0
]]
=
decodeURIComponent
(
strs
[
i
].
split
(
"="
)[
1
]
);
}
}
return
theRequest
.
jgid
;
}
//获取当前页面预约日期
function
getAppointmentDay
()
{
$
.
ajax
({
type
:
"get"
,
//提交方式
url
:
portal
.
api_url
+
"/portal/appointmentmh/getAppointmentDay"
,
//路径
data
:
{
jgid
:
Get
Request
(
),
jgid
:
Get
QueryString
(
"jgid"
),
},
dataType
:
"json"
,
success
:
function
(
result
)
{
...
...
@@ -121,14 +98,14 @@ function getAppointmentDay() {
},
});
}
// 根据办事大厅机构ID、日期、用户ID,
查询可预约的业务
GET
// 根据办事大厅机构ID、日期、用户ID,
获取对应日期的业务列表
GET
function
getAppointmentPeriodAndBusiness
()
{
$
.
ajax
({
type
:
"get"
,
//提交方式
url
:
portal
.
api_url
+
"/portal/appointmentmh/getAppointmentPeriodAndBusiness"
,
//
data
:
{
jgid
:
Get
Request
(
),
jgid
:
Get
QueryString
(
"jgid"
),
userid
:
getCookie
().
userid
,
bookingDate
:
bookingDate
,
},
...
...
@@ -139,84 +116,20 @@ function getAppointmentPeriodAndBusiness() {
if
(
result
.
code
==
200
&&
result
.
data
!=
null
)
{
console
.
log
(
result
.
data
)
data
.
busList
=
result
.
data
.
appointmentPeriodBusinessList
;
//bookingDate=result.data.bookingDate;
RenderBusinessList
(
result
.
data
);
// console.log(2222,data.busList)
// if(result.data.choosePeriodRulesId!==null){
// if(2){
// // for循环找到对应的id 打开,其余都设置为禁用
// }
// }else if(result.data.choosePeriodRulesId ==null){
// // step 1: 如果等于0
// for(var i =0;i<result.data.appointmentPeriodBusinessList.length;i++){
// for(var j=0;j<result.data.appointmentPeriodBusinessList[i].orgBusinessList.length; j++){
// if(result.data.appointmentPeriodBusinessList[i].orgBusinessList[j].residueNumber ==0){
// result.data.appointmentPeriodBusinessList[i].orgBusinessList[j].disabled = true
// }
// }
// }
// data.busList = result.data.appointmentPeriodBusinessList
// console.log(11111, data.busList)
// }
if
(
data
.
busList
.
length
>
0
)
{
data
.
busList
.
forEach
((
item
,
index
)
=>
{
hallname
=
item
.
orgBusinessList
[
0
].
jgName
})
}
// layui.use("laytpl", function () {
// laytpl = layui.laytpl;
// var getTpl1 = document.getElementById("business_item").innerHTML,
// view1 = document.getElementById("business_list");
// laytpl(getTpl1).render(data, function (html) {
// view1.innerHTML = html;
// });
// });
}
},
});
}
// 根据办事大厅机构ID、用户ID检查用户是否存在预约限制
function
checkAppointment
()
{
$
.
ajax
({
type
:
"get"
,
//提交方式
async
:
false
,
url
:
portal
.
api_url
+
"/portal/appointmentmh/checkAppointment"
,
data
:
{
jgid
:
GetRequest
(),
userid
:
getCookie
().
userid
,
},
dataType
:
"json"
,
//数据,这里使用的是Json格式进行传输
success
:
function
(
result
)
{
//返回数据根据结果进行相应的处理
if
(
result
.
code
==
200
)
{
return
flag
=
result
.
data
}
else
if
(
result
.
code
==
210
)
{
return
layer
.
msg
(
result
.
message
)
}
},
});
}
// 用户预约抢号 POST
function
makeAppointment
(
data
)
{
$
.
ajax
({
type
:
"post"
,
//提交方式
async
:
false
,
url
:
portal
.
api_url
+
"/portal/appointmentmh/makeAppointment"
,
//路径
headers
:
{
//***关键******
'Content-Type'
:
'application/json;charset=UTF-8'
,
},
dataType
:
"json"
,
data
:
JSON
.
stringify
(
data
),
//***关键******
success
:
function
(
result
)
{
//返回数据根据结果进行相应的处理
if
(
result
.
code
==
200
&&
result
.
data
!==
null
)
{
appointmentId
=
result
.
data
window
.
location
.
href
=
"./yyjg.html?appointmentId="
+
appointmentId
}
}
});
}
var
bookingDate
=
undefined
;
var
flag
=
undefined
;
...
...
@@ -258,7 +171,7 @@ function RenderBusinessList(data) {
businessContent
+=
'<h3>'
+
childItem
.
shortName
+
'</h3>'
;
businessContent
+=
'<input type="button" value="查看详情" id="'
+
childItem
.
periodRulesId
+
'" dataName="'
+
childItem
.
shortName
+
'" onclick="appointmentDetail(this.id)"/>'
;
}
else
{
else
{
businessContent
+=
'<li class="isAppoint">'
;
businessContent
+=
'<h3>'
+
childItem
.
shortName
+
'</h3>'
;
}
...
...
@@ -280,8 +193,42 @@ function RenderBusinessList(data) {
businessDiv
.
html
(
businessContent
);
}
// 根据办事大厅机构ID、用户ID检查用户是否存在预约限制
function
checkAppointment
()
{
let
msg
;
$
.
ajax
({
type
:
"get"
,
//提交方式
async
:
false
,
url
:
portal
.
api_url
+
"/portal/appointmentmh/checkAppointment"
,
data
:
{
jgid
:
GetQueryString
(
"jgid"
),
userid
:
getCookie
().
userid
,
},
dataType
:
"json"
,
//数据,这里使用的是Json格式进行传输
success
:
function
(
result
)
{
//返回数据根据结果进行相应的处理
// if (result.code == 200) {
// return flag = result.data
// }
if
(
result
.
code
==
210
)
{
msg
=
result
.
message
;
}
},
});
return
msg
;
}
var
yyrq
;
function
handle
(
id
)
{
let
msg
=
checkAppointment
();
if
(
msg
!=
undefined
)
{
//layer.msg('hello');
alert
(
msg
);
return
;
};
var
input
=
$
(
"#"
+
id
);
layui
.
use
(
"layer"
,
function
()
{
layer
.
open
({
...
...
@@ -315,6 +262,26 @@ function handle(id) {
});
}
// 用户预约抢号 POST
function
makeAppointment
(
data
)
{
$
.
ajax
({
type
:
"post"
,
//提交方式
async
:
false
,
url
:
portal
.
api_url
+
"/portal/appointmentmh/makeAppointment"
,
//路径
headers
:
{
//***关键******
'Content-Type'
:
'application/json;charset=UTF-8'
,
},
dataType
:
"json"
,
data
:
JSON
.
stringify
(
data
),
//***关键******
success
:
function
(
result
)
{
//返回数据根据结果进行相应的处理
if
(
result
.
code
==
200
&&
result
.
data
!==
null
)
{
appointmentId
=
result
.
data
window
.
location
.
href
=
"./yyjg.html?appointmentId="
+
appointmentId
}
}
});
}
//预约详情
function
appointmentDetail
(
id
)
{
var
input
=
$
(
"#"
+
id
);
...
...
staticViews/yysj.html
View file @
c1822b3
...
...
@@ -112,65 +112,3 @@
<
/ul
>
{{
#
}
}}
{{
#
});
}}
</script>
\ No newline at end of file
<script
id=
"business_item"
type=
"text/html"
>
{{
#
layui
.
each
(
d
.
busList
,
function
(
index
,
item
){
}}
<
div
class
=
"business_item"
>
<
div
class
=
"item_time"
>
<
span
>
上午
<
/span
>
<
span
>
{{
item
.
startTime
}}
<
/span
>
<
span
>-<
/span
>
<
span
>
{{
item
.
endTime
}}
<
/span
>
<
/div
>
<
ul
>
{{
#
layui
.
each
(
item
.
orgBusinessList
,
function
(
index1
,
item1
){
}}
{{
#
if
(
!
item
.
choosePeriodRulesId
&&
item1
.
residueNumber
==
0
){
}}
<
li
class
=
"isAppoint"
data
-
id
=
"{{item1.periodRulesId}}"
>
<
h3
>
{{
item1
.
shortName
}}
<
/h3
>
<
p
style
=
"color:#5FB878"
>
(
剩
{{
item1
.
residueNumber
}}
票
)
<
/p
>
<
/li
>
{{
#
}
}}
{{
#
if
(
!
item
.
choosePeriodRulesId
&&
item1
.
residueNumber
!=
0
){
}}
<
li
class
=
"item_appoint"
data
-
id
=
"{{item1.periodRulesId}}"
>
<
h3
>
{{
item1
.
shortName
}}
<
/h3
>
<
p
style
=
"color:#5FB878"
>
(
剩
{{
item1
.
residueNumber
}}
票
)
<
/p
>
<
/li
>
{{
#
}
}}
<!--
表示预约的是该时间段
且是最后一个号
-->
{{
#
if
(
item
.
choosePeriodRulesId
&&
item1
.
periodRulesId
==
item
.
choosePeriodRulesId
&&
item1
.
residueNumber
==
0
){
}}
<
li
class
=
"isAppoint"
data
-
id
=
"{{item1.periodRulesId}}"
>
<
h3
>
{{
item1
.
shortName
}}
<
/h3
>
<
input
type
=
"button"
value
=
'取消预约'
>
<
input
type
=
"button"
value
=
'查看详情'
>
<
p
style
=
"color:#5FB878"
>
(
剩
{{
item1
.
residueNumber
}}
票
)
<
/p
>
<
/li
>
{{
#
}
}}
<!--
表示预约的是该时间段,且该时间段的号不为
0
-->
{{
#
if
(
item
.
choosePeriodRulesId
&&
item1
.
periodRulesId
==
item
.
choosePeriodRulesId
&&
item1
.
residueNumber
!=
0
){
}}
<
li
class
=
"isAppoint"
data
-
id
=
"{{item1.periodRulesId}}"
>
<
h3
>
{{
item1
.
shortName
}}
<
/h3
>
<
input
type
=
"button"
value
=
'取消预约'
>
<
input
type
=
"button"
value
=
'查看详情'
>
<
p
style
=
"color:#5FB878"
>
(
剩
{{
item1
.
residueNumber
}}
票
)
<
/p
>
<
/li
>
{{
#
}
}}
<!--
表示预约的不是该时间段且剩余号为
0
-->
{{
#
if
(
item
.
choosePeriodRulesId
&&
item1
.
periodRulesId
!=
item
.
choosePeriodRulesId
&&
item1
.
residueNumber
==
0
){
}}
<
li
class
=
"isAppoint"
data
-
id
=
"{{item1.periodRulesId}}"
>
<
h3
>
{{
item1
.
shortName
}}
<
/h3
>
<
p
style
=
"color:#5FB878"
>
(
剩
{{
item1
.
residueNumber
}}
票
)
<
/p
>
<
/li
>
{{
#
}
}}
<!--
表示预约的不是该时间段且剩余数不为
0
-->
{{
#
if
(
item
.
choosePeriodRulesId
&&
item1
.
periodRulesId
!=
item
.
choosePeriodRulesId
&&
item1
.
residueNumbe
!=
0
){
}}
<
li
class
=
"isAppoint"
data
-
id
=
"{{item1.periodRulesId}}"
>
<
h3
>
{{
item1
.
shortName
}}
<
/h3
>
<
p
style
=
"color:#5FB878"
>
(
剩
{{
item1
.
residueNumber
}}
票
)
<
/p
>
<
/li
>
{{
#
}
}}
{{
#
})
}}
<
/ul
>
<
/div
>
{{
#
});
}}
</script>
...
...
Please
register
or
sign in
to post a comment