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 = ``;
org_list.forEach((dict, index) => {
temp_html += ``
});
$('#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 = `
无查询结果 |
`;
$('#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 = ``;
break;
case '2': //待结算
str = ``;
break;
case '3': //已结算
str = ``;
break;
case '4': //已取消
str = ``;
break;
default:
break;
}
let n_dict = JSON.stringify(dict);
let html = `
${dict.start_date}
${dict.end_date}
|
${dict.batch_id} |
${dict.sett_frequency} |
${dict.org_name} |
${dict.price} |
${dict.commission_price} |
${dict.reparations_price} |
${dict.status_des} |
${str} |
`
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 = `
无查询结果 |
`;
$('#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);
}