123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990 |
- define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
- var Controller = {
- index: function () {
- // 初始化表格参数配置
- Table.api.init({
- extend: {
- index_url: 'operation/promotion/index',
- // edit_url: 'user/user/edit',
- // multi_url: 'user/user/multi',
- table: 'operation_promotion',
- }
- });
- var table = $("#table");
- // 初始化表格
- table.bootstrapTable({
- url: $.fn.bootstrapTable.defaults.extend.index_url,
- pk: 'id',
- sortName: 'user.id',
- searchFormTemplate: 'customformtpl',
- columns: [
- [
- // {checkbox: true},
- {field: 'id', title: __('Id'), sortable: true},
- {field: 'u_id', title: __('前端用户ID')},
- {field: 'nickname', title: __('昵称'), operate: 'LIKE'},
- {field: 'mobile', title: __('手机号'), operate: 'LIKE'},
- {field: 'preuser.nickname', title: __('上级用户'), formatter: Controller.api.formatter.perusersearch},
- {field: 'promotionNum', title: __('下级用户'), formatter: Controller.api.formatter.nextusersearch},
- {field: 'promotionAllMoney', title: __('下级总充值'), operate: false},
- {field: 'totalRechargeNum', title: __('下级总充值人数'), operate: false},
- {field: 'conditionRechargeMoney', title: __('下级充值'), operate: false},
- {field: 'conditionPromotionNum', title: __('下级新增'), operate: false},
- {field: 'conditionFirstRecharge', title: __('下级新客首充'), operate: false},
- {field: 'arrpu', title: __('arrpu'), operate: false},
- {field: 'arpu', title: __('arpu'), operate: false},
- ]
- ],
- });
- // 为表格绑定事件
- Table.api.bindevent(table);
- },
- add: function () {
- Controller.api.bindevent();
- },
- edit: function () {
- Controller.api.bindevent();
- },
- api: {
- bindevent: function () {
- Form.api.bindevent($("form[role=form]"));
- },
- formatter: {
- perusersearch: function (value, row, index) {
- if(value){
- //这里手动构造URL
- url = "operation/promotion?pre_uid=" + row.preuser.u_id;
- //方式一,直接返回class带有addtabsit的链接,这可以方便自定义显示内容
- //return '<a href="' + url + '" class="label label-success addtabsit" title="' + __("Search %s", value) + '">' + __('Search %s', value) + '</a>';
- //方式二,直接调用Table.api.formatter.addtabs
- this.url = url;
- this.atitle = '用户推广列表';
- return Table.api.formatter.dialog.call(this, value, row, index);
- }else{
- return '-';
- }
- },
- nextusersearch: function (value, row, index) {
- //这里手动构造URL
- url = "user/usererji?parent_id=" + row.id;
- //方式一,直接返回class带有addtabsit的链接,这可以方便自定义显示内容
- //return '<a href="' + url + '" class="label label-success addtabsit" title="' + __("Search %s", value) + '">' + __('Search %s', value) + '</a>';
- //方式二,直接调用Table.api.formatter.addtabs
- this.url = url;
- this.atitle = '用户推广列表';
- return Table.api.formatter.dialog.call(this, value, row, index);
- }
- }
- }
- };
- return Controller;
- });
|