zhaojs
2023-06-29 7ed108f71c66e74724c066843c4ae08c1050d4b9
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
 
    var Controller = {
        index: function () {
            // 初始化表格参数配置
            Table.api.init({
                extend: {
                    index_url: 'order/pdd/index' + location.search,
                    add_url: 'order/pdd/add',
                    edit_url: 'order/pdd/edit',
                    del_url: 'order/pdd/del',
                    multi_url: 'order/pdd/multi',
                    import_url: 'order/pdd/import',
                    table: 'order_pdd',
                }
            });
 
            var table = $("#table");
 
            // 初始化表格
            table.bootstrapTable({
                url: $.fn.bootstrapTable.defaults.extend.index_url,
                pk: 'id',
                sortName: 'id',
                fixedColumns: true,
                fixedRightNumber: 1,
                columns: [
                    [
                        {checkbox: true},
                        {field: 'id', title: __('Id')},
                        {field: 'user.nickname', title: __('User.nickname'), operate: 'LIKE'},
                        {field: 'user.mobile', title: __('User.mobile'), operate: 'LIKE'},
                        {field: 'goods_name', title: __('Goods_name'), operate: 'LIKE'},
                        {field: 'goods_price', title: __('Goods_price'), operate: false,formatter:function(value, row, index){
                            if(value == "") return "";
                            return value/100;
                        }},
                        {field: 'goods_quantity', title: __('Goods_quantity')},
                        {field: 'goods_thumbnail_url', title: __('Goods_thumbnail_url'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
                        {field: 'order_amount', title: __('Order_amount'), operate: false,formatter:function(value, row, index){
                            if(value == "") return "";
                            return value/100;
                        }},
                        {field: 'order_modify_at', title: __('Order_modify_at'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime,dataTimeFormat:"YYYY-MM-DD HH:mm:ss"},
                        {field: 'order_pay_time', title: __('Order_pay_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime,dataTimeFormat:"YYYY-MM-DD HH:mm:ss"},
                        {field: 'order_sn', title: __('Order_sn'), operate: 'LIKE'},
                        {field: 'order_status_desc', title: __('Order_status_desc'), operate: false},
                        {field: 'promotion_amount', title: __('Promotion_amount'), operate: false,formatter:function(value, row, index){
                            if(value == "") return "";
                            return value/100;
                        }},
                        {field: 'promotion_rate', title: __('Promotion_rate'), operate: false,formatter:function(value, row, index){
                            if(value == "") return "";
                            return value/1000;
                        }},
                        {field: 'price_compare_status', title: __('Price_compare_status'), searchList: {"0":__('正常'),"1":__('比价')}, formatter: Table.api.formatter.status}
                    ]
                ]
            });
 
            // 为表格绑定事件
            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;
});