123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143 |
- define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
- var Controller = {
- showCols:function(table){
- var cols = new Array();
- cols.push({field: 'id', title: __('推广id'), operate: false});
- cols.push({field: 'custom.id', title: __('推广id'), visible: false, operate: "="});
- //VIP显示公众号昵称
- if (Config.group == 7 || Config.group == 8) {
- cols.push({field: 'official_account_name', title: __('公众号名称'), operate: false, formatter: function(value, row){
- return row['collect'][0].official_account_name;
- }});
- cols.push({field: 'custom_url.official_account_name', title: __('公众号名称'), operate: "LIKE %...%", visible: false});
- }
- cols.push({field: 'title', title: __('客服消息标题'), operate: false});
- cols.push({field: 'custom.title', title: '客服消息标题', operate: "LIKE %...%", visible: false});
- cols.push({field: 'ltitle', title: '推广标题' , align: 'left',operate:false, formatter:function(value,row,index){
- var l = [];
- var length = 15
- for (var i in row.collect){
- var title = row.collect[i].title
- if (title.length > length) {
- title = title.substr(0, length) + '...';
- }
- l.push('<span style="width:260px;line-height:1.5;white-space: nowrap;" title="'+row.collect[i].title+'">'+ title +'</span>')
- }
- return l.join('<br>')
- }});
- cols.push({field: 'username', title: __('渠道商账号')});
- cols.push({
- field: 'custom_url.book_name', title: __('书籍名称'), align: 'left', operate: false,
- formatter: function (value, row, index) {
- var l = [];
- for (var i in row.collect){
- if (row.collect[i].type == 0) {
- l.push('<a href="/admin/referral/book/info?id=' + row.collect[i].book_id + '">' + row.collect[i].book_name + '</a>');
- } else {
- l.push('-')
- }
- }
- return l.join('<br>')
- }
- });
- cols.push({field: 'custom_url.book_name', title: __('书籍名称'), visible:false, operate:"LIKE %...%"});
- cols.push({field: 'idx', title: __('推广位置'),formatter:function(value,row,index){
- var l = [];
- for (var i in row.collect){
- l.push('第' + row.collect[i].idx + '条')
- }
- return l.join('<br>')
- },operate:false});
- cols.push({field: 'type_text', width:100, title: __('推广类型'), operate:false, formatter: function(value, row){
- var e = {
- "0": "书籍",
- "1": "活动",
- "2": "继续阅读",
- "3": "菜单",
- "4": "没有url的文案",
- "5": "其他",
- "6": "自定义链接",
- "7": "自动签到",
- "8": "常用链接",
- "9": "自定义活动"
- };
- var l = [];
- for (var i in row.collect){
- if (e[row.collect[i].type]) {
- l.push(e[row.collect[i].type])
- } else {
- l.push('-')
- }
- }
- return l.join('<br>')
- }});
- cols.push({field: 'send_num', title: __('发送人数'), operate:false});
- cols.push({field: 'uv', title: 'UV(总/今日)', operate:false,formatter:function(value,row,index){
- var l = [];
- for (var i in row.collect){
- var v = row.collect[i]
- l.push(v.uv + "(" + v.day_uv + ")")
- }
- return l.join('<br>')
- }});
- cols.push({field: 'recharge_money', title:'充值金额(总/今日)', operate:false,formatter:function(value,row,index){
- var l = [];
- for (var i in row.collect){
- var v = row.collect[i]
- l.push(v.recharge_money + "(" + v.day_recharge_money + ")")
- }
- return l.join('<br>')
- }});
- cols.push({field: 'custom.sendtime', title: __('推送时间'), operate:'RANGE', addclass:'datetimerange', visible: false});
- cols.push({field: 'sendtime', title: __('推送时间'), operate:false, addclass:'datetimerange', formatter: Table.api.formatter.datetime});
- /*cols.push({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>';
- }});*/
- return cols;
- },
- index: function () {
- // 初始化表格参数配置
- Table.api.init({
- extend: {
- index_url: 'vipcustomurl/index?message_type='+$(".message_type").val()+Config.path,
- export_url: '/admin/vipcustomurl/export?message_type='+$(".message_type").val()+Config.path,
- 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,
- onLoadSuccess: function (data) {
- if (data.msg) {
- Toastr.error(data.msg);
- }
- },
- columns: [Controller.showCols(table)]
- });
- // 为表格绑定事件
- 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;
- });
|