order_invoice.js 3.9 KB
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {

    var Controller = {
        index: function () {
            // 初始化表格参数配置
            Table.api.init({
                extend: {
                    index_url: 'order_invoice/index' + location.search,
                    add_url: 'order_invoice/add',
                    edit_url: 'order_invoice/edit',
                    del_url: 'order_invoice/del',
                    multi_url: 'order_invoice/multi',
                    table: 'order_invoice',
                }
            });

            var table = $("#table");

            // 初始化表格
            table.bootstrapTable({
                url: $.fn.bootstrapTable.defaults.extend.index_url,
                pk: 'id',
                sortName: 'id',
                columns: [
                    [
                        {checkbox: true},
                        {field: 'id', title: __('Id')},
                        {field: 'user.username', title: __('User.username')},
                        {field: 'order_sn', title: __('Order_sn')},
                        {field: 'invoice_code', title: __('Invoice_code')},
                        {field: 'invoice_num', title: __('Invoice_num')},
                        {field: 'shopping', title: __('Shopping')},
                        {field: 'shop_order', title: __('Shop_order')},
                        {field: 'invoice_status', title: __('Invoice_status'), searchList: {"1":__('Invoice_status 1'),"2":__('Invoice_status 2'),"3":__('Invoice_status 3'),"4":__('Invoice_status 4')}, formatter: Table.api.formatter.status},
                        // {field: 'user_id', title: __('User_id')},
                        {field: 'invoice_type', title: __('Invoice_type'), searchList: {"1":__('Invoice_type 1'),"2":__('Invoice_type 2')}, formatter: Table.api.formatter.normal},
                        {field: 'invoice_head', title: __('Invoice_head'), searchList: {"1":__('Invoice_head 1'),"2":__('Invoice_head 2')}, formatter: Table.api.formatter.normal},
                        {field: 'invoice_head_name', title: __('Invoice_head_name')},
                        {field: 'company_code', title: __('Company_code')},
                        {field: 'bank_name', title: __('Bank_name')},
                        {field: 'bank_num', title: __('Bank_num')},
                        {field: 'company_tel', title: __('Company_tel')},
                        // {field: 'invoice_address', title: __('Invoice_address')},
                        {field: 'invoice_people', title: __('Invoice_people')},
                        {field: 'mobile', title: __('Mobile')},
                        {field: 'address', title: __('Address')},
                        {field: 'address_con', title: __('Address_con')},
                        {field: 'paragraph', title: __('Paragraph')},
                        // {field: 'register_tel', title: __('Register_tel')},
                        {field: 'invoice_head_people', title: __('Invoice_head_people')},
                        {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime},
                        {field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime},
                        {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
                    ]
                ]
            });

            // 为表格绑定事件
            Table.api.bindevent(table);
        },
        add: function () {
            Controller.api.bindevent();
        },
        edit: function () {
            Controller.api.bindevent();
        },
        api: {
            bindevent: function () {
                Form.api.bindevent($("form[role=form]"));
            }
        }
    };
    return Controller;
});