From 5665869bad15a4fefb42b7a0038d169f5302dbe7 Mon Sep 17 00:00:00 2001 From: luolei Date: Tue, 2 Sep 2014 22:56:28 +0800 Subject: [PATCH] =?UTF-8?q?25531=20=E8=BD=A6=E7=A5=A8=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E9=A1=B5=EF=BC=8C=E7=82=B9=E5=87=BB=E6=9C=80=E8=BF=91=E6=9F=A5?= =?UTF-8?q?=E6=89=BE=EF=BC=8C=E9=9C=80=E5=BC=B9toast=E2=80=9C=E5=88=87?= =?UTF-8?q?=E6=8D=A2=E6=88=90=E5=8A=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Mobile12306New/Gruntfile.js | 1 + Mobile12306New/assets/js/debug.js | 172 +++++++++++++++++++++++++++++- Mobile12306New/js/login.js | 2 +- Mobile12306New/js/query.js | 1 + 4 files changed, 174 insertions(+), 2 deletions(-) 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 += '
  • '; + html += '
    '; + html += '
    ' + list[i]['order_date'].split(' ')[0] + '订单号:' + list[i]['sequence_no'] + '
    '; + html += '
    ' + list[i]['train_code_page'] + '' + ts[0] + ' ' + (new Date(list[i]['order_date'].replace(/\-/gi, '/'))).day(3) + ' ' + ts[1] + '开
    '; + html += '
    ' + list[i]['from_station_name_page'][0] + ' → ' + list[i]['to_station_name_page'][0] + '
    '; + + tickets = list[i]['tickets']; + for (var j = 0; j < tickets.length; j++) { + + html += '
    '; + if (tickets[j]['ticket_status_code'] == 'a') { + + } else if (tickets[j]['ticket_status_code'] != 'c') { + html += '' + tickets[j]['ticket_status_name'] + ''; + } else { + html += '已退票'; + } + html += tickets[j]['passengerDTO']['passenger_name'] + ' ' + tickets[j]['ticket_type_name'] + ' ' + tickets[j]['seat_type_name'] + ' ' + tickets[j]['coach_name'] + '车' + tickets[j]['seat_name']; + html += '
    '; + }; + + html += '
    '; + html += '
    '; + if (list[i]['cancel_flag'] == 'Y') { + html += '取消订单'; + } + if (list[i]['pay_flag'] == 'Y') { + html += '立即支付'; + } + + if (list[i]['pay_flag'] != 'Y' && list[i]['cancel_flag'] != 'Y') { + html += ''; + } + // ticket_status_code: "c" + // switch(list[i]['ticket_status_code']){ + // case 'a': + // break; + // case 'b': + // html += '取消订单立即支付'; + // break; + // case 'c': + // html += ''ticket_status_name; + // break; + // case 'd': + // break; + // } + + html += '' + list[i]['ticket_total_price_page'] + '元
    '; + + html += '
  • '; + }; + + $('.order_list').html(html); + } +} var base64 = base64 || (function() { var base64Map = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split(''); var base64DeMap = ! function() { diff --git a/Mobile12306New/js/login.js b/Mobile12306New/js/login.js index ec74072..1f0b43a 100644 --- a/Mobile12306New/js/login.js +++ b/Mobile12306New/js/login.js @@ -150,7 +150,7 @@ var Login = { }); }, loginRoute:function(){ - + var urlData = Public.getQueryData(window.location.search); // 登录成功 跳转 diff --git a/Mobile12306New/js/query.js b/Mobile12306New/js/query.js index eac3a0b..9a9620e 100644 --- a/Mobile12306New/js/query.js +++ b/Mobile12306New/js/query.js @@ -101,6 +101,7 @@ var Query = { var key = $(this).attr('data-key'); if (!!key && !!Public.his.queryObjs[key]) { Query.newQuery(Public.his.queryObjs[key]); + Public.alert('切换成功'); } });