|
- $(document).ready(function() {
- $(".form_date").datetimepicker({
- format: 'yyyy-mm-dd',
- autoclose: true,
- minView: 2,
- pickerPosition: "bottom-left"
- });
- });
-
- var date_type = '';
- var start_date = '';
- var end_date = '';
- var org_id = '';
- var settlement_status = '';
- var more_search = '';
- var prod_type = '0';
- var page_size = '10';
- var current = '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() {
- date_type = $('#date_type').val();
- start_date = $('#beforeDate').val();
- end_date = $('#currentDate').val();
- settlement_status = $('#settlement_status').val();
- org_id = $('#org_list').val();
- more_search = $('#more_search').val();
- let first_current = '1';
- let tp = 'gathering_getList';
- let data = { date_type, start_date, end_date, settlement_status, org_id, more_search, prod_type, current_page: first_current, page_size, tp };
- $.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="11">无查询结果</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();
- }
-
- $('#total_price').text(res_data.data.sum_info.total_price);
- $('#commission_price').text(res_data.data.sum_info.total_commission);
- $('#reparation_price').text(res_data.data.sum_info.reparations_price);
- $('#price_div').css('opacity', '1');
-
- $('#order_list').show();
- }
- },
- error: error => {
- $$.closeLoading();
- $$.alert($$.infoApiError);
- }
- });
- }
-
- function replaceOrderList(dict) {
- // let title = getStatusDes(dict.order_prod_type);
- let html = `<tr>
- <td>${dict.order_id}</td>
- <td>${dict.outside_order_no}</td>
- <td>${dict.create_time}</td>
- <td>${dict.parent_prod_name}</td>
- <td>${dict.prodName}</td>
- <td>${dict.prodNum}</td>
- <td>${dict.prod_type_des}</td>
- <td>${dict.run_date}</td>
- <td>${dict.supplier_name}</td>
- <td>${dict.order_price}</td>
- <td>${dict.status_des}</td>
- </tr>`;
- return html;
- }
-
- //创建分页
- function createPage(currpage, totalpage) {
- $('#page_order_list').createPage({
- pageCount: totalpage,
- current: currpage,
- turndown: 'true',
- backFn: function(p) {
- current_page = p;
- $$.loading();
- $$.delay(httpData, 10);
- }
- });
- }
-
- //分页查询
- function httpData() {
- let tp = 'gathering_getList';
- let data = { date_type, start_date, end_date, settlement_status, org_id, more_search, prod_type, current_page, page_size, tp };
- $.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="11">无查询结果</td>
- </tr>`;
- $('#order_list').html(html);
- } else {
- $('#order_list').html(temp_html);
- }
- $('#order_list').show();
- }
- },
- error: error => {
- $$.closeLoading();
- $$.alert($$.infoApiError);
- }
- });
- }
-
- //查询
- function searchDidClick() {
- $$.loading();
- $$.delay(httpFirstData, 10);
- }
-
- //订单筛选
- function orderTypeDidClicked(index) {
- switch(index) {
- case 'all':
- prod_type = '0';
- break;
- case 'bar':
- prod_type = '81,82,38,369';
- break;
- case 'hotel':
- prod_type = '25,26';
- break;
- case 'ticket':
- prod_type = '258,282,311';
- break;
- case 'ziyou':
- prod_type = 'ziyou';
- break;
- default:
- break;
- }
- $$.loading();
- $$.delay(httpFirstData, 10);
- // httpFirstData();
- }
-
- //function getStatusDes(index) {
- // var arr1 = ['81', '82', '38', '369'];
- // var arr2 = ['25', '26'];
- // var arr3 = ['258', '282', '311'];
- // var title = '';
- // if(arr1.indexOf(index) != -1) title = '巴士';
- // if(arr2.indexOf(index) != -1) title = '酒店';
- // if(arr3.indexOf(index) != -1) title = '门票';
- //
- // return title;
- //}
-
- //操作订单
- function operationBill(index) {
- let tp = '';
- switch(index) {
- case 'close':
- tp = 'gathering_closesAmount';
- break;
- case 'generate':
- tp = 'gathering_addBalance';
- break;
- case 'cancel':
- tp = 'gathering_cancelCloses';
- break;
- default:
- break;
- }
- $$.loading();
- httpStatus(tp);
- }
-
- function httpStatus(tp) {
- let data = { date_type, start_date, end_date, settlement_status, org_id, more_search, prod_type, tp };
- $$.delay(function() {
- $.ajax({
- type: "post",
- url: $$.base_api + 'application/financeManager/index.php',
- async: false,
- dataType: 'json',
- data: data,
- success: res_data => {
- $$.closeLoading();
- if('0' != res_data.code) {
- $$.alert(res_data.info);
- } else {
- $$.alert('操作成功');
- httpFirstData();
- }
- },
- error: error => {
- $$.closeLoading();
- $$.alert($$.infoApiError);
- }
- });
- }, 10);
-
- }
|