|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489 |
- var httpData;
-
- var pagesize = 10;
- var tttHTML = '';
- 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(13));
-
- }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(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 searchBtnClicked(cur,timelimit,starttime,endtime,ordersource,moresearch,typelimit,ordersource_text){
- 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
- },
- async:false,
- dataType: "json",
- success: function (data) {
- console.log(data);
- if(data.code == 0){
- 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+')">退票</a>';
- }
- temp += '<tr class="list_info" id="list_info'+i+'">'
- + '<td class="list_middle">'+data.orderList[i].order_id+'</td>'
- + '<td class="list_middle">'+data.orderList[i].create_time+'</td>'
- + '<td class="list_middle">'+data.orderList[i].org_name+'</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">'+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].customer_memo+'</td>'
- + '<td class="list_middle" id="caozuo'+data.orderList[i].order_id+'">'+str+'</td>'
- + '</tr>'
- }
- }else{
- }
- $("#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');
- }
-
- },
- fail: 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){
- alert(order_id);
- var result =confirm("是否决定退票?");
- if(result ==true)
- {
- $.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
- {
- 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;
- default:
- cNewTimeStr = myYear + '-' + myMonth + '-' + myDay + ' ' + myHour + ':' + myMinu + ':' + mySecond;
- break;
- case 12: //本周起始日期
- return getWeekStartDate()
-
- function getWeekStartDate() {
- 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 weekStartDate = new Date(nowYear, nowMonth, nowDay - nowDayOfWeek);
- return formatDate(weekStartDate);
- }
-
- 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;
- case 14: //本月开始日期
- return getMonthStartDate()
-
- function getMonthStartDate() {
- 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 monthStartDate = new Date(nowYear, nowMonth, 1);
- return formatDate(monthStartDate);
- }
-
- 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);
- }
|