|
- //上下车信息html()
- var HTML = '';
- //数量html()
- var count_html = '';
- //返程的html()
- var back_info_html = '';
- //返程数量的html()
- var count_back_html = '';
- //乘客人信息html()
- var pass_info_html = '';
- //去程提交信息html()
- var gosuccessHTML = '';
- //返程提交信息html()
- var backsuccessHTML = '';
-
- //返程相关
- var back_line_id = '';
- var back_run_id = '';
- var back_ticket = '';
- var back_ticket_id = '';
-
-
- var line_id = '';
- var run_id = '';
- var ticket = '';
- var bus_type = '';
- var ticket_id = '';
- //checkbox选中状态
- var ifcheck = 0;
- //记录乘车人个数
- var passenger = 0;
- //去程和往返的交集库存
- var stockCount = 0;
- //定义一个 只记录去程库存 一般取消返程选中时 重置去程库存
- var stockCountTemp = 0;
-
- window.onload = function(){
- var run_id = getPar('run_id');
- var start_area_id = getPar('start_area_id');
- var end_area_id = getPar('end_area_id');
-
- HTML = $('#tabbable').html();
- count_html = $('#list').html();
- back_info_html = $('#back_info').html();
- count_back_html = $('#list_info_back').html();
- pass_info_html = $('#all_passenger').html();
- gosuccessHTML = $('#commit_ticket_go_success').html();
- backsuccessHTML = $('#commit_ticket_back_success').html();
- //展示去程信息
- showGoInfo(run_id,start_area_id,end_area_id);
- }
- //展示去程信息
- function showGoInfo(run_id,start_area_id,end_area_id){
- $.ajax({
- url:'./zz-fx/control.php',
- type: "post",
- data: {
- run_id:run_id,
- start_area_id:start_area_id,
- end_area_id:end_area_id,
- back:1,
- type:"retrieval_site"
- },
- dataType: "json",
- success: function (data) {
- if(data.code == 0){
- console.log(data);
- //去程信息的数据交互
- goInfoReloadData(data.list);
- }
- },
- fail: function (data) {
- // 此处放失败后执行的代码
- }
- });
- }
- //去程信息的数据交互
- function goInfoReloadData(data){
-
- var time_html = $('#go_time').html();
- time_html = time_html.replace('[出发日期]',data.date);
- $('#go_time').html(time_html);
-
- var up_down_html = $('#up_and_down_station').html();
- up_down_html = up_down_html.replace('[出发地]',data.start_area_name);
- up_down_html = up_down_html.replace('[目的地]',data.end_area_name);
- $('#up_and_down_station').html(up_down_html);
-
- // var html = '';
- // var temp = HTML;
- // //出发地、目的地、时间
- // temp = temp.replace('[出发地]',data.start_area_name);
- // temp = temp.replace('[目的地]',data.end_area_name);
- // temp = temp.replace('[出发日期]',data.date);
- //出发地站点、目的地站点
- var start_station_list = data.start_order;
- var end_station_list = data.end_order;
- //
- // html += temp;
- // $('#tabbable').html(html);
-
- var start_station_html = '';
- for (var i = 0 ; i < start_station_list.length; i ++) {
- var tempHTML = '<option value="0">[出发地站点]</option>';
- tempHTML = tempHTML.replace('[出发地站点]',start_station_list[i].name);
- tempHTML = tempHTML.replace('0',start_station_list[i].id);
- start_station_html += tempHTML;
- }
- $('#start_area_station').html(start_station_html);
-
- var end_station_html = '';
- for (var i = 0 ; i < end_station_list.length; i ++) {
- var tempHTML = '<option value="0">[出发地站点]</option>';
- tempHTML = tempHTML.replace('[出发地站点]',end_station_list[i].name);
- tempHTML = tempHTML.replace('0',end_station_list[i].id);
- end_station_html += tempHTML;
- }
- $('#end_area_station').html(end_station_html);
-
- run_id = data.run_id;
- line_id = data.line_id;
- var start_id = $('#start_area_station').val();
- var end_id = $('#end_area_station').val();
- ticket = data.ticket;
- bus_type = data.bus_type;
- //犹豫异步加载的问题 所以只能在展示数据后 继续调用票种价格等相关信息
- $.ajax({
- url:'./zz-fx/control.php',
- type: "post",
- data: {
- run_id:run_id,
- line_id:line_id,
- start_id:start_id,
- end_id:end_id,
- tickets:ticket,
- back:1,
- type:"retrieval_tickets"
- },
- dataType: "json",
- success: function (data) {
- if(data.code == 0){
- console.log(data);
- //替换去程票种数量信息
- showCountInfoByGo(data.list);
- }
- },
- fail: function (data) {
- // 此处放失败后执行的代码
- }
- });
-
- }
- //选择出发站点
- function selectStartStationID(){
- var start_id = $('#start_area_station').val();
- var end_id = $('#end_area_station').val();
- $.ajax({
- url:'./zz-fx/control.php',
- type: "post",
- data: {
- run_id:run_id,
- line_id:line_id,
- start_id:start_id,
- end_id:end_id,
- tickets:ticket,
- back:1,
- type:"retrieval_tickets"
- },
- dataType: "json",
- success: function (data) {
- if(data.code == 0){
- console.log(data);
- $("#ifback").attr("checked",false);
- ifbackSelected(0);
- //替换去程票种数量信息
- showCountInfoByGo(data.list);
- }
- },
- fail: function (data) {
- // 此处放失败后执行的代码
- }
- });
- }
-
- //选择到达站点
- function selectEndStationID(){
- var start_id = $('#start_area_station').val();
- var end_id = $('#end_area_station').val();
- $.ajax({
- url:'./zz-fx/control.php',
- type: "post",
- data: {
- run_id:run_id,
- line_id:line_id,
- start_id:start_id,
- end_id:end_id,
- tickets:ticket,
- back:1,
- type:"retrieval_tickets"
- },
- dataType: "json",
- success: function (data) {
- if(data.code == 0){
- console.log(data);
- $("#ifback").attr("checked",false);
- ifbackSelected(0);
- //替换去程票种数量信息
- showCountInfoByGo(data.list);
- }
- },
- fail: function (data) {
- // 此处放失败后执行的代码
- }
- });
- }
- //替换去程票种数量信息
- function showCountInfoByGo(data){
- var html1 = '';
- var temp1 = count_html;
- temp1 = temp1.replace('[座位等级]',data.site_type);
- temp1 = temp1.replace('[价格]',data.price);
- //数量
- var maxCount = data.num > 20 ? 20 : data.num;
- maxCount = maxCount>0 ? maxCount : 0;
-
- stockCount = maxCount;
- stockCountTemp = maxCount;
-
- html1 += temp1;
- $('#list').html(html1);
-
- if (stockCount == 0) {
- var count_replace = '';
- $('#ifback').attr('disabled','disabled');
- for (var i = 0 ; i <= stockCount; i ++) {
- var tempHTML2 = '<option value="[0]">[-]</option>';
- tempHTML2 = tempHTML2.replace('[0]',i);
- tempHTML2 = tempHTML2.replace('[-]','无库存');
- count_replace += tempHTML2;
- }
- $('#count_station').html(count_replace);
- } else{
- var count_replace = '';
- for (var i = 0 ; i <= stockCount; i ++) {
- var tempHTML2 = '<option value="[0]">[-]</option>';
- tempHTML2 = tempHTML2.replace('[0]',i);
- tempHTML2 = tempHTML2.replace('[-]',i);
- count_replace += tempHTML2;
- }
- $('#count_station').html(count_replace);
- }
- var select_count = $('#count_station').val();
- var totalPrice = parseFloat(select_count)*parseFloat(data.price);
- $('#total').html(totalPrice);
- ticket_id = data.ticket_id;
- }
-
-
- //随票种数量改变总价格
- function changeTotalPrice(){
- var select_count = $('#count_station').val();
- var price = $('#price').html();
- var totalPrice = parseFloat(select_count)*parseFloat(price);
- $('#total').html(totalPrice);
-
- passenger = select_count;
- var count_replace = '';
- for (var i = 0;i < passenger; i ++) {
- var tempHTML2 = pass_info_html;
- tempHTML2 = tempHTML2.replace('passenger_info','passenger_info'+i);
- tempHTML2 = tempHTML2.replace('乘客1','乘客'+(i+1));
- tempHTML2 = tempHTML2.replace('pass_name','pass_name'+i);
- tempHTML2 = tempHTML2.replace('pass_tel','pass_tel'+i);
- count_replace += tempHTML2;
- }
- $('#all_passenger').html(count_replace);
- }
-
- //随票种数量改变总价格---针对往返票
- function changeBackTotalPrice(){
- var select_count = $('#back_count_station').val();
- var price = $('#back_price').html();
- var totalPrice = parseFloat(select_count)*parseFloat(price);
- $('#back_total').html(totalPrice);
-
- passenger = select_count;
- var count_replace = '';
- for (var i = 0;i < passenger; i ++) {
- var tempHTML2 = pass_info_html;
- tempHTML2 = tempHTML2.replace('passenger_info','passenger_info'+i);
- tempHTML2 = tempHTML2.replace('乘客1','乘客'+(i+1));
- count_replace += tempHTML2;
- }
- $('#all_passenger').html(count_replace);
- }
-
- //返程信息选中
- function ifbackSelected(value) {
- if(value == true) {
- $('#ifback').val('1');
-
- $('#calendar').show();
- // $('#select_shift').show();
- // $('#select_shift').show();
- $('#has_noback').hide();
- $('#has_back').show();
- $('#list_info_back').show();
- $('#list_info').hide();
- $('#list_info_back').hide();
- ifcheck = 1;
- // var adate = $('#id-date-picker-1').val();
- // selectBackDate(adate);
- passenger = 1;
- var count_replace = '';
- for (var i = 0;i < passenger; i ++) {
- var tempHTML2 = pass_info_html;
- tempHTML2 = tempHTML2.replace('passenger_info','passenger_info'+i);
- tempHTML2 = tempHTML2.replace('乘客1','乘客'+(i+1));
- count_replace += tempHTML2;
- }
- $('#all_passenger').html(count_replace);
-
- } else {
- $('#ifback').val('0');
- $('#calendar').hide();
- $('#select_shift').hide();
- $('#back_info').hide();
- $('#has_noback').show();
- $('#has_back').hide();
- $('#list_info_back').hide();
- $('#list_info').show();
- ifcheck = 0;
-
- $('#select_shift_div').show();
- $('.no_info_atten').hide();
-
- //重置库存量
- stockCount = stockCountTemp;
-
- if ($('#count_station').val()==0) {
- passenger = 1;
- } else{
- passenger = $('#count_station').val()
- }
- var count_replace = '';
- for (var i = 0;i < passenger; i ++) {
- var tempHTML2 = pass_info_html;
- tempHTML2 = tempHTML2.replace('passenger_info','passenger_info'+i);
- tempHTML2 = tempHTML2.replace('乘客1','乘客'+(i+1));
- count_replace += tempHTML2;
- }
- $('#all_passenger').html(count_replace);
- }
- }
-
- //选中返程时间 获取返程班次
- function selectBackDate(value){
- //返程出发地
- var back_start_area_id = getPar('end_area_id');
- //返程目的地
- var back_end_area_id = getPar('start_area_id');
-
- $.ajax({
- url:'./zz-fx/control.php',
- type: "post",
- data: {
- bus_type:bus_type,
- start_id:back_start_area_id,
- end_id:back_end_area_id,
- back_time:value,
- back:2,
- type:"retrieval_backthrough"
- },
- dataType: "json",
- success: function (data) {
- if(data.code == 0){
- console.log(data);
- var barlist = data.list;
- if (barlist.length == 0) {
- // $('#select_shift_div').show();
- // $('#select_shift_div').html('无相关班次信息!');
- // $('#select_shift_div').addClass('has_no_bus');
- $('#select_shift_div').hide();
- $('.no_info_atten').show();
- $('#back_info').hide();
- $('#list_info_back').hide();
- } else{
- $('#select_shift_div').show();
- $('#select_shift').show();
- $('.no_info_atten').hide();
- var select_shift_html = '';
- for (var i = 0 ; i < data.list.length; i ++) {
- var tempHTML = '<option value="1">请选择</option>';
- tempHTML = tempHTML.replace('请选择',data.list[i].start_time);
- tempHTML = tempHTML.replace('1',data.list[i].run_id);
- select_shift_html += tempHTML;
- }
- $('#select_shift').html(select_shift_html);
- //==================选中班次,显示返程信息
- //继续调用显示 返程票价和数量等相关信息
- var bar_content = $('#select_shift').val();
- showBackTicketInfo(bar_content,back_start_area_id,back_end_area_id);
- }
- }
- },
- fail: function (data) {
- // 此处放失败后执行的代码
- }
- });
- }
-
- //选中返程班次 选择返程相关的信息
- function showBackTicketInfo(bar_content,back_area_start,back_area_end){
- $.ajax({
- url:'./zz-fx/control.php',
- type: "post",
- data: {
- run_id:bar_content,
- start_area_id:back_area_start,
- end_area_id:back_area_end,
- back:2,
- type:"retrieval_site"
- },
- dataType: "json",
- success: function (data) {
- if(data.code == 0){
- console.log(data);
- if (data.list=="") {
- $('#back_info').show();
- $('#back_info').html('无相关的票种信息!');
- $('#back_info').addClass('has_no_bus');
- $('#list_info_back').hide();
- }else{
- $('#back_info').show();
- $('#back_info').removeClass('has_no_bus');
- $('#list_info_back').show();
- var html = '';
- var temp = back_info_html;
- //出发地、目的地、时间
- temp = temp.replace('[返程出发地]',data.list.start_area_name);
- temp = temp.replace('[返程目的地]',data.list.end_area_name);
- //出发地站点、目的地站点
- var start_station_list = data.list.start_order;
- var end_station_list = data.list.end_order;
- html += temp;
- $('#back_info').html(html);
-
- var start_station_back_html = '';
- for (var i = 0 ; i < start_station_list.length; i ++) {
- var tempHTML = '<option value="0">[返程出发地站点]</option>';
- tempHTML = tempHTML.replace('[返程出发地站点]',start_station_list[i].name);
- tempHTML = tempHTML.replace('0',start_station_list[i].id);
- start_station_back_html += tempHTML;
- }
- $('#start_area_station_back').html(start_station_back_html);
-
- var end_station_back_html = '';
- for (var i = 0 ; i < end_station_list.length; i ++) {
- var tempHTML = '<option value="0">[返程目的地站点]</option>';
- tempHTML = tempHTML.replace('[返程目的地站点]',end_station_list[i].name);
- tempHTML = tempHTML.replace('0',end_station_list[i].id);
- end_station_back_html += tempHTML;
- }
- $('#end_area_station_back').html(end_station_back_html);
-
- back_line_id = data.list.line_id;
- back_run_id = data.list.run_id;
- back_ticket = data.list.ticket;
- //============展示返程的票种价格数量信息
- showBackCountInfo(data.list.run_id,data.list.line_id,data.list.ticket);
- }
- }
-
-
- },
- fail: function (data) {
- // 此处放失败后执行的代码
- }
- });
- }
-
- //展示返程的票种价格数量信息
- function showBackCountInfo(run_id,line_id,ticket){
- var start_id = $('#start_area_station_back').val();
- var end_id = $('#end_area_station_back').val();
- $.ajax({
- url:'./zz-fx/control.php',
- type: "post",
- data: {
- run_id:run_id,
- line_id:line_id,
- start_id:start_id,
- end_id:end_id,
- tickets:ticket,
- back:2,
- type:"retrieval_tickets"
- },
- dataType: "json",
- success: function (data) {
- if(data.code == 0){
- console.log(data);
- //替换返程票种数量信息
- showCountInfoByBack(data.list);
- }
- },
- fail: function (data) {
- // 此处放失败后执行的代码
- }
- });
- }
-
- //替换返程票种数量信息
- function showCountInfoByBack(data){
- var html1 = '';
- var temp1 = count_back_html;
- temp1 = temp1.replace('[座位等级]',data.site_type);
- temp1 = temp1.replace('[价格]',parseFloat(data.price)*2);
- //数量
- var maxCount = data.num > 20 ? 20 : data.num;
- maxCount = maxCount>0 ? maxCount : 0;
-
- stockCount = maxCount < stockCount ? maxCount : stockCount;
-
- html1 += temp1;
- $('#list_info_back').html(html1);
-
- if (stockCount == 0) {
- var count_replace = '';
- for (var i = 0 ; i <= stockCount; i ++) {
- var tempHTML2 = '<option value="[0]">[-]</option>';
- tempHTML2 = tempHTML2.replace('[0]',i);
- tempHTML2 = tempHTML2.replace('[-]','无库存');
- count_replace += tempHTML2;
- }
- $('#back_count_station').html(count_replace);
- } else{
- var count_replace = '';
- for (var i = 0 ; i <= stockCount; i ++) {
- var tempHTML2 = '<option value="[0]">[-]</option>';
- tempHTML2 = tempHTML2.replace('[0]',i);
- tempHTML2 = tempHTML2.replace('[-]',i);
- count_replace += tempHTML2;
- }
- $('#back_count_station').html(count_replace);
- }
- var select_count = $('#back_count_station').val();
- var totalPrice = parseFloat(select_count)*parseFloat(data.price)*2;
- $('#back_total').html(totalPrice);
- back_ticket_id = data.ticket_id;
- $('#list_info_back').show();
- }
-
- //返程出发站点的更改
- function selectBackStartStationID(){
- var start_id = $('#start_area_station_back').val();
- var end_id = $('#end_area_station_back').val();
- $.ajax({
- url:'./zz-fx/control.php',
- type: "post",
- data: {
- run_id:back_run_id,
- line_id:back_line_id,
- start_id:start_id,
- end_id:end_id,
- tickets:back_ticket,
- back:2,
- type:"retrieval_tickets"
- },
- dataType: "json",
- success: function (data) {
- if(data.code == 0){
- console.log(data);
- //替换返程票种数量信息
- showCountInfoByBack(data.list);
- }
- },
- fail: function (data) {
- // 此处放失败后执行的代码
- }
- });
- }
-
- //返程目的地站点的更改
- function selectBackEndStationID(){
- var start_id = $('#start_area_station_back').val();
- var end_id = $('#end_area_station_back').val();
- $.ajax({
- url:'./zz-fx/control.php',
- type: "post",
- data: {
- run_id:back_run_id,
- line_id:back_line_id,
- start_id:start_id,
- end_id:end_id,
- tickets:back_ticket,
- back:2,
- type:"retrieval_tickets"
- },
- dataType: "json",
- success: function (data) {
- if(data.code == 0){
- console.log(data);
- //替换返程票种数量信息
- showCountInfoByBack(data.list);
- }
- },
- fail: function (data) {
- // 此处放失败后执行的代码
- }
- });
- }
-
-
- //班次selected的选中事件
- function selectShiftInfo(){
- var run_id = $('#select_shift').val();
- //返程出发地
- var back_start_area_id = getPar('end_area_id');
- //返程目的地
- var back_end_area_id = getPar('start_area_id');
-
- showBackTicketInfo(run_id,back_start_area_id,back_end_area_id);
- }
-
-
- //保存按钮
- function saveBtnClicked(){
- // var goCount = $('#count_station').val();
- // var go_prod_id = '{m'+line_id+'p'+goCount+'|'+'r'+run_id+'}';
-
- //联系人信息
- var name = $('#peo_name').val();
- var tel = $('#peo_tel').val();
- var phoneRe =/^1[3|4|5|7|8]\d{9}$/;
- if (name == "") {
- window.wxc.xcConfirm("请输入联系人姓名!", window.wxc.xcConfirm.typeEnum.info);
- return;
- }
- var aname = name;
- if (tel == "") {
- window.wxc.xcConfirm("请输入联系人电话!", window.wxc.xcConfirm.typeEnum.info);
- return;
- }
- if(!phoneRe.test(tel)){
- window.wxc.xcConfirm("请输入正确的手机号", window.wxc.xcConfirm.typeEnum.info);
- return;
- };
- $('#save_btn').html('提交中...');
- var tempStr = '"';
- var passCount = $('#all_passenger').children().length;
- for (var i = 0; i < passCount ; i ++) {
- var pass_name_str = $('#pass_name'+i).val();
- var pass_tel_str = $('#pass_tel'+i).val();
- var addstr = pass_name_str+'×'+pass_tel_str+'|';
- tempStr= tempStr+addstr;
- }
-
- tempStr = tempStr.substring(0,tempStr.length-1);
- tempStr = tempStr+'"';
- var peoInfo = '{,'+aname+',1,'+tel+',150,,,0,,'+tempStr+'}';
- if (ifcheck==0) {
- var goCount = $('#count_station').val();
- if (goCount == 0) {
- window.wxc.xcConfirm("购买票种数量为0!", window.wxc.xcConfirm.typeEnum.info);
- $('#save_btn').html('提交');
- return;
- }
- var go_prod_id = '{m'+ticket_id+'p'+goCount+'|'+'r'+run_id+'}';
- $.ajax({
- url:'./zz-fx/control.php',
- type: "post",
- data: {
- prod:go_prod_id,
- customer:peoInfo,
- ifback:0,
- back_prod:0,
- type:"distribut_OrderUp"
- },
- dataType: "json",
- success: function (data) {
- if(data.code == 0){
- console.log(data);
- showSuccessConmiteInfo(data.go_list);
- $('#save_btn').html('提交');
- }else{
- window.wxc.xcConfirm("预订失败,请重新下单!", window.wxc.xcConfirm.typeEnum.info);
- }
- },
- fail: function (data) {
- // 此处放失败后执行的代码
- }
- });
- } else{
- var backCount = $('#back_count_station').val();
- var go_prod_id = '{m'+ticket_id+'p'+backCount+'|'+'r'+run_id+'}';
- var back_prod_id = '{m'+back_ticket_id+'p'+backCount+'|'+'r'+back_run_id+'}';
- if (back_line_id == '') {
- window.wxc.xcConfirm("请选择相关日期!", window.wxc.xcConfirm.typeEnum.info);
- return;
- }
- if (backCount == 0) {
- window.wxc.xcConfirm("购买票种数量为0!", window.wxc.xcConfirm.typeEnum.info);
- $('#save_btn').html('提交');
- return;
- }
- $.ajax({
- url:'./zz-fx/control.php',
- type: "post",
- data: {
- prod:go_prod_id,
- customer:peoInfo,
- ifback:1,
- back_prod:back_prod_id,
- type:"distribut_OrderUp"
- },
- dataType: "json",
- success: function (data) {
- if(data.code == 0){
- console.log(data);
- //替换返程票种数量信息
- showSuccessConmiteBackInfo(data);
- $('#save_btn').html('提交');
- }else{
- window.wxc.xcConfirm("预订失败,请重新下单!", window.wxc.xcConfirm.typeEnum.info);
- }
- },
- fail: function (data) {
- // 此处放失败后执行的代码
- }
- });
- }
- }
-
- //展示去程的成功提交信息
- function showSuccessConmiteInfo(data){
- center_show($('.commit_ticket_go_success'));
- var tempHTML = gosuccessHTML;
- var list = data.list;
- tempHTML=tempHTML.replace('[去程出发地]',data.start_area);
- tempHTML=tempHTML.replace('去程出发地站点',data.start_res);
- tempHTML=tempHTML.replace('[去程目的地]',data.end_area);
- tempHTML=tempHTML.replace('去程目的地站点',data.end_res);
- tempHTML=tempHTML.replace('[yyyy-mm-dd][mm:ss]',data.run_date+" "+data.run_time);
- tempHTML=tempHTML.replace('[座位等级]x[数量]',data.site_type+"×"+data.num);
- tempHTML=tempHTML.replace('[订单总额]',data.order_price);
- tempHTML=tempHTML.replace('[姓名]',data.customer_name);
- tempHTML=tempHTML.replace('[手机号]',data.customer_mobile);
- $('#commit_ticket_go_success').html(tempHTML);
- }
-
- //展示返程提交成功的返回信息
- function showSuccessConmiteBackInfo(data){
- center_show($('.commit_ticket_back_success'));
- var tempHTML = backsuccessHTML;
- var listgo = data.go_list;
- var listback = data.back_list;
- //去程
- tempHTML=tempHTML.replace('[去程出发地]',listgo.start_area);
- tempHTML=tempHTML.replace('去程出发地站点',listgo.start_res);
- tempHTML=tempHTML.replace('[去程目的地]',listgo.end_area);
- tempHTML=tempHTML.replace('去程目的地站点',listgo.end_res);
- tempHTML=tempHTML.replace('[yyyy-mm-dd][mm:ss]',listgo.run_date+" "+listgo.run_time);
- tempHTML=tempHTML.replace('[座位等级]x[数量]',listgo.site_type+"×"+listgo.num);
- //返程
- tempHTML=tempHTML.replace('[返程出发地]',listback.start_area);
- tempHTML=tempHTML.replace('返程出发地站点',listback.start_res);
- tempHTML=tempHTML.replace('[返程目的地]',listback.end_area);
- tempHTML=tempHTML.replace('返程目的地站点',listback.end_res);
- tempHTML=tempHTML.replace('[yyyy-mm-dd][mm:ss]',listback.run_date+" "+listback.run_time);
- tempHTML=tempHTML.replace('[座位等级]x[数量]',listback.site_type+"×"+listback.num);
-
- tempHTML=tempHTML.replace('[订单总额]',parseInt(listback.order_price)+parseInt(listback.order_price)+'元');
- tempHTML=tempHTML.replace('[姓名]',listback.customer_name);
- tempHTML=tempHTML.replace('[手机号]',listback.customer_mobile);
- $('#commit_ticket_back_success').html(tempHTML);
- }
-
-
-
-
-
-
-
- //得到url上的参数
- function getPar(par){
- var local_url = document.location.href;
- local_url = decodeURI(local_url);
- var get = local_url.indexOf(par +"=");
- if(get == -1){
- return false;
- }
- var get_par = local_url.slice(par.length + get + 1);
- var nextPar = get_par.indexOf("&");
- if(nextPar != -1){
- get_par = get_par.slice(0, nextPar);
- }
- return get_par;
- }
-
- //居中显示
- var tempDiv = null;
-
- function center_show(show_div) {
- tempDiv = show_div;
- //显示蒙板
- show_div.css('display', 'block');
- show_div.css('z-index', 10);
- show_div.css('background-color', 'white');
- show_div.css('position', 'fixed');
-
- var w = show_div.css('width');
- var h = show_div.css('height');
- w = w.substr(0, w.length - 2);
- h = h.substr(0, h.length - 2);
-
- var s_left = (window.innerWidth - w) / 2 + 'px';
- var s_top = (window.innerHeight - h) / 2 + 'px';
- show_div.css('left', s_left);
- show_div.css('top', s_top);
- $('.mask').css('display', 'block');
-
- }
- //点击蒙板
- function hide_all() {
- $('.mask').css('display', 'none');
- tempDiv.css('display', 'none');
- }
-
- //点击已经有的按钮
- function click_show_div(objName, self_obj) {
- var obj = $(objName);
- if (obj.css('display') == 'none') {
- center_show(obj);
- } else {
- obj.css('display', 'none');
- }
- }
- //点击了弹层关闭
- function click_cancel(father_name, self_name) {
- if (father_name) {
- var father = $(father_name);
- center_show(father);
- } else {
- $('.mask').css('display', 'none');
- }
- $(self_name).css('display', 'none');
- }
|