|
- //上下车信息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 go_price = '';
- //获取是否支付权限
- var pay_status = getStorage("pay_status");
-
- //返程相关
- var back_line_id = '';
- var back_run_id = '';
- var back_ticket = '';
- var back_ticket_id = '';
-
-
- var line_id = '';
- var run_id = '';
- var ticket = '';
- var line_type = '';
- var ticket_id = '';
- var start_area_id = '';
- var end_area_id = '';
- //checkbox选中状态
- var ifcheck = 0;
- //记录乘车人个数
- var passenger = 0;
- //去程和往返的交集库存
- var stockCount = 0;
- //定义一个 只记录去程库存 一般取消返程选中时 重置去程库存
- var stockCountTemp = 0;
- //定义一个back_back_id 记录绑定的back_id
- var back_back_id = '';
- //记录出发日期
- var go_data = '';
-
-
- 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",
- operate: 'initial'
- },
- dataType: "json",
- success: function (data) {
- if (data.code == 0) {
- console.log(data);
- //去程信息的数据交互
- goInfoReloadData(data.list);
- }
- },
- fail: function (data) {
- // 此处放失败后执行的代码
- }
- });
- }
- //去程信息的数据交互
- function goInfoReloadData(data) {
- start_area_id = data.start_area_id;
- end_area_id = data.end_area_id;
- line_type = data.line_type;
-
- var time_html = $('#go_time').html();
- time_html = time_html.replace('[出发日期]', data.run_date);
- $('#go_time').html(time_html);
- go_data = data.date;
- 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_down_html = up_down_html.replace('[start_area_id]', data.start_area_id);
- up_down_html = up_down_html.replace('[end_area_id]', data.end_area_id);
- $('#up_and_down_station').html(up_down_html);
-
- //站点填充
- var start_station_list = data.start_res_arr;
- var end_station_list = data.end_res_arr;
- var start_res_id = data.select_start_res.res_id;
- var end_res_id = data.select_end_res.res_id;
- addStationHtml(start_station_list, start_res_id, '#start_area_station');
- addStationHtml(end_station_list, end_res_id, '#end_area_station');
-
- run_id = data.run_id;
- line_id = data.line_id;
- bus_type = data.bus_type;
- //犹豫异步加载的问题 所以只能在展示数据后 继续调用票种价格等相关信息
-
- showCountInfoByGo(data.ticket_info);
- }
-
- /**
- * 填充站点列表
- * @param start_station_list
- * @param start_res_id
- */
- function addStationHtml(station_list, start_res_id, div_id) {
- //alert(123);
- var station_html = '';
- for (var i = 0; i < station_list.length; i++) {
- if (station_list[i].res_id == start_res_id) {
- var tempHTML = '<option value="0" selected ="selected">[出发地站点]</option>';
- } else {
- var tempHTML = '<option value="0">[出发地站点]</option>';
- }
- tempHTML = tempHTML.replace('[出发地站点]', station_list[i].res_name + '(' + station_list[i].res_time + ')');
- tempHTML = tempHTML.replace('0', station_list[i].res_id);
- station_html += tempHTML;
- }
- $(div_id).html(station_html);
- }
-
-
- //选择出发站点
- 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,
- start_res_id: start_id,
- end_area_id: end_area_id,
- back: 1,
- type: "retrieval_site",
- operate: 'start',
- line_type: line_type
- },
- dataType: "json",
- success: function (data) {
- if (data.code == 0) {
- console.log(data);
- $("#ifback").attr("checked", false);
- ifbackSelected(0);
- //替换去程票种数量信息
- var end_station_list = data.list.end_res_arr;
- var end_res_id = data.list.select_end_res.res_id;
-
- addStationHtml(end_station_list, end_res_id, '#end_area_station');
- showCountInfoByGo(data.list.ticket_info);
- }
- },
- 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,
- start_res_id: start_id,
- end_res_id: end_id,
- back: 1,
- type: "retrieval_site",
- operate: 'end',
- line_type: line_type
- },
- dataType: "json",
- success: function (data) {
- if (data.code == 0) {
- console.log(data);
- $("#ifback").attr("checked", false);
- ifbackSelected(0);
- //替换去程票种数量信息
- showCountInfoByGo(data.list.ticket_info);
- }
- },
- fail: function (data) {
- // 此处放失败后执行的代码
- }
- });
- }
- //替换去程票种数量信息
- function showCountInfoByGo(data) {
- //alert(data.prod_price);
- var html1 = '';
- var temp1 = count_html;
- go_price = data.price;
- temp1 = temp1.replace('[座位等级]', data.seat_type_name);
- temp1 = temp1.replace('[价格]', data.price);
- //数量
- var maxCount = data.stock > 20 ? 20 : data.stock;
- 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));
- 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 ifbackSelected(value) {
- if (value == true) {
- $('#ifback').val('1');
-
- $('#calendar').show();
- $('#has_noback').hide();
- $('#has_back').show();
- $('#list_info_back').show();
- $('#list_info').hide();
- $('#list_info_back').hide();
- ifcheck = 1;
- 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: {
- line_type: line_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].run_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) {
- var go_run_id = run_id;
- var go_start_res_id = $('#start_area_station').val();
- var go_end_res_id = $('#end_area_station').val();
- $.ajax({
- url: './zz-fx/control.php',
- type: "post",
- data: {
- go_run_id:go_run_id,
- go_start_res_id:go_start_res_id,
- go_end_res_id:go_end_res_id,
- run_id: bar_content,
- start_area_id: back_area_start,
- end_area_id: back_area_end,
- back: 2,
- type: "retrieval_site",
- operate: 'initial'
- },
- 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);
- html += temp;
- $('#back_info').html(html);
-
- //站点填充
- var start_station_list = data.list.start_res_arr;
- var end_station_list = data.list.end_res_arr;
- var start_res_id = data.list.select_start_res.res_id;
- var end_res_id = data.list.select_end_res.res_id;
- addStationHtml(start_station_list, start_res_id, '#start_area_station_back');
- addStationHtml(end_station_list, end_res_id, '#end_area_station_back');
-
- back_line_id = data.list.line_id;
- back_run_id = data.list.run_id;
- //============展示返程的票种价格数量信息
- showCountInfoByBack(data.list.ticket_info);
- }
- }
-
-
- },
- fail: function (data) {
- // 此处放失败后执行的代码
- }
- });
- }
-
- //替换返程票种数量信息
- function showCountInfoByBack(data) {
- var html1 = '';
- var temp1 = count_back_html;
-
- var json_cstr = JSON.stringify(data);
-
- $('#list_info_back').attr('data_str',json_cstr);
- temp1 = temp1.replace('[座位等级]', data.seat_type_name);
- temp1 = temp1.replace('[价格]', parseFloat(data.price));
- //数量
- var maxCount = data.stock > 20 ? 20 : data.stock;
- 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);
- $('#back_total').html(totalPrice);
- back_ticket_id = data.ticket_id;
- $('#list_info_back').show();
- }
-
- //返程出发站点的更改
- function selectBackStartStationID() {
- var go_run_id = run_id;
- var go_start_res_id = $('#start_area_station').val();
- var go_end_res_id = $('#end_area_station').val();
-
- var start_res_id = $('#start_area_station_back').val();
- var end_area_id = getPar('start_area_id');
- $.ajax({
- url: './zz-fx/control.php',
- type: "post",
- data: {
- go_run_id:go_run_id,
- go_start_res_id:go_start_res_id,
- go_end_res_id:go_end_res_id,
- run_id: back_run_id,
- start_res_id: start_res_id,
- end_area_id: end_area_id,
- line_type:line_type,
- back: 2,
- type: "retrieval_site",
- operate: 'start'
- },
- dataType: "json",
- success: function (data) {
- if (data.code == 0) {
- console.log(data);
- //替换返程票种数量信息
- var end_station_list = data.list.end_res_arr;
- var end_res_id = data.list.select_end_res.res_id;
-
- addStationHtml(end_station_list, end_res_id, '#end_area_station_back');
- showCountInfoByBack(data.list.ticket_info);
- }
- },
- fail: function (data) {
- // 此处放失败后执行的代码
- }
- });
- }
-
- //返程目的地站点的更改
- function selectBackEndStationID() {
- var go_run_id = run_id;
- var go_start_res_id = $('#start_area_station').val();
- var go_end_res_id = $('#end_area_station').val();
-
- var start_res_id = $('#start_area_station_back').val();
- var end_res_id = $('#end_area_station_back').val();
- $.ajax({
- url: './zz-fx/control.php',
- type: "post",
- data: {
- go_run_id:go_run_id,
- go_start_res_id:go_start_res_id,
- go_end_res_id:go_end_res_id,
- run_id: back_run_id,
- start_res_id: start_res_id,
- end_res_id: end_res_id,
- line_type:line_type,
- back: 2,
- type: "retrieval_site",
- operate: 'end'
- },
- dataType: "json",
- success: function (data) {
- if (data.code == 0) {
- console.log(data);
- //替换返程票种数量信息
- showCountInfoByBack(data.list.ticket_info);
- }
- },
- 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+'}';
-
- if (ifcheck == 1) {
- var dataValue = $('#id-date-picker-1').val();
- if (dataValue < go_data) {
- window.wxc.xcConfirm("返程日期不能低于出发日期!", window.wxc.xcConfirm.typeEnum.info);
- return;
- }
- }
-
-
- //联系人信息
- 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('提交中...');
- $('#save_btn').removeAttr('onclick');
- 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();
- //为导出功能使用
- if (!pass_name_str && !pass_tel_str) {
- continue;
- } else {
- if (pass_name_str == undefined) {
- pass_name_str = '-';
- }
- if (pass_tel_str == undefined) {
- pass_tel_str = '-';
- }
- var addstr = pass_name_str + '*' + pass_tel_str + '/';
- tempStr = tempStr + addstr;
- }
- }
- tempStr = tempStr.substring(0, tempStr.length - 1);
- console.log(tempStr);
- var peoInfo = '{' + aname + ',' + tel + ',' + 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 tic_count = $('#count_station').val();
- var tic_price = $('#price').html();
- var ticket_info = '{1,' + run_id + ',' + ticket_id + ',' + tic_price + ',' + tic_count + '}';
- var first_ticket_id = ticket_id;
- } else {
- var backCount = $('#back_count_station').val();
- var json_str = $('#list_info_back').attr('data_str');
- var ticket_data = JSON.parse(json_str);
- var go_ticket_info = '{1,' + ticket_data.go_run_id + ',' + ticket_data.go_ticket_id + ',' + ticket_data.go_discount_price + ',' + backCount + '}';
- var back_ticket_info = '{2,' + ticket_data.back_run_id + ',' + ticket_data.back_ticket_id + ',' + ticket_data.back_discount_price + ',' + backCount + '}';
- var ticket_info = go_ticket_info + back_ticket_info;
- var first_ticket_id = ticket_data.go_ticket_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: {
- ticket_info: ticket_info,
- customer_info: peoInfo,
- run_id:run_id,
- first_ticket_id:first_ticket_id,
- type: "distribut_OrderUp1"
- },
- dataType: "json",
- success: function (data) {
- if (data.code == 0) {
- setStorJson("submite_success", data);
- console.log(data);
- //替换返程票种数量信息
- if (ifcheck == 0){
- showSuccessConmiteInfo(data.go_list)
- }else{
- showSuccessConmiteBackInfo(data);
- }
-
- $('#save_btn').html('提交');
-
- } else {
- window.wxc.xcConfirm(data.info, 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);
- if (pay_status == 0) {
- $("#go_pay").show();
- $("#go_back_pay").show();
- } else {
- $("#go_pay").hide();
- $("#go_back_pay").hide();
- }
- }
-
- //展示返程提交成功的返回信息
- 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(listgo.order_price) + parseInt(listback.order_price) + '元');
- tempHTML = tempHTML.replace('[姓名]', listback.customer_name);
- tempHTML = tempHTML.replace('[手机号]', listback.customer_mobile);
- $('#commit_ticket_back_success').html(tempHTML);
- if (pay_status == 0) {
- $("#go_pay").show();
- $("#go_back_pay").show();
- } else {
- $("#go_pay").hide();
- $("#go_back_pay").hide();
- }
- }
-
-
- //得到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');
- }
-
- function go_pay() {
- window.open("pay_code_bus.html")
- }
|