|
- //进行中 等待支付
- var waitHTML = '';
- //进行中 已出票
- var outHTML = '';
- //已完成
- var didHTML = '';
-
- var inghave = '';
-
- var didhasno = '';
-
- window.onload = function(){
-
-
-
- waitHTML = $('#wait_pay').prop('outerHTML');
- outHTML = $('#out_ticket').prop('outerHTML');
- didHTML = $('#did').html();
-
- $.ajax({
- url:'./zz_wxsct/Model/order/order_list.php', //请求地址
- type: "post", //请求方式
- async:false,
- dataType: "json",
- success: function (data) {
- console.log(data);
- if(data.code == 0){
- didhasno = data.goning.length;
- inghave = data.completed.length;
- reloadData(data);
- selectStatus(0);
- }else{
- alert(data.info);
- }
-
- }
- });
-
-
- }
-
- //订单状态的切换和筛选
- function selectStatus(selectStatus){
- if (selectStatus == 0) {
- $('#hasnoinfo').addClass('ui_hide');
- $('#going').addClass('title_line');
- $('#going').removeClass('commongray_color');
- $('#completed').addClass('commongray_color');
- $('#completed').removeClass('title_line');
-
- $('#ing').removeClass('ui_hide');
- $('#did').addClass('ui_hide');
-
- if (didhasno == 0) {
-
- $('#hasnoinfo').removeClass('ui_hide');
- }else{
- $('#hasnoinfo').addClass('ui_hide');
- }
-
- } else{
- $('#hasnoinfo').addClass('ui_hide');
- $('#completed').addClass('title_line');
- $('#completed').removeClass('commongray_color');
- $('#going').addClass('commongray_color');
- $('#going').removeClass('title_line');
-
- $('#did').removeClass('ui_hide');
- $('#ing').addClass('ui_hide');
-
- if (inghave == 0) {
- $('#hasnoinfo').removeClass('ui_hide');
- }else{
- $('#hasnoinfo').addClass('ui_hide');
- }
- }
- }
-
- //加载数据
- function reloadData(data){
- var inglist = data.goning;
- var newHTML = '';
- for(var i=0;i<inglist.length;i++){
- var tempHTML = '';
- if (inglist[i].ORDER_STATUS == "145") {
- tempHTML = waitHTML;
- } else{
- tempHTML = outHTML;
- }
- tempHTML=tempHTML.replace('none','block');
- tempHTML=tempHTML.replace('[185518]',inglist[i].ORDER_ID);
- tempHTML=tempHTML.replace('[50]',inglist[i].ORDER_PRICE);
- if (inglist[i].ORDER_STATUS == "145") {
- tempHTML=tempHTML.replace('[待支付]',inglist[i].ORDER_STATUS_info);
- } else{
- tempHTML=tempHTML.replace('[已出票]',inglist[i].ORDER_STATUS_info);
- if (inglist[i].CAN_DO == "0") {
- // $('#refund_ticket').hide();
-
- var cstr='<div class="text_middle ui_radiu_all ui_m_r30 ui_m_t05 ui_m_b05" id="refund_ticket" style="display: inline-block;padding:0.04rem 0.2rem; border: 1px solid white; color:white;font-size:0.15rem;margin-top: 0.08rem;margin-bottom: 0.08rem;">隐藏</div>';
-
- tempHTML=tempHTML.replace('<div class="tuipiao"></div>',cstr);
- }else{
- var cstr='<div class="text_middle ui_radiu_all ui_m_r30 ui_m_t05 ui_m_b05" id="refund_ticket" style="display: inline-block;padding:0.04rem 0.2rem; border: 1px solid #3d434f;font-size:0.15rem;margin-top: 0.08rem;margin-bottom: 0.08rem;" onclick="refundTicket('+inglist[i].ORDER_ID+')">退票</div>';
-
- tempHTML=tempHTML.replace('<div class="tuipiao"></div>',cstr);
- }
- }
- tempHTML=tempHTML.replace(/\[order_id]/g,inglist[i].ORDER_ID);
- // tempHTML=tempHTML.replace('待支付',inglist[i].ORDER_STATUS_info);
-
- tempHTML=tempHTML.replace('[乌镇]',inglist[i].PROD_START_STATION_AREA_NAME);
- tempHTML=tempHTML.replace('[上海]',inglist[i].PROD_END_STATION_AREA_NAME);
- tempHTML=tempHTML.replace('[上海迪士尼]',inglist[i].PROD_END_STATION_RES_NAME);
- tempHTML=tempHTML.replace('[西栅1号停车场]',inglist[i].PROD_START_STATION_RES_NAME);
- tempHTML=tempHTML.replace('[5人]',inglist[i].STAT_NUM+'人');
- tempHTML=tempHTML.replace('[普通座]',inglist[i].STAT_TYPE);
- tempHTML=tempHTML.replace('[8月24日 今天]',inglist[i].DATE);
- tempHTML=tempHTML.replace('[07:45]',inglist[i].TIME);
- newHTML+=tempHTML;
- }
- $('#ing').html(newHTML);
- //
- var didlist = data.completed;
- var newHTML1 = '';
- for(var i=0;i<didlist.length;i++){
- var tempHTML1 = didHTML;
- tempHTML1=tempHTML1.replace('none','block');
- tempHTML1=tempHTML1.replace('[185518]',didlist[i].ORDER_ID);
- tempHTML1=tempHTML1.replace('[50]',didlist[i].ORDER_PRICE);
- tempHTML1=tempHTML1.replace('[订单已关闭]',didlist[i].ORDER_STATUS_info);
- tempHTML1=tempHTML1.replace('[乌镇]',didlist[i].PROD_START_STATION_AREA_NAME);
- tempHTML1=tempHTML1.replace('[上海]',didlist[i].PROD_END_STATION_AREA_NAME);
- tempHTML1=tempHTML1.replace('[上海迪士尼]',didlist[i].PROD_END_STATION_RES_NAME);
- tempHTML1=tempHTML1.replace('[西栅1号停车场]',didlist[i].PROD_START_STATION_RES_NAME);
- tempHTML1=tempHTML1.replace('[5人]',didlist[i].STAT_NUM+'人');
- tempHTML1=tempHTML1.replace('[普通座]',didlist[i].STAT_TYPE);
- tempHTML1=tempHTML1.replace('[8月24日 今天]',didlist[i].DATE);
- tempHTML1=tempHTML1.replace('[07:45]',didlist[i].TIME);
- tempHTML1=tempHTML1.replace(/\[order_id]/g,didlist[i].ORDER_ID);
- newHTML1+=tempHTML1;
- }
- $('#did').html(newHTML1);
- }
-
-
- //跳转订单详情页面
- 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 = './travel_book.html';
- }
|