1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192 |
- define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
- var Controller = {
- index: function () {
- Table.api.init({
- extend: {
- index_url: Config.orderpath,
- export_url: Config.exportpath,
- table: 'orders',
- },
- showToggle: false,
- showColumns: false,
- visible: false,
- searchFormVisible: true,
- search:false,
- showExport:false,
- commonSearch: true,
- });
- var table = $("#table");
- table.bootstrapTable({
- url: $.fn.bootstrapTable.defaults.extend.index_url,
- pk: 'id',
- sortName: 'orders.id',
- columns: [
- [
- {field: 'out_trade_no', title: __('商户单号')},
- {field: 'transaction_id', title: __('交易单号')},
- {field: 'user.nickname', title: __('用户'),operate:false,formatter: Controller.api.formatter.user},
- {field: 'user.createtime', title: __('用户注册时间'),operate:false,formatter: Table.api.formatter.datetime},
- {field: 'type', title: __('Type'), visible:false, searchList: {"type 1":__('Type 1'),"type 2":__('Type 2')},operate:false},
- {field: 'type_text', title: __('Type'), operate:false},
- {field: 'money', title: __('充值金额')},
- {field: 'state', title: __('支付状态'), formatter: Controller.api.formatter.states, searchList: {"0":__('未支付'),"1":__('已支付')}},
- {field: 'createtime', title: __('下单时间'), formatter: Table.api.formatter.datetime,operate: 'RANGE', addclass:'datetimerange', options: {dateLimit:{days : 30}}},
- {field: 'finishtime', title: __('完成时间'), formatter: Table.api.formatter.datetime,operate: false},
- {field: 'referral_id', title: __('推广链接id'),operate:false},
- {field: 'pdpd', title: __('推广链接渠道'),operate:false},
- {field: 'bookname', title: __('书名'),operate:false},
- {field: 'agent_nickname', title: __('代理商'), operate:false},
- {field: 'channel_nickname', title: __('渠道商昵称')},
- {field: 'channel_id', title: __('渠道商Id')},
- {field: 'channel_username', title: __('渠道商账号')},
- {
- field: 'channel_qrimage',
- title: __('渠道商二维码(点击查看大图)'),
- operate: false,
- formatter: Controller.api.formatter.qrimage
- }
- ]
- ],
- exportOptions: {
- type: 'excel',
- onMsoNumberFormat: function (cell, row, col) {
- return (row > 0 && col == 1) ? '\\@' : '';
- }
- }
- });
- // 为表格绑定事件
- Table.api.bindevent(table);
- },
- add: function () {
- Controller.api.bindevent();
- },
- edit: function () {
- Controller.api.bindevent();
- },
- api: {
- bindevent: function () {
- Form.api.bindevent($("form[role=form]"));
- }, formatter: {
- user: function (value, row, index) {
- return '<img style="width:20px;" src="' + row.user.avatar + '" /> ' + row.user.nickname + ' (id:' + row.user.id + ')';
- },
- states: function (value, row, index) {
- if (value == 0) {
- return '<span class="ord_red">未支付</span>';
- } else {
- return '<span class="ord_green">已支付</span>';
- }
- },
- qrimage: function (value, row, index) {
- if (value) {
- return '<a href="' + value + '" target="_blank"><img style="width:20px;" src="' + value + '"></a>';
- } else {
- return '无';
- }
- }
- }
- }
- };
- return Controller;
- });
|