|
@@ -637,7 +637,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
|
|
del_url: '',
|
|
|
multi_url: '',
|
|
|
import_url: '',
|
|
|
- table: 'commission_agent',
|
|
|
+ table: 'user',
|
|
|
}
|
|
|
});
|
|
|
|
|
@@ -646,38 +646,41 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
|
|
// 初始化表格
|
|
|
table.bootstrapTable({
|
|
|
url: $.fn.bootstrapTable.defaults.extend.index_url,
|
|
|
- pk: 'user_id',
|
|
|
- sortName: 'user_id',
|
|
|
+ pk: 'id',
|
|
|
+ sortName: 'id',
|
|
|
columns: [
|
|
|
[
|
|
|
{checkbox: true},
|
|
|
- {field: 'user_id', title: __('ID'), width: 60},
|
|
|
- {field: 'user.nickname', title: __('团队成员'), operate: 'LIKE', formatter: function(value, row, index) {
|
|
|
- if (row.user) {
|
|
|
- var avatarUrl = row.user.avatar || '/assets/img/avatar.png';
|
|
|
- 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;">' + (row.user.nickname || row.user_id) + '</div>';
|
|
|
- html += '<div style="color:#6c757d;font-size:12px;">' + (row.user.mobile || '') + '</div>';
|
|
|
- html += '</div></div>';
|
|
|
- return html;
|
|
|
- }
|
|
|
- return row.user_id;
|
|
|
+ {field: 'id', title: __('ID'), width: 60},
|
|
|
+ {field: 'nickname', title: __('团队成员'), 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;">';
|
|
|
+ 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>';
|
|
|
+ html += '<div style="color:#6c757d;font-size:12px;">' + (row.mobile || '') + '</div>';
|
|
|
+ html += '</div></div>';
|
|
|
+ return html;
|
|
|
}},
|
|
|
- {field: 'level_info.name', title: __('分销等级'), formatter: function(value, row, index) {
|
|
|
- if (row.level_info) {
|
|
|
- return row.level_info.name + '<br><small>等级' + row.level_info.level + '</small>';
|
|
|
+ {field: 'agent.level_info.name', title: __('分销等级'), 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>';
|
|
|
+ } else if (row.agent) {
|
|
|
+ return '等级' + (row.agent.level || '-');
|
|
|
}
|
|
|
- return '等级' + (row.level || '-');
|
|
|
+ return '<span class="text-muted">非分销商</span>';
|
|
|
}},
|
|
|
- {field: 'status', title: __('状态'), searchList: {
|
|
|
+ {field: 'agent.status', title: __('状态'), searchList: {
|
|
|
"normal": __('正常'),
|
|
|
"pending": __('审核中'),
|
|
|
"freeze": __('冻结'),
|
|
|
"forbidden": __('禁用'),
|
|
|
"reject": __('拒绝')
|
|
|
}, formatter: function(value, row, index) {
|
|
|
+ if (!row.agent) {
|
|
|
+ return '<span class="label label-default">非分销商</span>';
|
|
|
+ }
|
|
|
+ var status = row.agent.status;
|
|
|
var colorMap = {
|
|
|
'normal': 'success',
|
|
|
'pending': 'warning',
|
|
@@ -692,16 +695,28 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
|
|
'forbidden': '禁用',
|
|
|
'reject': '拒绝'
|
|
|
};
|
|
|
- var color = colorMap[value] || 'default';
|
|
|
- var text = textMap[value] || value;
|
|
|
+ var color = colorMap[status] || 'default';
|
|
|
+ var text = textMap[status] || status;
|
|
|
return '<span class="label label-' + color + '">' + text + '</span>';
|
|
|
}},
|
|
|
- {field: 'child_user_count_all', title: __('团队人数'), width: 80},
|
|
|
- {field: 'child_agent_count_1', title: __('直推分销商'), width: 80},
|
|
|
- {field: 'child_agent_count_all', title: __('团队分销商'), width: 80},
|
|
|
- {field: 'total_income', title: __('累计佣金'), operate: 'BETWEEN'},
|
|
|
- {field: 'pending_reward', title: __('待结算佣金'), width: 80},
|
|
|
- {field: 'become_time', title: __('成为分销商时间'), operate: 'RANGE', addclass: 'datetimerange', autocomplete: false, formatter: Table.api.formatter.datetime}
|
|
|
+ {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_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_agent_count_all', title: __('团队分销商'), width: 80, formatter: function(value, row, index) {
|
|
|
+ return row.agent ? (row.agent.child_agent_count_all || 0) : 0;
|
|
|
+ }},
|
|
|
+ {field: 'agent.total_income', title: __('累计佣金'), 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) {
|
|
|
+ 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>';
|
|
|
+ }}
|
|
|
]
|
|
|
]
|
|
|
});
|