|
- src="jquery-2.2.4.min.js";
- language="JavaScript";
- //结算信息
- window.onload = function() {
- initHtml();
- }
- //点击了关闭
- 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 get_order_send_message(mes_url) {
- $.getJSON(mes_url, function(res_data) {
- if(res_data['code'] != "0") {
- $('#ht_tr_mes_one').html('');
- alert(res_data['info']);
- }
- if(res_data['message'].length <= 0) {
- $('#ht_tr_mes_one').html('');
- return;
- }
- $('.notifacation').html('短信通知:' + res_data['message'].length + '条');
- // $('#span_info_noti').html('短信通知:'+res_data['message'].length+'条');
- console.log("短信" + mes_url);
- console.log(res_data);
- var ht_tr_mes_one_str = $('#ht_tr_mes_one').prop('outerHTML');
- var ht_send_message_list = $('#ht_send_message_list');
- var order_send_message_arr = res_data['message'];
- if(order_send_message_arr == undefined) {
- return;
- }
- var mesHTML = '';
- for(var i = 0; i < order_send_message_arr.length; i++) {
- var dict = order_send_message_arr[i];
- var HTML = ht_tr_mes_one_str;
- HTML = HTML.replace('[内容]', dict['send_mobile'] + ":" + dict['message']);
- HTML = HTML.replace('[操作人]', dict['user_name']);
- HTML = HTML.replace('[发送时间]', dict['send_time']);
- mesHTML += HTML;
- }
- console.log(mesHTML);
- ht_send_message_list.html(mesHTML);
- });
- }
- //点击了三个固定的
- 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_two_show_div(father_name, self_name) {
- var father = $(father_name);
- var self = $(self_name);
- father.css('display', 'none');
- center_show(self);
- }
- //居中显示
- 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.screen.availWidth-w)/2 +"px";
- // var s_top=(window.screen.availHeight-h)/2 +'px';
- 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 getPar(par) {
- //获取当前URL
- var local_url = document.location.href;
- local_url = decodeURI(local_url);
- //获取要取得的get参数位置
- var get = local_url.indexOf(par + "=");
- if(get == -1) {
- return "";
- }
- //截取字符串
- var get_par = local_url.slice(par.length + get + 1);
- //判断截取后的字符串是否还有其他get参数
- var nextPar = get_par.indexOf("&");
- if(nextPar != -1) {
- get_par = get_par.slice(0, nextPar);
- }
- return get_par;
- }
- var orderid = getPar("order_id");
- //var status=getQueryString("status");
- var url = "./st-xm/Api/order_details_qianlvhs.php?order_id=" + orderid;
- $.getJSON(url, function(res_data) {
- var jieguo = res_data;
- console.log(url);
- console.log(jieguo);
- if(jieguo.code == 0) {
- var order_no = jieguo.order_no;
-
- var order_status = jieguo.order_status;
- var order_source = jieguo.order_source;
-
- var order_status = jieguo.order_status;
- var sales = jieguo.sales;
- var order_sub = jieguo.order_sub;
- $('.order_no').html("订单号:" + order_no);
- $('.order_status').html(order_status);
- $('.order_source').html("订单来源:" + order_source);
- $('.sales').html("销售方式:" + sales);
- if(order_status == '待支付') {
- time = jieguo.pay_second;
- ShowCountDown();
- setInterval("ShowCountDown()", 1000); //1000为1秒钟
- $('#order-ticket').addClass('hide');
- $('#order-complete').addClass('hide');
- $('#order-cancel').addClass('hide');
- $('#order-pay .order_sub_date').html(order_sub.order_sub_date);
- $('#order-pay .order_sub_time').html(order_sub.order_sub_time);
- $('#order-pay').css("display", "block");
- } else if(order_status == '已出票') {
- var order_pay_success = jieguo.order_pay_success;
- var order_ticket_success = jieguo.order_ticket_success;
- $('#order-pay').addClass('hide');
- $('#order-complete').addClass('hide');
- $('#order-cancel').addClass('hide');
- $('#order-ticket .order_sub_date').html(order_sub.order_sub_date);
- $('#order-ticket .order_sub_time').html(order_sub.order_sub_time);
- $('#order-ticket .order_pay_success_date').html(order_pay_success.order_pay_success_date);
- $('#order-ticket .order_pay_success_time').html(order_pay_success.order_pay_success_time);
- $('#order-ticket .order_ticket_success_date').html(order_ticket_success.order_ticket_success_date);
- $('#order-ticket .order_ticket_success_time').html(order_ticket_success.order_ticket_success_time);
- $('#order-ticket').css("display", "block");
- } else if(order_status == '已完成') {
- var order_pay_success = jieguo.order_pay_success;
- var order_ticket_success = jieguo.order_ticket_success;
- var order_travel_success = jieguo.order_travel_success;
- $('#order-pay').addClass('hide');
- $('#order-ticket').addClass('hide');
- $('#order-cancel').addClass('hide');
- $('#order-complete .order_sub_date').html(order_sub.order_sub_date);
- $('#order-complete .order_sub_time').html(order_sub.order_sub_time);
- $('#order-complete .order_pay_success_date').html(order_pay_success.order_pay_success_date);
- $('#order-complete .order_pay_success_time').html(order_pay_success.order_pay_success_time);
- $('#order-complete .order_ticket_success_date').html(order_ticket_success.order_ticket_success_date);
- $('#order-complete .order_ticket_success_time').html(order_ticket_success.order_ticket_success_time);
- $('#order-complete .order_travel_success_date').html(order_travel_success.order_travel_success_date);
- $('#order-complete').css("display", "block");
- } else if(order_status == '已取消') {
- var order_cancel = jieguo.order_cancel;
- $('#order-pay').addClass('hide');
- $('#order-ticket').addClass('hide');
- $('#order-complete').addClass('hide');
- $('#order-cancel .order_sub_date').html(order_sub.order_sub_date);
- $('#order-cancel .order_sub_time').html(order_sub.order_sub_time);
- $('#order-cancel .order_cancel_reason').html(order_cancel.order_cancel_reason);
- $('#order-cancel .order_cancel_date').html(order_cancel.order_cancel_date);
- $('#order-cancel .order_cancel_time').html(order_cancel.order_cancel_time);
- $('#order-cancel').css("display", "block");
- }
- var line_info = jieguo.line_info;
-
- var insertTable = "";
- for(var item in line_info) {
- insertTable += "<tr><td><a href='#'>" + line_info[item].line_code + "</a>" + line_info[item].line_name + "</td><td>" + line_info[item].start_area + "</td><td>" + line_info[item].end_area + "</td>";
- var start_time = '';
- var car_number = '';
- var seat = '';
- var ticket_name = '';
- var seat_number = '';
- var if_print = '';
- var if_meal = '';
- var if_bounce = '';
- var price = '';
- for(var item1 in line_info[item].tickets) {
- (line_info[item].tickets[item1].if_print == 0) ? aif_print = "否": aif_print = "是";
- (line_info[item].tickets[item1].if_meal == 0) ? aif_meal = "否": aif_meal = "是";
- (line_info[item].tickets[item1].if_bounce == 0) ? aif_bounce = "否": aif_bounce = "已退票";
- if(line_info[item].tickets[item1].if_bounce != 0) {
- start_time += "<div class='padding gray'>" + line_info[item].tickets[item1].start_time + "</div>";
- car_number += "<div class='padding gray'>" + line_info[item].tickets[item1].car_number + "</div>";
- seat += "<div class='padding gray'>" + line_info[item].tickets[item1].seat + "</div>";
- ticket_name += "<div class='padding gray'>" + line_info[item].tickets[item1].ticket_name + "</div>";
- seat_number += "<div class='padding gray'>" + line_info[item].tickets[item1].seat_number + "</div>";
- if_print += "<div class='padding gray'>" + aif_print + "</div>";
- if_meal += "<div class='padding gray'>" + aif_meal + "</div>";
- if_bounce += "<div class='padding gray'>" + aif_bounce + "</div>";
- price += "<div class='padding gray' style='color:#FF9900;'><span style='font-family:Arial;'>¥</span>" + line_info[item].tickets[item1].price + "</div>";
- } else {
- start_time += "<div class='padding'>" + line_info[item].tickets[item1].start_time + "</div>";
- car_number += "<div class='padding'>" + line_info[item].tickets[item1].car_number + "</div>";
- seat += "<div class='padding'>" + line_info[item].tickets[item1].seat + "</div>";
- ticket_name += "<div class='padding'>" + line_info[item].tickets[item1].ticket_name + "</div>";
- seat_number += "<div class='padding'>" + line_info[item].tickets[item1].seat_number + "</div>";
- if_print += "<div class='padding'>" + aif_print + "</div>";
- if_meal += "<div class='padding'>" + aif_meal + "</div>";
- if_bounce += "<div class='padding'>" + aif_bounce + "</div>";
- price += "<div class='padding' style='color:#FF9900;'><span style='font-family:Arial;'>¥</span>" + line_info[item].tickets[item1].price + "</div>";
- }
- }
-
- insertTable += "<td>" + start_time + "</td><td>" + car_number + "</td><td>" + seat + "</td><td style='display:none;'>" + ticket_name + "</td><td>" + seat_number + "</td><td>" + if_print + "</td><td>" + if_meal + "</td><td>" + if_bounce + "</td><td>" + price + "</td></tr>";
- }
- insertTable += "<tr style='border-top:1px solid #797979;'><td colspan='9'></td><td>总额</td><td style='color:#FF9900;'><span style='font-family:Arial;'>¥</span>" + jieguo.total_rmb + "</td></tr>";
- //console.log(insertTable);
- $('#sample-table-1 tbody').html(insertTable);
-
- //循环添加乘客信息
- // var customer_info=jieguo['customer_info'];
- // var HTML='';
- // for (var i=0,m=customer_info.length;i<m;i++) {
- // var dict=customer_info[i];
- // var rowIndex=i/4;
- // var colIndex=i%4;
- // var tempHTML='';
- // if(i>3 && colIndex==0){
- // tempHTML+='<div class="col-sm-3" style="height: 84px;border-right:1px solid #ccc;padding-left:20px;overflow:hidden">';
- // tempHTML+='<p id="customer_name"></p>';
- // tempHTML+='<p id="customer_mobile"></p>';
- // tempHTML+='<p id="customer_mobile"></p>';
- // tempHTML+='</div>';
- // }
- // tempHTML+='<div class="col-sm-3" style="height: 84px;border-right:1px solid #ccc;padding-left:20px;overflow:hidden">';
- // tempHTML+='<p id="customer_name">联系人:'+dict['CUSTOMER_NAME']+'</p>';
- // tempHTML+='<p id="customer_mobile">手机:'+dict['CUSTOMER_MOBILE']+'</p>';
- // tempHTML+='<p id="customer_mobile">'+dict['TYPE_NAME']+':'+dict['CUSTOMER_ID_NO']+'</p>';
- // tempHTML+='</div>';
- // HTML+=tempHTML;
- // }
- // HTML+='<div id="fuelux-wizard" class="row-fluid col-sm-6" data-target="#step-container"></div>';
- // HTML+='<div style="clear:both;"></div>';
- // $('#customer').html(HTML);
-
-
- $('#customer_name').html("联系人:" + jieguo['customer_info'][0]['CUSTOMER_NAME']);
- $('#customer_mobile').html("手机号:" + jieguo['customer_info'][0]['CUSTOMER_MOBILE']);
- $('#customer_id').html(jieguo['customer_info'][0]['TYPE_NAME'] + ":" + jieguo['customer_info'][0]['CUSTOMER_ID_NO']);
- $('#order_remark').val(jieguo['customer_info'][0]['CUSTOMER_MEMO']);
- var driver=jieguo['driver'][0];
- $('#send_bus_no').html("车牌号:" + driver['bus_no']);
- $('#send_driver_name').html("司机姓名:" + driver['driver_name']);
- $('#send_driver_mobile').html("司机姓名:" + driver['driver_mobile']);
-
- $("#xm_show").css("display", "block");
-
- var msg_url = "./st-xm/Api/order_details_qianlvhs.php?method=get_msg&order_id=" + orderid;
- get_order_send_message(msg_url);
-
- $("#cancel").click(function() {
- var cancel = window.prompt("请输入取消原因","");
- $("#cancel").attr("disabled", "disabled");
- var url = "./st-xm/Api/order_list.php?method=cancelOrder&reason="+cancel+"&clock="+CurrentTime()+"&order_id=" + order_no;
- $.getJSON(url, function(res_data) {
- if(res_data['code'] != "0") {
- alert(res_data['info']);
- }
- alert('取消成功');
- location.replace(location.href);
- })
- });
- } else {
- $("#xm_show").html('');
- alert(jieguo.info);
-
- }
- });
-
-
-
-
-
- //时间倒计时
- function ShowCountDown() {
-
- time = Math.floor(time - 1);
- var leftsecond = time;
- minute = Math.floor((leftsecond) / 60);
- var second = Math.floor(leftsecond - minute * 60);
- cc = document.getElementById("countdown");
-
- if(time < 0) {
- return;
- }
- if(second < 10 && minute > 9) {
- cc.innerHTML = minute + "分0" + second + "秒";
- } else if(second < 10 && minute < 10) {
- cc.innerHTML = '0' + minute + "分:0" + second + "秒";
- } else if(second > 9 && minute < 10) {
- cc.innerHTML = '0' + minute + "分:" + second + "秒";
- } else {
- cc.innerHTML = minute + "分:" + second + "秒";
- }
- }
-
- //订单详情页结算信息
- function initHtml() {
-
- }
- //获取当前时间
- function CurrentTime() {
- var now = new Date();
-
- var year = now.getFullYear(); //年
- var month = now.getMonth() + 1; //月
- var day = now.getDate(); //日
-
- var hh = now.getHours(); //时
- var mm = now.getMinutes(); //分
- var ss = now.getSeconds(); //秒
-
- var clock = year + "-";
-
- if(month < 10)
- clock += "0";
-
- clock += month + "-";
-
- if(day < 10)
- clock += "0";
-
- clock += day + " ";
-
- if(hh < 10)
- clock += "0";
-
- clock += hh + ":";
- if (mm < 10) clock += '0';
- clock += mm + ":";
-
- if (ss < 10) clock += '0';
- clock += ss;
- return(clock);
- }/**
- * Created by Administrator on 2016/9/7.
- */
- /**
- * Created by Administrator on 2016/10/11.
- */
|