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

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

            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_id', title: __('User_id')},
                        {field: 'user.nickname', title: __('User.nickname')},
                        {field: 'user.avatar', title: __('User.avatar'), operate:false, events: Table.api.events.image, formatter: Table.api.formatter.image},
                        {field: 'merchant_title', title: __('Merchant_title')},
                        {field: 'merchant_name', title: __('Merchant_name')},
                        {field: 'merchant_mobile', title: __('Merchant_mobile')},
                        {field: 'area', title: __('Area')},
                        // {field: 'brief', title: __('Brief')},
                        {field: 'business_images', title: __('Business_images'), operate:false, events: Table.api.events.image, formatter: Table.api.formatter.images},
                        {field: 'other_images', title: __('Other_images'), operate:false, events: Table.api.events.image, formatter: Table.api.formatter.images},
                        {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime},
                        {field: 'status', title: __('审核状态'), searchList: {"3":__('审核失败'),"2":__('审核通过'),"1":__('待审核')}, formatter: Table.api.formatter.status},
                        {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;
});