diff --git a/Mobile12306New/Gruntfile.js b/Mobile12306New/Gruntfile.js index 20d812b..81acb60 100644 --- a/Mobile12306New/Gruntfile.js +++ b/Mobile12306New/Gruntfile.js @@ -74,6 +74,7 @@ module.exports=function(grunt){ "js/no_complete.js", "js/remind.js", "js/myremind.js", + "js/order_list.js", "js/init.js", ], dest:'<%= paths.assets %>/js/debug.js'//输出为压缩的合成js diff --git a/Mobile12306New/assets/js/debug.js b/Mobile12306New/assets/js/debug.js index 3a2940f..2e40d94 100644 --- a/Mobile12306New/assets/js/debug.js +++ b/Mobile12306New/assets/js/debug.js @@ -5405,7 +5405,7 @@ var Login = { }); }, loginRoute:function(){ - + var urlData = Public.getQueryData(window.location.search); // 登录成功 跳转 @@ -5535,6 +5535,7 @@ var Query = { var key = $(this).attr('data-key'); if (!!key && !!Public.his.queryObjs[key]) { Query.newQuery(Public.his.queryObjs[key]); + Public.alert('切换成功'); } }); @@ -7850,6 +7851,175 @@ var MyRemind = { $('#myremind_list').html(html); } } +var OrderList = { + token: '', + bankId: '', + payLoading: null, + curNo: '', + init: function() { + if ($('#order_list_page').length == 0) { + return false; + } + + OrderList.loading = Public.showLoading('正在获取订单列表'); + Public.checkLogin(OrderList.hasLogin, OrderList.noLogin, OrderList.noLogin); + }, + hasLogin: function() { + NoComplete.getToken(); + + OrderList.getNoComOrder(); + + + $('[data-no]').live('click', function() { + NoComplete.curNo = $(this).attr('data-no'); + NoComplete.selectBank(); + }); + + $('[data-cancelno]').live('click', function(events) { + var no = $(this).attr('data-cancelno'), + $_box = $(this).closest('li'); + Public.confirm('确定取消此订单?', function() { + NoComplete.cancelOrder(no, function() { + $_box.remove(); + }); + }); + }); + + $('[data-fn="close_bank"]').live('click', function() { + Public.hideInnerPage(); + }); + + $('#banks [data-bank]').live('click', function() { + NoComplete.bankId = $(this).attr('data-bank'); + NoComplete.payLoading = Public.showLoading('正在加载'); + NoComplete.pay(); + }); + + }, + noLogin: function() { + Public.hideLoading(); + Public.alert('请先登录', function() { + location.href = "login.html?order_list"; + }); + }, + loading: null, + hisList: [], + getNoComOrder: function() { + bootStrap.get("queryOrder/queryMyOrderNoComplete", "json", null, "queryOrder/initNoComplete").done(function(json) { + if (!!json['status'] && !!json['data'] && !!json['data']['orderDBList'] && json['data']['orderDBList'].length > 0) { + OrderList.hisList = json['data']['orderDBList']; + } + OrderList.getOrder(); + }).fail(function(xhr, type) { + OrderList.getOrder(); + }); + }, + getOrder: function() { + var data = { + 'queryType': 1, + 'queryStartDate': (new Date()).addDays(-90).format('yyyy-MM-dd'), + 'queryEndDate': (new Date()).format('yyyy-MM-dd'), + 'come_from_flag': 'my_order', + 'pageSize': 100, + 'pageIndex': 0, + 'sequeue_train_name': '' + }; + + bootStrap.get("queryOrder/queryMyOrder", "json", data, "queryOrder/init").done(function(json) { + + Public.hideLoading(); + + if (!!json['status'] && !!json['data']) { + if (!!json['data']['OrderDTODataList'] && json['data']['OrderDTODataList'].length > 0) { + // OrderList.hisList = json['data']['OrderDTODataList']; + for (var i = 0; i < json['data']['OrderDTODataList'].length; i++) { + OrderList.hisList.push(json['data']['OrderDTODataList'][i]) + }; + OrderList.setHtml(); + } else if (OrderList.hisList.length > 0) { + OrderList.setHtml(); + } else { + Public.alert('一个月内暂无订单'); + } + } else { + Public.confirm('获取订单列表失败,是否重新获取?', function() { + OrderList.getNoComOrder(); + }); + } + }).fail(function(xhr, type) { + Public.hideLoading(); + Public.confirm('获取订单列表失败,是否重新获取?', function() { + OrderList.getNoComOrder(); + }); + }); + }, + setHtml: function() { + if (OrderList.hisList.length == 0) { + return; + } + var html = '', + list = OrderList.hisList, + ts = [], + tickets = []; + + for (var i = 0; i < list.length; i++) { + ts = list[i]['start_train_date_page'].split(' '); + // (new Date(list[i]['order_date'].replace(/\-/gi,'/'))).format('yyyy-MM-dd') + html += '