';
+ getHisHmtl : function(){
var his = JSON.parse(localStorage.getItem('stationHis')),
- sp = [];
- if(!!his && his.length > 0){
- html += '
';
+ sp = [],
+ html = '';
+ if(!his || his.length == 0){
+ return '';
}
+ html += '
';
+
+
+ html += '
';
+ html += CheckStaion.getHisHmtl();
+ html += '
';
//
上海\
//
天津\
if (CheckStaion.hotList.length > 0) {
@@ -5110,10 +5154,17 @@ var CheckStaion = {
localStorage.setItem('stationHis',JSON.stringify(stationHis));
+ $('#station_hisbox').html(CheckStaion.getHisHmtl());
+
$('#station_suggest ul').html('');
$('#station_suggest').hide();
$('#station_search').val('');
});
+
+ $('[data-fn="remove_his"]').live('click',function(){
+ $('#station_hisbox').html('');
+ localStorage.removeItem('stationHis');
+ });
},
showSuggest: function(list) {
if (!list || list.length == 0) {
@@ -5371,6 +5422,12 @@ var Login = {
}
location.href = 'run_query.html?t='+urlData['t'];
break;
+ case 'order_list':
+ location.href = 'order_list.html';
+ break;
+ case 'no_commplete':
+ location.href = 'no_complete_order.html';
+ break;
}
}
}
@@ -5911,7 +5968,7 @@ var RunQuery = {
};
cn12306.queryTicket(data, function(json) {
- Public.hideLoading(loading);
+ Public.hideLoading();
if (json["status"] == true && json["httpstatus"] == 200) {
if (json['data'].length > 0) {
RunQuery.trainData = RunQuery.formatJson(json);
@@ -5934,7 +5991,7 @@ var RunQuery = {
}
}, function(xhr, type) {
console.log(xhr, type);
- Public.hideLoading(loading);
+ Public.hideLoading();
});
},
getHtml: function(lists) {
@@ -7078,12 +7135,13 @@ var NoComplete = {
bankId: '',
payLoading: null,
curNo: '',
+ loading:null,
init: function() {
if ($('#no_complete_page').length == 0) {
return false;
}
- Public.checkLogin(NoComplete.getOrder);
- NoComplete.getToken();
+ NoComplete.loading = Public.showLoading('正在获取订单信息');
+ Public.checkLogin(NoComplete.getToken,NoComplete.noLogin,NoComplete.noLogin);
$('[data-no]').live('click', function() {
NoComplete.curNo = $(this).attr('data-no');
@@ -7100,14 +7158,32 @@ var NoComplete = {
NoComplete.pay();
});
},
+ noLogin : function(){
+ Public.hideLoading();
+ Public.alert('请先登录', function() {
+ location.href = "login.html?no_commplete";
+ });
+ },
getOrder: function() {
// Referer: https://dynamic.12306.cn/otsweb/loginAction.do?method=init
bootStrap.get("queryOrder/queryMyOrderNoComplete", "json", null, "queryOrder/initNoComplete").done(function(json) {
- if (!!json['status'] && !!json['data'] && !!json['data']['orderDBList'] && json['data']['orderDBList'].length > 0) {
+ Public.hideLoading();
+ if (!!json['status'] && !!json['data'] && !!json['data']['orderDBList']&&json['data']['orderDBList'].length > 0) {
NoComplete.setHtml(json['data']['orderDBList']);
+ }else{
+ if ($('#no_complete_page').length > 0) {
+ Public.alert('暂无订单,请到我的订单查看已完成订单',function(){
+ location.href = 'order_list.html';
+ });
+ }
}
}).fail(function(xhr, type) {
- console.log(xhr, type);
+ if ($('#no_complete_page').length > 0) {
+ Public.hideLoading();
+ Public.alert('查询失败,请重试。',function(){
+ location.href = location.href;
+ });
+ }
});
},
getToken: function() {
@@ -7117,7 +7193,9 @@ var NoComplete = {
if (globalRepeatSubmitToken) {
NoComplete.token = globalRepeatSubmitToken;
}
+ NoComplete.getOrder();
}).fail(function() {
+ Public.hideLoading();
Public.alert("12306不给力啊,唉。出现网络错误了,请重试..");
});
},
@@ -7128,6 +7206,9 @@ var NoComplete = {
html += '
订单号:' + list[i]['sequence_no'] + '
';
html += '
';
payLimitTime = new Date(list[i]['tickets'][0]['pay_limit_time'].replace(/\-/gi,'/')).getTime();
+ if(!isNaN(payLimitTime)){
+ payLimitTime = new Date(list[i]['order_date'].replace(/\-/gi,'/')).getTime() + 2700000;
+ }
for (var j = 0; j < list[i]['tickets'].length; j++) {
html += '
';
html += '
K2341' + (new Date(list[i]['start_train_date_page'].replace(/\-/gi, '/'))).format('yyyy-M-d') + ' ' + (new Date(list[i]['start_train_date_page'].replace(/\-/gi, '/'))).day(3) + '
';
@@ -7186,7 +7267,7 @@ var NoComplete = {
var $this = $(el),
order = $this.attr('data-orderno'),
time = (new Date(parseInt($this.attr('data-limittime')))).getTime() - (new Date()).getTime();
- if (time > 2700000) {
+ if (time <= 0) {
$this.closest('p').html('订单已过期');
$('[data-no="' + order + '"').html('订单已过期').addClass('btn_gray');
} else {
@@ -7272,7 +7353,11 @@ var NoComplete = {
var htmlbank = result.replace(/[\n\t\r]/gi, '').replace(/>\s+<').match(/
/gi);
if (htmlbank.length > 0) {
$('span', NoComplete.payLoading).html('正在向银行提交支付请求');
+ // console.log(htmlbank[0])
$('#hideHtml').html(htmlbank[0]);
+ // if(NoComplete.bankId == "03080000"){
+ // $('form[name="myform"]').attr('action','https://netpay.cmbchina.com/netpayment/BaseHttp.dll?MB_Pay_FromPC');
+ // }
setTimeout(function() {
$('form[name="myform"]').submit();
}, 1000);
@@ -7285,6 +7370,48 @@ var NoComplete = {
}).fail(function() {
Public.alert("12306不给力啊,唉。出现网络错误了,请重试..");
});
+ },
+ cancelOrder:function(order,success,error){
+ var cancel_loading = Public.showLoading('正在取消订单...'),
+ data = {
+ 'sequence_no':order,
+ 'cancel_flag':'cancel_order',
+ '_json_att':''
+ };
+
+ bootStrap.post('queryOrder/cancelNoCompleteMyOrder', 'json', data, "queryOrder/initNoComplete").done(function(json) {
+ Public.hideLoading(cancel_loading);
+ if(json['status'] && json['data']['existError'] == "N"){
+ Public.alert('取消订单成功!',function(){
+ if(typeof success == "function"){
+ success();
+ }
+ });
+ }else{
+ var text = '';
+ if(json['messages'].length > 0){
+ text = json['messages'][0];
+ }
+
+ if(!text){
+ text = '取消订单失败,请重试!';
+ }
+
+ Public.alert(text,function(){
+ if(typeof error == "function"){
+ error();
+ }
+ });
+ }
+
+ }).fail(function() {
+ Public.hideLoading(cancel_loading);
+ Public.alert('网络连接失败,请重试!',function(){
+ if(typeof error == "function"){
+ error();
+ }
+ });
+ });
}
}
var Remind = {
@@ -7654,6 +7781,7 @@ var MyRemind = {
}
},
error: function() {
+ $('.list_tip').html('获取信息失败');
Public.alert('获取信息失败');
}
});
@@ -8247,7 +8375,7 @@ var bootStrap = (function() {
});
}
headers["Fish-RawUrl"] = url;
- url = "/proxy.php";
+ url = "/12306/proxy.php";
$.ajax({
url: url,
@@ -8258,6 +8386,7 @@ var bootStrap = (function() {
refer: refer,
headers: headers
}).done(function(result, xhr) {
+ console.log(result, xhr)
ad.resolve(result, {
headers: xhr.getAllResponseHeaders(),
statusCode: xhr.statusCode,
@@ -8284,7 +8413,7 @@ var bootStrap = (function() {
headers["Origin"] = /(https?:\/\/[^\/]+\/)/.exec(url)[1];
headers["User-Agent"] = "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)";
headers["Referer"] = refer || "";
- url = "/proxy.php";
+ url = "/12306/proxy.php";
xhr.open(method, url, true);
$.each(headers, function(k, v) {
@@ -8401,4 +8530,5 @@ bootStrap.done(function() {
NoComplete.init();
MyRemind.init();
Remind.init();
+ OrderList.init();
});
\ No newline at end of file