1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 |
- define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
- var Controller = {
- index: function () {
- // 初始化表格参数配置
- Table.api.init({
- extend: {
- index_url: 'ordersstatement/index',
- export_url: 'ordersexport',
- table: 'orders',
- }
- });
- var table = $("#table");
- table.bootstrapTable({
- url: $.fn.bootstrapTable.defaults.extend.index_url,
- pk: 'id',
- sortName: 'createtime',
- showColumns: false,
- showToggle: false,
- showExport: false,
- searchFormVisible: true,
- search: false,
- commonSearch: true,
- exportTypes: ['excel'],
- exportOptions: {
- type: 'excel',
- onMsoNumberFormat: function (cell, row, col) {
- return (row > 0 && col == 1) ? '\\@' : '';
- }
- },
- columns: [
- [
- {field: 'out_trade_no', title: __('商户单号')},
- {field: 'transaction_id', title: __('交易单号')},
- {field: 'type_text', title: __('Type'), operate: false},
- {field: 'user_id', title: __('用户 ID'), operate: false},
- {field: 'money', title: __('充值金额'), operate: false},
- {
- field: 'state',
- title: __('支付状态'),
- formatter: Controller.api.formatter.states,
- searchList: {"0": __('未支付'), "1": __('已支付')}
- },
- {
- field: 'createtime',
- title: __('下单时间'),
- formatter: Table.api.formatter.datetime,
- operate: 'RANGE',
- addclass: 'datetimerange'
- },
- {
- field: 'finishtime',
- title: __('完成时间'),
- formatter: Table.api.formatter.datetime,
- operate: false
- }
- ]
- ]
- });
- // 为表格绑定事件
- Table.api.bindevent(table);
- },
- api: {
- bindevent: function () {
- Form.api.bindevent($("form[role=form]"));
- },
- formatter: {
- states: function (value, row, index) {
- if (value == 0) {
- return '未支付';
- } else {
- return '已支付';
- }
- },
- },
- }
- };
- return Controller;
- });
|