4 Star 0 Fork 2

wondersPro/pudongMyOrder

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
wdyy.ejs 10.29 KB
一键复制 编辑 原始数据 按行查看 历史
<!DOCTYPE html>
<html>
<head>
<head/>
<title>我的预约</title>
<titleType style="display: none">wdyyList</titleType>
<%- include('./_global/appendJs') %>
<style type="text/css">
#orderUl li{
background: #fff;
}
#orderUl li:first-child{
margin-top: 0 !important;
}
#orderUl .cancelButton{
border: 1px solid #ccc;
padding: .5rem;
border-radius: .2rem;
}
</style>
</head>
<body>
<section class="page-wrap page-user">
<!-- header start -->
<header class="header-box grey fixed">
<div class="header-content">
<div class="left-tool">
<a class="back" href="javascript:void(0);"><i class="iconfont icon-back"></i></a>
</div>
<div class="title">我的预约</div>
</div>
<div class="right-tool">
<a class="tool-a" onclick="toSelfCenter()">返回首页</a>
</div>
</header>
<!-- header end -->
<!--内容-->
<div class="plane-box first" id="orderDiv" style="background: #f5f7fc">
<ul class="default-list" id="orderUl">
</ul>
</div>
<!--内容END-->
</section>
</body>
<script type="text/html" id="orderLiTop">
<li style="margin-top:.5rem ">
<div class="item-inner">
<div class="item-content">
<span class="user-title">就诊人:</span>
<span class="user-name orderInfo" name="patientName">张三</span>
</div>
<div class="item-after">
<span class="check orderInfo" name="orderStatus">预约成功</span>
</div>
</div>
</li>
</script>
<script type="text/html" id="orderLiDown">
<li>
<div class="item-inner big-box">
<div class="item-content">
<p class="doc"><span class="orderInfo" name="docName"></span><span class="second orderInfo" name="docTitle"></span></p>
<p class="doc"><span>就诊医院</span><span class="second orderInfo" name="hosName">上海第九医院(风湿免疫科)</span></p>
<!-- <p class="doc"><span>门诊费用</span><span class="second orderInfo" name="visitCost">普通门诊14:00元(支付宝)</span></p> -->
<!-- <p class="doc"><span>门诊类型</span><span class="second orderInfo" name="regType1">普通门诊</span></p> -->
<p class="doc"><span>就诊时间</span><span class="second orderInfo" name="jzsj">2017-02-28</span></p>
</div>
<div class="item-after"><i class="iconfont icon-more"></i></div>
</div>
</li>
</script>
<script type="text/html" id="orderNum">
<li>
<div class="item-inner">
<div class="item-content">
<span class="user-title">订单编号:</span>
<span class="user-name orderInfo" name="orderId">13456732</span>
</div>
<div class="item-after ">
<span class="check orderInfo cancelButton" name="orderStatus">取消预约</span>
</div>
</div>
</li>
</script>
<script src="/static/js/gzd/pageUrl.js"></script>
<script src="/quickJs/scripts/swiper/3.4.2/js/swiper.min.js"></script>
<script type="text/javascript">
/*订单状态*/
var tb_zy_order_status = {
"1": "已预约"
,"2": "已退号"
,"3": "已就诊"
,"4": "其他"
,"5": "其他"
,"6": "其他"
};
var requestRoot = "/api/gzd/yygh/";
/**查看详情*/
function toYydetail(data){
var info = data;
StoreCache.setCache("YYGH_MEDICARD", {mediCardId: info["mediCardId"], password: info["password"]});
StoreCache.setCache("YYGH_ORDERINFO",{orderId: info["orderId"]});
$.pageSwitch.goToUrl("myOrder","yyDetail","orderId="+info.orderId+"&hosCode="+info.hosCode);
}
function cancelOrder(data){
$.QuickAlert.alertConfirm({content: "<div style='margin:-38px 0px -25px 0px;'><div style='float:left;margin-top:30px;'>退号原因:</div><textarea id=\"cancelReason\" rows='3' cols='20'></textarea></div>",title: "确认是否退号",callback: function(cancelReason){
// var data = StoreCache.getCache("yyInfo");
},
yes : function(index) {
if(StringUtils.isEmpty($("#cancelReason").val())){
$.QuickAlert.alertNormal("请填写退号原因!",{callback:function(indexAlert){
layer.close(indexAlert);
}});
}else{
var cancelReason = $("#cancelReason").val();
var params = {
orderId:data.orderId,
hosOrgCode:data.hosCode,
cancelReason:cancelReason
};
$.QuickRemote.AjaxJson({
funcName:requestRoot + "cancelReservation"
,callback: function(result){
var message =data.orderStatus=="1"? "取消预约成功!":"退号成功!";
$.QuickAlert.alertNormal(message,{callback: function(){
/**刷新当前页面*/
location.reload();
}});
},params:params
});
}
}
});
}
var page_wdyy = (function($, page_wdyy) {
/**加载视图*/
function initView(){
}
/**加载数据*/
function initData(){
page_wdyy.initOrderList();
}
/**查询预约单列表*/
function initOrderList() {
$("#orderUl").remove();
var orderUl = $("<ul>").attr({"id":"orderUl","class":"default-list"});
$("#orderDiv").append(orderUl);
var nowdate = new Date();
nowdate.setMonth(nowdate.getMonth()-1);
var lastMonth = nowdate.Format("yyyy-MM-dd");
nowdate.setMonth(nowdate.getMonth()+2);
var nextMonth = nowdate.Format("yyyy-MM-dd");
var params = {
startTime:lastMonth,
endTime:nextMonth,
queryDateType:"1"
}
$.QuickRemote.AjaxJson({
funcName: $.getServiceUrl.getUrl("getOrderRecords")
,callback: page_wdyy.getOrderRecordsHandler
,params:params
});
}
/**解析结果创建预约单列表*/
function getOrderRecordsHandler(result) {
var orders = result["orders"];
if(orders){
orders.sort(page_wdyy.compare('orderId'));
page_wdyy.createItems(orders);
}else{
$.QuickAlert.alertFail({content:"没有预约信息!"});
$("#orderDiv").css("display", "none");
}
}
function compare(property){
return function(a,b){
var value1 = a[property].stringToDate();
var value2 = b[property].stringToDate();
return value2 - value1;
}
}
function createItems(ary){
var lis = [];
$.each(ary, function(index, item){
var orderLiTop = $($("#orderLiTop").html());
var orderLiDown = $($("#orderLiDown").html());
var orderNum = $($("#orderNum").html());
item["jzsj"] = item["scheduleDate"]+" "+item["startTime"]+"-"+item["endTime"];
$(orderLiTop).find(".orderInfo").each(function(){
if($(this).attr("name")=="orderStatus"){
var status = item['orderStatus'];
$(this).text(status==''?'':tb_zy_order_status[status]);
}else{
$(this).text(item[$(this).attr("name")]);
}
});
$(orderLiDown).find(".orderInfo").each(function(){
if($(this).attr("name")=="hosName"){
$(this).text(item.hosName+"("+item.depName+")");
}else if($(this).attr("name")=="visitCost"){
if(!StringUtils.isEmpty(item.visitCost)){
$(this).text(parseInt(item.visitCost).toFixed(2));
}else{
$(this).text("");
}
}else{
$(this).text(item[$(this).attr("name")]);
}
});
$(orderLiDown).find(".item-after").attr("onclick","toYydetail("+JSON.stringify(item)+")");
$(orderNum).find(".orderInfo").each(function(){
if($(this).attr("name")=="orderStatus" ){
if(item[$(this).attr("name")]=="1"){
$(this).text("取消预约");
$(this).attr("onclick","cancelOrder("+JSON.stringify(item)+")");
$(this).show();
}else if(item[$(this).attr("name")]=="2"){
$(this).hide();
/* $(this).text("退号");
$(this).attr("onclick","cancelOrder("+JSON.stringify(item)+")");*/
// $(this).show();
}else{
$(this).hide();
}
}else{
$(this).text(item[$(this).attr("name")]);
}
});
lis.push(orderLiTop);
lis.push(orderLiDown);
lis.push(orderNum);
});
$("#orderUl").append(lis);
}
var cfg_def = {
initData: initData,
initView: initView,
initOrderList: initOrderList,
getOrderRecordsHandler: getOrderRecordsHandler,
compare: compare,
createItems: createItems,
}
page_wdyy.init = function(cfg){
$.extend(page_wdyy, cfg_def, cfg);
page_wdyy.initData();
page_wdyy.initView();
}
return page_wdyy;
})(jQuery, {});
</script>
</html>
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/jxwonders/pudongMyOrder.git
git@gitee.com:jxwonders/pudongMyOrder.git
jxwonders
pudongMyOrder
pudongMyOrder
master

搜索帮助