123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146 |
- define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
- var Controller = {
- index: function () {
- // 初始化表格参数配置
- Table.api.init({
- extend: {
- index_url: 'book/collect/index',
- table: 'book_collect',
- },
- showToggle: false,
- showColumns: false,
- operate: false,
- commonSearch: true,
- searchFormVisible: true,
- search:false,
- onLoadSuccess: function (data) {
- $("[data-toggle='tooltip']").tooltip({trigger: 'focus hover'});
- }
- });
-
- var table = $("#table");
- if(Config.groupId<3){
- // 初始化表格
- table.bootstrapTable({
- url: $.fn.bootstrapTable.defaults.extend.index_url,
- pk: 'id',
- sortName: 'recharge_money',
- columns: [
- [
- {field: 'book_id', title: __('小说ID'),operate:false},
- {field: 'id', title: __('小说ID'),visible: false,operate:'LIKE %...%'},
- {field: 'name', title: __('小说名称'),operate:'LIKE %...%'},
- {field: 'sex', title: __('频道'), operate:false},
- {field: 'book_category', title: __('分类'), operate:false},
- {field: 'uv', title: __('阅读人次'), operate:false},
- {field: 'pv', title: __('阅读次数'), operate:false},
- {field: 'today_recharge_money', title: __('今日充值'), operate:false,formatter: Controller.api.formatter.today_recharge_money},
- {field: 'yesterday_recharge_money', title: __('昨日充值'), operate:false,formatter: Controller.api.formatter.yesterday_recharge_money},
- {field: 'recharge_money', title: __('总充值(不含当日)'), operate:false,formatter: Controller.api.formatter.recharge_money},
- {field: 'today_spending_count_kandian', title: __('今日消费'), operate:false,formatter: Controller.api.formatter.today_spending_count_kandian},
- {field: 'yesterday_spending_count_kandian', title: __('昨日消费'), operate:false,formatter: Controller.api.formatter.yesterday_spending_count_kandian},
- {field: 'spending_count_kandian', title: __('总消费(不含当日)'), operate:false,formatter: Controller.api.formatter.spending_count_kandian},
- {field: 'book_id', title: __('查看详情'),formatter: Controller.api.formatter.book_id,operate:false},
- ]
- ]
- });
- }else{
- // 初始化表格
- table.bootstrapTable({
- url: $.fn.bootstrapTable.defaults.extend.index_url,
- pk: 'id',
- sortName: 'recharge_money',
- columns: [
- [
- {field: 'book_id', title: __('小说ID'),operate:false},
- {field: 'id', title: __('小说ID'),visible: false,operate:'LIKE %...%'},
- {field: 'name', title: __('小说名称'),operate:'LIKE %...%'},
- {field: 'sex', title: __('频道'), operate:false},
- {field: 'book_category', title: __('分类'), operate:false},
- {field: 'today_recharge_money', title: __('今日充值'), operate:false,formatter: Controller.api.formatter.today_recharge_money},
- {field: 'yesterday_recharge_money', title: __('昨日充值'), operate:false,formatter: Controller.api.formatter.yesterday_recharge_money},
- {field: 'recharge_money', title: __('总充值(不含当日)'), operate:false,formatter: Controller.api.formatter.recharge_money},
- ]
- ]
- });
- }
- // 为表格绑定事件
- Table.api.bindevent(table);
- },
- detail: function () {
- // 初始化表格参数配置
- Table.api.init({
- showToggle: false,
- showColumns: false,
- operate: false,
- search:false,
- searchFormVisible: false,
- commonSearch: false
- });
- var table = $("#table");
- // 初始化表格
- table.bootstrapTable({
- url: Config.detailUrl,
- pk: 'id',
- sortName: 'createdate',
- columns: [
- [
- {field: 'name', title: __('小说'),operate:false},
- {field: 'createdate', title: __('日期'),operate:false},
- {field: 'pv', title: __('阅读数'),operate:false},
- {field: 'uv', title: __('阅读人次'),operate:false},
- {field: 'recharge_num', title: __('充值笔数'),operate:false},
- {field: 'recharge_users', title: __('充值人数'),operate:false},
- {field: 'recharge_money', title: __('充值金额(不含当日)'),operate:false,formatter: Controller.api.formatter.addfuhao},
- {field: 'spending_num', title: __('消费笔数'),operate:false},
- {field: 'spending_users', title: __('消费人数'),operate:false},
- {field: 'spending_count_kandian', title: __('消费金额'),operate:false,formatter: Controller.api.formatter.addfspending},
- {field: 'spending_recharge_kandian', title: __('消费充值书币'),operate:false,formatter: Controller.api.formatter.addfspending},
- {field: 'spending_free_kandian', title: __('消费赠送书币'),operate:false,formatter: Controller.api.formatter.addfspending}
- ]
- ]
- });
- // 为表格绑定事件
- Table.api.bindevent(table);
- },
- api: {
- bindevent: function () {
- Form.api.bindevent($("form[role=form]"));
- },formatter: {
- recharge_money: function (value, row, index) {
- return '<div style="color:#6495ed" >¥' + Number(value).toFixed(2) + '</div><div>' + row.recharge_num + '笔</div>';
- },
- spending_count_kandian: function (value, row, index) {
- return '<div style="color:#6495ed">¥' + Number(value).toFixed(2) + '</div><div>消费充值:¥' + Number(row.spending_recharge_kandian).toFixed(2) + '</div><div>消费赠送:¥' + Number(row.spending_free_kandian).toFixed(2) + '</div>';
- },
- today_recharge_money:function (value, row, index) {
- return '<div style="color:#6495ed" >¥' + Number(value).toFixed(2) + '</div><div>' + row.today_recharge_num + '笔</div>';
- },
- yesterday_recharge_money:function (value, row, index) {
- return '<div style="color:#6495ed" >¥' + Number(value).toFixed(2) + '</div><div>' + row.yesterday_recharge_num + '笔</div>';
- },
- today_spending_count_kandian:function (value, row, index) {
- return '<div style="color:#6495ed">¥' + Number(value).toFixed(2) + '</div><div>消费充值:¥' + row.today_spending_recharge_kandian.toFixed(2) + '</div><div>消费赠送:¥' + row.today_spending_free_kandian.toFixed(2) + '</div>';
- },
- yesterday_spending_count_kandian:function (value, row, index) {
- return '<div style="color:#6495ed">¥' + Number(value).toFixed(2) + '</div><div>消费充值:¥' + row.yesterday_spending_recharge_kandian.toFixed(2) + '</div><div>消费赠送:¥' + row.yesterday_spending_free_kandian.toFixed(2) + '</div>';
- },
- book_id:function (value, row, index) {
- return '<a href="/admin/book/collect/detail?book_id='+row.book_id+'">查看详情(不含当日)</a>';
- },
- addfuhao:function(value, row, index) {
- return '¥'+value;
- },
- addfspending:function(value, row, index) {
- return '¥'+value/100;
- }
- }
- }
- };
- return Controller;
- });
|