123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108 |
- define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
- var Controller = {
- index: function () {
- // 初始化表格参数配置
- Table.api.init({
- extend: {
- index_url: 'customurl/index?message_type='+$(".message_type").val()+Config.path,
- add_url: 'customurl/add',
- edit_url: 'customurl/edit',
- del_url: 'customurl/del',
- multi_url: 'customurl/multi',
- table: 'custom_url',
- }
- });
- var table = $("#table");
- // 初始化表格
- table.bootstrapTable({
- url: $.fn.bootstrapTable.defaults.extend.index_url,
- pk: 'id',
- sortName: 'id',
- showToggle: false,
- visible: false,
- searchFormVisible:true,
- search:false,
- columns: [
- [
- {field: 'custom_id', title: __('推广id')},
- {field: 'sendtime', title: __('发送时间'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime},
- {field: 'official_account_id', title: __('公众号id')},
- {field: 'official_account_type', title: __('Official_account_type'), visible:false, searchList: {"0":__('Official_account_type 0'),"1":__('Official_account_type 1')}},
- {field: 'official_account_name', title: __('Official_account_name'), operate:"LIKE %...%"},
- {field: 'official_account_type_text', title: __('Official_account_type'), operate:false},
- {field: 'title', title: __('Title') ,operate:"LIKE %...%", formatter:function(value,row,index){
- return '<div style="width:260px;line-height:1.5">'+ value +'</div>';
- }},
- {field: 'url', title: __('推送链接'), operate:false},
- {field: 'type', title: __('Type'), visible:false, searchList: {"0":__('Type 0'),"1":__('Type 1'),"2":__('Type 2'),"3":__('Type 3'),"5":__('Type 5')}},
- {field: 'type_text', title: __('Type'), operate:false},
- {field: 'book_id', title: __('Book_id'), formatter: function(value){
- return value?value:'--';
- }},
- {field: 'book_name', title: __('书籍名称/活动名称/菜单名称'),operate:false, formatter: function (value,row,index) {
- if(row.type == 0){
- return value?value:'--';
- }else if(row.type == 1){
- return row.activity_name?row.activity_name:'--';
- }else if(row.type == 3){
- return row.menu_name?row.menu_name:'--';
- }
- }},
- {field: 'book_name', title: __('书籍名称'), visible:false, operate:"LIKE %...%"},
- {field: 'push_type', title: __('Push_type'), visible:false, searchList: {"0":__('Push_type 0'),"1":__('Push_type 1')}},
- {field: 'idx', title: __('推广位置'),operate:false},
- {field: 'push_type_text', title: __('推广类型'), operate:false},
- {field: 'send_num', title: __('发送人数'), operate:false},
- {field: 'success_num', title: __('接收人数'), operate:false},
- {field: 'follow_num', title: __('主号关注人数(主号今日关注)'), operate:false,formatter:function(value,row,index){
- return (value === null ? 0 : value) + "(" + row.fn + ")";
- }},
- {field: 'unfollow_num', title: __('主号取关人数(主号今日取关)'), operate:false,formatter:function(value,row,index){
- return (value === null ? 0 : value) + "(" + row.un + ")";
- }},
- {field: 'guide_follow_num', title: __('倒粉关注人数(今日倒粉关注)'), operate:false,formatter:function(value,row,index){
- return (value === null ? 0 : value) + "(" + row.gn + ")";
- }},
- {field: 'net_follow_num', title: __('净关注(今日净关注)'), operate:false,formatter:function(value,row,index){
- return (value === null ? 0 : value) + "(" + row.nn + ")";
- }},
- {field: 'uv', title: __('阅读人数(今日阅读)'), operate:false,formatter:function(value,row,index){
- return (value === null ? 0 : value) + "(" + row.dayuv + ")";
- }},
- {field: 'recharge_money', title: __('充值金额(今日充值)'), operate:false,formatter:function(value,row,index){
- return (value === null ? 0 : value) + "(" + (row.rm / 100) + ")";
- }},
- {field: 'single', title: __('单个用户价值'), operate:false,formatter:function(value,row,index){
- if(row.uv == 0 || row.uv === null){
- return 0;
- }else{
- return Math.round((row.recharge_money / row.uv) * 100) / 100;
- }
- }},
- {field: 'operate', title: __('Operate'), table: table,formatter:function (value,row,index) {
- return '<a href="/admin/orders/index?mark=' + row.mark + '&push_id=' + row.custom_id + '&push_idx=' + row.idx + '" class="btn btn-dialog btn-xs btn-success btn-editone book_but">订单详情</a>';
- }}
- ]
- ]
- });
- // 为表格绑定事件
- 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;
- });
|