define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) { if(Config.orderType==1){ var Controller = { klorder: function () { // 初始化表格参数配置 Table.api.init({ extend: { index_url: 'orders/klorder', multi_url: 'orders/multi', table: 'orders', }, showToggle: false, showColumns: false, visible: false, searchFormVisible: true, search:false, showExport:true }); var table = $("#table"); // 初始化表格 table.bootstrapTable({ url: $.fn.bootstrapTable.defaults.extend.index_url, pk: 'id', sortName: 'id', columns: [ [ {field: 'out_trade_no', title: __('商户单号'),operate: 'LIKE %...%'}, {field: 'transaction_id', title: __('交易单号'),operate: 'LIKE %...%'}, {field: 'user.nickname', title: __('用户'),operate:false,formatter: Controller.api.formatter.user}, {field: 'orders.type', title: __('Type'), visible:false, searchList: {"1":__('书币充值'),"2":__('VIP充值')}}, {field: 'type_text', title: __('Type'), operate:false}, {field: 'money', title: __('充值金额'),operate:'='}, {field: 'orders.state', title: __('支付状态'),formatter: Controller.api.formatter.states, searchList: {"0":__('未支付'),"1":__('已支付')}}, {field: 'finishtime', title: __('完成时间'), formatter: Table.api.formatter.datetime,operate: 'RANGE', addclass:'datetimerange'}, {field: 'cnickname', title:__('渠道商'),operate:false}, {field: 'resource_id', title: __('资源id')}, ] ] }); // 为表格绑定事件 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){ if(row.user){ return ' '+row.user.nickname+' (id:'+row.user.id+')'; } }, states:function(value,row,index){ if (row.state=='0'){ return '未支付'; }else{ return '已支付'; } }, } } }; }else{ var Controller = { index: function () { // 初始化表格参数配置 Table.api.init({ extend: { index_url: Config.orderpath, multi_url: 'orders/multi', table: 'orders', }, showToggle: false, showColumns: false, visible: false, searchFormVisible: Config.searchFormVisibleStatus, search:false, showExport:true, commonSearch: Config.searchFormVisibleStatus, }); var table = $("#table"); // 初始化表格 table.bootstrapTable({ url: $.fn.bootstrapTable.defaults.extend.index_url, pk: 'id', sortName: 'id', columns: [ [ {field: 'out_trade_no', title: __('商户单号'),operate: 'LIKE %...%'}, {field: 'transaction_id', title: __('交易单号'),operate: 'LIKE %...%'}, {field: 'user.nickname', title: __('用户'),operate:false,formatter: Controller.api.formatter.user}, {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: __('充值金额'),operate:'='}, {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: 'RANGE', addclass:'datetimerange'}, {field: 'referral_id', title: __('推广链接id'),operate:false}, {field: 'pdqd', title: __('推广链接渠道'),operate:false}, {field: 'bookname', title: __('书名'),operate:false,visible:(Config.group<=2)}, {field: 'user.agent_id', title: __('代理商'),visible:(Config.group<4 || Config.group==5), operate:false}, {field: 'user.channel_id', title: __('渠道商'),visible:(Config.group<3 || Config.group==5), operate:false}, {field: 'user.cchannelid', title: __('渠道商Id'),visible:(Config.group<3 || Config.group==5), operate:false}, {field: 'user.cusername', title: __('渠道商用户名'),visible:(Config.group<3 || Config.group==5), operate:false}, {field: 'user.qrimage',title:__('渠道商二维码(点击查看大图)'),visible:(Config.group<3 || Config.group==5), 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 ' '+row.user.nickname+' (id:'+row.user.id+')'; }, states:function(value,row,index){ if (value==0){ return '未支付'; }else{ return '已支付'; } }, qrimage:function(value,row,index){ if(value){ return ''; }else{ return '无'; } } } } }; } return Controller; });