|
- //每页显示的数据个数
- var pagesize = 10;
- var tttHTML = '';
- var order_status = 0;
-
- var goHTML = '';
- var backHTML = '';
- var gosuccessHTML = '';
- var backsuccessHTML = '';
-
-
- window.onload = function (){
- iflogin();
- var paceker1 = getDateTime(0);
- $('#id-date-picker-2').val(paceker1);
- //for (var i = 0 ; i < 6 ; i ++) {
- paceker1 = before(paceker1)
- //}
- $('#id-date-picker-1').val(paceker1);
-
- $('#order_style_parent').children().removeClass('order_style_selected');
- var cur = "";
- var currpage = getPar("currpage");
- var time_style = '';
- var start_time = '';
- var end_time = '';
- var start_area = '';
- var end_area = '';
- var product_type = '';
- //更多查询
- var order_id = '';
- var condition = '';
- // var order_status = '';
- if(!currpage){
- cur = 1;
- time_style = $('#order_time').val();
-
- start_time = $('#id-date-picker-1').val();
-
- end_time = $('#id-date-picker-2').val();
-
- start_area = $('#start_area').val();
-
- end_area = $('#end_area').val();
-
- product_type = $('#order_product').val();
-
- order_id = $('#order_condition').val();
-
- condition = $('#more_search_input').val();
-
- order_status = order_status;
-
- switch (order_status){
- case 0:
- $('#all').addClass('order_style_selected');
- break;
- case 146:
- $('#out_ticket').addClass('order_style_selected');
- break;
- case 147:
- $('#all').addClass('order_style_selected');
- break;
- case 148:
- $('#cansel').addClass('order_style_selected');
- break;
- default:
- break;
- }
- // order_status = '';
-
- }else{
- cur = currpage;
- time_style = getPar('time_style');
- $('#order_time').val(time_style);
-
- start_time = getPar('start_time');
- $('#id-date-picker-1').val(start_time);
-
- end_time = getPar('end_time');
- $('#id-date-picker-2').val(end_time);
-
- start_area = getPar('start_area');
- $('#start_area').val(start_area);
-
- end_area = getPar('end_area');
- $('#end_area').val(end_area);
-
- product_type = getPar('product_type');
- $('#order_product').val(product_type);
-
- order_id = getPar('order_id');
- $('#order_condition').val(order_id);
-
- more_search_input = getPar('more_search_input');
- $('#more_search_input').val(more_search_input);
-
- order_status = getPar('order_status');
- switch (order_status){
- case '0':
- $('#all').addClass('order_style_selected');
- break;
- case '146':
- $('#out_ticket').addClass('order_style_selected');
- break;
- case '147':
- $('#all').addClass('order_style_selected');
- break;
- case '148':
- $('#cansel').addClass('order_style_selected');
- break;
- default:
- break;
- }
-
- }
- tttHTML = $('#list').html();
- searchBtnDidClicked(cur,time_style,start_time,end_time,start_area,end_area,product_type,order_id,more_search_input,order_status);
-
- goHTML = $('#refund_ticket_go').html();
-
- gosuccessHTML = $('#refund_ticket_go_success').html();
-
- backHTML = $('#refund_ticket_back').html();
-
- backsuccessHTML = $('#refund_ticket_back_success').html();
- }
-
-
-
-
- //查询按钮
- function searchBtnDidClicked(cur,time_style,start_time,end_time,start_area,end_area,product_type,order_id,more_search_input,order_status1){
-
- if(!cur){
- cur = 1;
- }
- if(!time_style||!start_time||!end_time||!start_area||!end_area||!product_type||!order_id||!more_search_input){
- time_style = $('#order_time').val();
-
- start_time = $('#id-date-picker-1').val();
-
- end_time = $('#id-date-picker-2').val();
-
- start_area = $('#start_area').val();
-
- end_area = $('#end_area').val();
-
- product_type = $('#order_product').val();
-
- order_id = $('#order_condition').val();
-
- more_search_input = $('#more_search_input').val();
-
- order_status = order_status;
- }
-
- $.ajax({
- url:'./zz-fx/control.php', //请求地址
- type: "post", //请求方式
- data:{
- type:"distribut_OrderList",
- time_style:time_style,
- start_time:start_time,
- end_time:end_time,
- start_area:start_area,
- end_area:end_area,
- product_type:product_type,
- order_id:order_id,
- condition:more_search_input,
- order_status:order_status,
- currpage:cur,
- pagesize:pagesize
- },
- async:false,
- dataType: "json",
- success: function (data) {
- if(data.code == 0){
- console.log(data.info);
- var sum = data.list_count;
- if (sum==0) {
- window.wxc.xcConfirm("没有相关订单信息!", window.wxc.xcConfirm.typeEnum.info);
- }
- var tag = "test";
- var sendurl = './order_list.html?time_style='+time_style+'&start_time='+start_time+'&end_time='+end_time+'&start_area='+start_area+'&end_area='+end_area+'&product_type='+product_type+'&order_id='+order_id+'&more_search_input='+more_search_input+'&order_status='+order_status;
- getPager(sendurl, sum, cur, pagesize,tag,'currpage');
-
- reloadInfo(data);
-
- }
- },
- fail: function (date) {
- window.wxc.xcConfirm("数据加载失败!", window.wxc.xcConfirm.typeEnum.info);
- }
- });
- if(cur!=1){
-
- time_style = getPar('time_style');
- $('#order_time').val(time_style);
-
- start_time = getPar('start_time');
- $('#id-date-picker-1').val(start_time);
-
- end_time = getPar('end_time');
- $('#id-date-picker-2').val(end_time);
-
- start_area = getPar('start_area');
- $('#start_area').val(start_area);
-
- end_area = getPar('end_area');
- $('#end_area').val(end_area);
-
- product_type = getPar('product_type');
- $('#order_product').val(product_type);
-
- order_id = getPar('order_id');
- $('#order_condition').val(order_id);
-
- more_search_input = getPar('more_search_input');
- $('#more_search_input').val(more_search_input);
-
- order_status = order_status1;
- }
- }
-
- //订单状态的筛选
- function orderStyleDidClicked(selectID){
- $('#order_style_parent').children().removeClass('order_style_selected');
- $('#'+selectID).addClass('order_style_selected');
- switch (selectID){
- case "all":
- order_status = 0;
- searchBtnDidClicked();
- break;
- case "out_ticket":
- order_status = 146;
- searchBtnDidClicked();
- break;
- case "out_go":
- order_status = 147;
- searchBtnDidClicked();
- break;
- default:
- order_status = 148;
- searchBtnDidClicked();
- break;
- }
- }
-
- //加载数据
- function reloadInfo(data){
- console.log(data);
- var list = data.searchInfo;
- //console.log(tttHTML)
- var newHTML='';
- for(var i=0;i<list.length;i++){
- var tempHTML=tttHTML;
- tempHTML=tempHTML.replace('[订单编号]',list[i].order_id);
- tempHTML=tempHTML.replace('[下单时间]',list[i].create_time);
- tempHTML=tempHTML.replace('[预订产品]',list[i].product_info);
- tempHTML=tempHTML.replace('[出发时间]',list[i].run_time);
- tempHTML=tempHTML.replace('[联系人]',list[i].customer_info);
- tempHTML=tempHTML.replace('[订单金额]',list[i].order_pay);
- tempHTML=tempHTML.replace('[支付方式]',list[i].order_pay_type);
- tempHTML=tempHTML.replace('[状态]',list[i].order_status);
- tempHTML=tempHTML.replace('[order_pay_style]','order_pay_style'+list[i].order_id);
- tempHTML=tempHTML.replace('[use]','use'+list[i].order_id);
- tempHTML=tempHTML.replace('[order_id]',list[i].order_id);
- tempHTML=tempHTML.replace('[ifdisney]',list[i].ifdisney);
-
- var nowDay = getDateTime(0);
- var nowHour = getDateTime(2);
- var newTimeStr = nowDay+" "+nowHour
- var ifTime = judgFailTime(list[i].run_time);
- //现在时间转换
-
- var time = new Date(newTimeStr.replace(/-/g, "/"));
- // var time = new Date(newTimeStr.replace("-","/"));
- time.setMinutes(time.getMinutes() - 0, time.getSeconds(), 0);
- // var subTime = ifTime.toString();
- // subTime = subTime.substring(16,21);
- //
- // var order_day = list[i].run_time.substring(0,10);
- // var now_day = getDateTime(0);
- // var now_hour = getDateTime(2);
- // now_hour = now_hour.substring(0,5);
- // var end_date1 = new Date(subTime);
- // var end_date2 = new Date(now_hour);
- if (list[i].go_pay == 0) {
- tempHTML=tempHTML.replace('[操作]','-');
- }else if(list[i].go_pay == 1){
- var str = '<span order_id="'+list[i].order_id+'" ifdisney="'+list[i].ifdisney+'" class="goto_pay" style="cursor:pointer;color:rgb(66,142,210)">去支付</span>';
- tempHTML=tempHTML.replace('[操作]',str);
- }else if(list[i].go_pay == 2){
- var str = '<span onclick="refundTicket('+list[i].order_id+')" style="cursor:pointer;color:rgb(66,142,210)">退票<input id="ifbackstyle'+list[i].order_id+'" type="hidden" value="'+list[i].ifback+'"></span>';
- tempHTML=tempHTML.replace('[操作]',str);
- }
-
-
- // time = format(time,'yyyy年MM月dd日 HH时mm分');
- // ifTime = format(ifTime,'yyyy年MM月dd日 HH时mm分');
- // alert(time);
- // alert(ifTime);
-
-
- //
- // if (time>ifTime) {
- // var str = '<span style="color:gray">退票</span>';
- // tempHTML=tempHTML.replace('[操作]',str);
- // } else{
- // var str = '<span onclick="refundTicket('+list[i].order_id+')" style="cursor:pointer;color:rgb(66,142,210)">退票<input id="ifbackstyle'+list[i].order_id+'" type="hidden" value="'+list[i].ifback+'"></span>';
- // tempHTML=tempHTML.replace('[操作]',str);
- // }
-
- newHTML+=tempHTML;
- }
- $('#list').html(newHTML);
- $(".goto_pay").click(function(){
- var order_id = $(this).attr("order_id");
- var ifdisney = $(this).attr("ifdisney");
- var submite_success = {
- order_id : order_id,
- ifdisney : ifdisney
- }
- if(ifdisney==0){
- alert(1)
- setStorJson('submite_success',submite_success);
- window.open("pay_code_bus.html")
- }else{
- alert(submite_success)
- console.log(submite_success)
- setStorJson('disney_success',submite_success);
- window.open("pay_code.html")
- }
-
- })
-
- }
-
- var format = function(time, format){
- var t = new Date(time);
-
- var tf = function(i){return (i < 10 ? '0' : '') + i};
- return format.replace(/yyyy|MM|dd|HH|mm|ss/g, function(a){
- switch(a){
- case 'yyyy':
- return tf(t.getFullYear());
- break;
- case 'MM':
- return tf(t.getMonth() + 1);
- break;
- case 'mm':
- return tf(t.getMinutes());
- break;
- case 'dd':
- return tf(t.getDate());
- break;
- case 'HH':
- return tf(t.getHours());
- break;
- case 'ss':
- return tf(t.getSeconds());
- break;
- }
- })
- }
-
-
- //时间加减
- function judgFailTime(agoTime) {
- var x = agoTime; // 取得的TextBox中的时间
- var time = new Date(x.replace(/-/g, "/"));
-
- var b = 30; //分钟数
- time.setMinutes(time.getMinutes() - b, time.getSeconds(), 0);
- return(time);
- }
-
- //点击退票
- function refundTicket(orderId){
- var ifback = $('#ifbackstyle'+orderId).val();
- $.ajax({
- url:'./zz-fx/control.php', //请求地址
- type: "post", //请求方式
- data:{
- type:"distribut_DropOrder",
- order_id:orderId,
- iffirst:1
- },
- async:false,
- dataType: "json",
- success: function (data) {
- if(data.code == 0){
- console.log(data);
- //展示退单信息
- showRefundOrder(data.ifback,data,orderId);
- }else{
- window.wxc.xcConfirm(data.massge, window.wxc.xcConfirm.typeEnum.info);
- }
- },
- fail: function (date) {
- window.wxc.xcConfirm("数据加载失败!", window.wxc.xcConfirm.typeEnum.info);
- }
- });
- }
-
-
- //展示退单信息
- function showRefundOrder(ifback,data,orderId){
- if (ifback == 0) {
- //去程退票
- center_show($('.refund_ticket_go'));
- refundOrderGo(data,orderId,ifback);
- } else{
- //往返退票
- center_show($('.refund_ticket_back'));
- refundOrderBack(data,orderId,ifback);
- }
- }
-
- //填充去程退单数据
- function refundOrderGo(data,orderId,ifback){
- var tempHTML = goHTML;
- var list = data.list;
- tempHTML=tempHTML.replace('[去程出发地]',list.start_station);
- tempHTML=tempHTML.replace('去程出发地站点',list.start_res_name);
- tempHTML=tempHTML.replace('[去程目的地]',list.end_station);
- tempHTML=tempHTML.replace('去程目的地站点',list.end_res_name);
- tempHTML=tempHTML.replace('[yyyy-mm-dd][mm:ss]',list.run_time);
- tempHTML=tempHTML.replace('[座位等级]x[数量]',list.count);
- tempHTML=tempHTML.replace('[订单总额]',list.order_price);
- tempHTML=tempHTML.replace('[true]',orderId);
- tempHTML=tempHTML.replace('[0]',ifback);
- $('#refund_ticket_go').html(tempHTML);
- }
-
- //填充往返退单数据
- function refundOrderBack(data,orderId,ifback){
- var tempHTML = backHTML;
- var listgo = data.list.to;
- var listback = data.list.back;
- //去程
- tempHTML=tempHTML.replace('[去程出发地]',listgo.start_station);
- tempHTML=tempHTML.replace('去程出发地站点',listgo.start_res_name);
- tempHTML=tempHTML.replace('[去程目的地]',listgo.end_station);
- tempHTML=tempHTML.replace('去程目的地站点',listgo.end_res_name);
- tempHTML=tempHTML.replace('[yyyy-mm-dd][mm:ss]',listgo.run_time);
- tempHTML=tempHTML.replace('[座位等级]x[数量]',listgo.count);
- //返程
- tempHTML=tempHTML.replace('[返程出发地]',listback.start_station);
- tempHTML=tempHTML.replace('返程出发地站点',listback.start_res_name);
- tempHTML=tempHTML.replace('[返程目的地]',listback.end_station);
- tempHTML=tempHTML.replace('返程目的地站点',listback.end_res_name);
- tempHTML=tempHTML.replace('[yyyy-mm-dd][mm:ss]',listback.run_time);
- tempHTML=tempHTML.replace('[座位等级]x[数量]',listback.count);
-
- tempHTML=tempHTML.replace('[订单总额]',parseInt(listgo.order_price)+parseInt(listback.order_price)+'元');
- tempHTML=tempHTML.replace('[true]',orderId);
- tempHTML=tempHTML.replace('[0]',ifback);
- $('#refund_ticket_back').html(tempHTML);
- }
-
- //展示成功退单信息
- function showRefundOrderSuccess(back,data){
- if (back == 0) {
- //去程成功退票填充
- center_show($('.refund_ticket_go_success'));
- refundOrderGoSuccess(data);
- } else{
- //往返成功退票填充
- center_show($('.refund_ticket_back_success'));
- refundOrderBackSuccess(data);
- }
- }
-
-
- //去程成功退票填充
- function refundOrderGoSuccess(data){
- var tempHTML = gosuccessHTML;
- var list = data.list;
- tempHTML=tempHTML.replace('[去程出发地]',list.start_station);
- tempHTML=tempHTML.replace('去程出发地站点',list.start_res_name);
- tempHTML=tempHTML.replace('[去程目的地]',list.end_station);
- tempHTML=tempHTML.replace('去程目的地站点',list.end_res_name);
- tempHTML=tempHTML.replace('[yyyy-mm-dd][mm:ss]',list.run_time);
- tempHTML=tempHTML.replace('[座位等级]x[数量]',list.count);
- tempHTML=tempHTML.replace('[订单总额]',list.order_price);
- $('#refund_ticket_go_success').html(tempHTML);
- // location.replace(location.href);
- $('#order_pay_style'+data.order_id).html('已取消');
- $('#use'+data.order_id).html('-');
- if (data.back_order_id!=null) {
- $('#order_pay_style'+data.back_order_id).html('已取消');
- $('#use'+data.back_order_id).html('-');
- }
- }
-
- //往返成功退票填充
- function refundOrderBackSuccess(data){
- var tempHTML = backsuccessHTML;
- var listgo = data.list.to;
- var listback = data.list.back;
- //去程
- tempHTML=tempHTML.replace('[去程出发地]',listgo.start_station);
- tempHTML=tempHTML.replace('去程出发地站点',listgo.start_res_name);
- tempHTML=tempHTML.replace('[去程目的地]',listgo.end_station);
- tempHTML=tempHTML.replace('去程目的地站点',listgo.end_res_name);
- tempHTML=tempHTML.replace('[yyyy-mm-dd][mm:ss]',listgo.run_time);
- tempHTML=tempHTML.replace('[座位等级]x[数量]',listgo.count);
- //返程
- tempHTML=tempHTML.replace('[返程出发地]',listback.start_station);
- tempHTML=tempHTML.replace('返程出发地站点',listback.start_res_name);
- tempHTML=tempHTML.replace('[返程目的地]',listback.end_station);
- tempHTML=tempHTML.replace('返程目的地站点',listback.end_res_name);
- tempHTML=tempHTML.replace('[yyyy-mm-dd][mm:ss]',listback.run_time);
- tempHTML=tempHTML.replace('[座位等级]x[数量]',listback.count);
-
- tempHTML=tempHTML.replace('[订单总额]',parseInt(listgo.order_price)+parseInt(listback.order_price)+'元');
- $('#refund_ticket_back_success').html(tempHTML);
- // location.replace(location.href);
- $('#order_pay_style'+data.order_id).html('已取消');
- $('#use'+data.order_id).html('-');
- if (data.back_order_id!=null) {
- $('#order_pay_style'+data.back_order_id).html('已取消');
- $('#use'+data.back_order_id).html('-');
- }
- }
-
-
- //居中显示
- 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_two_show_div(father_name, self_name,self_id) {
- var back = $('#'+self_id).attr('back');
- var father = $(father_name);
- var self = $(self_name);
- father.css('display', 'none');
- //if代表是去程退单的确认
- // if (father_name=='.refund_ticket_go') {
- // var father = $(father_name);
- // var self = $(self_name);
- // father.css('display', 'none');
- //
- // } else{
- //
- // }
- $.ajax({
- url:'./zz-fx/control.php', //请求地址
- type: "post", //请求方式
- data:{
- type:"distribut_DropOrder",
- order_id:self_id,
- ifback:back,
- iffirst:0
- },
- async:false,
- dataType: "json",
- success: function (data) {
- if(data.code == 0){
- console.log(data);
- //展示成功退单信息
- showRefundOrderSuccess(data.ifback,data);
- }else{
- window.wxc.xcConfirm(data.massge, window.wxc.xcConfirm.typeEnum.info);
- }
- },
- fail: function (date) {
- window.wxc.xcConfirm("退单失败!", window.wxc.xcConfirm.typeEnum.info);
- }
- });
-
-
-
-
- }
-
- //点击了弹层关闭
- 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 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 false;
- }
- //截取字符串
- 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;
- }
-
- //获取时间
- function getDateTime(nTypeFlag) {
- var tNowTime = new Date();
- var myYear = ';' + tNowTime.getFullYear() + ';';
- var myMonth = ';' + (tNowTime.getMonth() + 1 - 0) + ';';
- var myDay = ';' + tNowTime.getDate() + ';';
- var myHour = ';' + tNowTime.getHours() + ';';
- var myMinu = ';' + tNowTime.getMinutes() + ';';
- var mySecond = ';' + tNowTime.getSeconds() + ';';
-
- if(myMonth.length < 4) myMonth = '0' + myMonth;
- if(myDay.length < 4) myDay = '0' + myDay;
- if(myHour.length < 4) myHour = '0' + myHour;
- if(myMinu.length < 4) myMinu = '0' + myMinu;
- if(mySecond.length < 4) mySecond = '0' + mySecond;
-
- var cNewTimeStr;
- switch(nTypeFlag + 1 - 1) {
- case 0:
- cNewTimeStr = myYear + '-' + myMonth + '-' + myDay;
- break;
- case 1:
- cNewTimeStr = myYear + myMonth + myDay;
- break;
- case 2:
- cNewTimeStr = myHour + ':' + myMinu + ':' + mySecond;
- break;
- case 3:
- cNewTimeStr = myHour + myMinu + mySecond;
- break;
- case 4:
- cNewTimeStr = myYear + myMonth + myDay + myHour + myMinu + mySecond;
- break;
- case 5:
- cNewTimeStr = myYear + '年' + myMonth + '月' + myDay + '日';
- break;
- case 6:
- cNewTimeStr = myYear;
- break;
- case 7:
- cNewTimeStr = myYear + '-' + myMonth;
- break;
- case 8: //得到上一个月的今天
- var date = getDateTime(0);
- var arr = date.split('-');
- var year = arr[0]; //获取当前日期的年份
- var month = arr[1]; //获取当前日期的月份
- var day = arr[2]; //获取当前日期的日
- var days = new Date(year, month, 0);
- days = days.getDate(); //获取当前日期中月的天数
- var year2 = year;
- var month2 = parseInt(month) - 1;
- if(month2 == 0) {
- year2 = parseInt(year2) - 1;
- month2 = 12;
- }
- var day2 = day;
- var days2 = new Date(year2, month2, 0);
- days2 = days2.getDate();
- if(day2 > days2) {
- day2 = days2;
- }
- if(month2 < 10) {
- month2 = '0' + month2;
- }
- cNewTimeStr = year2 + '-' + month2 + '-' + day2;
- break;
- case 9: //得到下一个月的今天
- var date = getDateTime(0);
- var arr = date.split('-');
- var year = arr[0]; //获取当前日期的年份
- var month = arr[1]; //获取当前日期的月份
- var day = arr[2]; //获取当前日期的日
- var days = new Date(year, month, 0);
- days = days.getDate(); //获取当前日期中的月的天数
- var year2 = year;
- var month2 = parseInt(month) + 1;
- if(month2 == 13) {
- year2 = parseInt(year2) + 1;
- month2 = 1;
- }
- var day2 = day;
- var days2 = new Date(year2, month2, 0);
- days2 = days2.getDate();
- if(day2 > days2) {
- day2 = days2;
- }
- if(month2 < 10) {
- month2 = '0' + month2;
- }
-
- var t2 = year2 + '-' + month2 + '-' + day2;
- return t2;
- break;
- default:
- cNewTimeStr = myYear + '-' + myMonth + '-' + myDay + ' ' + myHour + ':' + myMinu + ':' + mySecond;
- break;
- }
-
- cNewTimeStr = cNewTimeStr.replace(/;/g, "");
-
- return cNewTimeStr;
-
- }
-
- //
- function before(str) {
- var dateStr = str;
- if (dateStr) {
- var now = ConvertDateFromString(dateStr);
- now.setDate(now.getDate() -1);
- var year = ";" + now.getFullYear() + ";";
- var month = ";" + now.getMonth() + ";";
- var day = ";" + now.getDate() + ";";
-
- if (year.length < 4) {
- year = "0" + year;
- }
-
- if (month.length < 4) {
- month = "0" + month;
- }
- if (day.length < 4) {
- day = "0" + day;
- }
-
- if(month == '0;0;'){
- month = '1;2;';
- year = parseInt(year.slice(1,5))-1;
- year = ';'+year+';';
- }
-
- var datestr = year + "-" + month + "-" + day;
- datestr = datestr.replace(/;/g, "");
- }
- return datestr;
- }
-
- function after(str) {
- var dateStr = str;
- if (dateStr) {
- var now = ConvertDateFromString(dateStr);
- now.setDate(now.getDate() - 0 + 1);
- var year = ";" + now.getFullYear() + ";";
- var month = ";" + now.getMonth() + ";";
- var day = ";" + now.getDate() + ";";
- if (year.length < 4) {
- year = "0" + year;
- }
- if (month.length < 4) {
- month = "0" + month;
- }
- if (day.length < 4) {
- day = "0" + day;
- }
- var datestr = year + "-" + month + "-" + day;
- datestr = datestr.replace(/;/g, "");
- }
- return datestr;
- }
- function ConvertDateFromString(dateString) {
- if (dateString) {
- var sdate = dateString.split('-');
- var date = new Date(parseInt(sdate[0]),parseInt(sdate[1]),parseInt(sdate[2]));
- return date;
- }
- }
-
-
- //进入详情页面
- function goToDetail(order_id){
- window.location.href = './order_details.html?order='+order_id;
- }
|