$(document).ready(function() { $(".form_date").datetimepicker({ format: 'yyyy-mm-dd', autoclose: true, minView: 2, pickerPosition: "bottom-left" }); $(".form_date").datetimepicker({ format: 'yyyy-mm-dd', autoclose: true, minView: 2, pickerPosition: "bottom-left" }); }); var date_type = ''; var start_date = ''; var end_date = ''; var province = ''; var city = ''; var hotel_name = ''; var order_status = '0'; var org_id = ''; var confirm_number = ''; var current = '1'; var page_size = '10'; var channel_order_status = ''; var temp_time = ''; window.onload = function() { $('#beforeDate').val(getDateByDay(-3, getDateTime(0))); $('#currentDate').val(getDateTime(0)); httpBaseInfo(); } function httpBaseInfo() { var org_data = { type: 'order_HotelOrderList', op: 'org_list' } //获取渠道商列表 $.ajax({ url: base_api, //请求地址 data: org_data, type: "post", dataType: "json", async: false, success: res_data => { ZZLog(res_data); if('0' != res_data.code) { ZZAlertInfo(res_data.info); } else { var org_list = res_data.org_list; var temp_html = ''; org_list.forEach((dict, index) => { temp_html += `` }) $('#org_list').html(temp_html); $('#org_list').comboSelect(); } }, error: error => { ZZAlertInfo(infoApiError); } }); //省份列表 var province_data = { type: 'hotel_AddHotelProduct', op: 'provinceCity', area_id: '' } $.ajax({ url: base_api, data: province_data, type: "post", dataType: "json", async: false, success: res_data => { ZZLog(res_data); if('0' != res_data.code) { ZZAlertInfo(res_data.info); } else { var province_list = res_data.area_list; var temp_html = ''; province_list.forEach((dict, index) => { temp_html += `` }) $('#province_list').html(temp_html); } }, error: error => { ZZAlertInfo(infoApiError); } }); //市列表 $('#province_list').on('change', function() { var city_data = { type: 'hotel_AddHotelProduct', op: 'provinceCity', area_id: $(this).val() } $.ajax({ url: base_api, data: city_data, type: "post", dataType: "json", async: false, success: res_data => { ZZLog(res_data); if('0' != res_data.code) { ZZAlertInfo(res_data.info); } else { var city_list = res_data.area_list; var temp_html = ''; city_list.forEach((dict, index) => { temp_html += `` }) $('#city_list').html(temp_html); if($(this).val() == '0'){ $('#city_list').html(''); } } }, error: error => { ZZAlertInfo(infoApiError); } }); }) loading(); // httpFirstData();delay(httpFirstData,10);delay(httpFirstData,10);delay(httpFirstData,10); delay(httpFirstData,50); } //切换订单快捷入口 function orderStatusDidClicked(status) { $('.channel_quick').find('button').removeAttr('disabled'); channel_order_status = ''; order_status = status; if (status == '313') { $('#batch_send').show(); $('#batch_right').hide(); } else if(status == '198'){ $('#batch_send').hide(); $('#batch_right').show(); } else { $('#batch_send').hide(); $('#batch_right').hide(); } loading(); delay(httpFirstData,10); } //切换渠道订单快捷入口 function channelOrderStatusDidClicked(channel_status,obj) { // channel_order_status = channel_status; $('#myTabs').find('li').removeClass('active'); $('#myTabs').children().first().addClass('active'); $('#batch_send').hide(); $('#batch_right').hide(); $('.channel_quick').find('button').removeAttr('disabled'); $(obj).attr('disabled','disabled'); switch(channel_status) { case '1': channel_order_status = 550; order_status = '0'; break; case '2': channel_order_status = 553; order_status = '198'; break; case '3': channel_order_status = ''; order_status = '564'; break; default: break; } loading(); delay(httpFirstData,10); // delay(httpFirstData,200); } //第一次请求数据 function httpFirstData() { date_type = $('#date_type').val(); start_date = $('#beforeDate').val(); end_date = $('#currentDate').val(); province = $('#province_list').val(); city = $('#city_list').val(); hotel_name = $('#hotel_name').val(); org_id = $('#org_list').val(); confirm_number = $('#confirm_number').val(); more_search = $('#more_search').val(); var firstCurrent = '1'; var type = 'order_HotelOrderList'; var op = 'order_list'; var data = { type, op, date_type, start_date, end_date, province, city, hotel_name, org_id, confirm_number, more_search, current: firstCurrent, page_size, order_status, channel_order_status }; ZZLog(data); $.ajax({ url: base_api, data: data, type: "post", dataType: "json", async: false, success: res_data => { ZZLog(res_data); closeLoading(); if('0' != res_data.code) { ZZAlertInfo(res_data.info); } else { var total_page = res_data.total_page; var order_list = res_data.order_list; var temp_html = ''; order_list.forEach((dict, index) => { temp_html += replaceOrderList(dict); }) if(order_list.length <= 0) { var html = ` 无查询结果 `; $('#order_list').html(html); } else { $('#order_list').html(temp_html); countTime(); } if(total_page == '0') { $('#btns_all').hide(); } else { createPage(firstCurrent, total_page); $('#btns_all').show(); } $('#page_order_list').prepend(' 共'+res_data.total+'条记录'); //渠道相关订单个数 var channel_counts = res_data.channel_counts; if (channel_counts.wait_count != 0) { $('#wait').text('待接单处理('+channel_counts.wait_count+')'); } if (channel_counts.cancel_count != 0) { $('#cancel').text('待取消单处理('+channel_counts.cancel_count+')'); } if (channel_counts.out_count != 0) { $('#refund').text('待退单处理('+channel_counts.out_count+')'); } $('#order_list').show(); } }, error: error => { closeLoading(); ZZAlertInfo(infoApiError); } }); } //创建分页控件 function createPage(currpage, totalpage) { $("#page_order_list").createPage({ pageCount: totalpage, //总页数 current: currpage, //当前页 turndown: 'true', //是否显示跳转框,显示为true,不现实为false,一定记得加上引号... backFn: function(p) { current = p; loading(); // delay(httpData,10); httpData(); } }) } //分页查询数据 function httpData() { var current_page = current; var type = 'order_HotelOrderList'; var op = 'order_list'; var data = { type, op, date_type, start_date, end_date, province, city, hotel_name, org_id, confirm_number, more_search, current: current_page, page_size, order_status, channel_order_status }; ZZLog(data); $.ajax({ url: base_api, data: data, type: "post", dataType: "json", async: false, success: (res_data) => { closeLoading(); if('0' != res_data.code) { ZZAlertInfo(res_data.info); } else { ZZLog(res_data.order_list) var order_list = res_data.order_list; var temp_html = ''; order_list.forEach((dict, index) => { temp_html += replaceOrderList(dict); }) if(order_list.length <= 0) { var html = ` 无查询结果 `; $('#order_list').html(html); } else { $('#order_list').html(temp_html); countTime(); } //渠道相关订单个数 var channel_counts = res_data.channel_counts; if (channel_counts.wait_count != 0) { $('#wait').text('待接单处理('+channel_counts.wait_count+')'); } if (channel_counts.cancel_count != 0) { $('#cancel').text('待取消单处理('+channel_counts.cancel_count+')'); } if (channel_counts.out_count != 0) { $('#refund').text('待退单处理('+channel_counts.out_count+')'); } $('#order_list').show(); $('#page_order_list').prepend(' 共'+res_data.total+'条记录'); } // closeLoading(); }, error: (error) => { closeLoading(); ZZAlertInfo(infoApiError); } }); } //倒计时 var timer = null; function countTime() { // if(timer != null){ // clearInterval(timer); // }else{ // timer = setInterval(timeJian, 1000); // } if(!timer){ timer = setInterval(timeJian, 1000); } function timeJian() { $('.time_s').each(function(index, dom) { var cha = $(this).attr('data_times'); if(cha <= temp_time) { cha--; if(cha <= 0) { $(this).html('(超时)'); cha = 0; } else { $(this).attr('data_times', cha); var m = parseInt(cha / 60); var s = parseInt(cha % 60); if(m == 0 && s == 0) { } else { m = m < 10 ? `0${m}` : m; s = s < 10 ? `0${s}` : s; $(this).html(`${m}:${s}`); } } } }) } } //替换订单列表数据 function replaceOrderList(dict) { var time_str = ''; //订单渠道状态和操作 var channel_operation = ''; var order_operation = '-'; var channel_status_str = ''; var html_dict = setJsonHtml(dict); if(dict.docking_type == '557') { channel_operation = '-'; switch (dict.order_status){ case '145'://待支付 break; case '313'://待发单 order_operation = `
`; break; case '198'://待安排 order_operation = `
`; break; case '314'://已安排 // if((dict.gathering_status == 1 && dict.payment_status == 1) || (dict.gathering_status == null && dict.payment_status == null)) // { order_operation = `
`; // } break; case '147'://已入住 break; case '382'://退改中 order_operation = `
`; break; case '564'://待退单确认 order_operation = `
`; break; case '148'://已取消 break; default: break; } } else { function tempTime(dict){ //订单 倒计时 var cha = dict.countdown_time; //主订单没有run_date if(dict.create_time.substring(0, 10) === dict.prod_start_station_date) { temp_time = 25 * 60; } else { temp_time = 55 * 60; } var m = parseInt(cha / 60); var s = parseInt(cha % 60); if(m == 0 && s == 0 || cha == 0) { time_str = '(超时)'; } else { m = m < 10 ? `0${m}` : m; s = s < 10 ? `0${s}` : m; time_str = `${m}:${s}`; } } switch(dict.merge_status) { case '2': //渠道 待处理 订单 待发单 channel_operation = `
`; order_operation = `
`; tempTime(dict); break; case '3': //渠道 待处理 订单 待安排 case '4': channel_operation = `
`; order_operation = `
`; tempTime(dict); // var cha1 = dict.countdown_time; // if(dict.create_time.substring(0, 10) == dict.check_in) { // temp_time = 25 * 60; // } else { // temp_time = 55 * 60; // } // var m1 = parseInt(cha1 / 60); // var s1 = parseInt(cha1 % 60); // if(m1 == 0 && s1 == 0 || cha1 == 0) { // time_str = '(超时)'; // } else { // m1 = m1 < 10 ? `0${m1}` : m1; // s1 = s1 < 10 ? `0${s1}` : m1; // time_str = `${m1}:${s1}`; // } // break; case '10': //渠道 已接单 订单 待发单 channel_operation = ''; order_operation = `
`; break; case '11': //渠道 已接单 订单 待安排 channel_operation = ''; order_operation = `
`; break; case '19': //渠道 已拒绝 订单 待安排 channel_operation = ''; order_operation = `
`; break; case '26': //渠道 申请取消 订单 待发单 channel_operation = `
`; order_operation = `
`; break; case '27': //渠道 申请取消 订单 待安排 channel_operation = `
`; order_operation = `
`; break; case '28': //渠道 申请取消 订单 已安排 channel_operation = `
`; order_operation = `
`; break; case '30': //渠道 申请取消 订单 退改中 channel_operation = `
`; order_operation = `
`; break; case '31': //渠道 申请取消 订单 待退单确认 channel_operation = `
`; order_operation = `
`; break; case '34': //渠道 取消被拒 订单 待发单 channel_operation = ''; order_operation = `
`; break; case '35': //渠道 取消被拒 订单 待安排 channel_operation = ''; order_operation = `
`; break; case '43': //渠道 已取消 订单 待安排 channel_operation = ''; order_operation = `
`; break; case '44': //渠道 已取消 订单 已安排 channel_operation = ''; order_operation = `
`; break; case '46': //渠道 已取消 订单 退改中 channel_operation = ''; order_operation = `
`; break; case '47': //渠道 已取消 订单 待确认退单 channel_operation = ''; order_operation = `
`; break; case '8': //渠道 待处理 订单 已取消 channel_operation = `
`; order_operation = '-'; break; case '32': //渠道 申请取消 订单 已取消 channel_operation = `
`; order_operation = '-'; break; default: break; } } channel_status_str = `
${dict.channel_order_status_name}${time_str}
`; var docking_str = ''; if (dict.docking_type == '556') { docking_str =dict.if_last_prod == '2'?'':''; } else{ docking_str =dict.order_title_id != '0'?'':''; } var cancel_font = ''; var cstr = ''; var cancel_reason_show = ''; if(dict.order_status == '148'){ cancel_font = 'cancel_font'; cancel_reason_show = `
${dict.cancel_reason}
`; cancel_reason_show = ''; } var right_order_show = ''; if (dict.order_status == '314') { right_order_show = `
${dict.order_confirm_code}
`; } var comment_count = '-'; if (dict.comment_count > 0) { comment_count = `