|
- var org_id = '';
- var current = '1';
- var batch_id = '';
- var status = '';
- var page_size = '10';
- var currpage_page = '1';
-
- window.onload = function() {
- httpBaseInfo();
- }
-
- function httpBaseInfo() {
- let data = {
- type: 'des_ordersource',
- ordersource: ''
- }
- $.ajax({
- url: $$.base_api + 'st-xm/control.php',
- data: data,
- dataType: 'json',
- type: 'post',
- async: false,
- success: res_data => {
- $$.ZZLog(res_data);
- if(0 != res_data.code) {
- $$.alert(res_data.info);
- } else {
- let org_list = res_data.list;
- let temp_html = `<option value="0">请选择</option>`;
- org_list.forEach((dict, index) => {
- temp_html += `<option value="${dict.org_id}">${dict.org_name}</option>`
- });
- $('#org_list').html(temp_html);
- $('#org_list').comboSelect();
- $$.loading();
- $$.delay(httpFirstData, 10);
- // httpFirstData();
- }
- },
- error: (error) => {
- $$.alert($$.infoApiError);
- }
- })
- }
-
- function httpFirstData() {
- org_id = $('#org_list').val();
- batch_id = $('#amount_id').val();
- status = $('#status_type').val();
- let first_current = '1';
- let tp = 'gathering_getBalance';
- let data = { tp, current_page: first_current, page_size, org_id, batch_id, status };
- $.ajax({
- type: "post",
- url: $$.base_api + 'application/financeManager/index.php',
- async: false,
- dataType: 'json',
- data: data,
- success: res_data => {
- $$.closeLoading();
- $$.ZZLog(res_data);
- if('0' != res_data.code) {
- $$.alert(res_data.info);
- } else {
- let total_page = res_data.data.page.total_page;
- let order_list = res_data.data.order_list;
-
- let temp_html = '';
- order_list.forEach((dict, index) => {
- temp_html += replaceOrderList(dict);
- });
-
- if(order_list.length <= 0) {
- var html = `<tr style="text-align: center;">
- <td style="color: #666;" colspan="8">无查询结果</td>
- </tr>`;
- $('#order_list').html(html);
- } else {
- $('#order_list').html(temp_html);
- }
-
- if(total_page == '0') {
- $('#page_order_list').hide();
- } else {
- createPage(first_current, total_page);
- $('#page_order_list').show();
- }
- $('#order_list').show();
- addHoverEvent();
- }
- },
- error: error => {
- $$.closeLoading();
- $$.alert($$.infoApiError);
- }
- });
- }
-
- function replaceOrderList(dict) {
- let str = '';
- switch(dict.status) {
- case '1': //待核对
- str = `<div><button type="button" class="btn btn-link btn-xs" onclick="rightCheck(${dict.id})">确认核对</button><button type="button" class="btn btn-link btn-xs" onclick="cancelBill(${dict.id})">取消对账</button><button type="button" class="btn btn-link btn-xs" onclick="downloadBill(${dict.id})">下载账单</button></div>`;
- break;
- case '2': //待结算
- str = `<div><button type="button" class="btn btn-link btn-xs" onclick="rightSettlement(${dict.id})">确认结算</button><button type="button" class="btn btn-link btn-xs" onclick="downloadBill(${dict.id})">下载账单</button></div>`;
- break;
- case '3': //已结算
- str = `<button type="button" class="btn btn-link btn-xs" onclick="downloadBill(${dict.id})">下载账单</button></div>`;
- break;
- case '4': //已取消
- str = `<button type="button" class="btn btn-link btn-xs" onclick="downloadBill(${dict.id})">下载账单</button></div>`;
- break;
- default:
- break;
- }
-
- let n_dict = JSON.stringify(dict);
- let html = `<tr dict='${n_dict}'>
- <td>
- <div>${dict.start_date}</div>
- <div>${dict.end_date}</div>
- </td>
- <td>${dict.batch_id}</td>
- <td>${dict.sett_frequency}</td>
- <td><span class="org_info" style="cursor:pointer;">${dict.org_name}</span></td>
- <td style="color:#0db910">${dict.price}</td>
- <td style="color:red">${dict.commission_price}</td>
- <td style="color:red">${dict.reparations_price}</td>
- <td>${dict.status_des}</td>
- <td>${str}</td>
- </tr>`
-
- return html;
- }
-
- function createPage(currpage, totalpage) {
- $('#page_order_list').createPage({
- pageCount: totalpage,
- current: currpage,
- turndown: 'true',
- backFn: function(p) {
- currpage_page = p;
- $$.loading();
- $$.delay(httpData, 10);
- }
- });
- }
-
- function httpData() {
- let tp = 'gathering_getBalance';
- let data = { tp, current_page: currpage_page, page_size, org_id, batch_id, status };
- $.ajax({
- type: "post",
- url: $$.base_api + 'application/financeManager/index.php',
- async: false,
- dataType: 'json',
- data: data,
- success: res_data => {
- $$.ZZLog(res_data);
- $$.closeLoading();
- if('0' != res_data.code) {
- $$.alert(res_data.info);
- } else {
- let order_list = res_data.data.order_list;
-
- let temp_html = '';
- order_list.forEach((dict, index) => {
- temp_html += replaceOrderList(dict);
- });
- if(order_list.length <= 0) {
- var html = `<tr style="text-align: center;">
- <td style="color: #666;" colspan="8">无查询结果</td>
- </tr>`;
- $('#order_list').html(html);
- } else {
- $('#order_list').html(temp_html);
- }
- $('#order_list').show();
- addHoverEvent();
- }
- },
- error: error => {
- $$.closeLoading();
- $$.alert($$.infoApiError);
- }
- });
- }
-
- function searchDidClick() {
- $$.loading();
- $$.delay(httpFirstData, 10);
- }
-
- function addHoverEvent() {
- $('.org_info').on('mouseover mouseout', function(event) {
- if(event.type == 'mouseover') {
- let mouthLeft = $(this).parent().offset().left;
- let mouthTop = $(this).parent().offset().top;
- let td_height = parseInt($(this).parent().css('height').replace('px', ''));
- $('#bank_info').css('top', mouthTop - 130 + 'px');
- $('#bank_info').css('left', parseInt(mouthLeft + 100) + 'px');
-
- let dict = $(this).parent().parent().attr('dict');
- dict = JSON.parse(dict);
- $('#cycle').text(dict.sett_frequency);
- $('#bank_name').text(dict.account_bank);
- $('#bank_id').text(dict.batch_id);
- $('#id_name').text(dict.bank_name);
-
- $('#bank_info').show();
-
- } else if(event.type == 'mouseout') {
- $('#bank_info').hide();
- }
- })
- }
-
- //确认核对
- function rightCheck(id) {
- $$.confirm('是否确认已核对完该对账单?', function() {
- let data = { tp: 'gathering_confirmedBalance', id: id };
- $.ajax({
- type: "post",
- url: $$.base_api + 'application/financeManager/index.php',
- async: false,
- dataType: 'json',
- data: data,
- success: res_data => {
- $$.ZZLog(res_data);
- if('0' != res_data.code) {
- $$.alert(res_data.info);
- } else {
- $$.loading();
- httpData();
- }
- },
- error: error => {
- $$.alert($$.infoApiError);
- }
- });
- }, function() {
-
- }, function() {
-
- });
-
- }
-
- //取消对账
- function cancelBill(id) {
- let data = { tp: 'gathering_cancelBalance', id: id };
- $.ajax({
- type: "post",
- url: $$.base_api + 'application/financeManager/index.php',
- async: false,
- dataType: 'json',
- data: data,
- success: res_data => {
- $$.ZZLog(res_data);
- if('0' != res_data.code) {
- $$.alert(res_data.info);
- } else {
- $$.loading();
- httpData();
- }
- },
- error: error => {
- $$.alert($$.infoApiError);
- }
- });
- }
-
- //确认结算
- function rightSettlement(id) {
- $$.confirm('是否确认已完成打款操作?', function() {
- let data = { tp: 'gathering_balancing', id: id };
- $.ajax({
- type: "post",
- url: $$.base_api + 'application/financeManager/index.php',
- async: false,
- dataType: 'json',
- data: data,
- success: res_data => {
- $$.ZZLog(res_data);
- if('0' != res_data.code) {
- $$.alert(res_data.info);
- } else {
- $$.loading();
- httpData();
- }
- },
- error: error => {
- $$.alert($$.infoApiError);
- }
- });
- }, function() {
-
- }, function() {
-
- });
-
- }
-
- //下载账单
- function downloadBill(id) {
- window.open($$.base_api + 'application/financeManager/index.php?tp=gathering_excelBalance&id=' + id);
- }
|