/**
 * 数据管理-税率数据管理首页JS
 *
 * Created by li.kui on 20203/17.
 */
'use strict';
var el = {
    searchForm: '#searchForm',
    pgCode: '#pgCode',
    pgName: '#pgName',
    poCode: '#poCode',
    orgCodeOrName: '#orgCodeOrName',
    tb: '#tb',
    addOrEditDialog: null,
    lookDialog: null,
    bodyHeight: document.documentElement.clientHeight
};


$(function () {
    loadGrid();
});


function loadGrid() {
    var searchHeight = $(el.searchForm).outerHeight();
    var pager = initGridPagerNew(el.bodyHeight - searchHeight, 40, 30);

    $(el.tb).datagrid({
        loadMsg: '数据加载中......',
        url: g.ctx + 'pc/finance/payable/refund/rest/list',
        singleSelect: true,
        height: el.bodyHeight - searchHeight,
        pagination: true,
        pageSize: pager.pageSize,
        pageList: pager.pageList,
        rownumbers: true,
        queryParams: {},
        columns: [
            [
                {
                    field: 'ck',
                    checkbox: true
                },
                {
                    field: 'dzdh',
                    title: '对账单号',
                    width: 140
                },
                {
                    field: 'yhls',
                    title: '银行流水',
                    width: 200
                },
                {
                    field: 'skdh',
                    title: '收款单号',
                    width: 140
                },
                {
                    field: 'tkje',
                    title: '退款金额',
                    width: 120
                },
                {
                    field: 'actualUnpaidAmount',
                    title: '实际应付金额',
                    width: 120,
                    formatter: function (value) {
                        if (value < 0) {
                            return '<span style="color: red;">' + formatterPrice(value) + '</span>';
                        }else {
                            return formatterPrice(value)
                        }
                    }
                },
                {
                    field: 'bz',
                    title: '币种',
                    width: 80
                },
                {
                    field: 'tkri',
                    title: '退款日期',
                    width: 120,
                    formatter: function (value) {
                        return moment(value).format('YYYY-MM-DD');
                    }
                },
                {
                    field: 'supplierName',
                    title: '供应商名称',
                    width: 160
                },
                {
                    field: 'qxsk',
                    title: '取消收款',
                    width: 80,
                    formatter:function (value,row) {
                        if(value === "1"){
                            return "是"
                        }else{
                            return '否';
                        }
                    }
                },
                {
                    field: 'cjrq',
                    title: '创建日期',
                    width: 140,
                    formatter: function (value) {
                        return moment(value).format('YYYY-MM-DD HH:mm:ss');
                    }
                },
                {
                    field: 'createTime',
                    title: '推送时间',
                    width: 140,
                    formatter: function (value) {
                        return moment(value).format('YYYY-MM-DD HH:mm:ss');
                    }
                }
            ]
        ]
    });
}



