|
- /**
- * Created by luocj on 2016/9/24.
- */
- var tr_order_str = $('#tr_order').prop('outerHTML');//获取tr中所有的字符串
- var order_status = 0;
- var start_date = '';
- var end_date = '';
- var province = $("#province").val();
- var city = $("#city").val();
- var hotel_name = $("#hotel_name").val();
- var org_id = $("#org_id").val();
- var more_search = $("#more_search").val();
- var date_type = $('#date_type').val();
- var confirm_number = $('#confirm_number').val();
- var yesterday = '';
- var today = '';
- var thisweekstartdate = '';
- var thisweekenddate = '';
- var thismonthstartdate = '';
- var thismonthenddate = '';
- var user_id = 1;
- var current = '1';
- var page_size = '10';
- var memodiv = $('.memo1').prop('outerHTML');
- var firstLoad = true;
- window.onload = function () {
- $("#start_date").val(getDateByDay(-3, getDateTime(0)));
- start_date = getDateByDay(-3, getDateTime(0));
- $("#end_date").val(getDateTime(0));
- end_date = getDateTime(0);
- // var url = base_api + "?type=order_HotelOrderList&op=order_list&date_type=" + date_type + "&start_date=" + start_date + "&end_date=" + end_date + "&province=" + province + "&city=" + city + "&hotel_name=" + hotel_name + "&order_status=" + order_status + "&org_id=" + org_id + "&more_search=" + more_search +"¤t="+current +"&page_size="+page_size;
- getHotelList();
- getOrgList(base_api + "?type=order_HotelOrderList&op=org_list");
- provinceHTML = $('#province').html();
- cityHTML = $('#city').html();
- var apiurl = base_api + "?type=hotel_AddHotelProduct&op=provinceCity &area_id=";
- ZZLog(apiurl);
- $.getJSON(apiurl, function (res_data) {
- ZZLog(res_data);
- if (res_data['code'] != "0") {
- ZZAlertInfo(res_data['info']);
- } else {
- //地区
- var area_list = res_data['area_list'];
- var areaHTML = '<option value="0" style="font-size:12px;">选择省</option>';
- for (var i = 0, m = area_list.length; i < m; i++) {
- var tempDict = area_list[i];
- var tempHTML = provinceHTML;
- tempHTML = tempHTML.replace('选择省', tempDict['area_name']);
- tempHTML = tempHTML.replace('0', tempDict['area_id']);
- areaHTML += tempHTML;
- }
- $('#province').html(areaHTML);
- $('#province')[0].selectedIndex = 0;
- }
- })
- excel();
- };
- //获取订单列表
- function getHotelList() {
- start_date = $('#start_date').val();
- end_date = $('#end_date').val();
- province = $("#province").val();
- city = $("#city").val();
- hotel_name = $("#hotel_name").val();
- org_id = $("#org_id").val();
- more_search = $("#more_search").val();
- date_type = $("#date_type").val();
- confirm_number = $('#confirm_number').val();
- var com_url = base_api + "?type=order_HotelOrderList&op=order_list&date_type=" + date_type + "&start_date=" + start_date + "&end_date=" + end_date + "&province=" + province + "&city=" + city + "&hotel_name=" + hotel_name + "&order_status=" + order_status + "&org_id=" + org_id + "&more_search=" + more_search + "¤t=" + current + "&page_size=" + page_size + "&confirm_number=" + confirm_number;
- ZZLog(com_url);
- if (!firstLoad)
- loading();
- firstLoad = false;
- $.getJSON(com_url, function (data) {
- closeLoading();
- ZZLog(data);
-
- setDataBody(data);
- if (data['total_count'] < 0) {
- $('.pageDiv').hide();
- } else {
- $(".pageDiv").createPage({
- pageCount: data['total_page'],//总页数
- current: current,//当前页
- turndown: 'true',//是否显示跳转框,显示为true,不现实为false,一定记得加上引号...
- backFn: function (p) {
- current = p;
- havePageData();
- }
- });
- $('.pageDiv').show();
- }
- }).error(function (msg) {
- closeLoading();
-
- });
- }
- //替换订单主体
- function setDataBody(data) {
- var order_list = data['order_list'];
- var comHTML = '';
- for (var i = 0; i < order_list.length; i++) {
- var dict = order_list[i];
- var HTML = tr_order_str;
- var order_id = dict['order_id'];
- var order_status_name = dict['order_status_name'];
- var org_name = dict['org_name'];
- var status_txt = '';
- //var order_info = filterRepeatStr(dict['order_description']);
- HTML = HTML.replace('[订单编号]', dict['order_id'] === null ? '-' : dict['order_id']);
- HTML = HTML.replace('[order_id]', dict['order_id'] === null ? '-' : dict['order_id']);
- HTML = HTML.replace('[order_status]', dict['order_status_name'] === null ? '-' : dict['order_status_name']);
- HTML = HTML.replace('[org_name]', dict['org_name'] === null ? '-' : dict['org_name']);
- HTML = HTML.replace('[org_id]', dict['org_id'] === null ? '-' : dict['org_id']);
- HTML = HTML.replace('[room_type]', dict['room_type'] === null ? '-' : dict['room_type']);
- HTML = HTML.replace('[hotel_id]', dict['hotel_id'] === null ? '-' : dict['hotel_id']);
- HTML = HTML.replace('[预订时间]', dict['create_time'] === null ? '-' : dict['create_time']);
- HTML = HTML.replace('[供应商]', dict['prod_supply_org_name'] === null ? '-' : dict['prod_supply_org_name']);
- HTML = HTML.replace('[预订产品]', dict['hotel_name'] + ' ' + dict['zifangxing'] + '<br/><span class="short-text" title="' + dict['order_description'] + '">' + dict['order_description'] + '</span>');
- HTML = HTML.replace('[客人信息]', dict['customer_name'] + '<br />' + dict['customer_mobile']);
- HTML = HTML.replace('[订单渠道]', dict['org_name'] === null ? '-' : dict['org_name'] + '<br/>');
- HTML = HTML.replace('[订单金额]', '¥' + dict['order_price']);
- HTML = HTML.replace('[支付方式]', dict['order_pay_type'] === null ? '-' : dict['order_pay_type']);
- //取消状态的订单要显示
- if ((dict['order_status'] == 148 || dict['order_status'] == 383) && dict['cancel_reason']) {
- status_txt = '<a href="javascritp:;" onclick="ZZAlertInfo(\'' + dict['cancel_reason'] + '\')">' + dict['order_status_name'] + '</a>';
- } else {
- status_txt = dict['order_status_name'];
- }
- HTML = HTML.replace('[状态]', status_txt);
- var order_id = dict['order_id'];
- var order_status = dict['order_status'];
- var hotel_id = dict['hotel_id'];
- var parent_room_type = dict['parent_room_type'];
- var room_type = dict['room_type'];
- var org_name = dict['org_name'];
- var org_id = dict['org_id'];
- var modify = ' <a onclick="modify_order(' + order_status + ',' + order_id + ',' + org_id + ',' + hotel_id + ',' + parent_room_type + ',' + room_type + ',\'' + org_name + '\')" style="cursor: pointer">修改</a> ';
- var cancel = ' <a onclick="cancel_order(' + order_id + ',' + order_status + ',148)" style="cursor: pointer">取消</a> ';
- var confirm = ' <a onclick="make_sure(' + order_id + ',' + order_status + ')" style="cursor: pointer">确认</a> ';
- var send = ' <a style="cursor: pointer" onclick="billing(' + order_id + ',' + order_status + ')">发送确认单</a> ';
- var sp_deal = ' <a style="cursor: pointer" onclick="showMB(' + order_id + ',' + order_status + ',\'' + order_status_name + '\')">异常订单处理</a> ';
- if (dict['order_status'] == 145) {
- var cstr145 = modify + cancel;
- HTML = HTML.replace('[操作]', cstr145);
- } else if (dict['order_status'] == 313) {
- var cstr313 = modify + cancel + send;
- HTML = HTML.replace('[操作]', cstr313)
- } else if (dict['order_status'] == 198) {
- var cstr198 = confirm + sp_deal;
- HTML = HTML.replace('[操作]', cstr198)
- } else if (dict['order_status'] == 314) {
- HTML = HTML.replace('[操作]', sp_deal)
- } else if (dict['order_status'] == 382) { //已安排的订单 异常操作处理了,
- cancel = '<a onclick="cancel_order(' + order_id + ',' + order_status + ',383)" style="cursor: pointer"> 取消 </a>';
- var cstr313 = modify + cancel + send;
- HTML = HTML.replace('[操作]', cstr313)
- } else if (dict['order_status'] == 383) {
- HTML = HTML.replace('[操作]', '-')
- HTML = HTML.replace('[font-color]', 'color: gray');
- }
- // else if (dict['order_status'] == 314 && dict['order_pay_type'] == '现金支付') {
- // HTML = HTML.replace('[操作]', sp_deal)
- // } else if (dict['order_status'] == 314 && dict['order_pay_type'] == '微信支付') {
- // var cstr314wx = modify;
- // HTML = HTML.replace('[操作]', cstr314wx)
- // }
- else if (dict['order_status'] == 147) {
- var cstr147 = modify + cancel;
- HTML = HTML.replace('[操作]', cstr147)
- } else if (dict['order_status'] == 148 || dict['order_status'] == 383) {
- HTML = HTML.replace('[操作]', '—');
- HTML = HTML.replace('[font-color]', 'color: #cccccc');
- }
- //公共备注
- if (dict['memo_flag'] != '') {
- HTML = HTML.replace('[公共备注]', '<a style="cursor: pointer" onclick="remarks(\'' + dict["memo_flag"] + '\')">有</a>')
- } else {
- HTML = HTML.replace('[公共备注]', '无')
- }
- comHTML += HTML;
- }
- $('#order_list').html(comHTML);
- $('#order_list').show();
- }
- function havePageData() {
- start_date = $('#start_date').val();
- end_date = $('#end_date').val();
- province = $("#province").val();
- city = $("#city").val();
- hotel_name = $("#hotel_name").val();
- org_id = $("#org_id").val();
- more_search = $("#more_search").val();
- date_type = $("#date_type").val();
- var com_url = base_api + "?type=order_HotelOrderList&op=order_list&date_type=" + date_type + "&start_date=" + start_date + "&end_date=" + end_date + "&province=" + province + "&city=" + city + "&hotel_name=" + hotel_name + "&order_status=" + order_status + "&org_id=" + org_id + "&more_search=" + more_search + "¤t=" + current + "&page_size=" + page_size;
- ZZLog(com_url);
- $.getJSON(com_url, function (data) {
- ZZLog(data);
- if (data['code'] != "0") {
- ZZAlertInfo(data['info']);
- } else {
- setDataBody(data);
- }
- })
- }
- //获取订单渠道列表
- function getOrgList(url) {
- ZZLog(url);
- $.getJSON(url, function (data) {
- ZZLog(data);
- var org_list = data['org_list'];
- var sumHTML = $('#org_id').prop('outerHTML');
- for (var i = 0; i < org_list.length; i++) {
- var dict = org_list[i];
- var orgHTML = "<option value=0 style='font-size: 12px;'>请选择</option>";
- orgHTML = orgHTML.replace('请选择', dict['org_name']);
- orgHTML = orgHTML.replace('value=0', 'value=' + dict['org_id']);
- sumHTML += orgHTML;
- }
- $('#org_id').html(sumHTML);
- $('.select_line').comboSelect();
- })
- }
-
- $(document).ready(function () {
- //点击查询
- $('#search').bind('click', function () {
- getHotelList();
- });
- //昨日日期
- $('#yesterday').bind('click', function () {
- $("#start_date").val(getDateTime(10));
- $("#end_date").val(getDateTime(10));
- getHotelList();
- });
- //今日日期
- $('#today').bind('click', function () {
-
- $("#start_date").val(getDateTime(0));
- $("#end_date").val(getDateTime(0));
- getHotelList();
-
- });
- //本周日期
- $('#thisweek').bind('click', function () {
- $("#start_date").val(after(getDateTime(12)));
- $("#end_date").val(after(getDateTime(13)));
- getHotelList();
-
- });
- //本月日期
- $('#thismonth').bind('click', function () {
- $("#start_date").val(getDateTime(14));
- $("#end_date").val(getDateTime(15));
- getHotelList();
-
- });
- //选择省的事件
- $('#province').bind('change', function () {
- var area_id = $(this).val();
- if (area_id == "0" || area_id == "") {
- $('#city').html(cityHTML);
- return;
- }
- var url = base_api + "?type=hotel_AddHotelProduct&op=provinceCity&area_id=" + area_id;
- ZZLog(url);
- $.getJSON(url, function (res_data) {
- ZZLog(res_data);
- if (res_data['code'] != "0") {
- ZZAlertInfo(res_data['info']);
- } else {
- //地区
- var area_list = res_data['area_list'];
- var areaHTML = '<option value="0" style="font-size: 12px;">选择市</option>';
- for (var i = 0, m = area_list.length; i < m; i++) {
- var tempDict = area_list[i];
- var tempHTML = cityHTML;
- tempHTML = tempHTML.replace('选择市', tempDict['area_name']);
- tempHTML = tempHTML.replace('0', tempDict['area_id']);
- areaHTML += tempHTML;
- }
- if (areaHTML) {
- $('#city').html(areaHTML);
- $('#city')[0].selectedIndex = 0;
- }
- }
- })
- });
- }
- );
- //订单状态筛选
- var tempobj = null;
- function submit(param, obj) {
-
- if (tempobj) {
- $(tempobj).css("cssText", "font-size: 12px;width: 50px; padding: 3px;display: inline-block;margin-left: 5px;");
- }
- if (obj) {
- $(obj).css("cssText", "font-size: 12px;width: 50px; padding: 3px;display: inline-block;margin-left: 5px;background:dimgrey!important");
- }
- tempobj = obj;
- var url = getSelectInfo(param);
- getHotelList();
- }
- function getSelectInfo(status) {
- order_status = status;
- getHotelList();
- }
- //end 订单状态筛选
- //确认订单
- function make_sure(order_id, order_status) {
-
- //判断状态是否正确
- $.ajax({
- url: base_api,
- type: 'post',
- dataType: 'json',
- data: {
- order_id: order_id,
- order_status: order_status,
- op: 'to_do_next',
- type: "order_HotelOrderList"
- },
- success: function (res_data) {
- if (res_data['code'] != "0") {
- ZZAlertInfo(res_data['info']);
- getHotelList();
- } else {
- MakeSureNum();
- }
- }
- })
-
- function MakeSureNum() {
- var make_sure_num = ZZInput("请输入确认号", function (make_sure_num) {
- var make_sure_order_id = order_id;
- if (make_sure_num) { //点击的是确定
- make_sure_order_update(make_sure_order_id, make_sure_num);
- } else if (make_sure_num == "") { //没有输入内窝 点击了取消
- ZZAlertInfo('请正确输入确认单号');
- } else { //点击了取消
- }
- });
- }
-
- function make_sure_order_update(make_sure_order_id, make_sure_num) {
- var url = base_api + "?type=order_HotelOrderList&op=make_sure&make_sure_order_id=" + make_sure_order_id + "&make_sure_num=" + make_sure_num;
- var param = {
- type: "order_HotelOrderList",
- op: "make_sure",
- make_sure_order_id: make_sure_order_id,
- make_sure_num: make_sure_num
- }
- $.ajax({
- url: url,
- type: "post",
- dataType: "json",
- data: param,
- success: function (res_data) {
- ZZLog(res_data);
- if (res_data['code'] != "0") {
- ZZAlertInfo(res_data['info']);
- getHotelList();
- return;
- }else {
- ZZAlertInfo('确认成功');
- getHotelList();
- }
- },
- error:function (e) {
- console.log(e)
- }
- })
- }
- }//end 确认订单
- //修改订单
- function modify_order(order_status, order_id, org_id, hotel_id, parent_room_type, room_type, org_name) {
- //判断状态是否正确
- $.ajax({
- url: base_api,
- type: 'post',
- dataType: 'json',
- data: {
- order_id: order_id,
- order_status: order_status,
- op: 'to_do_next',
- type: "order_HotelOrderList"
- },
- success: function (res_data) {
- if (res_data['code'] != "0") {
- ZZAlertInfo(res_data['info']);
- getHotelList();
- } else {
- window.location = "hotel_modify_order.html?order_id=" + order_id + "&hotel_id=" + hotel_id + "&room_type=" + room_type + "&parent_room_type=" + parent_room_type + "&org_name=" + org_name + "&org_id=" + org_id + "&order_status=" + order_status;
- }
- }
- })
-
- }//end 修改订单
- //取消订单
- function cancel_order(cancel_order_id, cancel_order_status, new_status) {
- //判断状态是否正确,如果正确则调用取消订单函数
- $.ajax({
- url: base_api,
- type: 'post',
- dataType: 'json',
- data: {
- order_id: cancel_order_id,
- order_status: cancel_order_status,
- op: 'to_do_next',
- type: "order_HotelOrderList"
- },
- success: function (res_data) {
- if (res_data['code'] != "0") {
- ZZAlertInfo(res_data['info']);
- getHotelList();
- } else {
- ZZInput("请输入取消原因", function (cancel_reason) {
- if (cancel_reason) {
- cancel_order_update(cancel_order_id, cancel_order_status, new_status);
- cancel_reason_insert(cancel_order_id, cancel_reason);
- } else if (cancel_reason == '') {
- cancel_order_update(cancel_order_id, cancel_order_status, new_status);
- } else {
- }
- });
- }
- }
- });
-
- function cancel_order_update(cancel_order_id, cancel_order_status, new_status) {
- var url = base_api;
- ZZLog(url);
- var param = {
- type: "order_HotelOrderList",
- op: "cancel_order",
- cancel_order_id: cancel_order_id,
- user_id: user_id,
- cancel_order_status: cancel_order_status,
- new_status: new_status
- };
- $.ajax({
- url: url,
- type: 'post',
- dataType: 'json',
- data: param,
- success: function (res_data) {
- if (res_data['code'] != "0") {
- ZZAlertInfo(res_data['info']);
- getHotelList();
- } else {
- ZZAlertInfo('取消成功');
- getHotelList();
- }
- }
- })
- }
-
- function cancel_reason_insert(cancel_order_id, cancel_reason) {
- var url = base_api + "?type=order_HotelOrderList&op=reason_insert&cancel_order_id=" + cancel_order_id + "&cancel_reason=" + cancel_reason;
- if (cancel_reason == '') {
- ZZAlertInfo('请输入取消原因');
- return
- }
- ZZLog(url);
- $.getJSON(url, function (data) {
- ZZLog(data);
- getHotelList();
- })
- }
- }//end 取消订单
- //发单
- function billing(order_id, order_status) {
-
- //判断状态是否正确,如果正确则继续
- $.ajax({
- url: base_api,
- type: 'post',
- dataType: 'json',
- data: {
- order_id: order_id,
- order_status: order_status,
- op: 'to_do_next',
- type: "order_HotelOrderList"
- },
- success: function (res_data) {
- if (res_data['code'] != "0") {
- ZZAlertInfo(res_data['info']);
- getHotelList();
- } else {
- ZZConfirm("确定发送确认单吗?", function () {
- var url = base_api + "?type=order_HotelOrderList&op=billing&user_id=" + user_id + "&order_id=" + order_id;
- var param = {
- type: "order_HotelOrderList",
- op: "billing",
- user_id: user_id,
- order_id: order_id
- };
- $.ajax({
- url: url,
- type: "post",
- dataType: "json",
- data: param,
- success: function (res_data) {
- ZZLog(res_data);
- if (res_data['code'] != "0") {
- ZZAlertInfo(res_data['info'])
- } else {
- getHotelList();
- }
- }
- })
- });
- }
- }
- });
-
- }
- //删掉重复显示的房型
- function filterRepeatStr(str) {
- var array = str.split("|");
- var data = '<br/>';
- var dict = array[0];//得到第一条数据
- var str2 = dict.split(",");
- var str3 = str2[0];//得到重复房型
- for (var i = 0; i < array.length; i++) {
- var dict1 = array[i];
- if (i == 0) {
- data += dict1;
- } else {
- dict1 = dict1.replace(str3 + ",", "|");
- data += dict1;
- }
-
- }
- return data;
- }
-
- //点击备注
- function remarks(memo) {
- $('#beizhu').show();
- $('#mask').show();
- var row_arr = memo.split('|');
- var sumHTML = '';
- if (row_arr) {
- for (var i = 0; i < row_arr.length; i++) {
- var dict = row_arr[i];
- var HTML = memodiv;
- var temp = dict.split(',');
- var main = temp[2];
- var time = temp[1];
- var user = temp[0];
- HTML = HTML.replace('[备注main]', main);
- HTML = HTML.replace('[备注time]', time);
- HTML = HTML.replace('[备注user]', user);
- sumHTML += HTML
- }
- $('#beizhumain').html(sumHTML);
- $('.memo1:odd').css('background', 'lightgray');
- }
- }
- // 点击蒙板
- function showMB(order_id, order_status, order_status_name) {
-
- //判断状态是否正确,如果正确则继续
- $.ajax({
- url: base_api,
- type: 'post',
- dataType: 'json',
- data: {
- order_id: order_id,
- order_status: order_status,
- op: 'to_do_next',
- type: "order_HotelOrderList"
- },
- success: function (res_data) {
- if (res_data['code'] != "0") {
- ZZAlertInfo(res_data['info']);
- getHotelList();
- } else {
- $('#exception_handling').show();
- $('#mask').show();
- //提交异常状态处理状态
- $('#make_sure').unbind('click');
- $('#make_sure').on('click', function () {
- var text_reason = $('#text_reason').val();
- var url = base_api;
- var param = {
- type: 'order_HotelOrderList',
- op: 'handle_order',
- user_id: 1,
- order_id: order_id,
- text_reason: text_reason,
- order_status: order_status,
- order_status_name: order_status_name
- }
- $.ajax({
- url: url,
- type: "post",
- dataType: "json",
- data: param,
- success: function (data) {
- ZZLog(data);
- if (data['code'] != "0") {
- ZZAlertInfo(res_data['info']);
- } else {
- ZZLog('code=0');
- hideMB();
- getHotelList();
- }
- }, error: function (error) {
- ZZLog(error);
- }
- })
- })
-
- }
- }
- });
-
- }
-
- function hideMB() {
- $('#exception_handling').hide();
- $('#mask').hide();
- $("#text_reason").val('');
- $("#beizhu").hide();
- }
- function excel() {
- $('#excel').bind('click', function () {
- start_date = $('#start_date').val();
- end_date = $('#end_date').val();
- province = $("#province").val();
- city = $("#city").val();
- hotel_name = $("#hotel_name").val();
- org_id = $("#org_id").val();
- more_search = $("#more_search").val();
- date_type = $("#date_type").val();
- //var com_url = base_api + "?type=order_HotelOrderList&op=order_list&date_type=" + date_type + "&start_date=" + start_date + "&end_date=" + end_date + "&province=" + province + "&city=" + city + "&hotel_name=" + hotel_name + "&order_status=" + order_status + "&org_id=" + org_id + "&more_search=" + more_search +"¤t="+current +"&page_size="+page_size
- window.location.href = "/zz-jd/st-ht/HTcontrol.php?type=order_HotelOrderList&op=execl&date_type=" + date_type + "&start_date=" + start_date + "&end_date=" + end_date + "&province=" + province + "&city=" + city + "&hotel_name=" + hotel_name + "&order_status=" + order_status + "&org_id=" + org_id + "&more_search=" + more_search + "¤t=" + current + "&page_size=" + page_size;
- })
- }
- //发送短信
- function sendMessage() {
-
- }
-
-
-
|