123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167 |
- 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 '<img style="width:20px;" src="'+row.user.avatar+'" /> '+row.user.nickname+' (id:'+row.user.id+')';
- }
- },
- states:function(value,row,index){
- if (row.state=='0'){
- return '<span class="ord_red">未支付</span>';
- }else{
- return '<span class="ord_green">已支付</span>';
- }
- },
- }
- }
- };
- }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 '<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;
- });
|