customurl.js 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
  2. var Controller = {
  3. index: function () {
  4. // 初始化表格参数配置
  5. Table.api.init({
  6. extend: {
  7. index_url: 'customurl/index?message_type='+$(".message_type").val()+Config.path,
  8. add_url: 'customurl/add',
  9. edit_url: 'customurl/edit',
  10. del_url: 'customurl/del',
  11. multi_url: 'customurl/multi',
  12. table: 'custom_url',
  13. }
  14. });
  15. var table = $("#table");
  16. // 初始化表格
  17. table.bootstrapTable({
  18. url: $.fn.bootstrapTable.defaults.extend.index_url,
  19. pk: 'id',
  20. sortName: 'id',
  21. showToggle: false,
  22. visible: false,
  23. searchFormVisible:true,
  24. search:false,
  25. columns: [
  26. [
  27. {field: 'custom_id', title: __('推广id')},
  28. {field: 'sendtime', title: __('发送时间'), operate:'RANGE', addclass:'datetimerange', formatter: Table.api.formatter.datetime},
  29. {field: 'official_account_id', title: __('公众号id')},
  30. {field: 'official_account_type', title: __('Official_account_type'), visible:false, searchList: {"0":__('Official_account_type 0'),"1":__('Official_account_type 1')}},
  31. {field: 'official_account_name', title: __('Official_account_name'), operate:"LIKE %...%"},
  32. {field: 'official_account_type_text', title: __('Official_account_type'), operate:false},
  33. {field: 'title', title: __('Title') ,operate:"LIKE %...%", formatter:function(value,row,index){
  34. return '<div style="width:260px;line-height:1.5">'+ value +'</div>';
  35. }},
  36. {field: 'url', title: __('推送链接'), operate:false},
  37. {field: 'type', title: __('Type'), visible:false, searchList: {"0":__('Type 0'),"1":__('Type 1'),"2":__('Type 2'),"3":__('Type 3'),"5":__('Type 5')}},
  38. {field: 'type_text', title: __('Type'), operate:false},
  39. {field: 'book_id', title: __('Book_id'), formatter: function(value){
  40. return value?value:'--';
  41. }},
  42. {field: 'book_name', title: __('书籍名称/活动名称/菜单名称'),operate:false, formatter: function (value,row,index) {
  43. if(row.type == 0){
  44. return value?value:'--';
  45. }else if(row.type == 1){
  46. return row.activity_name?row.activity_name:'--';
  47. }else if(row.type == 3){
  48. return row.menu_name?row.menu_name:'--';
  49. }
  50. }},
  51. {field: 'book_name', title: __('书籍名称'), visible:false, operate:"LIKE %...%"},
  52. {field: 'push_type', title: __('Push_type'), visible:false, searchList: {"0":__('Push_type 0'),"1":__('Push_type 1')}},
  53. {field: 'idx', title: __('推广位置'),operate:false},
  54. {field: 'push_type_text', title: __('推广类型'), operate:false},
  55. {field: 'send_num', title: __('发送人数'), operate:false},
  56. {field: 'success_num', title: __('接收人数'), operate:false},
  57. {field: 'follow_num', title: __('主号关注人数(主号今日关注)'), operate:false,formatter:function(value,row,index){
  58. return (value === null ? 0 : value) + "(" + row.fn + ")";
  59. }},
  60. {field: 'unfollow_num', title: __('主号取关人数(主号今日取关)'), operate:false,formatter:function(value,row,index){
  61. return (value === null ? 0 : value) + "(" + row.un + ")";
  62. }},
  63. {field: 'guide_follow_num', title: __('倒粉关注人数(今日倒粉关注)'), operate:false,formatter:function(value,row,index){
  64. return (value === null ? 0 : value) + "(" + row.gn + ")";
  65. }},
  66. {field: 'net_follow_num', title: __('净关注(今日净关注)'), operate:false,formatter:function(value,row,index){
  67. return (value === null ? 0 : value) + "(" + row.nn + ")";
  68. }},
  69. {field: 'uv', title: __('阅读人数(今日阅读)'), operate:false,formatter:function(value,row,index){
  70. return (value === null ? 0 : value) + "(" + row.dayuv + ")";
  71. }},
  72. {field: 'recharge_money', title: __('充值金额(今日充值)'), operate:false,formatter:function(value,row,index){
  73. return (value === null ? 0 : value) + "(" + (row.rm / 100) + ")";
  74. }},
  75. {field: 'single', title: __('单个用户价值'), operate:false,formatter:function(value,row,index){
  76. if(row.uv == 0 || row.uv === null){
  77. return 0;
  78. }else{
  79. return Math.round((row.recharge_money / row.uv) * 100) / 100;
  80. }
  81. }},
  82. {field: 'operate', title: __('Operate'), table: table,formatter:function (value,row,index) {
  83. 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>';
  84. }}
  85. ]
  86. ]
  87. });
  88. // 为表格绑定事件
  89. Table.api.bindevent(table);
  90. },
  91. add: function () {
  92. Controller.api.bindevent();
  93. },
  94. edit: function () {
  95. Controller.api.bindevent();
  96. },
  97. api: {
  98. bindevent: function () {
  99. Form.api.bindevent($("form[role=form]"));
  100. }
  101. }
  102. };
  103. return Controller;
  104. });