|
@@ -25,15 +25,66 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
|
|
columns: [
|
|
|
[
|
|
|
{checkbox: true},
|
|
|
- {field: 'user_id', title: __('ID'), width: 60},
|
|
|
- {field: 'user.nickname', title: __('用户昵称'), operate: 'LIKE'},
|
|
|
- {field: 'user.mobile', title: __('手机号'), operate: 'LIKE'},
|
|
|
- {field: 'level_info.name', title: __('分销等级'), formatter: function(value, row, index) {
|
|
|
+ {field: 'user_id', title: __('ID'), width: 90},
|
|
|
+ {field: 'user.nickname', title: __('分销商信息'), width: 200, operate: 'LIKE', formatter: function(value, row, index) {
|
|
|
+ var avatarUrl = row.user && row.user.avatar ? Fast.api.cdnurl(row.user.avatar) : Fast.api.cdnurl('/assets/img/avatar.png');
|
|
|
+ var nickname = row.user && row.user.nickname ? row.user.nickname : 'yimizi';
|
|
|
+ var mobile = row.user && row.user.mobile ? row.user.mobile : '';
|
|
|
+
|
|
|
+ var html = '<div style="display:flex;align-items:center;">';
|
|
|
+ html += '<img src="' + avatarUrl + '" style="width:40px;height:40px;border-radius:50%;margin-right:10px;" />';
|
|
|
+ html += '<div>';
|
|
|
+ html += '<div style="color:#337ab7;font-weight:bold;">' + nickname + '</div>';
|
|
|
+ if (mobile) {
|
|
|
+ html += '<div style="color:#6c757d;font-size:12px;">' + mobile + '</div>';
|
|
|
+ }
|
|
|
+ html += '</div></div>';
|
|
|
+ return html;
|
|
|
+ }},
|
|
|
+ {field: 'level_info.name', title: __('等级'), width: 120, formatter: function(value, row, index) {
|
|
|
if (row.level_info) {
|
|
|
- return row.level_info.name + '(等级' + row.level_info.level + ')';
|
|
|
+ var html = '<div>' + row.level_info.name + '</div>';
|
|
|
+ html += '<div style="color:#999;font-size:12px;">(等级' + row.level_info.level + ')</div>';
|
|
|
+ return html;
|
|
|
+ }
|
|
|
+ return '默认等级<br><small>(等级' + (row.level || 1) + ')</small>';
|
|
|
+ }},
|
|
|
+ {field: 'total_income', title: __('累计佣金'), width: 120, operate: 'BETWEEN', formatter: function(value, row, index) {
|
|
|
+ return (row.total_income || 0) + '元';
|
|
|
+ }},
|
|
|
+ {field: 'user.total_consume', title: __('消费金额'), width: 120, formatter: function(value, row, index) {
|
|
|
+ return ((row.user && row.user.total_consume) || 0) + '元';
|
|
|
+ }},
|
|
|
+ {field: 'child_order_money_0', title: __('自购分销业绩'), width: 140, formatter: function(value, row, index) {
|
|
|
+ var orderCount = row.child_order_count_first;
|
|
|
+ var orderMoney = row.child_order_money_first;
|
|
|
+ var html = '<div>' + orderCount + '单</div>';
|
|
|
+ html += '<div style="color:#999;font-size:12px;">' + orderMoney + '元</div>';
|
|
|
+ return html;
|
|
|
+ }},
|
|
|
+ {field: 'user.parent_user.nickname', title: __('上级分销商'), width: 150, formatter: function(value, row, index) {
|
|
|
+ if (row.user && row.user.parent_user) {
|
|
|
+ var parentAvatar = row.user.parent_user.avatar ? Fast.api.cdnurl(row.user.parent_user.avatar) : Fast.api.cdnurl('/assets/img/avatar.png');
|
|
|
+ var parentNickname = row.user.parent_user.nickname || ('用户' + row.user.parent_user_id);
|
|
|
+
|
|
|
+ var html = '<div style="display:flex;align-items:center;justify-content:center;">';
|
|
|
+ html += '<img src="' + parentAvatar + '" style="width:30px;height:30px;border-radius:50%;margin-right:8px;" />';
|
|
|
+ html += '<div style="text-align:left;">';
|
|
|
+ html += '<div style="font-size:12px;">' + parentNickname + '</div>';
|
|
|
+ html += '</div></div>';
|
|
|
+ return html;
|
|
|
}
|
|
|
- return row.level || '-';
|
|
|
+ return '<div style="text-align:center;color:#999;">平台直推</div>';
|
|
|
+ }},
|
|
|
+ {field: 'child_order_money_second', title: __('一级用户人数'), width: 120, formatter: function(value, row, index) {
|
|
|
+ var count = row.child_user_count_first;
|
|
|
+ return count + '人';
|
|
|
}},
|
|
|
+ {field: 'child_agent_count_1', title: __('一级分销商人数'), width: 160, formatter: function(value, row, index) {
|
|
|
+ var count = row.child_agent_count_first;
|
|
|
+ return '<div>' + count + '人</div>';
|
|
|
+ }},
|
|
|
+ {field: 'become_time', title: __('创建时间'), width: 172, operate: 'RANGE', addclass: 'datetimerange', autocomplete: false, formatter: Table.api.formatter.datetime},
|
|
|
{field: 'status', title: __('状态'), searchList: {
|
|
|
"normal": __('正常'),
|
|
|
"pending": __('审核中'),
|
|
@@ -59,38 +110,32 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
|
|
var text = textMap[value] || value;
|
|
|
return '<span class="label label-' + color + '">' + text + '</span>';
|
|
|
}},
|
|
|
- {field: 'total_income', title: __('总收益'), operate: 'BETWEEN'},
|
|
|
- {field: 'child_agent_count_1', title: __('直推分销商'), width: 80},
|
|
|
- {field: 'child_agent_count_all', title: __('团队分销商'), width: 80},
|
|
|
- {field: 'child_user_count_all', title: __('团队人数'), width: 80},
|
|
|
- {field: 'pending_reward', title: __('待结算佣金'), width: 80},
|
|
|
- {field: 'become_time', title: __('成为分销商时间'), operate: 'RANGE', addclass: 'datetimerange', autocomplete: false, formatter: Table.api.formatter.datetime},
|
|
|
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate,
|
|
|
- buttons: [
|
|
|
- {
|
|
|
- name: 'detail',
|
|
|
- text: __('详情'),
|
|
|
- title: __('详情'),
|
|
|
- classname: 'btn btn-xs btn-primary btn-dialog',
|
|
|
- icon: 'fa fa-list',
|
|
|
- url: 'commission/agent/detail',
|
|
|
- callback: function (data) {
|
|
|
- table.bootstrapTable('refresh');
|
|
|
- }
|
|
|
- },
|
|
|
- {
|
|
|
- name: 'team',
|
|
|
- text: __('团队'),
|
|
|
- title: __('团队'),
|
|
|
- classname: 'btn btn-xs btn-info btn-dialog',
|
|
|
- icon: 'fa fa-users',
|
|
|
- url: 'commission/agent/team',
|
|
|
- callback: function (data) {
|
|
|
- table.bootstrapTable('refresh');
|
|
|
- }
|
|
|
- },
|
|
|
- ],
|
|
|
- formatter: Table.api.formatter.operate}
|
|
|
+ buttons: [
|
|
|
+ {
|
|
|
+ name: 'detail',
|
|
|
+ text: __('详情'),
|
|
|
+ title: __('详情'),
|
|
|
+ classname: 'btn btn-xs btn-primary btn-dialog',
|
|
|
+ icon: 'fa fa-list',
|
|
|
+ url: 'commission/agent/detail',
|
|
|
+ callback: function (data) {
|
|
|
+ table.bootstrapTable('refresh');
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ name: 'team',
|
|
|
+ text: __('团队'),
|
|
|
+ title: __('团队'),
|
|
|
+ classname: 'btn btn-xs btn-info btn-dialog',
|
|
|
+ icon: 'fa fa-users',
|
|
|
+ url: 'commission/agent/team',
|
|
|
+ callback: function (data) {
|
|
|
+ table.bootstrapTable('refresh');
|
|
|
+ }
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ formatter: Table.api.formatter.operate}
|
|
|
]
|
|
|
]
|
|
|
});
|
|
@@ -651,10 +696,10 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
|
|
columns: [
|
|
|
[
|
|
|
{checkbox: true},
|
|
|
- {field: 'id', title: __('ID'), width: 60},
|
|
|
- {field: 'nickname', title: __('团队成员'), operate: 'LIKE', formatter: function(value, row, index) {
|
|
|
+ {field: 'id', title: __('ID'), width: 90},
|
|
|
+ {field: 'nickname', title: __('团队用户'), width: 150, operate: 'LIKE', formatter: function(value, row, index) {
|
|
|
var avatarUrl = row.avatar ? Fast.api.cdnurl(row.avatar) : Fast.api.cdnurl('/assets/img/avatar.png');
|
|
|
- var html = '<div style="display:flex;align-items:center;">';
|
|
|
+ var html = '<div style="display:flex;align-items:center;cursor:pointer;" onclick="viewTeam(' + row.id + ')">';
|
|
|
html += '<img src="' + avatarUrl + '" style="width:40px;height:40px;border-radius:50%;margin-right:10px;" />';
|
|
|
html += '<div>';
|
|
|
html += '<div style="color:#337ab7;font-weight:bold;">' + (row.nickname || '用户' + row.id) + '</div>';
|
|
@@ -662,15 +707,21 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
|
|
html += '</div></div>';
|
|
|
return html;
|
|
|
}},
|
|
|
- {field: 'agent.level_info.name', title: __('分销等级'), formatter: function(value, row, index) {
|
|
|
+ {field: 'agent.level_info.name', title: __('等级'), width: 150, formatter: function(value, row, index) {
|
|
|
if (row.agent && row.agent.level_info) {
|
|
|
- return row.agent.level_info.name + '<br><small>等级' + row.agent.level_info.level + '</small>';
|
|
|
+ var html = '<div style="display:flex;align-items:center;">';
|
|
|
+ if (row.agent.level_info.image) {
|
|
|
+ html += '<img src="' + Fast.api.cdnurl(row.agent.level_info.image) + '" style="width:32px;height:32px;margin-right:8px;" />';
|
|
|
+ }
|
|
|
+ html += '<span>' + row.agent.level_info.name + '</span>';
|
|
|
+ html += '</div>';
|
|
|
+ return html;
|
|
|
} else if (row.agent) {
|
|
|
return '等级' + (row.agent.level || '-');
|
|
|
}
|
|
|
return '<span class="text-muted">非分销商</span>';
|
|
|
}},
|
|
|
- {field: 'agent.status', title: __('状态'), searchList: {
|
|
|
+ {field: 'agent.status', title: __('状态'), width: 120, align: 'center', searchList: {
|
|
|
"normal": __('正常'),
|
|
|
"pending": __('审核中'),
|
|
|
"freeze": __('冻结'),
|
|
@@ -678,15 +729,15 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
|
|
"reject": __('拒绝')
|
|
|
}, formatter: function(value, row, index) {
|
|
|
if (!row.agent) {
|
|
|
- return '<span class="label label-default">非分销商</span>';
|
|
|
+ return '<span style="color:#777;">非分销商</span>';
|
|
|
}
|
|
|
var status = row.agent.status;
|
|
|
var colorMap = {
|
|
|
- 'normal': 'success',
|
|
|
- 'pending': 'warning',
|
|
|
- 'freeze': 'info',
|
|
|
- 'forbidden': 'danger',
|
|
|
- 'reject': 'danger'
|
|
|
+ 'normal': '#5cb85c',
|
|
|
+ 'pending': '#f0ad4e',
|
|
|
+ 'freeze': '#5bc0de',
|
|
|
+ 'forbidden': '#d9534f',
|
|
|
+ 'reject': '#d9534f'
|
|
|
};
|
|
|
var textMap = {
|
|
|
'normal': '正常',
|
|
@@ -695,28 +746,63 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
|
|
'forbidden': '禁用',
|
|
|
'reject': '拒绝'
|
|
|
};
|
|
|
- var color = colorMap[status] || 'default';
|
|
|
+ var color = colorMap[status] || '#777';
|
|
|
var text = textMap[status] || status;
|
|
|
- return '<span class="label label-' + color + '">' + text + '</span>';
|
|
|
+ return '<span style="color:' + color + ';">' + text + '</span>';
|
|
|
+ }},
|
|
|
+ {field: 'agent.child_user_count_all', title: __('团队人数/分销商人数'), width: 160, align: 'center', formatter: function(value, row, index) {
|
|
|
+ if (!row.agent) return '0人/0人';
|
|
|
+ var userCount = row.agent.child_user_count_all || 0;
|
|
|
+ var agentCount = row.agent.child_agent_count_all || 0;
|
|
|
+ return userCount + '人/' + agentCount + '人';
|
|
|
+ }},
|
|
|
+ {field: 'agent.child_user_count_first', title: __('一级团队人数/一级分销商人数'), width: 220, align: 'center', formatter: function(value, row, index) {
|
|
|
+ if (!row.agent) return '0人/0人';
|
|
|
+ var userCount = row.agent.child_user_count_first || 0;
|
|
|
+ var agentCount = row.agent.child_agent_count_first || 0;
|
|
|
+ return userCount + '人/' + agentCount + '人';
|
|
|
}},
|
|
|
- {field: 'agent.child_user_count_all', title: __('团队人数'), width: 80, formatter: function(value, row, index) {
|
|
|
- return row.agent ? (row.agent.child_user_count_all || 0) : 0;
|
|
|
+ {field: 'agent.child_user_count_second', title: __('二级团队人数/二级分销商人数'), width: 220, align: 'center', formatter: function(value, row, index) {
|
|
|
+ if (!row.agent) return '0人/0人';
|
|
|
+ var userCount = row.agent.child_user_count_second || 0;
|
|
|
+ var agentCount = row.agent.child_agent_count_second || 0;
|
|
|
+ return userCount + '人/' + agentCount + '人';
|
|
|
}},
|
|
|
- {field: 'agent.child_agent_count_1', title: __('直推分销商'), width: 80, formatter: function(value, row, index) {
|
|
|
- return row.agent ? (row.agent.child_agent_count_1 || 0) : 0;
|
|
|
+ {field: 'agent.child_order_money_all', title: __('团队分销总额/团队分销订单'), width: 220, align: 'center', formatter: function(value, row, index) {
|
|
|
+ if (!row.agent) return '0元/0单';
|
|
|
+ var money = row.agent.child_order_money_all || 0;
|
|
|
+ var count = row.agent.child_order_count_all || 0;
|
|
|
+ return money + '元/' + count + '单';
|
|
|
}},
|
|
|
- {field: 'agent.child_agent_count_all', title: __('团队分销商'), width: 80, formatter: function(value, row, index) {
|
|
|
- return row.agent ? (row.agent.child_agent_count_all || 0) : 0;
|
|
|
+ {field: 'agent.child_order_money_first', title: __('一级分销总额/一级分销订单'), width: 220, align: 'center', formatter: function(value, row, index) {
|
|
|
+ if (!row.agent) return '0元/0单';
|
|
|
+ var money = row.agent.child_order_money_first || 0;
|
|
|
+ var count = row.agent.child_order_count_first || 0;
|
|
|
+ return money + '元/' + count + '单';
|
|
|
}},
|
|
|
- {field: 'agent.total_income', title: __('累计佣金'), operate: 'BETWEEN', formatter: function(value, row, index) {
|
|
|
+ {field: 'agent.child_order_money_second', title: __('二级分销总额/二级分销订单'), width: 220, align: 'center', formatter: function(value, row, index) {
|
|
|
+ if (!row.agent) return '0元/0单';
|
|
|
+ var money = row.agent.child_order_money_second || 0;
|
|
|
+ var count = row.agent.child_order_count_second || 0;
|
|
|
+ return money + '元/' + count + '单';
|
|
|
+ }},
|
|
|
+ {field: 'agent.child_order_money_0', title: __('自购分销总金额/订单数'), width: 220, align: 'center', formatter: function(value, row, index) {
|
|
|
+ if (!row.agent) return '0元/0单';
|
|
|
+ // 自购数据可能存储在其他字段中,这里使用0级别或者特定字段
|
|
|
+ var money = row.agent.self_order_money || 0;
|
|
|
+ var count = row.agent.self_order_count || 0;
|
|
|
+ return money + '元/' + count + '单';
|
|
|
+ }},
|
|
|
+ {field: 'agent.total_income', title: __('累计佣金'), width: 160, align: 'center', operate: 'BETWEEN', formatter: function(value, row, index) {
|
|
|
return row.agent ? ((row.agent.total_income || 0) + '元') : '0元';
|
|
|
}},
|
|
|
- {field: 'agent.pending_reward', title: __('待结算佣金'), width: 80, formatter: function(value, row, index) {
|
|
|
+ {field: 'total_consume', title: __('消费金额'), width: 160, align: 'center', formatter: function(value, row, index) {
|
|
|
+ return ((row.total_consume) || 0) + '元';
|
|
|
+ }},
|
|
|
+ {field: 'agent.pending_reward', title: __('待入账佣金'), width: 160, align: 'center', formatter: function(value, row, index) {
|
|
|
return row.agent ? ((row.agent.pending_reward || 0) + '元') : '0元';
|
|
|
}},
|
|
|
- {field: 'agent.become_time', title: __('成为分销商时间'), operate: 'RANGE', addclass: 'datetimerange', autocomplete: false, formatter: function(value, row, index) {
|
|
|
- return row.agent && row.agent.become_time ? Table.api.formatter.datetime(row.agent.become_time, row, index) : '<span class="text-muted">-</span>';
|
|
|
- }}
|
|
|
+ {field: 'createtime', title: __('加入时间'), width: 172, align: 'center', operate: 'RANGE', addclass: 'datetimerange', autocomplete: false, formatter: Table.api.formatter.datetime}
|
|
|
]
|
|
|
]
|
|
|
});
|
|
@@ -724,14 +810,14 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
|
|
// 为表格绑定事件
|
|
|
Table.api.bindevent(table);
|
|
|
|
|
|
- // // 团队页面特有的全局函数
|
|
|
- // window.viewTeam = function(userId) {
|
|
|
- // Fast.api.open('commission/agent/team?id=' + userId, '查看团队');
|
|
|
- // };
|
|
|
+ // 团队页面特有的全局函数
|
|
|
+ window.viewTeam = function(userId) {
|
|
|
+ Fast.api.open('commission/agent/team?id=' + userId, '查看团队');
|
|
|
+ };
|
|
|
|
|
|
- // window.viewDetail = function(userId) {
|
|
|
- // Fast.api.open('commission/agent/detail?id=' + userId, '分销商详情');
|
|
|
- // };
|
|
|
+ window.viewDetail = function(userId) {
|
|
|
+ Fast.api.open('commission/agent/detail?id=' + userId, '分销商详情');
|
|
|
+ };
|
|
|
|
|
|
Controller.api.bindevent();
|
|
|
},
|