|
- //Author:zhangsq
- //Date:20160906
- //Description:订单列表
-
-
- var orderHTML = '';
- //已完成
- var didHTML = '';
- var inghave = '';
- //记录得到的数组
- var inglist = '';
- var didlist = '';
-
- window.onload = function(){
- $("#loadingToast").show();
- orderHTML = $('#wait_pay').html();
-
- var url=base_api+"./application/custom_made/control.php";
- var data = {
- type:'order_orderlist'
- }
- var parm=data;
- ZZLog(parm)
- $.post(url,parm,function(data){
- data=JSON.parse(data);
- ZZLog(data);
- if (data.code == 0) {
- $("#loadingToast").hide();
- $('#wait_pay').removeClass('ui_hide');
- didhasno = data.goning.length;
- inghave = data.completed.length;
- inglist = data.goning;
- didlist = data.completed;
- selectStatus(0);
- }else{
- $("#loadingToast").hide();
- $('#wait_pay').removeClass('ui_hide');
- alert(data.info);
- }
- });
- }
-
- //加载数据
- function reloadData(list,sel){
- // var list = '';
- // if (sel == 0) {
- // list = data.goning;
- // } else{
- // list = data.completed;
- // }
- var newHTML = '';
- for(var i=0;i<list.length;i++){
- var tempHTML = orderHTML;
- tempHTML=tempHTML.replace('[185518]',list[i].ORDER_ID);
- tempHTML=tempHTML.replace('[35]',list[i].ORDER_PRICE);
-
- if (list[i].ORDER_STATUS == "145") {
- tempHTML=tempHTML.replace('<div class="ub-f1 payred_color text_right ui_p_r15 ulev1" style="padding-top: 0.1rem;">[待支付]</div>','<div class="ub-f1 payred_color text_right ui_p_r15 ulev1" style="padding-top: 0.1rem;">'+list[i].ORDER_STATUS_info+'</div>');
- var cstr = '<div class="main_color text_middle white_color ulev2" id="pay" style="padding-top: 0.11rem;padding-bottom: 0.11rem;" onclick="goToPay('+list[i].ORDER_ID+')">去支付</div>';
-
- tempHTML=tempHTML.replace('<div class="replace ui_hide" id="repalace"></div>',cstr);
-
- }else if (list[i].ORDER_STATUS == "146") {
- tempHTML=tempHTML.replace('<div class="ub-f1 payred_color text_right ui_p_r15 ulev1" style="padding-top: 0.1rem;">[待支付]</div>','<div class="ub-f1 main_font_color text_right ui_p_r15 ulev1" style="padding-top: 0.1rem;">'+list[i].ORDER_STATUS_info+'</div>');
- if (list[i].CAN_DO == "0") {
- $('#repalace').addClass('ui_hide');
- }else{
- var cstr='<div class="ub" id="refund"><div class="ub-f1"></div><div style="border: 1px solid #3d434f;color: #3d434f;border-radius: 0.03rem;padding: 0.06rem 0.27rem;margin-top: 0.07rem;margin-bottom: 0.06rem;" class="ulev1 ui_m_r15" onclick="refundTicket('+list[i].ORDER_ID+')">退票</div></div>';
-
- tempHTML=tempHTML.replace('<div class="replace ui_hide" id="repalace"></div>',cstr);
- }
- }else{
- tempHTML=tempHTML.replace('<div class="ub-f1 payred_color text_right ui_p_r15 ulev1" style="padding-top: 0.1rem;">[待支付]</div>','<div class="ub-f1 fontmiddle_color text_right ui_p_r15 ulev1" style="padding-top: 0.1rem;">'+list[i].ORDER_STATUS_info+'</div>');
- $('#repalace').addClass('ui_hide');
- }
-
-
- tempHTML=tempHTML.replace(/\[order_id]/g,list[i].ORDER_ID);
- tempHTML=tempHTML.replace('[南京]',list[i].PROD_START_STATION_AREA_NAME);
- tempHTML=tempHTML.replace('[南通]',list[i].PROD_END_STATION_AREA_NAME);
- tempHTML=tempHTML.replace('[出发站点]',list[i].PROD_START_STATION_RES_NAME);
- tempHTML=tempHTML.replace('[目的站点]',list[i].PROD_END_STATION_RES_NAME);
- tempHTML=tempHTML.replace('[n]',list[i].STAT_NUM);
- tempHTML=tempHTML.replace('[8月24日 今天]',list[i].DATE);
- tempHTML=tempHTML.replace('[07:45]',list[i].TIME);
- newHTML+=tempHTML;
- }
- $('#wait_pay').html(newHTML);
-
- }
-
-
-
-
- //订单状态的切换和筛选
- function selectStatus(selectStatus){
- if (selectStatus == 0) {
- $('#going').addClass('title_line_selected');
- $('#going').removeClass('title_line');
- $('#completed').addClass('title_line');
- $('#completed').removeClass('title_line_selected');
-
- if (didhasno == 0) {
- $('#hasnoinfo').removeClass('ui_hide');
- }else{
- $('#hasnoinfo').addClass('ui_hide');
- }
- selectStatus = 0;
- var datalist = inglist;
- reloadData(datalist,selectStatus);
- } else{
- $('#completed').addClass('title_line_selected');
- $('#completed').removeClass('title_line');
- $('#going').addClass('title_line');
- $('#going').removeClass('title_line_selected');
-
- if (inghave == 0) {
- $('#hasnoinfo').removeClass('ui_hide');
- }else{
- $('#hasnoinfo').addClass('ui_hide');
- }
- selectStatus = 1;
- var datalist = didlist;
- reloadData(datalist,selectStatus);
- }
-
- }
-
- //跳转订单详情页面
- function goToDetail(order_id,order_status){
- window.location.href = './order_detail.html?order_id='+order_id;
- }
-
- //跳转支付页面
- function goToPay(order_id){
- window.location.href = './order_detail.html?order_id='+order_id;
- }
-
- //跳转退票
- function refundTicket(order_id){
- window.location.href = './order_detail.html?order_id='+order_id;
- }
-
-
- //预订
- function seeTheOrder(){
- window.location.href = './index.html';
- }
|