|
- /*
- author:yimazsq
- * 2016-10-27
- * */
-
- //分页参数
- var current_page = 1;
- var page_size = 10;
- var urlstr = base_api + 'index.php';
- var user_type = window.getStorage('user_type');
-
- window.onload = function () {
- listHTML = $('#list').html();
- $('#start_date_all').val(getDateTime(0));
- $('#end_date_all').val(getDateTime(0));
-
- selectOnePage(1);
- }
-
- //查询按钮的点击
- function searchBtnDidClicked() {
- selectOnePage(1);
- }
-
- //选中页码
- function selectOnePage(page) {
-
- var start_date = $('#start_date_all').val();
- var end_date = $('#end_date_all').val();
- var line_code = $('#line').val();
- var bill_type = $('#order_channel').val();
- var tp = 'finance_groupFinance_getFinanceList';
-
- current_page = page;
- var data = {
- tp: tp,
- start_date: start_date,
- end_date: end_date,
- line_code: line_code,
- bill_type: bill_type,
- current_page: page,
- page_size: page_size
- };
- ZZLog(data);
- $.ajax({
- url: urlstr, //请求地址
- data: data,
- type: "post",
- dataType: "json",
- async: false,
- success: function (data) {
- if (data.code == "0") {
- ZZLog(data);
- totalpage = data.page.total_page;
- reloadData(data);
- if (totalpage == 0) {
- $('.pageDiv').hide();
- } else {
- createPage(current_page, totalpage);
- $('.pageDiv').show();
- }
- } else {
- ZZAlertInfo(data.info);
- }
- },
- error: function (e) {
- ZZLog(e);
- }
- });
- }
-
- //创建分页控件
- function createPage(currpage, totalpage) {
- $(".pageDiv").createPage({
- pageCount: totalpage, //总页数
- current: currpage, //当前页
- turndown: 'true', //是否显示跳转框,显示为true,不现实为false,一定记得加上引号...
- backFn: function (p) {
-
- var start_date = $('#start_date_all').val();
- var end_date = $('#end_date_all').val();
- var line_code = $('#line').val();
- var bill_type = $('#order_channel').val();
- var tp = 'finance_groupFinance_getFinanceList';
- current_page = p;
- var data = {
- tp: tp,
- start_date: start_date,
- end_date: end_date,
- line_code: line_code,
- bill_type: bill_type,
- current_page: p,
- page_size: page_size
- };
- ZZLog(data);
- $.ajax({
- url: urlstr, //请求地址
- data: data,
- type: "post",
- dataType: "json",
- async: false,
- success: function (data) {
- if (data.code == "0") {
- console.log(data);
- totalpage = data.page.total_page;
- reloadData(data);
- } else {
- ZZAlertInfo(data.info);
- }
- },
- error: function (e) {
- ZZLog(e);
- }
- });
- }
- });
- }
-
- //加载数据
- function reloadData(data){
- var list = data.finance_list;
- var newHTML = '', action = '', action_url = '';
- for(var i = 0; i < list.length; i++) {
- var tempHTML = listHTML;
- var str = list[i].line_code_name;
- if(str!=null)
- {
- str = str.replace(',','</br>');
- }
- list[i].bus_order_id = list[i].bus_order_id < 10 ? '0'+list[i].bus_order_id : list[i].bus_order_id;
-
- //申请报账
- //<a href="[id]" style="cursor: pointer;">申请报账</a><a href="[changeid]" style="cursor: pointer;padding-left: 10px;">修改</a>
- if(list[i].finance_status == 340){
- action_url = "./apply_statement.html?bus_order_id="+list[i].bus_order_id+'&run_id='+list[i].run_id;
- action = '申请';
- }else if(list[i].finance_status == 137 ){ //修改报账
- action_url = "./change_statement.html?bus_order_id="+list[i].bus_order_id+'&run_id='+list[i].run_id;
- if(user_type == 0)
- action = '审核';
- else
- action = '修改';
- }else if(list[i].finance_status == 341 ){ //查看报账
- action_url = "./change_statement.html?ac=view&bus_order_id="+list[i].bus_order_id+'&run_id='+list[i].run_id;
- action = '查看';
- }
- tempHTML = tempHTML.replace('[编号]', list[i].run_id+''+list[i].bus_order_id);
- tempHTML = tempHTML.replace('[线路]', str);
- tempHTML = tempHTML.replace('[出发日期]', list[i].run_date);
- tempHTML = tempHTML.replace('[出发时间]', list[i].run_time);
- tempHTML = tempHTML.replace('[车次]', list[i].bus_order_id);
- tempHTML = tempHTML.replace('[座位数]', list[i].seat_count);
- tempHTML = tempHTML.replace('[人数]', list[i].saled_count);
- tempHTML = tempHTML.replace('[车辆]', list[i].bus_no);
- tempHTML = tempHTML.replace('[司机]', list[i].driver_name);
- tempHTML = tempHTML.replace('[导游]', list[i].guide_name);
- tempHTML = tempHTML.replace('[报账状态]', list[i].finance_type);
- // tempHTML = tempHTML.replace('[id]', "./apply_statement.html?bus_order_id="+list[i].bus_order_id+'&run_id='+list[i].run_id);
- // tempHTML = tempHTML.replace('[changeid]', "./change_statement.html?bus_order_id="+list[i].bus_order_id+'&run_id='+list[i].run_id);
- tempHTML = tempHTML.replace('[操作_url]', action_url);
- tempHTML = tempHTML.replace('[操作]', action);
- // tempHTML = tempHTML.replace('[oneCheck]', 'oneCheck' + list[i].M_ID);
- // tempHTML = tempHTML.replace('[oneCheckName]', list[i].M_ID);
- newHTML += tempHTML;
- }
- $('#list').html(newHTML);
- $('#list').show();
-
- }
-
-
- //复选框判断
- function select_checked(index) {
- //index=0最上面的全选 index=1表示的是下面所有的
- var cur_check = $('.ace_check')[0];
- var checkList = $('.ace_check');
- var checkCount = checkList.length - 1;
- var true_count = 0;
- for (var i = 1; i < checkList.length; i++) {
- if (index == '0') {
- checkList[i].checked = cur_check.checked;
- } else {
- if (checkList[i].checked == false) {
- cur_check.checked = false
- } else {
- true_count = true_count + 1;
- }
- }
- }
- //判断下面是否选中完
- if (checkCount == true_count) {
- cur_check.checked = true;
- }
- }
-
-
- //点击昨天
- function yesterday() {
- var yesterday = before(getDateTime(0));
- $('.start_date_all').val(yesterday);
- $('.end_date_all').val(yesterday);
- }
-
- //点击今天
- function today() {
- var today = getDateTime(0);
- $('.start_date_all').val(today);
- $('.end_date_all').val(today);
- }
|