//Author:fuhc //Date:20161017 //选择产品 用angular 试水 var page_size = '15'; var current_page = '1'; var top_type_value = '255'; var line_param = ''; var start_area = ''; var end_area = ''; var start_date = ''; var user_type = getStorage('user_type'); //$(document).ready(function(){ // $('.select_line').comboSelect(); //}) (function () { var app = angular.module('myApp', []); setAngularJSApp(app); app.controller('myVC', function ($scope, $http) { $scope.create_order_url = "single_order.html?line_type=" + top_type_value; var $tempType = null; var _tNowTime = new Date(); var _input_date_hour = _tNowTime.getHours(); if (_input_date_hour >= 7) { $scope.start_date = after(getDateTime(0)); $('#start_date').val(after(getDateTime(0))); } else { $scope.start_date = getDateTime(0); $('#start_date').val(getDateTime(0)); } // 0:全权限 1:仅直通巴士 2.穿梭巴士 3.组合线路 4:直通+穿梭 5.直通+组合 6.穿梭+组合 switch (user_type) { case '1': top_type_value = '255'; $('.top_line[typevalue="256"]').hide(); $('.top_line[typevalue="316"]').hide(); topClick($('.top_line[typevalue="255"]')); break; case '2': top_type_value = '256'; $('.top_line[typevalue="255"]').hide(); $('.top_line[typevalue="316"]').hide(); topClick($('.top_line[typevalue="256"]')); break; case '3': top_type_value = '316'; $('.top_line[typevalue="255"]').hide(); $('.top_line[typevalue="256"]').hide(); $('#sing-table').hide(); $('#com-table').show(); topClick($('.top_line[typevalue="316"]')); break; case '4': top_type_value = '255'; $('.top_line[typevalue="316"]').hide(); topClick($('.top_line[typevalue="255"]')); break; case '5': top_type_value = '255'; $('.top_line[typevalue="256"]').hide(); topClick($('.top_line[typevalue="255"]')); break; case '6': top_type_value = '256'; $('.top_line[typevalue="255"]').hide(); topClick($('.top_line[typevalue="256"]')); break; default: topClick($('.top_line[typevalue="255"]')); break; } $('.top_line[typevalue="316"]').hide(); $('.top_line').bind('click', function () { topClick($(this)); }) function topClick(obj) { top_type_value = $(obj).attr('typevalue'); //跳转链接 $scope.create_order_url = (top_type_value == "316" ? "group_order.html" : "single_order.html") + "?line_type=" + top_type_value; if (top_type_value == "316") { $('.comline').show(); $('#com-table').show(); $('#sing-table').hide(); $('.singline').hide(); } else { $('.comline').hide(); $('#com-table').hide(); $('#sing-table').show(); $('.singline').show(); } if ($tempType) { $tempType.removeClass('type_btn_cur'); $tempType.addClass('btn-primary'); } else { $('.type_btn_cur').addClass('btn-primary'); $('.type_btn_cur').removeClass('type_btn_cur'); } $(obj).removeClass('btn-primary'); $(obj).addClass('type_btn_cur'); $tempType = $tempType == null ? $(obj) : $(obj); hideImport(top_type_value); if (top_type_value == "316") { httpComBaseInfo(); //加载组合线路的基础信息 } else { httpBaseInfo(); //加载单一线路的基础信息 } httpDataFirst(); //第一次请求 } // httpDataFirst(); //第一次请求 //点击查询 $scope.searchClick = function () { httpDataFirst(); } //第一次请求 function httpDataFirst() { line_param = $('#line').val(); start_area = $('#start_area').val(); end_area = $('#end_area').val(); start_date = $('#start_date').val(); $scope.param = { tp: "lineProduct_getProductList", page_size: page_size, current_page: current_page, line_code: line_param, start_area: start_area, end_area: end_area, run_date: start_date, line_type: top_type_value } if (top_type_value == "316") { $scope.param = { tp: "lineProduct_groupProductList", current_page: current_page, page_size: page_size, line: line_param, // top_type_value product_type: $('#leimu').val(), run_date: start_date } } ZZLog(base_api + "orderManager/index.php" + JSON.stringify($scope.param)) $http({ url: base_api + "orderManager/index.php", method: "POST", data: $scope.param }).success(function (res_data) { ZZLog(res_data); if (res_data['code'] != "0") { ZZAlertInfo(res_data['info']); } else { if (top_type_value == "316") { $scope.com_product_list = res_data['product_list']; $scope.start_date = $('#start_date').val(); } else { $scope.product_list = res_data['product_list']; } $('#single-tbody').show(); if (res_data['page']['total_count'] <= 0) { $('.pageDiv').hide(); } else { $(".pageDiv").createPage({ pageCount: res_data['page']['total_page'],//总页数 current: current_page,//当前页 turndown: 'true',//是否显示跳转框,显示为true,不现实为false,一定记得加上引号... backFn: function (p) { current_page = p; httpData(); } }); $('.pageDiv').show(); } } }).error(function () { ZZLog("error"); }) } //加载单一线路的基础信息 function httpBaseInfo() { $scope.param = { tp: "lineProduct_getProductListBase", line_type: top_type_value } ZZLog(base_api + "orderManager/index.php" + JSON.stringify($scope.param)) $http({ url: base_api + "orderManager/index.php", method: "POST", data: $scope.param }).success(function (res_data) { ZZLog(res_data); if (res_data['code'] != "0") { ZZAlertInfo(res_data['info']); } else { $scope.start_area = res_data['start_area']; $scope.end_area = res_data['end_area']; } }).error(function () { ZZLog('error'); }) } //加载组合线路的基础信息 function httpComBaseInfo() { $scope.param = { tp: "lineProduct_groupProductHeadInfo" } ZZLog(base_api + "orderManager/index.php" + JSON.stringify($scope.param)); $http({ url: base_api + "orderManager/index.php", method: "POST", data: $scope.param }).success(function (res_data) { ZZLog(res_data); if (res_data['code'] != "0") { ZZAlertInfo(res_data['info']); } else { $scope.product_line = res_data['product_line']; } }).error(function () { ZZLog('error'); }) } //得到产品列表 function httpData() { line_param = $('#line').val(); start_area = $('#start_area').val(); end_area = $('#end_area').val(); start_date = $('#start_date').val(); $scope.param = { tp: "lineProduct_getProductList", page_size: page_size, current_page: current_page, line_code: line_param, start_area: start_area, end_area: end_area, run_date: start_date, line_type: top_type_value } if (top_type_value == "316") { $scope.param = { tp: "lineProduct_groupProductList", current_page: current_page, page_size: page_size, line: line_param, // top_type_value product_type: $('#leimu').val(), run_date: start_date } } ZZLog(base_api + "orderManager/index.php" + JSON.stringify($scope.param)) $http({ url: base_api + "orderManager/index.php", method: "POST", data: $scope.param }).success(function (res_data) { ZZLog(res_data); if (res_data['code'] != "0") { ZZAlertInfo(res_data['info']); } else { if (top_type_value == "316") { $scope.com_product_list = res_data['product_list']; } else { $scope.product_list = res_data['product_list']; } } }).error(function () { ZZLog("error"); }) } }); $("#file").on('change', function (e) { $("#file_name").val($(this).val()); }) })(); function upload_import() { ZZConfirm("数据较多时请耐心等待
确定导入订单吗?",function(ok){ if ($("#file").val() != '') { loading(); var form = document.querySelector('form'); var data = new FormData(form); data.append('tp', 'order_singleOrder_importOrder'); $.ajax({ url: base_api + 'index.php', //请求地址 data: data, type: "post", dataType: "json", processData: false, contentType: false, success: function (data) { closeLoading(); var EXCEL_ORDER_ID = 0; var EXCEL_NAME = 3; var EXCEL_TEL = 4; var EXCEL_FLIGHT = 5; var EXCEL_DATE = 6; var EXCEL_FLIGHT_T = 7; var EXCEL_TIME = 8; var EXCEL_MOUNT = 9; var EXCEL_HOTEL = 10; var EXCEL_NOTE = 11; var EXCEL_SUPPLIER = 2; if (data.code != "0") { ZZAlertInfo(data.info); }else if(data.info != '') { ZZAlertInfo(data.info); } if (data.data.length > 0) { $("#bulk-info").html("以下数据导入失败:
"); var table = ""; $.each(data.data, function (k, item) { table += ""; }) table += "
类型商家订单号日期时间姓名手机提示
" + item['type'] + "" + item[EXCEL_ORDER_ID] + "" + item[EXCEL_DATE] + "" + item[EXCEL_TIME] + "" + item[EXCEL_NAME] + "" + item[EXCEL_TEL] + "" + item['error'] + "
"; $("#bulk-info").append(table); $("#bulk-info").show(); } else{ $(".bulk-info").html(''); $(".bulk-info").hide(); } ZZlog(data.data) // $(".bulk input").val(''); }, error: function (msg) { closeLoading(); } }); }else{ ZZAlertInfo('请选择excel文档'); } },function(cancel){},function(close){}); } //隐藏批量导入 function hideImport() { if (top_type_value == "256") { $(".bulk").show(); } else { $(".bulk").hide(); $(".bulk-info").hide(); } }