|
- var httpData;
-
- var pagesize = 10;
- var tttHTML = '';
- var index = "0";
- var will = '';
- var over = '';
- var cancel = '';
- var pay = '';
- window.onload = function () {
-
- tttHTML = document.getElementById("tableOrder").innerHTML;
-
- var cur = "";
- var currpage = getPar('currpage');
- var timelimit = '';
- var starttime = '';
- var endtime = '';
- var ordersource = '';
- var moresearch = '';
- var typelimit = '';
- var ordersource_text = '';
-
- if (!currpage) {
- cur = 1;
-
- $('#starttime').val(getDateTime(12));
-
- $('#endtime').val(getDateTime(0));
-
- } else {
-
- cur = currpage;
- timelimit = getPar('timelimit');
- $('#timelimit').val(timelimit);
-
- starttime = getPar('starttime');
- $('#starttime').val(starttime);
-
- endtime = getPar('endtime');
- $('#endtime').val(endtime);
-
- ordersource = getPar('ordersource');
- $('#ordersource').attr('changeid', ordersource);
-
- ordersource_text = getPar('ordersource_text');
- $('#ordersource').val(ordersource_text);
-
- moresearch = getPar('moresearch');
- $('#moresearch').val(moresearch);
-
- typelimit = getPar('typelimit');
- $('#typelimit').val(typelimit);
-
- }
- searchBtnClicked(index, cur, timelimit, starttime, endtime, ordersource, moresearch, typelimit, ordersource_text);
- }
-
- function ordersourceSearch(value, self_id) {
- var ordersource = $("#ordersource").val();
- $.ajax({
- url: './st-xm/control.php',
- type: "post",
- data: {
- ordersource: ordersource,
- type: "des_ordersource"
- },
- dataType: "json",
- success: function (data) {
- if (data.code == 0) {
- console.log(data);
- createHtml(data.list, self_id)
- }
- },
- fail: function (data) {
- // 此处放失败后执行的代码
- }
- });
- }
- $(document).ready(function () {
- $("#ordersource").click(function (e) {
- e.stopPropagation();
- $("#select_ordersource").removeClass("hide1");
- });
- })
-
- $(document).click(function () {
- if (!$(".select_ordersource").hasClass("hide1")) {
- $(".select_ordersource").addClass("hide1");
- }
- })
-
-
- //筛选列表
- function createHtml(data, select_id) {
- var temp = '<div class="content" id="suoypuqudao" onmouseover="getDark(this.id)" onmouseout="getLight(this.id)" org_id="-1">所有渠道</div>';
- for (var i = 0; i < data.length; i++) {
- temp += '<div class="content" id="' + select_id + '' + data[i].org_id + '" onmouseover="getDark(this.id)" onmouseout="getLight(this.id)" org_id="' + data[i].org_id + '">' + data[i].org_name + '</div>'
- }
- $(".select_ordersource").html(temp);
- $(".content").click(function () {
- var line = $(this).text();
- var value = $(this).attr('org_id');
- $("#" + select_id).val(line);
- $("#" + select_id).attr('changeid', value);
- })
- }
-
-
- function getDark(value) {
- $('#' + value).addClass("get_dark");
- }
- function getLight(value) {
- $('#' + value).removeClass("get_dark");
- }
-
- function searchBtnClicked2(index, cur, timelimit, starttime, endtime, ordersource, moresearch, typelimit, ordersource_text) {
- if (!timelimit || !starttime || !endtime || !ordersource || !moresearch || !typelimit) {
- timelimit = $('#timelimit').val();
-
- starttime = $('#starttime').val();
-
- endtime = $('#endtime').val();
-
- ordersource = $('#ordersource').attr('changeid');
-
- ordersource_text = $('#ordersource').val();
-
- if (!ordersource) {
- ordersource = -1;
- }
-
- moresearch = $('#moresearch').val();
- if (!moresearch) {
- moresearch = "";
- }
- typelimit = $('#typelimit').val();
- }
-
- var url =
- "./st-xm/Model/des/export.php?tt=" + getDateTime(4) +
- "&timelimit=" + timelimit +
- "&starttime=" + starttime +
- "&endtime=" + endtime +
- "&ordersource=" + ordersource +
- "&moresearch=" + moresearch +
- "&typelimit=" + typelimit +
- "&orderstatus=" + index;
- var listURL = url;
- // 跳转前将URL编码
- listURL = encodeURI(listURL);
- window.location.href = listURL;
- }
-
- //查询按钮
- function searchBtnClicked(index, cur, timelimit, starttime, endtime, ordersource, moresearch, typelimit, ordersource_text) {
- $("#minus").children('span').removeClass("btn-primary");
- $("#minus").children('span').addClass("btn-default");
- $("#add" + index).removeClass("btn-default");
- $("#add" + index).addClass("btn-primary");
-
- if (!cur) {
- cur = 1;
- }
- if (!timelimit || !starttime || !endtime || !ordersource || !moresearch || !typelimit) {
- timelimit = $('#timelimit').val();
-
- starttime = $('#starttime').val();
-
- endtime = $('#endtime').val();
-
- ordersource = $('#ordersource').attr('changeid');
-
- ordersource_text = $('#ordersource').val();
-
- if (!ordersource) {
- ordersource = -1;
- }
-
- moresearch = $('#moresearch').val();
- if (!moresearch) {
- moresearch = "";
- }
-
- typelimit = $('#typelimit').val();
-
- }
-
- $.ajax({
- url: './st-xm/control.php', //请求地址
- type: "post", //请求方式
- //data: data, //请求参数
- data: {
- type: "des_orderlist",
- timelimit: timelimit,
- starttime: starttime,
- endtime: endtime,
- ordersource: ordersource,
- moresearch: moresearch,
- typelimit: typelimit,
- currpage: cur,
- pagesize: pagesize,
- orderstatus: index
- },
- async: false,
- dataType: "json",
- success: function (data) {
- console.log(data);
- if (data.code == 0) {
- var count_list = data['count_list'];
- var st_145 = count_list['will'];
- var st_146 = count_list['pay'];
- var st_147 = count_list['over'];
- var st_148 = count_list['cancel'];
-
- var orderAll = parseInt(st_145) + parseInt(st_146) + parseInt(st_147) + parseInt(st_148);
- $('#orderAll').text(orderAll);
- $('#will').text(st_145);
- $('#pay').text(st_146);
- $('#over').text(st_147);
- $('#cancel').text(st_148);
-
-
- var sum = data.totalTickets;
- var tag = "page";
- var sendurl = './des_order_list.html?timelimit=' + timelimit + '&starttime=' + starttime + '&endtime=' + endtime + '&ordersource=' + ordersource + '&moresearch=' + moresearch + '&typelimit=' + typelimit + '&ordersource_text=' + ordersource_text;
-
- getPager(sendurl, sum, cur, pagesize, tag, 'currpage');
- $('#sum').html('共' + data.list_count + '条记录');
- if (data.orderList.length > 0) {
- var temp = '';
- $("#tableOrder").html('');
- for (var i = 0; i < data.orderList.length; i++) {
- var ifzhouzhuang = data.orderList[i].ifzhouzhuang;
- var str = "";
- if (ifzhouzhuang == 0) {
- str = '-';
- } else if (ifzhouzhuang == 1) {
- str = '<a onclick = "refundTicket(' + data.orderList[i].order_id + ',\'' + data.orderList[i].product_info + '\')">退票</a>';
- }
- var orderType = '<span class="label label-primary">单</span>';
- if (data.orderList[i].order_title_id > 0) {
- orderType = '<span class="label btn-success">组</span>';
-
- }
- var top_org_name_show = data.orderList[i].top_org_name ==null?'-':data.orderList[i].top_org_name;
- temp += '<tr class="list_info" id="list_info' + i + '">'
- + '<td class="list_middle">' + orderType + data.orderList[i].order_id + '</td>'
- + '<td class="list_middle">' + data.orderList[i].create_user_name + '</td>'
- + '<td class="list_middle">' + data.orderList[i].create_time + '</td>'
- + '<td class="list_middle">' + data.orderList[i].org_name + '<br />' + data.orderList[i].outside_order_no + '</td>'
- // + '<td class="list_middle">'+data.orderList[i].outside_order_no+'</td>'
- + '<td class="list_middle">' + data.orderList[i].product_info + '</td>'
- + '<td class="list_middle">' + top_org_name_show + '</td>'
- + '<td class="list_middle">' + data.orderList[i].order_pay + '</td>'
- + '<td class="list_middle">' + data.orderList[i].run_time + '</td>'
- + '<td class="list_middle">' + data.orderList[i].customer_info + '</td>'
- + '<td class="list_middle">' + data.orderList[i].order_status + '</td>'
- + '<td class="list_middle">' + data.orderList[i].order_pay_type + '</td>'
- + '<td class="list_middle" onclick="change_customer_memo( ' + data.orderList[i].order_id + ',\'' + data.orderList[i].customer_memo + '\' )">' + data.orderList[i].customer_memo + '</td>'
- + '<td class="list_middle" id="caozuo' + data.orderList[i].order_id + '">' + str + '</td>'
- + '</tr>'
- }
- } else {
- $("#tableOrder").html('');
- }
- $("#tableOrder").html(temp);
- } else {
- $("#tableOrder").html('');
- $('#sum').html('共' + data.list_count + '条记录');
- var sum = 0;
- var tag = "page";
- var sendurl = './des_order_list.html?timelimit=' + timelimit + '&starttime=' + starttime + '&endtime=' + endtime + '&ordersource=' + ordersource + '&moresearch=' + moresearch + '&typelimit=' + typelimit + '&ordersource_text=' + ordersource_text;
-
- getPager(sendurl, sum, cur, pagesize, tag, 'currpage');
- }
-
- },
- error: function (data) {
- }
-
- });
- if (cur != 1) {
- var cur = cur;
-
- timelimit = getPar('timelimit');
- $('#timelimit').val(timelimit);
-
- var starttime = getPar('starttime');
- $('#starttime').val(starttime);
-
- var endtime = getPar('endtime');
- $('#endtime').val(endtime);
-
- var ordersource = getPar('ordersource');
- $('#ordersource').attr('changeid', ordersource);
-
- var ordersource_text = getPar('ordersource_text');
- $('#ordersource').val(ordersource_text);
-
- var moresearch = getPar('moresearch');
- $('#moresearch').val(moresearch);
-
- var typelimit = getPar('typelimit');
- $('#typelimit').val(typelimit);
- }
- }
-
- function refundTicket(order_id, ifzhouzhuang) {
- var result = confirm("是否决定退票?");
- if (result == true) {
- //判断是否是周庄门票
- if (ifzhouzhuang.indexOf("周庄门票") != -1) {
- $.ajax({
- url: './zz-fx/Model/cancelzhoutickets.php', //请求地址
- type: "post", //请求方式
- data: {
- order_id: order_id,
- method: 1
- },
- async: true,
- dataType: "json",
- success: function (data) {
- console.log(data);
- if (data.code == 0) {
- alert('退票成功!');
- $('#caozuo' + order_id).html('-');
-
- } else {
- alert(data.info);
- }
- }
- });
- } else {
- $.ajax({
- url: './zz-fx/Model/cancelnormaltickets.php',//请求地址
- type: "post", //请求方式
- data: {
- order_id: order_id,
- action: 'cancel_ticket_order'
- },
- xhrFields: {
- withCredentials: true
- },
- crossDomain: true,
- async: true,
- dataType: "json",
- success: function (data) {
- if (data.code == 0) {
- alert('退票成功!');
- $('#caozuo' + order_id).html('-');
- $('#caozuo' + order_id).prev().prev().prev().html('已取消');
- } else {
- alert(data.info);
- }
- }
- });
- }
- }
- else {
- return;
- }
- }
-
- function change_customer_memo(order_id, customer_memo) {
- swal({
- title: '请输入备注',
- input: 'textarea',
- inputValue: customer_memo,
- showCancelButton: true,
- cancelButtonText: '返 回',
- confirmButtonText: '确 定',
- showLoaderOnConfirm: true,
- allowOutsideClick: false
- }).then(function (email) {
- change_memo(order_id, email);
- })
- function change_memo(order_id, new_memo) {
- $.ajax({
- url: './st-xm/control.php',
- type: "post",
- data: {
- order_id: order_id,
- new_memo: new_memo,
- type: "des_changememo"
- },
- dataType: "json",
- success: function (data) {
- if (data.code == 0) {
- swal({
- title: '修改备注成功',
- type: 'success',
- timer: 20000,
- confirmButtonText: 'OK'
- }).then(
- function () {
- location.replace(location.href);
- },
- function (dismiss) {
- location.replace(location.href);
- }
- )
- } else {
- swal(
- '修改备注失败',
- ' ',
- 'error'
- );
- return;
- }
- },
- fail: function (data) {
- swal(
- '修改备注失败',
- ' ',
- 'error'
- );
- return;
- }
- });
- }
- }
-
- 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;
- //alert(tNowTime);
- 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;
- case 12: //本周起始日期
- return getBeforeDate(7);
- function getBeforeDate(n) {
- var n = n;
- var d = new Date();
- var year = d.getFullYear();
- var mon = d.getMonth() + 1;
- var day = d.getDate();
- if (day <= n) {
- if (mon > 1) {
- mon = mon - 1;
- }
- else {
- year = year - 1;
- mon = 12;
- }
- }
- d.setDate(d.getDate() - n);
- year = d.getFullYear();
- mon = d.getMonth() + 1;
- day = d.getDate();
- s = year + "-" + (mon < 10 ? ('0' + mon) : mon) + "-" + (day < 10 ? ('0' + day) : day);
- return s;
- }
-
- break;
- case 13: //本周结束日期
- return getWeekEndDate()
-
- function getWeekEndDate() {
- var now = new Date(); //当前日期
- var nowDayOfWeek = now.getDay(); //今天本周的第几天
- var nowDay = now.getDate(); //当前日
- var nowMonth = now.getMonth(); //当前月
- var nowYear = now.getYear(); //当前年
- nowYear += (nowYear < 2000) ? 1900 : 0; //
-
- var lastMonthDate = new Date(); //上月日期
- lastMonthDate.setDate(1);
- lastMonthDate.setMonth(lastMonthDate.getMonth() - 1);
- var lastYear = lastMonthDate.getYear();
- var lastMonth = lastMonthDate.getMonth();
- var weekEndDate = new Date(nowYear, nowMonth, nowDay + (6 - nowDayOfWeek));
- return formatDate(weekEndDate);
- }
-
- break;
- default:
- cNewTimeStr = myYear + '-' + myMonth + '-' + myDay + ' ' + myHour + ':' + myMinu + ':' + mySecond;
- break;
-
- }
-
- cNewTimeStr = cNewTimeStr.replace(/;/g, "");
-
- return cNewTimeStr;
-
- }
- 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;
- }
-
- //获取当前时间
- 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);
- }
-
- function getList(index) {
- $("#minus").children().children().removeClass("addbackground");
- $("#add" + index).addClass("addbackground");
- click_type_id = index;
- var timelimit = $('#timelimit').val(); //时间类型
- var starttime = $('#starttime').val(); //开始时间
- var endtime = $('#endtime').val(); //结束时间
- //var ordersource=$('#ordersource').val();//订单渠道
- var ordersource = order_from_id; //订单渠道
- order_from_id = ordersource;
- var paystatus = $('#paystatus').val(); //支付状态
-
- /*以下三个条件暂时隐藏,''代替传入参数
- var billingstatus=document.getElementById("billingstatus").value;
- var mealbounce=document.getElementById("mealbounce").value;
- var refund=document.getElementById("refund").value;
- */
- var billingstatus = '';
- var mealbounce = '';
- var refund = '';
- var moresearch = document.getElementById("moresearch").value;
-
- //2016-07-15新增参数
- var start_area = $('#start_area').val();
- var end_area = $('#end_area').val();
- var line = $('#line').val();
-
- var tnowtime = getDateTime(4);
- var myURL =
- "./st-xm/Api/order_list.php?tt=" + tnowtime +
- "&timelimit=" + timelimit +
- "&starttime=" + starttime +
- "&endtime=" + endtime +
- "&ordersource=" + ordersource +
- "&orderstatus=" + index +
- "&will=" + will +
- "&over=" + over +
- "&pay=" + pay +
- "&cancel=" + cancel +
- "&paystatus=" + paystatus +
- "&currpage=1" +
- "&pagesize=" + pagesize;
- var myURL2 = "./des_order_list.html?tt=" + tnowtime +
- "&timelimit=" + timelimit +
- "&starttime=" + starttime +
- "&endtime=" + endtime +
- "&ordersource=" + ordersource +
- "&orderstatus=" + index +
- "&paystatus=" + paystatus +
- "&billingstatus=" + billingstatus +
- "&mealbounce=" + mealbounce +
- "&refund=" + refund +
- "&moresearch=" + moresearch +
- "&start_area=" + start_area +
- "&end_area=" + end_area +
- "&line=" + line
- // +"&currpage="+currpage
- +
- "&pagesize=" + pagesize;
- method(myURL, myURL2);
- $('#ordersource').val(order_from_id);
- }
-
-
|