//Author:zhangsq //Date:20160826 //Description:查询结果 var goinfoHTML = ''; var backinfoHTML = ''; //记录去程时间 var go_date = ''; //去程的出发地站点数组 var go_stares_ary = ''; //去程的目的地站点数组 var go_endres_ary = ''; //返程的出发地站点数组 var back_stares_ary = ''; //返程的目的地站点数组 var back_endres_ary = ''; //记录map info var map_info = ''; //站点下弹框 var resHTML = ''; //乘客人弹层的html var passHTML = ''; //ticket_id var ticket_id_back = ''; var ticket_id_go = ''; var ticket_id_back_back =''; var run_id_go = ''; var run_id_back = ''; //乘客数量 var passCount = 0; //记录乘客人的数组 var passAry = ''; //记录是否选择返程 0为单一去程 var ifselback = 0; //选择不同的站点弹层 var sel_res_div = ''; //存乘客信息缓存数组 var cacheinfo = new Array(); // 选中的上下车站点 var t_res_name=''; var t_res_id=''; var t_sel_id=''; $(document).ready(function(){ }) window.onload = function(){ $("#loadingToast").show(); //去程的html goinfoHTML = $('#goinfo').html(); //返程的html backinfoHTML = $('#backinfo').html(); //站点html 下弹框 resHTML = $('#wei_info').html(); //乘客人的弹层 passHTML = $('#wei_info_passenger').html(); //加载乘客人信息 reloadPassangersInfo(); var cache_info_people = getStorJson('CacheInfo_people'); if (cache_info_people) { //加载历史填写信息 reloadHistoryInfo(cache_info_people); } // if (CacheInfo_station) { // //加载之前的选中信息 // reloadHistoryStation(CacheInfo_station); // } //判断返程 var go_ticketid = getPar('go_ticket_id'); if (go_ticketid == '') { $('#discount').removeClass('ui_hide'); $('#hideback').addClass('ui_hide'); $('#backinfo').addClass('ui_hide'); ifselback = 0 //加载去程的信息 reloadGoInfo(); } else{ $("#loadingToast").show(); $('#add_back').addClass('ui_hide'); $('#discount').addClass('ui_hide'); ifselback = 1; //加载去程和返程信息 reloadBackInfo(go_ticketid); } } //加载历史信息 function reloadHistoryInfo(data){ $('#custmer').val(data.name); $('#tel').val(data.tel); $('#count_price').html(data.count_price); $('#people_count').html(data.people_count); var newhtml = ''; for (var i = 0; i < data.peopele_array.length; i ++ ) { var str = '
' +'
'+data.peopele_array[i].name+'
' +'
'+data.peopele_array[i].card+'
' +'
' +'' +'
' +'
' newhtml += str; } $('#fill_info').html(newhtml); cacheinfo = data.peopele_array; } //加载站点的历史信息 function reloadHistoryStation(data){ $('#gotime').html(data.gotime); $('#go_price').html(data.goPrice); $('#start_res_go').text(data.go_start_res_name); $('#start_res_go').attr('startres_goid',data.go_start_res_id); $('#end_res_go').text(data.go_end_res_name); $('#end_res_go').attr('#endres_goid',data.go_end_res_id); $('#backtime').html(data.backtime); $('#back_price').html(data.backPrice); $('#start_res_back').text(data.back_start_res_name); $('#start_res_back').attr('startres_backid',data.back_start_res_id); $('#end_res_back').text(data.back_end_res_name); $('#end_res_back').attr('endres_backid',data.back_end_res_id); $('#distance_back').html(data.distance_back); $('#usetime_back').html(data.usetime_back); map_info = data.map_info; $('#seat').html(data.seat); $('#single').html(data.single); $('#discount').html(data.discount); ticket_id_go = data.ticket_id_go; ticket_id_back = data.ticket_id_back; ticket_id_back_back = data.ticket_id_back_back; } //加载乘客人信息 function reloadPassangersInfo(){ var url=base_api+"./zz_wxsct/control.php"; var parm={ type:"order_getcustomer" } $.post(url,parm,function(res_data){ res_data=JSON.parse(res_data); ZZLog(res_data); if (res_data.code == 0) { passCount = res_data.list.length; passAry = res_data.list; } }); } //页面开始 加载去程信息 function reloadGoInfo(){ var run_id = getPar('run_id'); var start_area_id = getPar('start_area_id'); var end_area_id = getPar('end_area_id'); var start_res_id = getPar('start_res_id'); var end_res_id = getPar('end_res_id'); //fuhc var go_data=getStorJson('go_data'); if(go_data){ // 替换去程信息 ZZLog('storJson'); replaceGoInfo(go_data); //得到之前选中的值 var sel_station=getStorJson('CacheInfo_station'); if(sel_station){ //加载之前的选中信息 reloadHistoryStation(sel_station); } }else{ ZZLog('storJson'); var url=base_api+"./zz_wxsct/control.php"; var parm={ type:"bus_detail_info_go", run_id:run_id, start_area_id:start_area_id, end_area_id:end_area_id, start_res_id:start_res_id, end_res_id:end_res_id } ZZLog(url+JSON.stringify(parm)); $.post(url,parm,function(res_data){ res_data=JSON.parse(res_data); ZZLog(res_data); if (res_data.code == 0) { // 替换去程信息 replaceGoInfo(res_data); countTotal(); setStorJson('go_data',res_data); } else{ alert(res_data.info); } }); } //fuhc end // var url=base_api+"./zz_wxsct/control.php"; // var parm={ // type:"bus_detail_info_go", // run_id:run_id, // start_area_id:start_area_id, // end_area_id:end_area_id, // start_res_id:start_res_id, // end_res_id:end_res_id // } // ZZLog(url+JSON.stringify(parm)); // $.post(url,parm,function(res_data){ // res_data=JSON.parse(res_data); // ZZLog(res_data); // if (res_data.code == 0) { //// 替换去程信息 // replaceGoInfo(res_data); // countTotal(); // setStorJson('go_data',res_data); // } else{ // alert(res_data.info); // } // }); } //替换去程信息 function replaceGoInfo(data){ var list = data.list; var temphtml = goinfoHTML; var nowdate = getDateTime(0); var selmonth = getMonthAndDayByDate(list.run_date,'month'); var selday = getMonthAndDayByDate(list.run_date,'day'); go_date = list.run_date; if (nowdate == list.run_date) { temphtml = temphtml.replace('[日期]',selmonth+'月'+selday+'日'+'  今天'); }else{ temphtml = temphtml.replace('[日期]',selmonth+'月'+selday+'日'); } temphtml = temphtml.replace('[去程时间]',list.start_time); temphtml = temphtml.replace('[出发地]',list.start_area_name); temphtml = temphtml.replace('[出发地站点]',list.start_res_name); temphtml = temphtml.replace('[目的地]',list.end_area_name); temphtml = temphtml.replace('[目的地站点]',list.end_res_name); // temphtml = temphtml.replace('[日程]','全程'+list.distance+'公里'); // temphtml = temphtml.replace('[用时]',list.center_time); temphtml = temphtml.replace('[go_line_id]',list.line_id); temphtml = temphtml.replace('[go_ticket_id]',list.ticket.ticket_id_go); temphtml = temphtml.replace('[startarea_goid]',list.start_area_id); temphtml = temphtml.replace('[startres_goid]',list.start_res_id); temphtml = temphtml.replace('[endarea_goid]',list.end_area_id); temphtml = temphtml.replace('[endres_goid]',list.end_res_id); temphtml = temphtml.replace('[run_id_go]',list.run_id); temphtml = temphtml.replace('[价格]',list.ticket.go_price); $('#goinfo').html(temphtml); if (data.list.bus_type == '256'){ $('#start_res_go').addClass('ui_hide'); $('#end_res_go').addClass('ui_hide'); }else{ $('#start_res').removeClass('ui_hide'); $('#end_res').removeClass('ui_hide'); } $('#distance_back').html('全程'+list.distance+'公里'); $('#usetime_back').html(list.center_time); ticket_id_back = list.ticket.ticket_id_back; ticket_id_go = list.ticket.ticket_id_go; run_id_go = list.run_id; var temphtml1 = $('#seatInfo').html(); temphtml1 = temphtml1.replace('[普通座]',list.ticket.site); temphtml1 = temphtml1.replace('[单程]',list.ticket.run_type); if (list.ticket.discount_price == '0') { temphtml1 = temphtml1.replace('[优惠]','无往返优惠'); }else{ temphtml1 = temphtml1.replace('[优惠]','往返优惠'+list.ticket.discount_price+'元'); temphtml1 = temphtml1.replace('[aaa]',list.ticket.discount_price); } $('#seatInfo').html(temphtml1); //去程的出发地、目的地数组 go_stares_ary = list.start_res_array; go_endres_ary = list.end_res_array; //记录地图信息 map_info = list['map']; //选择站点的下侧弹层 $("#start_area").click(function(){ $("#mask").css("display","block"); $('#res_div').css("display","block"); sel_res_div = 'startres_goid'; upDiv(go_stares_ary,'start_res_go','go'); $("#weui_actionsheet").addClass("weui_actionsheet_toggle"); }) $("#end_area").click(function(){ $("#mask").css("display","block"); $('#res_div').css("display","block"); sel_res_div = 'endres_goid'; upDiv(go_endres_ary,'end_res_go','go'); $("#weui_actionsheet").addClass("weui_actionsheet_toggle"); }) $('#mask').click(function(){ $("#mask").css("display","none"); $('#res_div').css("display","none"); $('#continue_add').css("display","none"); $('#add_pass').css("display","none"); $("#weui_actionsheet").removeClass("weui_actionsheet_toggle"); }) $('#total_div').removeClass('ui_hide'); $("#loadingToast").hide(); } //选择返程 function selectBackInfo(){ cacheTheInfo(); cacheTheStation(); var go_ticket_id = $('#go_id_info').attr('go_ticket_id'); var data = { back : 'back', go_date : go_date, go_ticket_id : go_ticket_id } setStorJson('goListInfo',data); ifselback = 1; window.location.href = './calendar.html?go_ticket_id='+go_ticket_id+'&go_date='+go_date+'&from=fill_order'; } //取消返程 function hideBackInfo(){ $('#discount').removeClass('ui_hide'); $('#hideback').addClass('ui_hide'); $('#backinfo').addClass('ui_hide'); $('#add_back').removeClass('ui_hide'); // clearStorage('back_data'); // clearStorage('CacheInfo_station'); ifselback = 0; countTotal(); } //跳转地图 function goToMapInfo(){ cacheTheInfo(); cacheTheStation(); setStorJson('goMapInfo',map_info); console.log(map_info); window.location.href = './navigation_map.html'; } ////选择站点的下侧弹层 //$("#start_res_go").click(function(){ //// upDiv(start_station_list,'start_res_go','go'); // $("#mask").css("display","block"); // $("#weui_actionsheet").addClass("weui_actionsheet_toggle"); //}) //$("#end_res_go").click(function(){ // upDiv(end_station_list,'end_res_go','go'); // $("#mask").css("display","block"); // $("#weui_actionsheet").addClass("weui_actionsheet_toggle"); //}) // //$('#mask').click(function(){ // $("#mask").css("display","none"); // $("#weui_actionsheet").removeClass("weui_actionsheet_toggle"); //}) //修改去程票种的信息 function changeTicketInfoGo(go_back){ var type = ''; var start_area_id = ''; var start_res_id = ''; var end_area_id = ''; var end_res_id = ''; var run_id = ''; if (go_back == 'go') { type = 'bus_detail_ticket_go'; start_area_id = $('#stare_area_id').attr('startarea_goid'); start_res_id = $('#start_res_go').attr('startres_goid'); end_area_id = $('#end_area_id').attr('endarea_goid'); end_res_id = $('#end_res_go').attr('endres_goid'); run_id = $('#hiderun').html(); }else{ type = 'bus_detail_ticket_back'; start_area_id = $('#back_stare_area_id').attr('startarea_backid'); start_res_id = $('#start_res_back').attr('startres_backid'); end_area_id = $('#back_end_area_id').attr('endarea_backid'); end_res_id = $('#end_res_back').attr('endres_backid'); run_id = $('#hiderun_back').html(); } // run_id = $('#hiderun').html(); var data = { type:type, run_id:run_id, start_area_id:start_area_id, start_res_id:start_res_id, end_area_id:end_area_id, end_res_id:end_res_id } ZZLog(JSON.stringify(data)); $.ajax({ url:base_api+'./zz_wxsct/control.php', type: "post", data: data, dataType: "json", success: function (data) { if(data.code == 0){ console.log(data); //替换去程票种数量信息 showCountInfoByBack(data.list,go_back); }else{ // $('#'+t_sel_id).attr(sel_res_div,t_res_id); $('#'+t_sel_id).html(t_res_name); alert(data.info) } }, fail: function (data) { alert(data.info); } }); } //加载去程和返程信息 function reloadBackInfo(go_ticket_id){ //得到去程的信息 并填充 var godata = getStorJson('go_data'); replaceGoInfo(godata); //fuhc 添加测试一下错没 //得到之前选中的值 var sel_station=getStorJson('CacheInfo_station'); if(sel_station){ //加载之前的选中信息 reloadHistoryStation(sel_station); } var run_id = getPar('run_id'); $('#loadingToast').show(); //fuhc var back_data=getStorJson('back_data'); if(back_data){ //替换去程信息 replaceBackInfo(back_data); var get_station = getStorJson('CacheInfo_station'); if (get_station) { reloadHistoryStation(get_station); countTotal(); } }else{ var url=base_api+"./zz_wxsct/control.php"; var parm={ type:"bus_detail_info_back", run_id:run_id, ticket_id:go_ticket_id } ZZLog(url+JSON.stringify(parm)); $.post(url,parm,function(res_data){ res_data=JSON.parse(res_data); ZZLog(res_data); if (res_data.code == 0) { setStorJson('back_data',res_data); // 替换去程信息 replaceBackInfo(res_data); cacheTheStation(); countTotal(); } else{ alert(res_data.info); } }); } //fuhc end // var url=base_api+"./zz_wxsct/control.php"; // var parm={ // type:"bus_detail_info_back", // run_id:run_id, // ticket_id:go_ticket_id // } // ZZLog(url+JSON.stringify(parm)); // $.post(url,parm,function(res_data){ // res_data=JSON.parse(res_data); // ZZLog(res_data); // if (res_data.code == 0) { //// 替换去程信息 // replaceBackInfo(res_data); // countTotal(); // setStorJson('back_data',res_data); // } else{ // alert(res_data.info); // } // }); } //替换返程信息 function replaceBackInfo(data){ var list = data.list; var temphtml = backinfoHTML; var nowdate = getDateTime(0); var selmonth = getMonthAndDayByDate(list.run_date,'month'); var selday = getMonthAndDayByDate(list.run_date,'day'); if (nowdate == list.run_date) { temphtml = temphtml.replace('[返程日期]',selmonth+'月'+selday+'日'+'  今天'); }else{ temphtml = temphtml.replace('[返程日期]',selmonth+'月'+selday+'日'); } temphtml = temphtml.replace('[返程时间]',list.start_time); temphtml = temphtml.replace('[返程出发地]',list.start_area_name); temphtml = temphtml.replace('[返程出发地站点]',list.start_res_name); temphtml = temphtml.replace('[返程目的地]',list.end_area_name); temphtml = temphtml.replace('[返程目的地站点]',list.end_res_name); // temphtml = temphtml.replace('[日程]','全程'+list.distance+'公里'); // temphtml = temphtml.replace('[用时]',list.center_time); temphtml = temphtml.replace('[back_line_id]',list.line_id); temphtml = temphtml.replace('[back_ticket_id]',list.ticket.ticket_id_go); temphtml = temphtml.replace('[startarea_backid]',list.start_area_id); temphtml = temphtml.replace('[startres_backid]',list.start_res_id); temphtml = temphtml.replace('[endarea_backid]',list.end_area_id); temphtml = temphtml.replace('[endres_backid]',list.end_res_id); temphtml = temphtml.replace('[run_id_back]',list.run_id); ZZLog('run_id_back'+list.run_id); temphtml = temphtml.replace('[返程价格]',list.ticket.price); $('#backinfo').html(temphtml); $('#seat').html(list.ticket.site); $('#single').html(list.ticket.run_type); if (data.list.bus_type == '256'){ $('#start_res_back').addClass('ui_hide'); $('#end_res_back').addClass('ui_hide'); }else{ $('#start_res_back').removeClass('ui_hide'); $('#end_res_back').removeClass('ui_hide'); } ticket_id_back_back = list.ticket.ticket_id; run_id_back = list.run_id; // ticket_id_go = list.ticket.ticket_id_go; //去程的出发地、目的地数组 back_stares_ary = list.start_res_array; back_endres_ary = list.end_res_array; //记录地图信息 // map_info = list['map']; //返程站点 更换 //选择站点的下侧弹层 $("#back_start_area").click(function(){ $("#mask").css("display","block"); $('#res_div').css("display","block"); sel_res_div = 'startres_backid'; upDiv(back_stares_ary,'start_res_back','back'); $("#weui_actionsheet").addClass("weui_actionsheet_toggle"); }) $("#back_end_area").click(function(){ $("#mask").css("display","block"); $('#res_div').css("display","block"); sel_res_div = 'endres_backid'; upDiv(back_endres_ary,'end_res_back','back'); $("#weui_actionsheet").addClass("weui_actionsheet_toggle"); }) $('#mask').click(function(){ $("#mask").css("display","none"); $('#res_div').css("display","none"); $('#continue_add').css("display","none"); $('#add_pass').css("display","none"); $("#weui_actionsheet").removeClass("weui_actionsheet_toggle"); }) $('#hideback').removeClass('ui_hide'); $('#backinfo').removeClass('ui_hide'); $("#loadingToast").hide(); } //添加乘客 function addPassanger(){ if (passCount == 0) { $("#mask").css("display","block"); $('#add_pass').css("display","block"); $("#weui_actionsheet").addClass("weui_actionsheet_toggle"); } else{ var html = ''; for (var i = 0 ; i < passAry.length; i ++) { var tempHTML = passHTML; tempHTML = tempHTML.replace('[乘客]',passAry[i].name); tempHTML = tempHTML.replace('[证件]',passAry[i].id_num); tempHTML = tempHTML.replace('[changeid]',passAry[i].id); tempHTML = tempHTML.replace('[img]','img'+passAry[i].id); tempHTML = tempHTML.replace('[selid]',passAry[i].id); // tempHTML = tempHTML.replace('[showtime]',data.station[i].start_time); // tempHTML = tempHTML.replace('images/a3/ic_select_sel.png','images/a3/ic_select_nor.png'); html += tempHTML; } $('#wei_info_passenger').html(html); $("#mask").css("display","block"); $('#continue_add').css("display","block"); $("#weui_actionsheet").addClass("weui_actionsheet_toggle"); // $('.weui_actionsheet_cell').click(function(){ $('#ok').click(function(){ cacheinfo = new Array(); var newhtml = ''; $('.selectInfo').each(function(index,dom){ var str = '
' +'
'+$(this).parent().children().eq(0).text()+'
' +'
'+$(this).parent().children().eq(1).text()+'
' +'
' +'' +'
' +'
' newhtml += str; var tempdata = { name : $(this).parent().children().eq(0).text(), card : $(this).parent().children().eq(1).text() } cacheinfo.push(tempdata); }) $('#fill_info').html(newhtml); $('#mask').click(); countTotal(); }) $('#add_pass_info').click(function(){ goToAddPassangers(); }) // }) } } //删除某一个乘车人信息 function delThis(obj){ $(obj).parent().remove(); var index = $(obj).attr('index'); cacheinfo.splice(index,1); countTotal(); } //计算购买总数 function countTotal() { var count = $('#fill_info').children().length; $('#people_count').html(count); if (ifselback == 1) { $('#count_price').html(count*(parseInt($('#back_price').html())+parseInt($('#go_price').html()))); }else{ $('#count_price').html(count*$('#go_price').html()); } // if (ifselback == 1) { // $('#count_price').html(count*(parseInt($('#back_price').html())+parseInt($('#go_price').html()))); // }else{ // if(getPar('go_ticket_id')!=""){ // $('#count_price').html(count*(parseInt($('#back_price').html())+parseInt($('#go_price').html()))); // }else{ // $('#count_price').html(count*$('#go_price').html()); // } // } } //修改乘客信息 function changeinfo(id){ cacheTheInfo(); cacheTheStation(); var temp = getPar('go_ticket_id'); var run_id = getPar('run_id'); var start_area_id = getPar('start_area_id'); var end_area_id = getPar('end_area_id'); var start_res_id = getPar('start_res_id'); var end_res_id = getPar('end_res_end'); if (temp == '') { var urlstr = './wirte_order.html?run_id='+run_id+'&start_area_id='+start_area_id+'&end_area_id='+end_area_id+'&start_res_id='+start_res_id+'&end_res_id='+end_res_id+'&man_id='+id; window.location.href = urlstr; }else{ var urlstr = './wirte_order.html?run_id='+run_id+'&start_area_id='+start_area_id+'&end_area_id='+end_area_id+'&start_res_id='+start_res_id+'&end_res_id='+end_res_id+'&go_ticket_id='+temp+'&man_id='+id; window.location.href = urlstr; } } //选中乘客 function selectInfo(selid,obj){ if (obj.id == 0) { $('#img'+selid).addClass('selectInfo'); $('#img'+selid).attr('src','images/a3/ic_select_sel.png'); obj.id = 1; } else{ $('#img'+selid).removeClass('selectInfo'); $('#img'+selid).attr('src','images/a3/ic_select_nor.png'); obj.id = 0; } // $('#img'+selid).addClass('selectInfo'); // $('#img'+selid).attr('src','images/a3/ic_select_sel.png') } //跳转添加乘客界面 function goToAddPassangers(){ cacheTheInfo(); cacheTheStation(); var temp = getPar('go_ticket_id'); var run_id = getPar('run_id'); var start_area_id = getPar('start_area_id'); var end_area_id = getPar('end_area_id'); var start_res_id = getPar('start_res_id'); var end_res_id = getPar('end_res_end'); if (temp == '') { window.location.href = './wirte_order.html?run_id='+run_id+'&start_area_id='+start_area_id+'&end_area_id='+end_area_id+'&start_res_id='+start_res_id+'&end_res_id='+end_res_id; }else{ window.location.href = './wirte_order.html?run_id='+run_id+'&start_area_id='+start_area_id+'&end_area_id='+end_area_id+'&start_res_id='+start_res_id+'&end_res_id='+end_res_id+'&go_ticket_id='+temp; } } //支付按钮的点击 function payBtnDidClicked(){ var custmer = $('#custmer').val(); var tel = $('#tel').val(); var phoneRe =/^1[3|4|5|7|8]\d{9}$/; var people = $('#people_count').html(); if (custmer =='') { alert('请输入联系人!'); return; } else if(tel == ''){ alert('请输入手机号!'); return; }else if (people == '') { alert('请选择乘车人!'); return; }else if(!phoneRe.test(tel)){ alert('请输入正确的手机号!') return; }; $("#loadingToast").show(); var newstr = ''; $('.passinfo').each(function(){ var str = $(this).children().eq(0).text()+'*'+$(this).children().eq(1).text(); newstr += str + '/'; }) var passenger = newstr.substring(0,newstr.length-1); //联系人 乘客人信息 var customer = '{,'+custmer+',1,'+tel+',,,,0,,,'+passenger+'}'; var prod = ''; var count = $('#people_count').html(); if (ifselback == 0) { prod = '{m'+ticket_id_go+'p'+count+'|r'+run_id_go+'}' }else{ //判断是否 有返程优惠 if (ticket_id_back == '') { prod = '{m'+ticket_id_go+'p'+count+'|r'+run_id_go+'}' } else{ prod = '{m'+ticket_id_back+'p'+count+'|r'+run_id_go+'}' } } var ifback = ifselback; var back_prod = '{m'+ticket_id_back_back+'p'+count+'|r'+run_id_back+'}'; var data = { type : 'order_submit', prod : prod, ifback : ifselback, back_prod : back_prod, customer :customer } ZZLog('提交传参') ZZLog(data); var url=base_api+"./zz_wxsct/control.php"; var parm=data; $.post(url,parm,function(res_data){ res_data=JSON.parse(res_data); ZZLog(res_data); if (res_data.code == 0) { $("#loadingToast").hide(); clearStorage('CacheInfo_people'); window.location.href = res_data.info; }else{ alert(res_data.info); } }); } //展示去程票种 修改后的信息 function showCountInfoByBack(data,go_back){ if (go_back == 'go') { map_info = data['map']; var temphtml1 = $('#seatInfo').html(); temphtml1 = temphtml1.replace('[普通座]',data.ticket.site); temphtml1 = temphtml1.replace('[单程]',data.ticket.run_type); if (data.ticket.discount_price == '0') { temphtml1 = temphtml1.replace('[优惠]','无往返优惠'); }else{ temphtml1 = temphtml1.replace('[优惠]','往返优惠'+data.ticket.discount_price+'元'); } $('#seatInfo').html(temphtml1); $('#go_price').html(data.ticket.go_price); $('#gotime').html(data.start_time); $('#distance').html('全程'+data.distance+'公里'); $('#usetime').html(data.center_time); ticket_id_back = data.ticket.ticket_id_back; ticket_id_go = data.ticket.ticket_id_go; map_info = data.map; $('#distance_back').html('全程'+data.distance+'公里'); $('#usetime_back').html(data.center_time); }else{ $('#seat').html(data.site); $('#single').html(data.run_type); $('#backtime').html(data.start_time); $('#back_price').html(data.price); ticket_id_back_back = data.ticket_id; } } //上弹框的内容封装 function upDiv(data,select_id,goBack){ var sel = $('#'+select_id).attr(sel_res_div); var html = ''; for (var i = 0 ; i < data.station.length; i ++) { var tempHTML = resHTML; tempHTML = tempHTML.replace('示例菜单',data.station[i].res_name); tempHTML = tempHTML.replace('[res_id]',data.station[i].res_id); tempHTML = tempHTML.replace('[showtime]',data.station[i].start_time); if (sel == data.station[i].res_id) { tempHTML = tempHTML.replace('images/a3/ic_select_nor.png','images/a3/ic_select_sel.png'); } else{ tempHTML = tempHTML.replace('images/a3/ic_select_nor.png','images/a3/ic_select_nor.png'); } // tempHTML = tempHTML.replace('images/a3/ic_select_sel.png','images/a3/ic_select_nor.png'); html += tempHTML; } $('#wei_info').html(html); // html = html.replace('[poi]',data.area_name) $('#poi').html(data.area_name); $('#actionsheet_cancel').click(function(){ $('#mask').click(); }) $('.weui_actionsheet_cell').click(function(){ t_res_name=this.innerHTML; t_res_id=this.id t_sel_id=select_id; $('#'+select_id).html(this.innerHTML); $('#'+select_id).attr(sel_res_div,this.id); var seltime = $(this).attr('showtime'); //添加选中图片 // $(this).parent().eq(1).attr('src','images/a3/ic_select_sel.png'); $('gotime').html(seltime); $('#mask').click(); //修改去程的票种信息 changeTicketInfoGo(goBack); }) } //截取日期参数 function getMonthAndDayByDate(datestr,info){ var dateAry = datestr.split('-'); var cNewTimeStr; switch(info){ case 'year': cNewTimeStr = dateAry[0]; break; case 'month': cNewTimeStr = dateAry[1]; break; default: cNewTimeStr = dateAry[2]; break; } return cNewTimeStr; } //存联系人和乘车人的缓存 function cacheTheInfo(){ var name = $('#custmer').val(); var tel = $('#tel').val(); var people_count = $('#people_count').html(); var count_price = $('#count_price').html(); var infodata = { name : name, tel : tel, people_count : people_count, count_price : count_price, peopele_array : cacheinfo } setStorJson('CacheInfo_people',infodata); } //存站点信息的缓存 function cacheTheStation(){ // if (ifselback == 1) { // var gotime = $('#gotime').html(); // var goPrice = $('#go_price').html(); // var go_start_res_name = $('#start_res_go').text(); // var go_start_res_id = $('#start_res_go').attr('startres_goid'); // var go_end_res_name = $('#end_res_go').text(); // var go_end_res_id = $('#end_res_go').attr('#endres_goid'); // var backtime = $('#backtime').html(); // var backPrice = $('#back_price').html(); // var back_start_res_name = $('#start_res_back').text(); // var back_start_res_id = $('#start_res_back').attr('startres_backid'); // var back_end_res_name = $('#end_res_back').text(); // var back_end_res_id = $('#end_res_back').attr('endres_backid'); // // var distance_back = $('#distance_back').html(); // var usetime_back = $('#usetime_back').html(); // var map_info1 = map_info; // var seat = $('#seat').html(); // var single = $('#single').html(); // var discount = $('#discount').html() // // var ticket_id_go1 = ticket_id_go; // var ticket_id_back1 = ticket_id_back; // var ticket_id_back_back1 = ticket_id_back_back; // // // var data = { // gotime : gotime, // goPrice : goPrice, // go_start_res_name : go_start_res_name, // go_start_res_id : go_start_res_id, // go_end_res_name : go_end_res_name, // go_end_res_id : go_end_res_id, // backtime : backtime, // backPrice : backPrice, // back_start_res_name : back_start_res_name, // back_start_res_id : back_start_res_id, // back_end_res_name : back_end_res_name, // back_end_res_id : back_end_res_id, // distance_back : distance_back, // usetime_back : usetime_back, // map_info : map_info1, // seat : seat, // single : single, // discount : discount, // ticket_id_go : ticket_id_go1, // ticket_id_back : ticket_id_back1, // ticket_id_back_back : ticket_id_back_back1 // } // setStorJson('CacheInfo_station',data); // } else{ // var gotime = $('#gotime').html(); // var goPrice = $('#go_price').html(); // var go_start_res_name = $('#start_res_go').text(); // var go_start_res_id = $('#start_res_go').attr('startres_goid'); // var go_end_res_name = $('#end_res_go').text(); // var go_end_res_id = $('#end_res_go').attr('#endres_goid'); // var backtime = $('#backtime').html(); // var backPrice = $('#back_price').html(); // var back_start_res_name = $('#start_res_back').text(); // var back_start_res_id = $('#start_res_back').attr('startres_backid'); // var back_end_res_name = $('#end_res_back').text(); // var back_end_res_id = $('#end_res_back').attr('endres_backid'); // var distance_back = $('#distance_back').html(); // var usetime_back = $('#usetime_back').html(); // var map_info1 = map_info; // var seat = $('#seat').html(); // var single = $('#single').html(); // var discount = $('#discount').html() // // var ticket_id_go1 = ticket_id_go; // var ticket_id_back1 = ticket_id_back; // var ticket_id_back_back1 = ticket_id_back_back; // var data = { // gotime : gotime, // goPrice : goPrice, // go_start_res_name : go_start_res_name, // go_start_res_id : go_start_res_id, // go_end_res_name : go_end_res_name, // go_end_res_id : go_end_res_id, // backtime : backtime, // backPrice : backPrice, // back_start_res_name : back_start_res_name, // back_start_res_id : back_start_res_id, // back_end_res_name : back_end_res_name, // back_end_res_id : back_end_res_id, // distance_back : distance_back, // usetime_back : usetime_back, // map_info : map_info1, // seat : seat, // single : single, // discount : discount, // ticket_id_go : ticket_id_go1, // ticket_id_back : ticket_id_back1, //// ticket_id_back_back : ticket_id_back_back1 // } // setStorJson('CacheInfo_station',data); // } var gotime = $('#gotime').html(); var goPrice = $('#go_price').html(); var go_start_res_name = $('#start_res_go').text(); var go_start_res_id = $('#start_res_go').attr('startres_goid'); var go_end_res_name = $('#end_res_go').text(); var go_end_res_id = $('#end_res_go').attr('#endres_goid'); var backtime = $('#backtime').html(); var backPrice = $('#back_price').html(); var back_start_res_name = $('#start_res_back').text(); var back_start_res_id = $('#start_res_back').attr('startres_backid'); var back_end_res_name = $('#end_res_back').text(); var back_end_res_id = $('#end_res_back').attr('endres_backid'); var distance_back = $('#distance_back').html(); var usetime_back = $('#usetime_back').html(); var map_info1 = map_info; var seat = $('#seat').html(); var single = $('#single').html(); var discount = $('#discount').html() var ticket_id_go1 = ticket_id_go; var ticket_id_back1 = ticket_id_back; var ticket_id_back_back1 = ticket_id_back_back; var data = { gotime : gotime, goPrice : goPrice, go_start_res_name : go_start_res_name, go_start_res_id : go_start_res_id, go_end_res_name : go_end_res_name, go_end_res_id : go_end_res_id, backtime : backtime, backPrice : backPrice, back_start_res_name : back_start_res_name, back_start_res_id : back_start_res_id, back_end_res_name : back_end_res_name, back_end_res_id : back_end_res_id, distance_back : distance_back, usetime_back : usetime_back, map_info : map_info1, seat : seat, single : single, discount : discount, ticket_id_go : ticket_id_go1, ticket_id_back : ticket_id_back1, ticket_id_back_back : ticket_id_back_back1 } setStorJson('CacheInfo_station',data); } //取消按钮的点击 function cancelDidClicked(){ $('#mask').click(); }